toolroll 0.9.110 → 0.9.112
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 +66 -0
- package/README.md +5 -1
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/action-ledger.js +13 -0
- package/dist/agent-detect.js +1 -1
- package/dist/agent-said-schema.js +4 -0
- package/dist/agent-said.js +77 -0
- package/dist/approval-summary.js +39 -8
- package/dist/bin.js +5 -1
- package/dist/browser/THIRD_PARTY_NOTICES.txt +30 -0
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.js +1 -1
- package/dist/builder.js +6 -1
- package/dist/chat-channel.js +10 -0
- package/dist/claim.js +28 -13
- package/dist/cli-help.js +7 -1
- package/dist/cli.js +2 -0
- 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/lead-tools.js +28 -0
- package/dist/contracts/route.js +1 -0
- package/dist/dispatch.js +1 -1
- package/dist/dispose.js +15 -9
- package/dist/easy-start.js +19 -3
- package/dist/engine-reads.js +79 -2
- package/dist/evidence.js +6 -6
- package/dist/fast-start.js +20 -11
- package/dist/flexible-start.js +1 -1
- package/dist/integrations.js +6 -1
- package/dist/lead-tools.js +107 -1
- package/dist/lead.js +1 -1
- package/dist/ledger-view.js +2 -1
- package/dist/local-owner.js +1 -0
- package/dist/needs-you.js +12 -2
- package/dist/operate.js +57 -9
- package/dist/outbound-privacy.js +6 -1
- package/dist/phase-routing.js +3 -1
- package/dist/plain-words.js +1 -1
- package/dist/plane-review.js +1 -1
- package/dist/proposal.js +2 -2
- package/dist/provider-connection.js +14 -2
- package/dist/release.js +1 -0
- package/dist/route-store.js +1 -1
- package/dist/serve.js +6 -4
- package/dist/server/chat.js +6 -1
- package/dist/server/pages.js +4 -1
- package/dist/server/render-history.js +2 -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/view-tools.js +94 -0
- package/dist/webhooks.js +8 -2
- package/dist/work-index.js +4 -4
- package/package.json +2 -1
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";
|
|
@@ -273,6 +273,7 @@ import { holdRuleOff, routeRulesPass, taskEvidenceWords } from "./route-rules.js
|
|
|
273
273
|
import { ruleHoldOf } from "./route-store.js";
|
|
274
274
|
import { wasInterrupted } from "./run-ending.js";
|
|
275
275
|
import { loginFileOf, migrateLegacyLogin, removeStaleSavedLogin, savedLoginFile, writableLoginFile } from "./login-secrets.js";
|
|
276
|
+
import { runWords } from "./needs-you.js";
|
|
276
277
|
export const EXIT = { ok: 0, failed: 1, usage: 2, refused: 3 };
|
|
277
278
|
const STATES = ["queued", "running", "done", "failed", "cancelled"];
|
|
278
279
|
export const OPERATE_HELP = `toolroll — operating the queue
|
|
@@ -581,6 +582,10 @@ Agents — which provider and model each phase runs on
|
|
|
581
582
|
toolroll config set|clear|show quick-answers --as <you> --token <t>
|
|
582
583
|
quick answers on (set) or off (clear): plain status questions go to a
|
|
583
584
|
faster model on the Claude membership; changes stay on the main model
|
|
585
|
+
toolroll config set task-sizing on|off --as <you> --token <t>
|
|
586
|
+
size each new task with a quick model call (Claude Haiku, on your
|
|
587
|
+
plan) before you approve; off, the default, sizes from the words alone
|
|
588
|
+
and plans anything uncertain (config show task-sizing says which)
|
|
584
589
|
toolroll chat --as <you> [--repo <path>…] [--say "…"] [--end]
|
|
585
590
|
[--ceiling-usd <n>] [--json] (password at the prompt;
|
|
586
591
|
--token <t> only for scripts — it lands in shell history)
|
|
@@ -3447,13 +3452,14 @@ async function startConsole(options) {
|
|
|
3447
3452
|
store: context.store, settings: () => readMonitoring(dirname(context.databaseFile)),
|
|
3448
3453
|
instance: options.publicUrl ?? hostname(), version: packageVersion(),
|
|
3449
3454
|
});
|
|
3455
|
+
const signIns = createConnectionChecker({ store: context.store });
|
|
3450
3456
|
const besideConsole = [
|
|
3451
3457
|
stopMonitoring,
|
|
3452
3458
|
startBudgetAlerts(context.store),
|
|
3453
3459
|
startTokenNotices(context.store),
|
|
3454
|
-
startSignInProbes(context.store,
|
|
3460
|
+
startSignInProbes(context.store, signIns),
|
|
3455
3461
|
startBackups(context.store, context.databaseFile),
|
|
3456
|
-
startCodexLimits(context.store),
|
|
3462
|
+
startCodexLimits(context.store, () => codexSignedInNow(signIns)),
|
|
3457
3463
|
startUpdateChecks(context.store, dirname(context.databaseFile), PACKAGE_VERSION, installMethod(context.installBin).updateCommand, context.releaseIo ?? {}),
|
|
3458
3464
|
];
|
|
3459
3465
|
server.on("close", () => { for (const stop of besideConsole)
|
|
@@ -3544,6 +3550,7 @@ async function requeueTask(positional, flags, context) {
|
|
|
3544
3550
|
"accepted-result": `${id}'s last result was accepted; change it through a revision, not a rerun`,
|
|
3545
3551
|
published: `${id}'s last result is published; revise it through its pull request`,
|
|
3546
3552
|
moved: `${id} changed since its page was read; read it again`,
|
|
3553
|
+
stale: `${id} changed since its page was read; read it again`,
|
|
3547
3554
|
archived: `${id} is put away — restore it with \`toolroll task restore ${id}\` first`,
|
|
3548
3555
|
};
|
|
3549
3556
|
return fail(write, json, "task requeue", result.reason, why[result.reason], EXIT.refused);
|
|
@@ -4221,6 +4228,8 @@ async function configCommand(positional, flags, context) {
|
|
|
4221
4228
|
const scope = repoGiven === undefined ? INSTALLATION_SCOPE : canonicalProject(repoGiven) ?? resolve(repoGiven);
|
|
4222
4229
|
if (phase === "quick-answers")
|
|
4223
4230
|
return quickAnswersConfig(action ?? "show", repoGiven !== undefined, flags, context);
|
|
4231
|
+
if (phase === "task-sizing")
|
|
4232
|
+
return taskSizingConfig(action ?? "show", positional[2], repoGiven !== undefined, flags, context);
|
|
4224
4233
|
if (action === undefined || action === "show") {
|
|
4225
4234
|
const installation = store.listPhaseConfig(INSTALLATION_SCOPE);
|
|
4226
4235
|
const project = scope === INSTALLATION_SCOPE ? [] : store.listPhaseConfig(scope);
|
|
@@ -7366,8 +7375,11 @@ async function statusCommand(positional, flags, context) {
|
|
|
7366
7375
|
notifySecurityRelease(context.store, release, current, method.updateCommand, context.clock());
|
|
7367
7376
|
const line = updateLine(release, current, method.updateCommand);
|
|
7368
7377
|
const update = release === null ? {} : { update: { current, latest: release.version, security: release.security, updateCommand: method.updateCommand, url: release.url } };
|
|
7369
|
-
const
|
|
7378
|
+
const savedList = await savedIntegrations(context).catch(() => []);
|
|
7379
|
+
const brokenIntegrations = savedList.filter(one => one.state === "broken");
|
|
7370
7380
|
const brokenLine = integrationsBrokenLine(brokenIntegrations);
|
|
7381
|
+
const signedOutLines = agentsSignedOutLines(savedList);
|
|
7382
|
+
const signedOut = signedOutLines.length === 0 ? {} : { agentsSignedOut: signedOutLines };
|
|
7371
7383
|
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
7384
|
const waiting = waitingUpdate(context.databaseFile, run => context.store.stopQuiescenceProblem(run) !== null, context.clock());
|
|
7373
7385
|
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 +7393,7 @@ async function statusCommand(positional, flags, context) {
|
|
|
7381
7393
|
const laptop = { laptop: await laptopStatus(context.store, context.databaseFile, context.laptopSeams) };
|
|
7382
7394
|
if (!laptop.laptop.running && laptop.laptop.background === "on" && !machineActing())
|
|
7383
7395
|
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])]);
|
|
7396
|
+
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
7397
|
}
|
|
7386
7398
|
function unsentRepliesLine(unsent) {
|
|
7387
7399
|
if (unsent.length === 0)
|
|
@@ -8095,7 +8107,7 @@ function showTask(positional, context) {
|
|
|
8095
8107
|
...detail.runs
|
|
8096
8108
|
.filter(one => one.route !== null)
|
|
8097
8109
|
.slice(0, 8)
|
|
8098
|
-
.map(one => `
|
|
8110
|
+
.map(one => ` ${runWords(detail.runs, one.id)} ${one.role.padEnd(8)} ${one.route.provider}${one.route.model === null ? "" : ` · ${one.route.model}`} [${one.route.chosen}]`),
|
|
8099
8111
|
]);
|
|
8100
8112
|
}
|
|
8101
8113
|
function reviewStatusLines(review, sourceRun) {
|
|
@@ -8702,7 +8714,7 @@ async function scopeTask(positional, flags, context) {
|
|
|
8702
8714
|
previous?.proposedVia === "coordinator" || store.filedViaOf(id)?.startsWith("mcp:"))
|
|
8703
8715
|
return null;
|
|
8704
8716
|
const input = { title: store.getTask(id).title, goal, outOfScope: text(flags, "not") ?? null, touches };
|
|
8705
|
-
const sized = store.applySizing(id,
|
|
8717
|
+
const sized = store.applySizing(id, filingSizing(store, input), { followPlanning: true }, now);
|
|
8706
8718
|
if (sized.ok)
|
|
8707
8719
|
refinement = refineFiledSizing(store, id, input, true, context.clock);
|
|
8708
8720
|
return null;
|
|
@@ -12643,3 +12655,39 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12643
12655
|
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
12644
12656
|
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
12657
|
}
|
|
12658
|
+
async function taskSizingConfig(action, value, repoGiven, flags, context) {
|
|
12659
|
+
const { store, write, json, clock } = context;
|
|
12660
|
+
const command = `config ${action}`;
|
|
12661
|
+
if (repoGiven)
|
|
12662
|
+
return fail(write, json, command, "usage", "task sizing is installation-wide: no --repo", EXIT.usage);
|
|
12663
|
+
const said = () => {
|
|
12664
|
+
const read = taskSizingSetting(store);
|
|
12665
|
+
const on = read.on && !read.byEnv;
|
|
12666
|
+
const name = (one) => one === "jev" ? "Jev via OpenRouter (your credit)" : "Claude Haiku (on your plan)";
|
|
12667
|
+
return { payload: { taskSizing: { on, setting: read.chosen ? "on" : "off", sizer: read.sizer, available: read.available, byEnv: read.byEnv } }, lines: () => [read.byEnv
|
|
12668
|
+
? "Task sizing is off: TOOLROLL_NO_TASK_CLASSIFIER is set, so no model call happens before you approve; uncertain tasks get a plan first."
|
|
12669
|
+
: on ? `Task sizing is on: each new task is sized by ${name(read.sizer)} before you approve.`
|
|
12670
|
+
: 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.`
|
|
12671
|
+
: "Task sizing is off: no model call before you approve; uncertain tasks get a plan first."] };
|
|
12672
|
+
};
|
|
12673
|
+
if (action === "show") {
|
|
12674
|
+
const shown = said();
|
|
12675
|
+
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12676
|
+
}
|
|
12677
|
+
if (action !== "set" || (value !== "on" && value !== "off"))
|
|
12678
|
+
return fail(write, json, command, "usage", "`toolroll config set task-sizing on|off --as <you> --token <t>`", EXIT.usage);
|
|
12679
|
+
const acting = await askCredentials(flags, context);
|
|
12680
|
+
if (acting === null)
|
|
12681
|
+
return fail(write, json, command, "usage", "changing task sizing takes `--as <you> --token <t>`", EXIT.usage);
|
|
12682
|
+
const saved = store.transact(() => {
|
|
12683
|
+
const verified = authenticateApprover(store, acting.name, acting.token);
|
|
12684
|
+
if (!verified.ok || !store.isInstanceOperator(acting.name))
|
|
12685
|
+
return false;
|
|
12686
|
+
setTaskSizing(store, value === "on" ? taskSizingSetting(store).available : false, acting.name, clock());
|
|
12687
|
+
return true;
|
|
12688
|
+
});
|
|
12689
|
+
if (!saved)
|
|
12690
|
+
return fail(write, json, command, "unauthenticated", "an instance operator changes task sizing, with their password", EXIT.refused);
|
|
12691
|
+
const shown = said();
|
|
12692
|
+
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12693
|
+
}
|
package/dist/outbound-privacy.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { scanForSecrets } from "./evidence.js";
|
|
2
2
|
const HOME_FOLDER = /(?:^|[\s"'`(<[=:,])(?:\/Users\/|\/home\/|\/root\/|~\/)/;
|
|
3
3
|
const DRIVE_OR_SHARE = /(?<![A-Za-z0-9+.-])[A-Za-z]:[\\/]|\\\\|\bfile:\/\//i;
|
|
4
|
+
const HOME_OTHERWISE = /(?:^|[\s"'`(<[=:,])\\\/(?:Users|home|root)\\\/|\$HOME[\\/]|\$\{HOME\}[\\/]|%USERPROFILE%|%HOMEPATH%|\$env:USERPROFILE\b|:\/\/\/(?:Users|home|root|[A-Za-z]:)[\\/]/i;
|
|
5
|
+
const decodedOnce = (text) => text.replace(/%([0-9A-Fa-f]{2})/g, (_, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
|
|
6
|
+
const folderWords = (text) => HOME_FOLDER.test(text) || DRIVE_OR_SHARE.test(text) || HOME_OTHERWISE.test(text);
|
|
4
7
|
export function privateWords(text) {
|
|
5
|
-
|
|
8
|
+
if (scanForSecrets(text).length > 0 || /\b\d{5,}:[A-Za-z0-9_-]{20,}\b/.test(text) || folderWords(text))
|
|
9
|
+
return true;
|
|
10
|
+
return /%[0-9A-Fa-f]{2}/.test(text) && folderWords(` ${decodedOnce(text)}`);
|
|
6
11
|
}
|
|
7
12
|
export const outboundPrivate = (fields) => fields.some(privateWords);
|
|
8
13
|
export function textsOf(value, depth = 0) {
|
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/plain-words.js
CHANGED
|
@@ -26,7 +26,7 @@ export const PLAIN_WORDS = [
|
|
|
26
26
|
row("Draft a repair task", "draft\\s+a\\s+repair\\s+task", "Send back"),
|
|
27
27
|
row("put away", "put(?:s|ting)?\\s+(?:it\\s+|them\\s+|tasks\\s+|old\\s+tasks\\s+)?away", "Archive"),
|
|
28
28
|
row("tidy", "tidy|tidied|tidying", "Archive"),
|
|
29
|
-
row("run #N", "(?:run|
|
|
29
|
+
row("run #N", "(?:run|result)\\s+#?\\d+|attempt\\s+#?\\d+(?!\\s+\\(build\\s+#\\d+\\))", "build #N, or attempt N (build #M)"),
|
|
30
30
|
row("reconcile", "reconcile[ds]?|reconciling|reconciliation", "Waiting: Toolroll is …"),
|
|
31
31
|
row("requeue", "requeue[ds]?|requeuing", "Waiting: Toolroll is …"),
|
|
32
32
|
row("claim", "claim|claimed", "Waiting: Toolroll is …"),
|
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/release.js
CHANGED
|
@@ -46,6 +46,7 @@ export const ADVISORY_PR_CHECKS = {
|
|
|
46
46
|
"workbench bundle / binary · linux-x64": ".github/workflows/tui-bundle.yml",
|
|
47
47
|
"workbench bundle / binary · linux-arm64": ".github/workflows/tui-bundle.yml",
|
|
48
48
|
"workbench bundle / assemble": ".github/workflows/tui-bundle.yml",
|
|
49
|
+
"gate changes": ".github/workflows/gate-changes.yml",
|
|
49
50
|
};
|
|
50
51
|
export const RELEASE_TAG_CHECKS = ["release proof", "package / binary · darwin-arm64", "package / binary · darwin-x64", "package / binary · linux-x64", "package / binary · linux-arm64", "package / assemble", "publish"];
|
|
51
52
|
export const RELEASE_TAG_WORKFLOW = ".github/workflows/publish.yml";
|
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"]);
|
package/dist/serve.js
CHANGED
|
@@ -1012,7 +1012,8 @@ export function createDecisionServer(options) {
|
|
|
1012
1012
|
return localSignInChecking;
|
|
1013
1013
|
const ask = (again) => Promise.all(LOCAL_AGENTS.map(one => connectionCheck(one, again).catch(() => null)));
|
|
1014
1014
|
localSignInChecking = ask(fresh)
|
|
1015
|
-
.then(first => first.some(one => one !== null && SIGNED_IN_STATES.has(one.state)) || !first.some(one => one === null || one.state === "unverified") ? first
|
|
1015
|
+
.then(first => first.some(one => one !== null && SIGNED_IN_STATES.has(one.state)) || !first.some(one => one === null || one.state === "unverified") ? first
|
|
1016
|
+
: Promise.all(LOCAL_AGENTS.map((one, index) => { const was = first[index] ?? null; return was === null || was.state === "unverified" ? connectionCheck(one, true).catch(() => null) : was; })))
|
|
1016
1017
|
.then(async (answers) => {
|
|
1017
1018
|
const at = clock().getTime();
|
|
1018
1019
|
const [claudeSeen, codexSeen] = answers.map((value, index) => heldSignIn(LOCAL_AGENTS[index], value, at));
|
|
@@ -1768,8 +1769,9 @@ export function createDecisionServer(options) {
|
|
|
1768
1769
|
waits.push(lastChecks.run(`project-mcp:${repo}`, async () => { const looked = await lookProjectMcp(repo); if (looked.ok)
|
|
1769
1770
|
savedProjectMcp.set(repo, looked.value); return looked.ok; }));
|
|
1770
1771
|
}
|
|
1771
|
-
if (lastChecks.due(`codex-tools:${repo}`, 10 * 60_000))
|
|
1772
|
-
waits.push(lastChecks.run(`codex-tools:${repo}`, () => codexServers(repo)));
|
|
1772
|
+
if (SIGNED_IN_STATES.has(knownConnections.get("codex")?.state ?? "") && lastChecks.due(`codex-tools:${repo}`, 10 * 60_000)) {
|
|
1773
|
+
waits.push(lastChecks.run(`codex-tools:${repo}`, async () => SIGNED_IN_STATES.has((await connectionCheck("codex", true)).state) ? codexServers(repo) : null));
|
|
1774
|
+
}
|
|
1773
1775
|
}
|
|
1774
1776
|
if (databaseFile !== null && lastChecks.due("storage", 30 * 60_000)) {
|
|
1775
1777
|
waits.push(lastChecks.run("storage", () => checkoutPlan(store, storagePool(databaseFile), clock(), { manual: true })));
|
|
@@ -1781,7 +1783,7 @@ export function createDecisionServer(options) {
|
|
|
1781
1783
|
catch { }
|
|
1782
1784
|
}
|
|
1783
1785
|
await Promise.all(waits);
|
|
1784
|
-
}),
|
|
1786
|
+
}).finally(() => options.onBackgroundPass?.()),
|
|
1785
1787
|
onError: () => { }, });
|
|
1786
1788
|
void backgroundChecks.runNow();
|
|
1787
1789
|
});
|
package/dist/server/chat.js
CHANGED
|
@@ -37,6 +37,7 @@ import { runActivityOf } from "../task-activity.js";
|
|
|
37
37
|
import { teamWorkspaceHtml } from '../team-ui.js';
|
|
38
38
|
import { loadBotToken, redactToken } from "../telegram.js";
|
|
39
39
|
import { WORK_INDEX_MAX_LIMIT, workIndexPage } from "../work-index.js";
|
|
40
|
+
import { binaryViewRunner, viewAllowedFor } from '../view-tools.js';
|
|
40
41
|
import { html, htmlString, postForm, reauth } from "../html.js";
|
|
41
42
|
import { requestContext } from "./request-context.js";
|
|
42
43
|
import { refuse, screen, whenTime } from "./chrome.js";
|
|
@@ -863,7 +864,8 @@ export function createChatHandlers(runtime) {
|
|
|
863
864
|
const ended = (ok) => { if (onProgress !== undefined)
|
|
864
865
|
endLiveTurn(opened.thread.id, ok, onProgress); };
|
|
865
866
|
void freshFacts.run(null, () => runLeadTurn({ store, who: principal, session: leadSession, thread: opened.thread, config: enabled.config, key: enabled.key, message,
|
|
866
|
-
onAdmitted: () => { onProgress = beginLiveTurn(opened.thread.id, liveShape); }, onProgress: event => onProgress?.(event), channel: "console", requestId,
|
|
867
|
+
onAdmitted: () => { onProgress = beginLiveTurn(opened.thread.id, liveShape); }, onProgress: event => onProgress?.(event), channel: "console", requestId,
|
|
868
|
+
...(viewAllowed(request, who) ? { view: viewRunner } : {}), ...(focusTask === null && chatProject !== null ? { context: `Current project: ${projectName(chatProject)} (${chatProject}). Keep this conversation about that project unless the operator explicitly asks to broaden it; use it as the repo for project tools.` } : {}), ...(focusTask === null ? {} : { context: `Current task: ${focusTask.id}. Read it with get_task before answering or proposing changes. Read its currentExecution next and bind new actions to that exact execution. Never replace the target of a prior proposal with a newer revision. Keep this turn about that task unless the operator explicitly asks to broaden it.${resultContext}${modeContext}` }), fetcher: chatFetcher, ...(options.subscriptionChatRunner === undefined ? {} : { subscriptionRunner: options.subscriptionChatRunner }), clock, evidenceRoot }))
|
|
867
869
|
.then(outcome => {
|
|
868
870
|
if (!outcome.ok && "refused" in outcome && (outcome.refused === "concurrent" || outcome.refused === "backlog") && queueIt().kind === "queued") {
|
|
869
871
|
ended(false);
|
|
@@ -1385,5 +1387,8 @@ export function createChatHandlers(runtime) {
|
|
|
1385
1387
|
"chat.file": chatFile,
|
|
1386
1388
|
"chat.ack-send": chatAckSend,
|
|
1387
1389
|
});
|
|
1390
|
+
const viewRunner = options.viewRunner ?? binaryViewRunner();
|
|
1391
|
+
const viewAllowed = (request, who) => viewAllowedFor({ via: who.via, ...(who.authority === undefined ? {} : { authority: who.authority }), name: who.name,
|
|
1392
|
+
fromThisComputer: runtime.fromThisComputer(request), approvers: store.listApprovers().map(one => one.name) });
|
|
1388
1393
|
return { registrations, chatFirstRun, phoneCard, chatProjectOf, beginLiveTurn, endLiveTurn, noteLead, takeLeadNote, demoResultView, storeChatKey, forgetChatKey, sweepChatDrafts, runChatTurn, chatHomeOf, firstTasksFor, approverCandidateCount, evictOldestCandidate };
|
|
1389
1394
|
}
|
package/dist/server/pages.js
CHANGED
|
@@ -79,6 +79,7 @@ import { flowAsks, NO_HOME_ASKS, releaseAsks, setupAsks } from "./home-asks.js";
|
|
|
79
79
|
import { workIndexPage } from "../work-index.js";
|
|
80
80
|
import { checkEngineResponse, ENGINE_API_VERSION } from "../contracts/engine-api.js";
|
|
81
81
|
import { readRunLive } from "./engine-api.js";
|
|
82
|
+
import { waitingForTasks } from "../engine-reads.js";
|
|
82
83
|
export function createPagesHandlers(runtime, work) {
|
|
83
84
|
const { identities, clock, lastChecks, store, visible, consoleProjects, restricted, ceiling, options, projectFamilyPeek, sendScreen, chromeFor, unscopedMode, admissionList, taskRepoOf, taskViewData, runVisible, evidenceRoot, workAccess, identify, liveCeiling, sessions, deletedRepos, authenticateApprover, authenticateCredential, consumeApprovalNonce, projectOf, lookupSession, firstRunStepsNow, chatEnablement, leadPrincipal, leadConversationRows, outsideAdmissions } = runtime;
|
|
84
85
|
async function projectsBrowse(ctx) {
|
|
@@ -1249,10 +1250,12 @@ export function createPagesHandlers(runtime, work) {
|
|
|
1249
1250
|
})();
|
|
1250
1251
|
const needOf = (row) => ({ id: row.id, title: row.title, href: row.href, project: row.project, age: row.age, state: row.state, ask: row.ask,
|
|
1251
1252
|
...(row.group === undefined ? {} : { group: row.group }), reason: row.reason, line: row.line, action: row.action, question: row.question });
|
|
1253
|
+
const waiting = waitingForTasks(store, list.rows.map(row => row.id), now);
|
|
1252
1254
|
const body = {
|
|
1253
1255
|
version: ENGINE_API_VERSION, project: view.project, projectName: view.projectName, needsCount: view.needsCount, groups: list.groups,
|
|
1254
1256
|
rows: list.rows.map(row => ({ id: row.id, title: row.title, href: row.href, project: row.project, age: row.age, status: row.status, word: row.word, ask: row.ask,
|
|
1255
|
-
chip: row.chip, group: row.group, rank: row.rank, detail: row.detail, problem: row.problem, need: row.need === undefined ? null : needOf(row.need)
|
|
1257
|
+
chip: row.chip, group: row.group, rank: row.rank, detail: row.detail, problem: row.problem, need: row.need === undefined ? null : needOf(row.need),
|
|
1258
|
+
waiting: waiting.get(row.id) ?? null })),
|
|
1256
1259
|
needs: view.needs.map(group => ({ key: group.key, label: group.label, count: group.count, rows: group.rows.map(needOf) })),
|
|
1257
1260
|
next: list.pages.next, room: "workspace", spend,
|
|
1258
1261
|
};
|
|
@@ -7,6 +7,7 @@ import { taskHref } from "./http.js";
|
|
|
7
7
|
import { btn, chip, disclose, doc, docHeader, dock, facts, note, notice, phoneHeader, radios, slots, status } from "./kit.js";
|
|
8
8
|
import { editorFileHref, evidenceBundleCard, evidenceWords, humanBytes, prefillScript, resultPanelHtml, revisionSealFields, runFactsRows, runNoun, terminalDiffCard, } from "./render-results.js";
|
|
9
9
|
import { publicationFactsOf } from "./render-tasks.js";
|
|
10
|
+
import { detailShown } from "../action-ledger.js";
|
|
10
11
|
export const sec = (title, body, attrs = html ``) => html `<section class="k-sec"${attrs}><h3>${title}</h3>${body}</section>`;
|
|
11
12
|
const kitPage = (attrs, ...parts) => html `<div class="h-page" data-kit-page${attrs}>${parts}</div>`;
|
|
12
13
|
export function runPage(chrome, run, taskId, artifacts, terminal = null, notes = [], csrf = "", comments = [], ciRepair = null, liveScript, peekable = false, running = false, editor = null, editorToggle = null, noted = false, structuredHandoff = null, proofBundle = null, route = null, publicationRow = null, review = null, result = null, sourceDigest = null) {
|
|
@@ -203,7 +204,7 @@ ${runs.map(run => html `<div class="h-tr" role="row"><span role="cell"><a class=
|
|
|
203
204
|
const entries = pack.ledger.entries.filter(one => one.source !== "request");
|
|
204
205
|
const requests = pack.ledger.entries.length - entries.length;
|
|
205
206
|
const log = sec("Audit log", html `${entries.length === 0 ? note("No entries.") : html `<ul class="h-log">${[...entries].reverse().map(one => html `<li data-ledger-id="${one.id}">\
|
|
206
|
-
<span class="k-num k-muted">${at(one.at)}</span><span><b>${one.actor}</b> ${one.action}${one.detail ? html `<span class="k-muted"> · ${one.detail}</span>` : ""}</span>\
|
|
207
|
+
<span class="k-num k-muted">${at(one.at)}</span><span><b>${one.actor}</b> ${one.action}${one.detail ? html `<span class="k-muted"> · ${detailShown(one.detail)}</span>` : ""}</span>\
|
|
207
208
|
<span class="k-muted">${one.outcome}</span><span class="h-seal">${shortHash(one.seal?.hash ?? null)}</span></li>`)}</ul>`}${requests > 0 ? note(`Plus ${requests} ${requests === 1 ? "request" : "requests"} made through the console (accepted or refused), listed in the JSON.`) : ""}${pack.ledger.truncated ? note(`This record holds ${entries.length} of the task's entries and the newest ${requests} requests; the audit log export has the rest.`) : ""}`);
|
|
208
209
|
const foot = html `<p class="k-note h-foot">Record digest <span class="k-mono">${pack.digest}</span>. Each entry's seal can be rechecked from the JSON: <span class="k-mono">${pack.ledger.recipe}</span>.</p>`;
|
|
209
210
|
return { summary, broken, versions, agents, outcome, log, foot };
|
|
@@ -471,7 +471,7 @@ export function summaryWarningsHtml(summary) {
|
|
|
471
471
|
export function summaryUsualHtml(summary) {
|
|
472
472
|
if (summary.usual.length === 0)
|
|
473
473
|
return html ``;
|
|
474
|
-
return html `<details class="approval-details terms-usual" data-terms-usual><summary>${summary.usualLabel}</summary><dl class="approval-rows">${summary.usual.map(one => html `<div class="approval-row"><dt>${one.label}</dt><dd><p>${one.words}</p></dd></div>`)}</dl></details>`;
|
|
474
|
+
return html `<details class="approval-details terms-usual" data-terms-usual><summary>${summary.usualSummary === "" ? summary.usualLabel : `${summary.usualLabel}: ${summary.usualSummary}`}</summary><dl class="approval-rows">${summary.usual.map(one => html `<div class="approval-row"><dt>${one.label}</dt><dd><p>${one.words}</p></dd></div>`)}</dl></details>`;
|
|
475
475
|
}
|
|
476
476
|
export const EVIDENCE_SHEET = Object.fromEntries(Object.entries(EVIDENCE_WORDS).map(([kind, words]) => [kind, `${words.charAt(0).toUpperCase()}${words.slice(1)}`]));
|
|
477
477
|
export function earlierVersionsWords(active, running) {
|
|
@@ -1759,7 +1759,7 @@ export function taskBodyParts(data) {
|
|
|
1759
1759
|
? postForm(`${taskHref(task.id)}/cancel`, joinHtml([
|
|
1760
1760
|
data.coordinator == null ? "" : html `<label>Reason for cancellation<textarea name="reason" rows="3" maxlength="500" required>${data.cancelDraft ?? ""}</textarea></label>`,
|
|
1761
1761
|
html `<button type="submit" class="danger">Confirm cancellation</button>`,
|
|
1762
|
-
]))
|
|
1762
|
+
]), { hidden: cancelPinsOf(task.state, data.runs) })
|
|
1763
1763
|
: "";
|
|
1764
1764
|
const cancelAct = cancelForm === "" ? "" : html `<details class="arm-danger"${data.cancelDraft === undefined ? "" : html ` open`}><summary>Cancel task</summary>${cancelForm}</details>`;
|
|
1765
1765
|
const sectionParts = [];
|
|
@@ -2327,3 +2327,6 @@ export function planVersionDetailsHtml(digest) {
|
|
|
2327
2327
|
function agentlessRoute(dispatch, route) {
|
|
2328
2328
|
return dispatch?.summary === NO_AGENT_TITLE && route?.kind === "unreadable" && (route.problem ?? "").includes("has no exact model");
|
|
2329
2329
|
}
|
|
2330
|
+
export function cancelPinsOf(state, runs) {
|
|
2331
|
+
return { state, run: runs.length === 0 ? "none" : String(Math.max(...runs.map(one => one.id))) };
|
|
2332
|
+
}
|
|
@@ -87,6 +87,7 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
87
87
|
"settings.knowledge-note": "memory-review",
|
|
88
88
|
"settings.knowledge-tidy": "memory-review",
|
|
89
89
|
"settings.advanced": "view-preference",
|
|
90
|
+
"settings.task-sizing": "task-sizing-switch",
|
|
90
91
|
"agents.seen": "mark-seen",
|
|
91
92
|
"agents.watch": "watch-agent",
|
|
92
93
|
});
|
|
@@ -416,6 +417,7 @@ post("tasks", "sweep.cancel-rest", "^\\/sweeps\\/[1-9][0-9]{0,9}\\/cancel-rest$"
|
|
|
416
417
|
get("settings", "settings.passwordless", "/settings/passwordless", { ...free, ...operator("An instance operator sets Passwordless.", "/settings") });
|
|
417
418
|
post("settings", "settings.passwordless-send", "/settings/passwordless", { callers: ["cookie"], ...operator("An instance operator sets Passwordless.", "/settings") });
|
|
418
419
|
post("settings", "settings.local-mode-off", "/settings/local-mode/off", { callers: ["cookie"], scope: "step-up", ...operator("An instance operator turns off local mode.", "/settings/general?section=local-mode") });
|
|
420
|
+
post("settings", "settings.task-sizing", "/settings/task-sizing", { scope: "step-up", limited: "deny", ...operator("An instance operator chooses how tasks are sized.", "/settings/general?section=task-sizing") });
|
|
419
421
|
post("settings", "settings.just-me", "/settings/install-mode/solo", { callers: ["cookie"], scope: "step-up", ...operator("An instance operator says it's just them.", "/settings/general?section=install-mode") });
|
|
420
422
|
post("settings", "settings.release-approval-send", "/settings/release-approval", { callers: ["cookie"], ...approver("An approver sets how releases are approved.", "/settings/approval") });
|
|
421
423
|
post("pages", "ledger.checkpoint", "/ledger/checkpoint", operator("An instance operator makes ledger checkpoints.", "/ledger"));
|
|
@@ -17,6 +17,9 @@ export const SETTINGS_SECTIONS = Object.freeze([
|
|
|
17
17
|
{ id: "install-mode", area: "general", title: "Solo or team", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
18
18
|
read: [], scope: {}, act: { "just-me": ["full-session", "operator"] }, changes: [{ id: "just-me", act: "just-me", proof: "install-solo" }],
|
|
19
19
|
opens: false, scripts: [], oldIds: [] },
|
|
20
|
+
{ id: "task-sizing", area: "general", title: "Size tasks with a quick model call (Claude Haiku, on your plan)", pinnedFrom: "settings.group-general", policy: GROUP_PAGE,
|
|
21
|
+
read: ["installation"], scope: {}, act: { switch: ["cookie-session", "operator"] }, changes: [{ id: "task-sizing", act: "switch", proof: "task-sizing" }],
|
|
22
|
+
opens: false, scripts: [], oldIds: [] },
|
|
20
23
|
{ id: "advanced", area: "general", title: "Show advanced features", pinnedFrom: "settings.group-advanced", policy: GROUP_PAGE,
|
|
21
24
|
read: [], scope: { "operator-pages": ["operator"] }, act: { switch: ["cookie-session"] }, changes: [], opens: true, scripts: [], oldIds: ["show-advanced"] },
|
|
22
25
|
{ id: "local-mode", area: "general", title: "Local mode", pinnedFrom: "settings.group-access", policy: GROUP_PAGE,
|
|
@@ -269,6 +269,41 @@ function installModeSection(deps) {
|
|
|
269
269
|
},
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
|
+
export const TASK_SIZING_OFF_WORDS = "Off: no model call before you approve; uncertain tasks get a plan first.";
|
|
273
|
+
const SIZER_NAME = { claude: "Claude Haiku, on your plan", jev: "Jev via OpenRouter, your credit" };
|
|
274
|
+
const SIZER_SHORT = { claude: "Claude Haiku", jev: "Jev via OpenRouter" };
|
|
275
|
+
function taskSizingSection(deps) {
|
|
276
|
+
return {
|
|
277
|
+
loadSummary: ctx => {
|
|
278
|
+
const read = deps.taskSizing();
|
|
279
|
+
return { on: read.on && !read.byEnv, byEnv: read.byEnv, canSwitch: ctx.can["switch"] === true, sizer: read.sizer, available: read.available, moved: read.chosen && !read.on };
|
|
280
|
+
},
|
|
281
|
+
render: ({ summary, attrs }) => settingsSection({ id: "task-sizing", title: `Size tasks with a quick model call (${SIZER_NAME[summary.on && summary.sizer !== null ? summary.sizer : summary.available]})`, state: summary.on ? " · on" : " · off", attrs,
|
|
282
|
+
lead: summary.byEnv ? "Off: TOOLROLL_NO_TASK_CLASSIFIER is set on this computer, so no model call happens before you approve; uncertain tasks get a plan first."
|
|
283
|
+
: summary.on ? `On: before you approve, a quick call to ${SIZER_SHORT[summary.sizer]} sizes each new task, and the plan names it.`
|
|
284
|
+
: summary.moved && summary.sizer !== null ? `Off: you turned it on for ${SIZER_SHORT[summary.sizer]}, but ${SIZER_SHORT[summary.available]} is the one available now, so nothing is sent. Turn it on again to choose it. Uncertain tasks get a plan first.`
|
|
285
|
+
: TASK_SIZING_OFF_WORDS,
|
|
286
|
+
...(summary.canSwitch && !summary.byEnv ? { right: btn(summary.on ? "Turn off" : "Turn on", { sm: true, href: "/settings/change/task-sizing" }) } : {}), body: html `` }),
|
|
287
|
+
refusal: "An instance operator changes how tasks are sized.",
|
|
288
|
+
renderChange: ({ declaration, summary, problem }) => {
|
|
289
|
+
const home = sectionHref(declaration);
|
|
290
|
+
const on = summary?.on === true;
|
|
291
|
+
const choice = summary === null ? "claude" : on && summary.sizer !== null ? summary.sizer : summary.available;
|
|
292
|
+
const title = `Size tasks with a quick model call (${SIZER_NAME[choice]})`;
|
|
293
|
+
const words = summary === null || summary.byEnv
|
|
294
|
+
? html `${infoLine("TOOLROLL_NO_TASK_CLASSIFIER is set on this computer, so task sizing stays off.")}<div class="k-acts">${btn("Back to General", { href: home })}</div>`
|
|
295
|
+
: joinHtml([
|
|
296
|
+
html `<p>${on ? `Turn it off. ${TASK_SIZING_OFF_WORDS}` : choice === "jev"
|
|
297
|
+
? "Turn it on. Before you approve, each new task's words go to Jev through your OpenRouter key (your credit) to size it: small ones build at once on a fast model, risky ones plan first, and the plan names the model that sized it. Only Jev is asked; if the key goes, sizing turns itself off."
|
|
298
|
+
: "Turn it on. Before you approve, a quick call to Claude Haiku on your own plan sizes each new task: small ones build at once on a fast model, risky ones plan first, and the plan names the model that sized it. Only Claude is asked; if an OpenRouter key is saved later, sizing turns itself off until you choose again."}</p>`,
|
|
299
|
+
problem === null ? "" : notice(problem),
|
|
300
|
+
kitSectionForm({ proof: "task-sizing", action: "/settings/task-sizing", id: "task-sizing-form", native: true, save: { label: on ? "Turn off" : "Turn on" }, confirm: on ? "Turn off task sizing" : "Turn on task sizing", hidden: { enabled: on ? "off" : "on", sizer: choice }, body: html `` }),
|
|
301
|
+
html `<div class="k-acts">${btn("Cancel", { variant: "ghost", href: home })}</div>`,
|
|
302
|
+
]);
|
|
303
|
+
return { title, body: html `<div data-kit-page>${phoneHeader(title, { back: home })}${doc(docHeader({ title, back: [home, "General"], same: true }), words)}</div>` };
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
}
|
|
272
307
|
export function generalSections(deps) {
|
|
273
308
|
return {
|
|
274
309
|
appearance: appearanceSection(),
|
|
@@ -276,6 +311,7 @@ export function generalSections(deps) {
|
|
|
276
311
|
"your-password": yourPasswordSection(deps),
|
|
277
312
|
version: versionSection(deps),
|
|
278
313
|
"install-mode": installModeSection(deps),
|
|
314
|
+
"task-sizing": taskSizingSection(deps),
|
|
279
315
|
advanced: advancedSection(),
|
|
280
316
|
"local-mode": localModeSection(deps),
|
|
281
317
|
};
|
package/dist/server/settings.js
CHANGED
|
@@ -150,6 +150,8 @@ import { sweepSchedule } from "../storage-sweep-schedule.js";
|
|
|
150
150
|
import { storageHtml } from "../storage-ui.js";
|
|
151
151
|
import { landedSummary } from "../landed-cleanup.js";
|
|
152
152
|
import { bytesWords, parseCleanup, parseIdle } from "../storage.js";
|
|
153
|
+
import { setTaskSizing, taskSizingSetting } from "../task-sizing.js";
|
|
154
|
+
import { localActNow } from "../local-owner.js";
|
|
153
155
|
import { checkoutIdle, isDigestTime, leadQuickAnswersOn, liveBackupState, setCheckoutIdle, localModeOf, RESULT_SCREENSHOTS, setLeadQuickAnswers, setLiveBackupSettings, setLocalModeOff } from "../store.js";
|
|
154
156
|
import { defaultLiveFolder, liveFolderOf, liveFolderProblem } from "../live-backup.js";
|
|
155
157
|
import { LIVE_EVERY } from "../backup-ui.js";
|
|
@@ -2763,6 +2765,7 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
2763
2765
|
"settings.lead-identity": leadIdentity,
|
|
2764
2766
|
"settings.lead-about": leadAbout,
|
|
2765
2767
|
"settings.lead-quick": leadQuick,
|
|
2768
|
+
"settings.task-sizing": taskSizingAct,
|
|
2766
2769
|
"settings.lead-promise-cancel": leadPromiseCancel,
|
|
2767
2770
|
"settings.lead-on": leadOn,
|
|
2768
2771
|
"settings.code-map": codeMapAct("switch"),
|
|
@@ -2985,6 +2988,38 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
2985
2988
|
return back("problem", turned.reason === "not-on" ? "Local mode is already off." : "Only an instance operator can turn off local mode.");
|
|
2986
2989
|
return done("said", "Local mode is off. This computer's browser signs in with your password now.");
|
|
2987
2990
|
}
|
|
2991
|
+
async function taskSizingAct(ctx) {
|
|
2992
|
+
const { response, now, posted } = ctx;
|
|
2993
|
+
const who = browserCaller(ctx.who);
|
|
2994
|
+
const body = readForm(posted, CONSOLE_FORMS.taskSizing);
|
|
2995
|
+
const done = sayTo(response, "/settings/general?section=task-sizing");
|
|
2996
|
+
const back = sayTo(response, "/settings/change/task-sizing");
|
|
2997
|
+
if (["password", "enabled", "sizer"].some(field => body.sent.getAll(field).length > 1))
|
|
2998
|
+
return back("problem", "That form was sent twice over. Nothing changed.");
|
|
2999
|
+
const wanted = body.get("enabled");
|
|
3000
|
+
if (wanted !== "on" && wanted !== "off")
|
|
3001
|
+
return back("problem", "Choose on or off.");
|
|
3002
|
+
const shown = body.get("sizer");
|
|
3003
|
+
const saved = store.transact(() => {
|
|
3004
|
+
if (!store.isInstanceOperator(who.name))
|
|
3005
|
+
return "proof";
|
|
3006
|
+
if (who.authority !== "full" && localActNow(store, "task-sizing-switch") === null)
|
|
3007
|
+
return "proof";
|
|
3008
|
+
if (!authenticateApprover(who, body.get("password") ?? "").ok)
|
|
3009
|
+
return "proof";
|
|
3010
|
+
const available = taskSizingSetting(store).available;
|
|
3011
|
+
if (wanted === "on" && shown !== available)
|
|
3012
|
+
return "moved";
|
|
3013
|
+
setTaskSizing(store, wanted === "on" ? available : false, who.name, now);
|
|
3014
|
+
return "ok";
|
|
3015
|
+
});
|
|
3016
|
+
if (saved === "proof")
|
|
3017
|
+
return back("problem", "Enter your Toolroll password to change task sizing.");
|
|
3018
|
+
if (saved === "moved")
|
|
3019
|
+
return back("problem", "Which model would size your tasks changed since you looked. Nothing changed; look again.");
|
|
3020
|
+
const read = taskSizingSetting(store);
|
|
3021
|
+
return done("said", wanted === "on" ? `Task sizing is on. Each new task is sized by ${read.available === "jev" ? "Jev through your OpenRouter key" : "a quick call to Claude Haiku on your plan"} before you approve.` : "Task sizing is off. No model call before you approve; uncertain tasks get a plan first.");
|
|
3022
|
+
}
|
|
2988
3023
|
async function justMe(ctx) {
|
|
2989
3024
|
const { response, now, posted } = ctx;
|
|
2990
3025
|
const who = browserCaller(ctx.who);
|
|
@@ -3163,6 +3198,7 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3163
3198
|
passwordless: () => sessionStandsIn(store),
|
|
3164
3199
|
localModeOn: () => localModeOf(store)?.enabled === true,
|
|
3165
3200
|
installMode: () => installModeNow(store),
|
|
3201
|
+
taskSizing: () => taskSizingSetting(store),
|
|
3166
3202
|
});
|
|
3167
3203
|
const computersDeps = {
|
|
3168
3204
|
computers: (now, manage) => computersOf(store, now, visible, manage),
|