toolroll 0.9.114 → 0.9.116
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 +54 -0
- package/dist/agent-state-words.js +1 -1
- package/dist/assignment-ui.js +1 -1
- package/dist/browser/terminal.css +1 -1
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +29 -28
- package/dist/chat-controls.js +1 -1
- package/dist/chat-quiet.js +2 -2
- package/dist/chat-voice.js +3 -3
- package/dist/check-levels.js +1 -1
- package/dist/claim.js +7 -2
- package/dist/cli.js +1 -0
- package/dist/code-map-cli.js +2 -1
- package/dist/coding-shipping-ui.js +2 -1
- package/dist/console-instance.js +21 -1
- package/dist/contracts/console-api.js +6 -2
- package/dist/contracts/engine-api.js +32 -4
- package/dist/demo-chat.js +1 -1
- package/dist/design/kit.css +3 -0
- package/dist/design/kit.js +1 -1
- package/dist/dispatch.js +19 -2
- package/dist/easy-start.js +23 -11
- package/dist/engine-reads.js +98 -7
- package/dist/export.js +16 -4
- package/dist/flexible-authority-end.js +94 -0
- package/dist/flexible-everyday-schema.js +76 -0
- package/dist/flexible-interactive-schema.js +133 -0
- package/dist/flexible-interactive.js +94 -0
- package/dist/flexible-laptop.js +38 -0
- package/dist/flexible-relay.js +9 -3
- package/dist/flexible-session.js +430 -10
- package/dist/flexible-ship.js +77 -12
- package/dist/flexible-sign-in.js +16 -1
- package/dist/flexible-start.js +17 -2
- package/dist/flexible-thread.js +1 -1
- package/dist/flexible-turns.js +9 -0
- package/dist/flexible-ui.js +3 -2
- package/dist/flexible.js +13 -0
- package/dist/flow-card-task.js +1 -1
- package/dist/home-groups.js +1 -1
- package/dist/lead-status.js +5 -3
- package/dist/lead-tools.js +1 -0
- package/dist/local-owner-acts.js +44 -1
- package/dist/local-owner.js +10 -0
- package/dist/needs-you.js +18 -6
- package/dist/operate-remote-arguments.js +1 -1
- package/dist/operate.js +250 -32
- package/dist/plan-problems-schema.js +4 -0
- package/dist/planner.js +17 -6
- package/dist/release-cli.js +2 -2
- package/dist/result-actions.js +1 -2
- package/dist/retention-ui.js +1 -1
- package/dist/scope.js +18 -7
- package/dist/server/chat.js +3 -3
- package/dist/server/console.css +15 -10
- package/dist/server/engine-api.js +161 -15
- package/dist/server/flows.js +4 -3
- package/dist/server/home.js +1 -1
- package/dist/server/kit.js +2 -2
- package/dist/server/render-chat.js +1 -1
- package/dist/server/render-pages.js +1 -1
- package/dist/server/render-tasks.js +21 -12
- package/dist/server/route-table.js +16 -0
- package/dist/server/settings-sections.js +6 -2
- package/dist/server/settings.js +22 -8
- package/dist/server/task-views.js +10 -4
- package/dist/server/tasks.js +51 -4
- package/dist/settings-kit.js +3 -3
- package/dist/skills-ui.js +3 -2
- package/dist/spend-report.js +2 -2
- package/dist/spend.js +3 -3
- package/dist/store.js +202 -7
- package/dist/subagent-admin.js +23 -10
- package/dist/subagent-backup-schema.js +36 -0
- package/dist/subagent-backup.js +92 -0
- package/dist/subagent-week.js +2 -2
- package/dist/subagent-work.js +70 -47
- package/dist/subagents-ui.js +6 -2
- package/dist/subagents.js +5 -2
- package/dist/subscription-chat.js +4 -0
- package/dist/surface.js +8 -1
- package/dist/task-status.js +13 -13
- package/dist/telegram-status.js +3 -3
- package/dist/terminal-safety.js +114 -0
- package/dist/toolroll-update.js +2 -1
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/tui-launch.js +20 -1
- package/dist/tui.js +1 -1
- package/dist/work-index.js +23 -10
- package/dist/workspace-ui.js +5 -5
- package/dist/youiyoux-intake.js +1 -1
- package/package.json +2 -2
|
@@ -49,6 +49,12 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
49
49
|
"decision.answer": "answer-question",
|
|
50
50
|
"agents.live.thread.answer": "answer-question",
|
|
51
51
|
"agents.live.thread.start": "start-thread",
|
|
52
|
+
"agents.live.thread.turn": "reply-thread",
|
|
53
|
+
"agents.live.thread.stop": "stop-thread",
|
|
54
|
+
"agents.live.thread.end": "end-thread",
|
|
55
|
+
"agents.live.thread.ship": "ship-thread",
|
|
56
|
+
"agents.live.thread.ship-cancel": "cancel-ship",
|
|
57
|
+
"agents.live.thread.ship-send-back": "reply-thread",
|
|
52
58
|
"task.act.reply": "answer-question",
|
|
53
59
|
"task.act.stop": "stop-run",
|
|
54
60
|
"task.act.cancel": "stop-run",
|
|
@@ -89,6 +95,10 @@ const LOCAL_POSTS = Object.freeze({
|
|
|
89
95
|
"settings.advanced": "view-preference",
|
|
90
96
|
"settings.task-sizing": "task-sizing-switch",
|
|
91
97
|
"settings.flexible": "flexible-switch",
|
|
98
|
+
"settings.flexible-sign-in": "flexible-sign-in-save",
|
|
99
|
+
"settings.flexible-sign-in-check": "flexible-sign-in-check",
|
|
100
|
+
"settings.flexible-sign-in-clear": "flexible-sign-in-clear",
|
|
101
|
+
"settings.project-flexible": "project-flexible",
|
|
92
102
|
"agents.seen": "mark-seen",
|
|
93
103
|
"agents.watch": "watch-agent",
|
|
94
104
|
});
|
|
@@ -259,6 +269,12 @@ get("pages", "agents.live.thread", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}$",
|
|
|
259
269
|
get("pages", "agents.live.threads", "/agents/live/threads", { limited: "unscoped", callers: ["cookie"], ...free });
|
|
260
270
|
post("pages", "agents.live.thread.answer", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/answer$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/answer` });
|
|
261
271
|
post("pages", "agents.live.thread.start", "/agents/live/thread", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver starts threads.") });
|
|
272
|
+
post("pages", "agents.live.thread.turn", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/turn$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver replies to their own threads."), sample: `/agents/live/thread/${"a".repeat(32)}/turn` });
|
|
273
|
+
post("pages", "agents.live.thread.stop", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/stop$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/stop` });
|
|
274
|
+
post("pages", "agents.live.thread.end", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/end$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/end` });
|
|
275
|
+
post("pages", "agents.live.thread.ship", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver ships their own thread's work."), sample: `/agents/live/thread/${"a".repeat(32)}/ship` });
|
|
276
|
+
post("pages", "agents.live.thread.ship-cancel", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship\\/cancel$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/ship/cancel` });
|
|
277
|
+
post("pages", "agents.live.thread.ship-send-back", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship\\/send-back$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver sends back their own thread's Ship."), sample: `/agents/live/thread/${"a".repeat(32)}/ship/send-back` });
|
|
262
278
|
get("pages", "agents.terminals", "/agents/terminals", TERM);
|
|
263
279
|
get("pages", "fleet", "/fleet", free);
|
|
264
280
|
get("tasks", "tasks.new", "/tasks/new", { limited: "collection", ...free });
|
|
@@ -164,8 +164,12 @@ function yourPasswordSection(deps) {
|
|
|
164
164
|
render: ({ summary, attrs }) => settingsSection({
|
|
165
165
|
id: "your-password", title: "Your password", attrs,
|
|
166
166
|
body: joinHtml([
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
...(() => {
|
|
168
|
+
const saved = deps.savedLogin?.() ?? null;
|
|
169
|
+
return saved === null
|
|
170
|
+
? [formRow("Forgot it?", "On the computer running Toolroll, run this to choose a new one:", html ``, "wide"), codeLine("toolroll password reset")]
|
|
171
|
+
: [formRow("Where it is", "Your first password is saved on the computer running Toolroll. Toolroll never shows it in a browser. To read it, run this there:", html ``, "wide"), codeLine(`cat ${saved}`)];
|
|
172
|
+
})(),
|
|
169
173
|
summary.passwordless === null ? "" : formRow("Passwordless", "Sign in once; most approvals then need no password.", btn(`${summary.passwordless ? "On" : "Off"} · Change`, { sm: true, href: "/settings/passwordless" }), "inline"),
|
|
170
174
|
]),
|
|
171
175
|
}),
|
package/dist/server/settings.js
CHANGED
|
@@ -169,6 +169,7 @@ import { effectivePrimary, isMessagingChannel, savePrimary } from "../webhooks.j
|
|
|
169
169
|
import { personChip, ROLE_TITLES } from "./chrome.js";
|
|
170
170
|
import { chatReturnWithSaid, goOutside } from "./http.js";
|
|
171
171
|
import { leadSettingsHtml, notificationProjects, SETTINGS_AUTOSAVE_SCRIPT, settingsWorkers, telegramDeliveryWords, telegramTrouble } from "./render-settings.js";
|
|
172
|
+
import { loginHelpOf } from "./login-help.js";
|
|
172
173
|
export function createSettingsHandlers(runtime) {
|
|
173
174
|
const { identities, store, providerHome, managedRepos, consoleProjects, sendScreen, chromeFor, connectionCheck, connectionKnown, lastChecks, checkRelease, clock, modelCatalog, modelSeams, toolsViewOf, codexServers, projectViewOf, sessions, restricted, options, integrations, consoleOrigin, evidenceRoot, storagePool, visible, ssoSettings, checkLocalAgents, chatKeyFor, chatCatalog, chatCatalogKnown, leadWords, agentSignInCommand, settingsUpdates, phoneSetup, authenticateApprover, authenticateCredential, deletedRepos, projectOf, providerFor, admissionList, toolHome, connectVisits, mintApprovalNonce, consumeApprovalNonce, googleVisits } = runtime;
|
|
174
175
|
async function spendPage(ctx) {
|
|
@@ -3046,9 +3047,11 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3046
3047
|
return false;
|
|
3047
3048
|
}
|
|
3048
3049
|
else {
|
|
3049
|
-
if (who.authority
|
|
3050
|
-
|
|
3051
|
-
|
|
3050
|
+
if (who.authority === "local-owner") {
|
|
3051
|
+
if (localActNow(store, "flexible-switch") === null)
|
|
3052
|
+
return false;
|
|
3053
|
+
}
|
|
3054
|
+
else if (who.authority !== "full" || !authenticateApprover(who, body.get("password") ?? "").ok)
|
|
3052
3055
|
return false;
|
|
3053
3056
|
}
|
|
3054
3057
|
setFlexibleSetting(store, wanted === "on", who.name, now);
|
|
@@ -3237,6 +3240,7 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3237
3240
|
firstResult: now => { const at = store.firstSuccessAt(now), since = store.installationStartedAt(); return at === null || since === null ? null : firstResultWords(since, at); },
|
|
3238
3241
|
passwordless: () => sessionStandsIn(store),
|
|
3239
3242
|
localModeOn: () => localModeOf(store)?.enabled === true,
|
|
3243
|
+
savedLogin: savedLoginOf.bind(null, store),
|
|
3240
3244
|
installMode: () => installModeNow(store),
|
|
3241
3245
|
taskSizing: () => taskSizingSetting(store),
|
|
3242
3246
|
flexible: () => flexibleSetting(store),
|
|
@@ -3352,8 +3356,12 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3352
3356
|
return back("problem", "That form was sent twice over. Nothing was saved.");
|
|
3353
3357
|
if (body.sent.has("person"))
|
|
3354
3358
|
return back("problem", "Your Claude sign-in is always your own. Nothing was saved.");
|
|
3355
|
-
if (who.authority !== "full")
|
|
3356
|
-
|
|
3359
|
+
if (who.authority !== "full") {
|
|
3360
|
+
if (who.authority !== "local-owner" || localActNow(store, "flexible-sign-in-save") === null)
|
|
3361
|
+
return back("problem", "Saving your Claude sign-in needs your Toolroll password, typed now. Nothing was saved.");
|
|
3362
|
+
if (store.accountOf(who.name)?.passwordSet !== true)
|
|
3363
|
+
return back("problem", "Set a password first: run `toolroll password set`, then save your sign-in here with it. Nothing was saved.");
|
|
3364
|
+
}
|
|
3357
3365
|
const paste = setupTokenFromPaste(body.get("token") ?? "");
|
|
3358
3366
|
if (!paste.ok)
|
|
3359
3367
|
return back("problem", paste.message);
|
|
@@ -3404,9 +3412,15 @@ ${postForm("/settings/chat-approval/save", html `\
|
|
|
3404
3412
|
const state = signInState();
|
|
3405
3413
|
if (state !== null)
|
|
3406
3414
|
void tidyFlexibleSignIns(store, state, { now, person }).catch(() => { });
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3415
|
+
const stopping = removed.ended.threads.length;
|
|
3416
|
+
const stopWords = stopping === 0 ? "" : ` Toolroll is stopping ${stopping === 1 ? "1 running thread" : `${stopping} running threads`}.`;
|
|
3417
|
+
return done("said", !removed.removed ? (self ? `You had no Claude sign-in for threads saved.${stopWords}` : `${person} had no Claude sign-in for threads saved.${stopWords}`)
|
|
3418
|
+
: self ? `Removed.${stopWords} Your threads can't reach Claude until you add one again. The token still works at Claude until you revoke it in your Claude account.`
|
|
3419
|
+
: `Removed ${person}'s Claude sign-in for threads.${stopWords} Their threads can't reach Claude until they add one again.`);
|
|
3410
3420
|
}
|
|
3411
3421
|
return { registrations, modelsView };
|
|
3412
3422
|
}
|
|
3423
|
+
function savedLoginOf(store) {
|
|
3424
|
+
const help = loginHelpOf(store, { here: true });
|
|
3425
|
+
return help.kind === "password" ? help.savedAt : null;
|
|
3426
|
+
}
|
|
@@ -26,6 +26,7 @@ import { knowledgeContextHtml } from "../knowledge-ui.js";
|
|
|
26
26
|
import { failedAttemptSentence, failingCheckSuggestion, GENERAL_SUGGESTION, isInternalErrorReason, latestFinishedAttempt, missedRequirementLine, missedRequirementSuggestion, NO_REASON_RECORDED, stopSuggestionOf } from '../needs-you.js';
|
|
27
27
|
import { planAutoPending } from "../plan-auto.js";
|
|
28
28
|
import { planSourceOf, retryPinsOf } from "../local-owner-acts.js";
|
|
29
|
+
import { planBackoffFor, planStoppedFor } from "../engine-reads.js";
|
|
29
30
|
import { readKnowledgeSnapshot } from "../project-knowledge.js";
|
|
30
31
|
import { learningView } from "../project-learning.js";
|
|
31
32
|
import { readSkillsSnapshot, skillTestResult } from "../project-skills.js";
|
|
@@ -326,6 +327,8 @@ export function createTaskViews(runtime) {
|
|
|
326
327
|
planAuto: planAutoPending(runtime.store, taskId, now),
|
|
327
328
|
planSource: planSourceOf(runtime.store, taskId),
|
|
328
329
|
retryPins: retryPinsOf(runtime.store, taskId),
|
|
330
|
+
planStopped: planStoppedFor(runtime.store, taskId),
|
|
331
|
+
planBackoff: planBackoffFor(runtime.store, taskId, now),
|
|
329
332
|
planDocument: planView?.document ?? null,
|
|
330
333
|
planSha: planView?.sha256 ?? null,
|
|
331
334
|
planContract: ref === null || planView === null ? null : planContractViewOf(ref.id, scope),
|
|
@@ -1113,12 +1116,15 @@ export function releaseStepsViewOf(progress, now) {
|
|
|
1113
1116
|
return all.indexOf(step) < lastAt ? { name: RELEASE_STEP_WORDS[step] ?? step, sub: "not recorded", st: "q", start: 0, dur: 0 }
|
|
1114
1117
|
: { name: RELEASE_STEP_WORDS[step] ?? step, st: "q", start: 0, dur: 0 };
|
|
1115
1118
|
const start = Date.parse(one.startedAt), end = one.endedAt === null ? now.getTime() : Date.parse(one.endedAt);
|
|
1116
|
-
const passed = one.state === "failed" && progress.stopped
|
|
1117
|
-
const st = one.state === "done"
|
|
1118
|
-
|
|
1119
|
+
const passed = one.state === "failed" && progress.stopped?.step !== step;
|
|
1120
|
+
const st = passed ? "history" : one.state === "done" ? "ok" : one.state === "failed" ? "bad" : one.state === "waiting" ? step === "approval" ? "wait" : "waiting" : "run";
|
|
1121
|
+
const waitingReason = st !== "waiting" ? null : step === "ci" ? "Waiting for PR checks"
|
|
1122
|
+
: step === "quiet" ? "Waiting for active work to finish" : `Waiting for ${(RELEASE_STEP_WORDS[step] ?? step).toLowerCase()}`;
|
|
1123
|
+
const detail = one.state === "done" ? null : one.detail ?? waitingReason;
|
|
1124
|
+
return { name: RELEASE_STEP_WORDS[step] ?? step, ...(detail === null ? {} : { sub: detail.slice(0, 160) }), st,
|
|
1119
1125
|
start: Number.isFinite(start) && Number.isFinite(origin) ? Math.max(0, (start - origin) / 1000) : 0, dur: Number.isFinite(start) && Number.isFinite(end) ? Math.max(0, (end - start) / 1000) : 0 };
|
|
1120
1126
|
});
|
|
1121
|
-
const current = rows.findIndex(row => row.st === "run" || row.st === "wait" || row.st === "bad");
|
|
1127
|
+
const current = rows.findIndex(row => row.st === "run" || row.st === "wait" || row.st === "waiting" || row.st === "bad");
|
|
1122
1128
|
const done = progress.stopped === null && recorded.get("homebrew")?.state === "done";
|
|
1123
1129
|
const at = current === -1 ? null : rows[current];
|
|
1124
1130
|
const last = lastAt === -1 ? null : RELEASE_STEP_WORDS[all[lastAt]] ?? all[lastAt];
|
package/dist/server/tasks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { advancedShownNow } from "../advanced-view.js";
|
|
2
2
|
import { titleWithin } from "../task-text.js";
|
|
3
3
|
import { parseFeedbackImage, sameFeedbackImage } from "../result-review.js";
|
|
4
|
-
import { archiveTaskFamily, dropFeedbackImage, markTypedByPerson, typedNotesFor, releaseAuthorityOfTask, restoreTaskFamily, revokeRelease, runCheckStamp, runLiveCommands } from "../store.js";
|
|
4
|
+
import { archiveTaskFamily, dropFeedbackImage, markTypedByPerson, PLAN_AGAIN_ACTIONS, planAgain, PLANNER_INCIDENT_KINDS, typedNotesFor, releaseAuthorityOfTask, restoreTaskFamily, revokeRelease, runCheckStamp, runLiveCommands } from "../store.js";
|
|
5
5
|
import { ranWords } from "../check-stamp.js";
|
|
6
6
|
import { applyTidy, approverStandsNow, familyRepoOf, releaseFactsOf, tidyDays, tidyDigest, tidyPreview, TIDY_DEFAULT_DAYS } from "../tidy.js";
|
|
7
7
|
import { steerCapabilityOf } from "../steer-capabilities.js";
|
|
@@ -29,7 +29,7 @@ import { codingShippingHtml } from '../coding-shipping-ui.js';
|
|
|
29
29
|
import { codingWorkspaceHtml, codingWorkspaceScript } from '../coding-ui.js';
|
|
30
30
|
import { CodingActionError } from '../coding-workspace.js';
|
|
31
31
|
import { checkResponse, CONSOLE_FORMS, readForm } from "../contracts/console-api.js";
|
|
32
|
-
import { LOCAL_TASK_CHANGED, requestPlanAsLocalOwner, retryAsLocalOwner, retryPinsOf } from "../local-owner-acts.js";
|
|
32
|
+
import { LOCAL_TASK_CHANGED, PLAN_AGAIN_FIRST, planAgainAsLocalOwner, planSourceOf, RESOLVE_INCIDENT_FIRST, requestPlanAsLocalOwner, retryAsLocalOwner, retryPinsOf } from "../local-owner-acts.js";
|
|
33
33
|
import { hasForbiddenControls, validateNote } from "../decision.js";
|
|
34
34
|
import { builderReadyFor, diagnoseTaskDispatch, firstRunBuilderRepo } from "../dispatch.js";
|
|
35
35
|
import { firstTaskSuggestions, withBuilderStep } from "../first-run.js";
|
|
@@ -95,6 +95,7 @@ import { releaseSheetPage } from "./render-release.js";
|
|
|
95
95
|
import { approvalFactsNow } from "./kit.js";
|
|
96
96
|
import { localOwnerRefusal } from "../local-owner.js";
|
|
97
97
|
import { firstTaskRouted } from "../welcome-facts.js";
|
|
98
|
+
import { plural } from "../design/kit.js";
|
|
98
99
|
export const FIRST_TASK_DETECT_WAIT_MS = 8_000;
|
|
99
100
|
export function createTasksHandlers(runtime) {
|
|
100
101
|
const { identities, store, peekSay, peekCache, PEEK_CACHE_TTL_MS, peekInFlight, PEEK_GLOBAL_INFLIGHT, peekBySession, PEEK_SESSION_INFLIGHT, clock, peekName, PEEK_FRAGMENT_BYTES, peekEvict, evidenceRoot, sendScreen, chromeFor, visible, consumeApprovalNonce, authenticateApprover, authenticateCredential, options, mintApprovalNonce, taskScreen, unscopedMode, admissionList, planViewOf, revisionViewOf, runIsTaskResult, leadPrincipal, familyOf, armTaskResume, runIsLive, revisionLedgerOf, resultDetailOf, reviewFactsFor, taskRepoOf, runVisible, restricted, codingActorAllowed, codingProjectAllowed, managedRepos, routeViewOf, workAccess, firstRunStepsNow, revisionDocOf, failureOf, dockedConversation, planContractViewOf, familiesInView, explainAttempt, taskChatFocus, familyTasksInView, liveCeiling, projectOf, ceiling, bustBadge, revisionDestination } = runtime;
|
|
@@ -1356,7 +1357,7 @@ export function createTasksHandlers(runtime) {
|
|
|
1356
1357
|
parts.push(html `<p class="meta">New files · ${fresh.total}</p>`);
|
|
1357
1358
|
for (const row of fresh.rows) {
|
|
1358
1359
|
parts.push(row.collapsed
|
|
1359
|
-
? html `<p class="row mono">+ ${shownName(row.label)} <span class="meta">collapsed names — ${row.count
|
|
1360
|
+
? html `<p class="row mono">+ ${shownName(row.label)} <span class="meta">collapsed names — ${plural(row.count, "file", "files")}</span></p>`
|
|
1360
1361
|
: html `<p class="row mono">+ ${shownName(row.label)}</p>`);
|
|
1361
1362
|
}
|
|
1362
1363
|
if (fresh.renderedFiles < fresh.total) {
|
|
@@ -1634,6 +1635,9 @@ export function createTasksHandlers(runtime) {
|
|
|
1634
1635
|
if (note !== "" && !validateNote(note).ok)
|
|
1635
1636
|
return taskScreen(response, who, taskId, "that note will not store, so nothing was retried", 400);
|
|
1636
1637
|
let replayed = false;
|
|
1638
|
+
const blocked = requeueBlockedWords(store, taskId, body.get("run"), body.get("digest"), who.via === "cookie" && who.authority === "local-owner");
|
|
1639
|
+
if (blocked !== null)
|
|
1640
|
+
return taskScreen(response, who, taskId, blocked, 409);
|
|
1637
1641
|
if (who.via === "cookie" && who.authority === "local-owner") {
|
|
1638
1642
|
const retried = localOwnerRetry(store, taskId, body.get("run"), body.get("digest"), now);
|
|
1639
1643
|
if (!retried.ok)
|
|
@@ -1696,8 +1700,15 @@ export function createTasksHandlers(runtime) {
|
|
|
1696
1700
|
return redirect(response, taskHref(filed.id));
|
|
1697
1701
|
}
|
|
1698
1702
|
case "plan": {
|
|
1703
|
+
const planForm = readForm(posted, CONSOLE_FORMS.taskPlan);
|
|
1704
|
+
if (planForm.get("incident") !== null) {
|
|
1705
|
+
const again = who.via === "cookie" && who.authority === "local-owner"
|
|
1706
|
+
? localOwnerPlanAgain(store, taskId, planForm.get("incident"), planForm.get("source"), now)
|
|
1707
|
+
: personPlanAgain(store, taskId, who.name, planForm.get("incident"), planForm.get("source"), now);
|
|
1708
|
+
return again.ok ? redirect(response, taskHref(taskId)) : taskScreen(response, who, taskId, again.message, again.status);
|
|
1709
|
+
}
|
|
1699
1710
|
if (who.via === "cookie" && who.authority === "local-owner") {
|
|
1700
|
-
const asked = localOwnerPlan(store, taskId,
|
|
1711
|
+
const asked = localOwnerPlan(store, taskId, planForm.get("source"), now);
|
|
1701
1712
|
return asked.ok ? redirect(response, taskHref(taskId)) : taskScreen(response, who, taskId, asked.message, asked.status);
|
|
1702
1713
|
}
|
|
1703
1714
|
const asked = store.requestPlan(ref.id, now);
|
|
@@ -2942,3 +2953,39 @@ export function answerTermsInPlace(response, offer) {
|
|
|
2942
2953
|
respond(response, 200, "application/json; charset=utf-8", JSON.stringify({ outcome: "terms", preview: offer.preview, digest: offer.digest, terms: offer.terms.map(([label, words]) => ({ label, words })) }));
|
|
2943
2954
|
}
|
|
2944
2955
|
export const TASK_CHANGED_SINCE = "This task changed since you looked. Review it again.";
|
|
2956
|
+
function planAgainPins(incident, source) {
|
|
2957
|
+
if (typeof incident !== "string" || !/^[1-9][0-9]{0,14}$/.test(incident) || typeof source !== "string" || !/^[a-f0-9]{64}$/.test(source))
|
|
2958
|
+
return null;
|
|
2959
|
+
return { incident: Number(incident), source };
|
|
2960
|
+
}
|
|
2961
|
+
export function localOwnerPlanAgain(store, taskId, incident, source, now) {
|
|
2962
|
+
const pins = planAgainPins(incident, source);
|
|
2963
|
+
if (pins === null)
|
|
2964
|
+
return { ok: false, status: 409, message: LOCAL_TASK_CHANGED };
|
|
2965
|
+
const done = planAgainAsLocalOwner(store, taskId, pins, now);
|
|
2966
|
+
return done.ok ? { ok: true } : { ok: false, status: done.reason === "local-owner" || done.reason === "refused" ? 403 : 409, message: done.message };
|
|
2967
|
+
}
|
|
2968
|
+
export function personPlanAgain(store, taskId, by, incident, source, now) {
|
|
2969
|
+
const pins = planAgainPins(incident, source);
|
|
2970
|
+
if (pins === null)
|
|
2971
|
+
return { ok: false, status: 409, message: LOCAL_TASK_CHANGED };
|
|
2972
|
+
const done = store.transact(() => {
|
|
2973
|
+
if (planSourceOf(store, taskId) !== pins.source)
|
|
2974
|
+
return { ok: false, reason: "stale", message: LOCAL_TASK_CHANGED };
|
|
2975
|
+
return planAgain(store, { taskId, incident: pins.incident, by, actor: `operator:${by}`, action: PLAN_AGAIN_ACTIONS.person, detail: { source: pins.source, via: "browser" }, now });
|
|
2976
|
+
});
|
|
2977
|
+
return done.ok ? { ok: true } : { ok: false, status: done.reason === "refused" ? 403 : 409, message: done.message };
|
|
2978
|
+
}
|
|
2979
|
+
export function requeueBlockedWords(store, taskId, run, digest, local) {
|
|
2980
|
+
if ((run ?? "") !== "" || (digest ?? "") !== "")
|
|
2981
|
+
return null;
|
|
2982
|
+
const ref = store.lookupRef(taskId);
|
|
2983
|
+
if (ref === null)
|
|
2984
|
+
return null;
|
|
2985
|
+
const open = store.handle.prepare("SELECT incident.kind, run.role FROM incident JOIN run ON run.id = incident.run WHERE run.task_ref = ? AND incident.resolved_at IS NULL ORDER BY incident.id DESC LIMIT 1").get(ref.id);
|
|
2986
|
+
if (open === undefined)
|
|
2987
|
+
return null;
|
|
2988
|
+
if (open["role"] === "planner" && PLANNER_INCIDENT_KINDS.has(String(open["kind"])))
|
|
2989
|
+
return PLAN_AGAIN_FIRST;
|
|
2990
|
+
return local ? RESOLVE_INCIDENT_FIRST : null;
|
|
2991
|
+
}
|
package/dist/settings-kit.js
CHANGED
|
@@ -51,10 +51,10 @@ ${field.error ? fieldError(field.id, field.error) : ""}</div>`;
|
|
|
51
51
|
}
|
|
52
52
|
export function secretInput(field) {
|
|
53
53
|
const described = [field.hint === undefined ? null : `${field.id}-hint`, field.error ? errorId(field.id) : null].filter(Boolean).join(" ");
|
|
54
|
-
return html `<div class="
|
|
55
|
-
${field.
|
|
56
|
-
<input${attributes({ id: field.id, name: field.name, type: "password", autocomplete: "off", spellcheck: "false", autocapitalize: "none", "data-so-secret": true, ...SECRET_OPT_OUTS,
|
|
54
|
+
return html `<div class="k-field"><label class="k-label" for="${field.id}">${field.label}</label>\
|
|
55
|
+
<input${attributes({ class: "k-input", id: field.id, name: field.name, type: "password", autocomplete: "off", spellcheck: "false", autocapitalize: "none", "data-so-secret": true, ...SECRET_OPT_OUTS,
|
|
57
56
|
required: field.required === true, "aria-invalid": field.error ? "true" : null, "aria-describedby": described === "" ? null : described, autofocus: field.error ? true : null })}>\
|
|
57
|
+
${field.hint === undefined ? "" : html `<p class="k-hint" id="${field.id}-hint">${field.hint}</p>`}\
|
|
58
58
|
${field.error ? fieldError(field.id, field.error) : ""}</div>`;
|
|
59
59
|
}
|
|
60
60
|
export function choiceGroup(group) {
|
package/dist/skills-ui.js
CHANGED
|
@@ -2,15 +2,16 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { whenUtc } from "./when-html.js";
|
|
3
3
|
import { html, joinHtml, postForm } from "./html.js";
|
|
4
4
|
import { acts, btn, chip, disclose, facts, formRow, input, note, notice, select, settingsRecord, settingsSection, textarea } from "./server/kit.js";
|
|
5
|
+
import { plural } from "./design/kit.js";
|
|
5
6
|
const fields = (data) => Object.fromEntries(Object.entries(data).map(([k, v]) => [k, String(v ?? "")]));
|
|
6
7
|
export const SKILLS_CSS = `.skills{max-width:780px;min-width:0;overflow-wrap:anywhere}.skills h2{font-size:1.1rem}.skills .card{padding:18px;margin:14px 0;min-width:0}.skills form,.skills label{display:grid;gap:10px}.skills input,.skills textarea,.skills select{box-sizing:border-box;width:100%;max-width:100%;min-width:0}.skills textarea{resize:vertical;min-height:130px}.skills button{justify-self:start;white-space:nowrap;min-height:44px}.skills summary{cursor:pointer;min-height:44px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}.skills pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:360px;overflow:auto;font-size:.9rem}.skills .skill-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.skills .skill-heading h2{margin:0}.skills .skill-state{font-size:.85rem;flex-shrink:0}.skills .skill-source{font-size:.85rem}.skills .skill-controls{display:flex;gap:12px;flex-wrap:wrap}.skills .skill-controls form{margin:0}.skills details details{margin-top:10px}.skills [hidden]{display:none!important}.skills .skill-files{max-height:200px;overflow:auto}.skills .problem{padding:12px}@media(max-width:600px){.skills input,.skills textarea,.skills select{font-size:16px}.skills .card{padding:14px}.skills .skill-heading{align-items:flex-start}}`;
|
|
7
8
|
function source(skill) {
|
|
8
|
-
return html `<p class="skill-source">${skill.source} · ${skill.sha.slice(0, 10)}</p><p>${skill.files.length
|
|
9
|
+
return html `<p class="skill-source">${skill.source} · ${skill.sha.slice(0, 10)}</p><p>${plural(skill.files.length, "file", "files")} · ${Math.ceil(skill.files.reduce((n, f) => n + Buffer.from(f.base64, "base64").length, 0) / 1024)} KB</p><pre>${Buffer.from(skill.files.find((f) => f.path === "SKILL.md").base64, "base64").toString("utf8")}</pre><details><summary>Package files</summary><ul class="skill-files">${skill.files.map((f) => html `<li>${f.path}</li>`)}</ul></details>`;
|
|
9
10
|
}
|
|
10
11
|
function sourceKit(skill) {
|
|
11
12
|
const kb = Math.ceil(skill.files.reduce((n, f) => n + Buffer.from(f.base64, "base64").length, 0) / 1024);
|
|
12
13
|
return joinHtml([
|
|
13
|
-
facts([["Source", html `${skill.source} · <span class="k-mono">${skill.sha.slice(0, 10)}</span>`], ["Size", `${skill.files.length
|
|
14
|
+
facts([["Source", html `${skill.source} · <span class="k-mono">${skill.sha.slice(0, 10)}</span>`], ["Size", `${plural(skill.files.length, "file", "files")} · ${kb} KB`]]),
|
|
14
15
|
html `<pre class="k-scode">${Buffer.from(skill.files.find((f) => f.path === "SKILL.md").base64, "base64").toString("utf8")}</pre>`,
|
|
15
16
|
disclose("Package files", html `<ul class="k-note">${skill.files.map((f) => html `<li class="k-mono">${f.path}</li>`)}</ul>`),
|
|
16
17
|
]);
|
package/dist/spend-report.js
CHANGED
|
@@ -109,11 +109,11 @@ export function spendRows(db, from, to) {
|
|
|
109
109
|
rows.push({ ref: `mate_turn:${id}`, at: turn.at, source: "lead", role: "lead", project: turn.project, person: turn.person, subagent: null, taskId: null, runId: null,
|
|
110
110
|
provider: turn.provider ?? "lead", modelChosen: turn.model, modelReported: null, billing: "api-key", amount, charge: { microusd: held, basis: "estimated" } });
|
|
111
111
|
}
|
|
112
|
-
for (const row of db.prepare(`SELECT t.id, t.at, t.subagent, t.model, t.cost_usd, m.repo FROM subagent_turn t JOIN subagent m ON m.id = t.subagent
|
|
112
|
+
for (const row of db.prepare(`SELECT t.id, t.at, t.subagent, t.model, t.provider, t.model_reported, t.cost_usd, m.repo FROM subagent_turn t JOIN subagent m ON m.id = t.subagent
|
|
113
113
|
WHERE t.at >= ? AND t.at < ? ORDER BY t.id`).all(from, to)) {
|
|
114
114
|
const amount = { kind: "unknown" };
|
|
115
115
|
rows.push({ ref: `subagent_turn:${Number(row["id"])}`, at: String(row["at"]), source: "subagent", role: "subagent", project: text(row["repo"]), person: null,
|
|
116
|
-
subagent: Number(row["subagent"]), taskId: null, runId: null, provider: "
|
|
116
|
+
subagent: Number(row["subagent"]), taskId: null, runId: null, provider: String(row["provider"]), modelChosen: text(row["model"]), modelReported: text(row["model_reported"]), billing: "unproved",
|
|
117
117
|
amount, charge: chargeOf(amount, usdMicro(row["cost_usd"]), "estimated") });
|
|
118
118
|
}
|
|
119
119
|
for (const row of db.prepare("SELECT id, at, repo, provider, model, cost_usd FROM side_spend WHERE at >= ? AND at < ? ORDER BY id").all(from, to)) {
|
package/dist/spend.js
CHANGED
|
@@ -221,12 +221,12 @@ export function spendItems(db, from, to, readMode = provider => billingOf(provid
|
|
|
221
221
|
taskId: String(row["task"]), runId: Number(row["id"]), authMode: billing,
|
|
222
222
|
};
|
|
223
223
|
});
|
|
224
|
-
for (const row of !any("subagent") ? [] : db.prepare(`SELECT t.at, t.subagent, t.model, t.cost_usd, t.tokens_in, t.tokens_out, t.billing, m.repo FROM subagent_turn t JOIN subagent m ON m.id = t.subagent
|
|
224
|
+
for (const row of !any("subagent") ? [] : db.prepare(`SELECT t.at, t.subagent, t.model, t.provider, t.cost_usd, t.tokens_in, t.tokens_out, t.billing, m.repo FROM subagent_turn t JOIN subagent m ON m.id = t.subagent
|
|
225
225
|
WHERE t.at >= ? AND t.at < ? ORDER BY t.id`).all(from, to)) {
|
|
226
226
|
const billing = row["billing"] === "api-key" ? "api-key" : "subscription";
|
|
227
|
-
const priced = priceWork(db, { provider: "
|
|
227
|
+
const priced = priceWork(db, { provider: String(row["provider"]), model: text(row["model"]), costUsd: count(row["cost_usd"]), tokensIn: count(row["tokens_in"]), tokensOut: count(row["tokens_out"]), billing }, lookup);
|
|
228
228
|
items.push({ at: String(row["at"]), kind: "subagent", microusd: priced.microusd, source: priced.source, project: String(row["repo"]), person: null,
|
|
229
|
-
subagent: Number(row["subagent"]), provider: "
|
|
229
|
+
subagent: Number(row["subagent"]), provider: String(row["provider"]), model: text(row["model"]),
|
|
230
230
|
tokensIn: count(row["tokens_in"]), tokensOut: count(row["tokens_out"]), taskId: null, runId: null, authMode: billing });
|
|
231
231
|
}
|
|
232
232
|
for (const row of !any("chat") ? [] : db.prepare(`SELECT created_at AS at, approver, provider, model, settled_microusd, tokens_in, tokens_out, NULL AS project
|