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
package/dist/operate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FLEXIBLE_CANDIDATE_FIXED, FLEXIBLE_FILED_PREFIX, flexibleMergeRefusal } from "./flexible-merge-guard.js";
|
|
2
2
|
import { flexibleArmedPass } from "./flexible-ship.js";
|
|
3
|
-
import { stopFlexibleThreadsEverywhere } from "./flexible-session.js";
|
|
3
|
+
import { closeFlexibleThread, flexibleThreadRecords, flexibleThreadShipTerms, flexibleThreadTitleOf, latestFlexibleShip, removeFlexibleThreadCopy, shipFlexibleThread, stopFlexibleThreadsEverywhere } from "./flexible-session.js";
|
|
4
4
|
import { runCardCommand } from "./card-cli.js";
|
|
5
5
|
import { mintSecret } from "./secret-mint.js";
|
|
6
6
|
import { ACP_AGENTS, ACP_PROVIDER_IDS, isAcpProvider, isKeyedProvider } from "./acp-agents.js";
|
|
@@ -90,11 +90,11 @@ import { scheduledTidy } from "./memory-tidy.js";
|
|
|
90
90
|
import { CI_READ_EVERY_MS, ciCursorKey, ciRepositoriesOf, observeCiAttempts } from "./flaky-ci.js";
|
|
91
91
|
import { runKnowledgeApply, runKnowledgeCommand } from "./knowledge-cli.js";
|
|
92
92
|
import { FLOWS_VALUE_FLAGS, runFlowsCommand } from "./flows-cli.js";
|
|
93
|
-
import { approvalSummaryFor, approvalSummaryOf, describeScope, summaryContextOf } from "./approval-summary.js";
|
|
93
|
+
import { approvalSummaryFor, approvalSummaryOf, describeScope, summaryContextOf, summaryLines } from "./approval-summary.js";
|
|
94
94
|
import { runAssignmentCommand } from "./assignment-adapters.js";
|
|
95
95
|
import { applyProjectProfile, runProjectCommand } from "./project-cli.js";
|
|
96
96
|
import { passwordFreeOwner, passwordFreeShell, passwordFreeShellWords, proveTaskBuildsStopped, pullRequestLines, runLocalCompletion, runLocalRevision, runTaskMergeCommand, runTaskOutcomeCommand } from "./task-outcome-cli.js";
|
|
97
|
-
import { requestPlanAsLocalOwner, retryAsLocalOwner } from "./local-owner-acts.js";
|
|
97
|
+
import { planAgainAsLocalOwner, requestPlanAsLocalOwner, retryAsLocalOwner } from "./local-owner-acts.js";
|
|
98
98
|
import { withTaskAlias } from "./task-aliases.js";
|
|
99
99
|
import { checklistLines, mergeChecklistOf } from "./merge-checklist.js";
|
|
100
100
|
import { taskReviewBrief, renderReviewBrief } from "./task-review-brief.js";
|
|
@@ -168,7 +168,7 @@ function planContractLines(store, evidenceRoot, taskId) {
|
|
|
168
168
|
...describeContractChanges(record.changes).map(line => ` ${line}`),
|
|
169
169
|
];
|
|
170
170
|
}
|
|
171
|
-
import { verdictWords as proofVerdictWords, matrixWords, plainReasonWords, semanticCoverage, coverageWords } from "./proof.js";
|
|
171
|
+
import { verdictWords as proofVerdictWords, manualReviewCriterionOf, matrixWords, plainReasonWords, semanticCoverage, coverageWords } from "./proof.js";
|
|
172
172
|
import { probeRepo } from "./probe.js";
|
|
173
173
|
import { agentlessFirstRun, buildersFor, diagnoseTaskDispatch, diagnosisIsDispatchable, NO_AGENT_TITLE, scopeApprovedForDispatch, } from "./dispatch.js";
|
|
174
174
|
import { createDecisionServer, SIGN_IN_LINK_MS } from "./serve.js";
|
|
@@ -236,7 +236,7 @@ import { fileGithubItem, readGithubItem } from "./github-import.js";
|
|
|
236
236
|
import { runRelease } from "./release.js";
|
|
237
237
|
import { releaseAdapters } from "./release-adapters.js";
|
|
238
238
|
import { routeChangeOf, routeLegacyPlans } from "./route-change.js";
|
|
239
|
-
import { sessionStandsIn } from "./install-mode.js";
|
|
239
|
+
import { installModeNow, sessionStandsIn } from "./install-mode.js";
|
|
240
240
|
import { parseDemoUrl, projectDemoUrl, saveProjectDemo } from "./project-demo.js";
|
|
241
241
|
import { effectiveConcurrency, maySlotTake, parseProjectConcurrency, PROJECT_CONCURRENCY_DEFAULT, ProjectPasses, projectConcurrency, saveProjectConcurrency, savedProjectConcurrency } from "./project-concurrency.js";
|
|
242
242
|
import { activeWebhookTargets, webhookPass, LEGACY_WEBHOOK_WARNING, loadWebhookTargets, effectivePrimary, isMessagingChannel, loadConsoleUrl, phoneOrigin, readUpConsoleUrl, saveConsoleUrl, savePrimary, UP_CONSOLE_FILE } from "./webhooks.js";
|
|
@@ -731,6 +731,7 @@ export const OPERATE_VALUE_FLAGS = new Set([
|
|
|
731
731
|
"choose", "choice", "claim", "revision", "note", "max-open-decisions", "name", "days", "publication", "auto-approve", "review-auto", "port", "host", "allow-host",
|
|
732
732
|
"for", "tick-every", "bridge-every", "reconcile-every", "incarnation",
|
|
733
733
|
"say", "ceiling-usd", "cap-usd",
|
|
734
|
+
"incident",
|
|
734
735
|
"case", "k", "world", "deny", "abandon",
|
|
735
736
|
"token-file", "bin", "poll", "github", "remote", "head-prefix", "password",
|
|
736
737
|
"not-requester", "protect", "protect-paths",
|
|
@@ -1274,6 +1275,8 @@ async function dispatch(command, positional, flags, context) {
|
|
|
1274
1275
|
return incidentCommand(positional, flags, context);
|
|
1275
1276
|
case "flows":
|
|
1276
1277
|
return flowsCommand(positional, flags, context);
|
|
1278
|
+
case "thread":
|
|
1279
|
+
return threadCommand(positional, flags, context);
|
|
1277
1280
|
case "config":
|
|
1278
1281
|
if (positional[0] === "unconfined-agents")
|
|
1279
1282
|
return unconfinedAgentsCommand(positional, flags, context);
|
|
@@ -2594,6 +2597,9 @@ async function tickCommand(flags, context) {
|
|
|
2594
2597
|
failure: outcome.kind,
|
|
2595
2598
|
...(outcome.kind === "malformed" ? { malformed: outcome.reason === "malformed-decision" ? "decision" : "plan" } : {}),
|
|
2596
2599
|
message: outcome.message,
|
|
2600
|
+
code: outcome.reason,
|
|
2601
|
+
...(outcome.kind === "malformed" && outcome.problems !== undefined ? { problems: outcome.problems.map(problem => problem.message) } : {}),
|
|
2602
|
+
...(outcome.agentSaid === undefined ? {} : { agentSaid: outcome.agentSaid }),
|
|
2597
2603
|
now: clock(),
|
|
2598
2604
|
});
|
|
2599
2605
|
if (!sealedFailure.ok && sealedFailure.reason === "stopped") {
|
|
@@ -3547,6 +3553,9 @@ async function requeueTask(positional, flags, context) {
|
|
|
3547
3553
|
const [id] = positional;
|
|
3548
3554
|
if (id === undefined)
|
|
3549
3555
|
return fail(write, json, "task requeue", "usage", "`toolroll task requeue <id> --as <you> --token <t>`", EXIT.usage);
|
|
3556
|
+
const passwordFree = passwordFreeRefusal(store, flags, "r", context.principal !== undefined);
|
|
3557
|
+
if (passwordFree !== null)
|
|
3558
|
+
return fail(write, json, "task requeue", "local-owner", passwordFree, EXIT.refused);
|
|
3550
3559
|
const acting = await askCredentials(flags, context);
|
|
3551
3560
|
const verified = acting === null ? null : authenticateApprover(store, acting.name, acting.token);
|
|
3552
3561
|
if (acting === null || !verified?.ok)
|
|
@@ -3688,6 +3697,9 @@ async function incidentCommand(positional, flags, context) {
|
|
|
3688
3697
|
const id = Number(idText);
|
|
3689
3698
|
if (!Number.isInteger(id) || id <= 0)
|
|
3690
3699
|
return fail(write, json, "incident resolve", "usage", "`toolroll incident resolve <id> --as <you> --token <t>`", EXIT.usage);
|
|
3700
|
+
const passwordFree = passwordFreeRefusal(store, flags, "r", context.principal !== undefined);
|
|
3701
|
+
if (passwordFree !== null)
|
|
3702
|
+
return fail(write, json, "incident resolve", "local-owner", passwordFree, EXIT.refused);
|
|
3691
3703
|
const acting = await askCredentials(flags, context);
|
|
3692
3704
|
const verified = acting === null ? null : authenticateApprover(store, acting.name, acting.token);
|
|
3693
3705
|
if (acting === null || !verified?.ok)
|
|
@@ -7739,7 +7751,7 @@ async function addTask(positional, flags, context) {
|
|
|
7739
7751
|
}
|
|
7740
7752
|
}
|
|
7741
7753
|
const next = filedRef !== null && filedRef.repo !== null && filedRef.plan === null && !flags.has("report")
|
|
7742
|
-
? "Next:
|
|
7754
|
+
? "Next: run `toolroll`, select it and press p to ask for a plan." : null;
|
|
7743
7755
|
return succeed(write, json, "task add", {
|
|
7744
7756
|
task: outcome.task,
|
|
7745
7757
|
...(replaces === undefined ? {} : { replaces }),
|
|
@@ -8070,8 +8082,11 @@ function showTask(positional, context) {
|
|
|
8070
8082
|
standing: steerStandingOf(one, steeringLive), words: steerStandingWords(one, steeringLive, utcMinute) })),
|
|
8071
8083
|
approvalTerms: scope === null ? null : approvalSummaryOf(scope, summaryContextOf(store, id, scope, now)).key,
|
|
8072
8084
|
};
|
|
8085
|
+
const checkedByPerson = detail.proofAccepted || shared?.headline === "Complete";
|
|
8086
|
+
const shownReasons = checkedByPerson ? detail.proofReasons.filter(reason => manualReviewCriterionOf(reason) === null) : detail.proofReasons;
|
|
8087
|
+
const shownMatrix = checkedByPerson ? detail.proofMatrix.map(row => ({ ...row, detail: row.detail.filter(line => manualReviewCriterionOf(line) === null) })) : detail.proofMatrix;
|
|
8073
8088
|
return succeed(write, json, "task show", detail, () => [
|
|
8074
|
-
`${task.id} ${task.state}${ref.deliverable === "report" ? " (scout — delivers a report)" : ""}`,
|
|
8089
|
+
`${task.id} ${shared?.headline ?? detail.work?.status.label ?? task.state}${ref.deliverable === "report" ? " (scout — delivers a report)" : ""}`,
|
|
8075
8090
|
` ${task.title}`,
|
|
8076
8091
|
...(detail.work === null ? [] : [
|
|
8077
8092
|
` status: ${shared?.headline ?? detail.work.status.label}${shared === null ? "" : `${shared.headline === "On hold" ? " · " : " — "}${shared.sentence}`}`,
|
|
@@ -8081,8 +8096,8 @@ function showTask(positional, context) {
|
|
|
8081
8096
|
? []
|
|
8082
8097
|
: [
|
|
8083
8098
|
` checked: ${proofVerdictWords(current?.receipt?.runId === latestFinished?.id ? current?.readiness?.verdict ?? detail.proofVerdict : detail.proofVerdict, detail.proofReasons).word}${detail.proofAccepted ? " (accepted)" : ""}`,
|
|
8084
|
-
...(
|
|
8085
|
-
...matrixWords(
|
|
8099
|
+
...(shownReasons.length > 0 ? [` ${shownReasons.map(plainReasonWords).join(" ")}`] : []),
|
|
8100
|
+
...matrixWords(shownMatrix),
|
|
8086
8101
|
...(detail.semanticCoverage === null ? [] : coverageWords(detail.semanticCoverage).map(line => ` ${line}`)),
|
|
8087
8102
|
]),
|
|
8088
8103
|
...(detail.report === null
|
|
@@ -9161,7 +9176,11 @@ async function askCredentials(flags, context) {
|
|
|
9161
9176
|
if (local !== null)
|
|
9162
9177
|
return { name: local.account, token: "" };
|
|
9163
9178
|
if ((name === undefined || token === undefined) && interactive() && !context.json) {
|
|
9164
|
-
name
|
|
9179
|
+
const usual = name === undefined ? soloOperatorOf(context.store) : null;
|
|
9180
|
+
if (name === undefined) {
|
|
9181
|
+
const answered = await ask(usual === null ? "username: " : `username [${usual}]: `);
|
|
9182
|
+
name = answered === "" && usual !== null ? usual : answered;
|
|
9183
|
+
}
|
|
9165
9184
|
token ??= await askHidden("password: ");
|
|
9166
9185
|
}
|
|
9167
9186
|
if (name === undefined || token === undefined || name === "" || token === "")
|
|
@@ -11698,6 +11717,7 @@ async function passwordCommand(positional, flags, context) {
|
|
|
11698
11717
|
if (store.accountOf(binding.account)?.passwordSet === true)
|
|
11699
11718
|
return fail(write, json, command, "already-set", "A password is already set. Sign in with it in the browser.", EXIT.refused);
|
|
11700
11719
|
const typeHidden = context.easySeams?.askHidden ?? askHidden;
|
|
11720
|
+
write("Setting a password signs out open browser tabs and the open Toolroll screen. You can open it again right after.");
|
|
11701
11721
|
write(`Choose a password for ${binding.account}. It signs you in from other devices and approves what this computer's browser can't.`);
|
|
11702
11722
|
const chosen = await typeHidden("New password: ");
|
|
11703
11723
|
if (chosen.length < 8)
|
|
@@ -11714,7 +11734,7 @@ async function passwordCommand(positional, flags, context) {
|
|
|
11714
11734
|
}
|
|
11715
11735
|
return succeed(write, json, command, { account: binding.account, generation: enrolled.generation }, () => [
|
|
11716
11736
|
"Password set.",
|
|
11717
|
-
"
|
|
11737
|
+
"Sign in with it in your browser; an open Toolroll screen asks to open again.",
|
|
11718
11738
|
]);
|
|
11719
11739
|
}
|
|
11720
11740
|
export function upLaptopPortCandidates(store, fromSeam, localInstall = false) {
|
|
@@ -12314,14 +12334,24 @@ async function localPlanCommand(positional, flags, context) {
|
|
|
12314
12334
|
return fail(write, json, command, "local-owner", `Choosing which agent plans needs your password. ${passwordSet ? "Sign in with your password to do this." : "Set a password first: run \`toolroll password set\`."}`, EXIT.refused);
|
|
12315
12335
|
}
|
|
12316
12336
|
for (const name of flags.keys())
|
|
12317
|
-
if (!["json", "db", "digest"].includes(name))
|
|
12337
|
+
if (!["json", "db", "digest", "incident"].includes(name))
|
|
12318
12338
|
return fail(write, json, command, "usage", `--${name} is not a ${command} option.`, EXIT.usage);
|
|
12319
|
-
const id = positional[0], digest = flags.get("digest");
|
|
12320
|
-
const usage = "Use task plan <task> --digest <the plan source you read
|
|
12339
|
+
const id = positional[0], digest = flags.get("digest"), incident = flags.get("incident");
|
|
12340
|
+
const usage = "Use task plan <task> --digest <the plan source you read> [--incident <the planning incident you read>].";
|
|
12321
12341
|
if (positional.length !== 1 || !id || id.length > 64 || /[\x00-\x1f]/.test(id))
|
|
12322
12342
|
return fail(write, json, command, "usage", usage, EXIT.usage);
|
|
12323
12343
|
if (typeof digest !== "string" || !/^[a-f0-9]{64}$/.test(digest))
|
|
12324
12344
|
return fail(write, json, command, "usage", `--digest needs the exact task you read. ${usage}`, EXIT.usage);
|
|
12345
|
+
if (incident !== undefined) {
|
|
12346
|
+
if (typeof incident !== "string" || !/^[1-9]\d{0,14}$/.test(incident))
|
|
12347
|
+
return fail(write, json, command, "usage", `--incident needs the incident you read. ${usage}`, EXIT.usage);
|
|
12348
|
+
const again = planAgainAsLocalOwner(store, id, { incident: Number(incident), source: digest }, clock());
|
|
12349
|
+
if (!again.ok)
|
|
12350
|
+
return fail(write, json, command, again.reason, again.message, EXIT.refused);
|
|
12351
|
+
return succeed(write, json, command, { id, replayed: again.replayed, again: true }, () => [
|
|
12352
|
+
again.replayed ? `${id} · Already planning again.` : `${id} · Planning again. You approve the plan before anything is built.`,
|
|
12353
|
+
]);
|
|
12354
|
+
}
|
|
12325
12355
|
const done = requestPlanAsLocalOwner(store, id, digest, clock());
|
|
12326
12356
|
if (!done.ok)
|
|
12327
12357
|
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
@@ -12728,23 +12758,30 @@ async function flexibleConfig(action, value, repoGiven, flags, context) {
|
|
|
12728
12758
|
: "Only an instance operator, as a person with their password, turns interactive agent threads off; never a token, the lead or a chat app.";
|
|
12729
12759
|
if (machineActing() || process.env["TOOLROLL_LEAD_TOKEN"] !== undefined || process.env["TOOLROLL_REMOTE_TOKEN"] !== undefined)
|
|
12730
12760
|
return fail(write, json, command, "person-only", personOnly, EXIT.refused);
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12761
|
+
const solo = value === "off" && !flags.has("token") ? soloOperatorOf(store) : null;
|
|
12762
|
+
let acting = solo !== null && (text(flags, "as") ?? solo) === solo ? { name: solo, token: "" } : null;
|
|
12763
|
+
if (acting === null) {
|
|
12764
|
+
if (passwordFreeOwner(store))
|
|
12765
|
+
return fail(write, json, command, "local-owner", "You haven't set a password yet, and this needs one. Set it first with `toolroll password set`, then run this again.", EXIT.refused);
|
|
12766
|
+
acting = value === "on" ? await typedForCommand(flags, context) : await askCredentials(flags, context);
|
|
12767
|
+
}
|
|
12734
12768
|
if (acting === null)
|
|
12735
|
-
return fail(write, json, command, "usage", "This needs your name and password: run it in your own terminal to be asked, or add `--as <your Toolroll name> --token <your password>`.", EXIT.usage);
|
|
12769
|
+
return fail(write, json, command, "usage", value === "on" ? "Turning threads on asks for your Toolroll password at a hidden prompt: run it in your own terminal." : "This needs your name and password: run it in your own terminal to be asked, or add `--as <your Toolroll name> --token <your password>`.", EXIT.usage);
|
|
12770
|
+
const by = acting;
|
|
12736
12771
|
const saved = store.transact(() => {
|
|
12737
|
-
const verified =
|
|
12738
|
-
|
|
12772
|
+
const verified = by.token === "" && value === "off" ? null
|
|
12773
|
+
: value === "on" ? credentialApprover(store, by.name, by.token) : authenticateApprover(store, by.name, by.token);
|
|
12774
|
+
const proved = verified === null ? soloOperatorOf(store) === by.name : verified.ok && personProof(verified.method);
|
|
12775
|
+
if (!proved || !store.isInstanceOperator(by.name))
|
|
12739
12776
|
return false;
|
|
12740
|
-
setFlexibleSetting(store, value === "on",
|
|
12777
|
+
setFlexibleSetting(store, value === "on", by.name, clock());
|
|
12741
12778
|
return true;
|
|
12742
12779
|
});
|
|
12743
12780
|
if (!saved)
|
|
12744
12781
|
return fail(write, json, command, "unauthenticated", personOnly, EXIT.refused);
|
|
12745
12782
|
const shown = said();
|
|
12746
12783
|
if (value === "on")
|
|
12747
|
-
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12784
|
+
return succeed(write, json, command, shown.payload, () => [...shown.lines(), ...flexibleNextStepWords(store, by.name)]);
|
|
12748
12785
|
const report = await stopFlexibleThreadsEverywhere(store, { reason: "interactive agent threads were turned off", clock });
|
|
12749
12786
|
const short = (thread) => thread.slice(0, 8);
|
|
12750
12787
|
const lines = [
|
|
@@ -12772,24 +12809,32 @@ async function flexibleSignInConfig(action, extra, repoGiven, flags, context) {
|
|
|
12772
12809
|
const personOnly = "Only you, as a person with your Toolroll password, change your own Claude sign-in for threads; never a token, the lead, a chat app or a machine.";
|
|
12773
12810
|
if (machineActing() || process.env["TOOLROLL_LEAD_TOKEN"] !== undefined || process.env["TOOLROLL_REMOTE_TOKEN"] !== undefined)
|
|
12774
12811
|
return fail(write, json, command, "person-only", personOnly, EXIT.refused);
|
|
12775
|
-
if (passwordFreeOwner(store))
|
|
12776
|
-
return fail(write, json, command, "local-owner", "You haven't set a password yet, and this needs one. Set it first with `toolroll password set`, then run this again.", EXIT.refused);
|
|
12777
12812
|
if (action !== "show" && action !== "set" && action !== "clear")
|
|
12778
12813
|
return fail(write, json, command, "usage", "`toolroll config set|clear|show flexible-sign-in`", EXIT.usage);
|
|
12814
|
+
if (action === "set" && passwordFreeOwner(store))
|
|
12815
|
+
return fail(write, json, command, "local-owner", "You haven't set a password yet, and this needs one. Set it first with `toolroll password set`, then run this again.", EXIT.refused);
|
|
12779
12816
|
let acting;
|
|
12780
|
-
|
|
12817
|
+
const solo = (action === "clear" || (action === "show" && !flags.has("check"))) && !flags.has("token") ? soloOperatorOf(store) : null;
|
|
12818
|
+
if (solo !== null && (text(flags, "as") ?? solo) === solo)
|
|
12819
|
+
acting = { name: solo, token: "" };
|
|
12820
|
+
else if (action === "set") {
|
|
12781
12821
|
if (flags.has("token"))
|
|
12782
12822
|
return fail(write, json, command, "usage", "Saving your Claude sign-in asks for your Toolroll password at a hidden prompt, typed for this command: never --token or a saved sign-in.", EXIT.usage);
|
|
12783
12823
|
const typed = context.easySeams?.askHidden ?? (interactive() && !json ? askHidden : null);
|
|
12784
12824
|
const named = context.easySeams?.ask ?? (interactive() && !json ? ask : null);
|
|
12785
12825
|
if (typed === null)
|
|
12786
12826
|
return fail(write, json, command, "usage", "Run this in your own terminal: it asks for your Toolroll password and the token from `claude setup-token` at hidden prompts.", EXIT.usage);
|
|
12787
|
-
const
|
|
12827
|
+
const usual = soloOperatorOf(store) ?? savedLoginName(context);
|
|
12828
|
+
const answered = text(flags, "as") ?? (named === null ? undefined : await named(usual === null ? "username: " : `username [${usual}]: `));
|
|
12829
|
+
const name = answered === "" && usual !== null ? usual : answered;
|
|
12788
12830
|
const password = await typed("password: ");
|
|
12789
12831
|
acting = name === undefined || name.length === 0 || password.length === 0 ? null : { name, token: password };
|
|
12790
12832
|
}
|
|
12791
|
-
else
|
|
12833
|
+
else {
|
|
12834
|
+
if (passwordFreeOwner(store))
|
|
12835
|
+
return fail(write, json, command, "local-owner", "You haven't set a password yet, and this needs one. Set it first with `toolroll password set`, then run this again.", EXIT.refused);
|
|
12792
12836
|
acting = await askCredentials(flags, context);
|
|
12837
|
+
}
|
|
12793
12838
|
if (acting === null)
|
|
12794
12839
|
return fail(write, json, command, "usage", "This needs your name and password: run it in your own terminal to be asked.", EXIT.usage);
|
|
12795
12840
|
const statusWords = (status) => status.state === "none"
|
|
@@ -12800,6 +12845,8 @@ async function flexibleSignInConfig(action, extra, repoGiven, flags, context) {
|
|
|
12800
12845
|
const statusData = (status) => status.state === "none" ? { state: "none" } : { state: status.state, savedAt: status.savedAt, check: status.checkOutcome, checkStatus: status.checkStatus };
|
|
12801
12846
|
if (action === "show") {
|
|
12802
12847
|
const shown = store.transact(() => {
|
|
12848
|
+
if (acting.token === "" && !flags.has("check"))
|
|
12849
|
+
return soloOperatorOf(store) === acting.name ? flexibleSignInStatus(store, acting.name) : null;
|
|
12803
12850
|
const proved = authenticateApprover(store, acting.name, acting.token);
|
|
12804
12851
|
return proved.ok && personProof(proved.method) ? flexibleSignInStatus(store, acting.name) : null;
|
|
12805
12852
|
});
|
|
@@ -12822,9 +12869,15 @@ async function flexibleSignInConfig(action, extra, repoGiven, flags, context) {
|
|
|
12822
12869
|
}
|
|
12823
12870
|
if (action === "clear") {
|
|
12824
12871
|
const removed = store.transact(() => {
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
|
|
12872
|
+
if (acting.token === "") {
|
|
12873
|
+
if (soloOperatorOf(store) !== acting.name)
|
|
12874
|
+
return null;
|
|
12875
|
+
}
|
|
12876
|
+
else {
|
|
12877
|
+
const proved = authenticateApprover(store, acting.name, acting.token);
|
|
12878
|
+
if (!proved.ok || !personProof(proved.method))
|
|
12879
|
+
return null;
|
|
12880
|
+
}
|
|
12828
12881
|
return removeFlexibleSignIn(store, { person: acting.name, by: acting.name, now: clock() });
|
|
12829
12882
|
});
|
|
12830
12883
|
if (removed === null)
|
|
@@ -12833,9 +12886,14 @@ async function flexibleSignInConfig(action, extra, repoGiven, flags, context) {
|
|
|
12833
12886
|
await tidyFlexibleSignIns(store, dirname(realpathSync(context.databaseFile)), { now: clock(), person: acting.name });
|
|
12834
12887
|
}
|
|
12835
12888
|
catch { }
|
|
12836
|
-
|
|
12889
|
+
const report = removed.ended.threads.length === 0 ? { stopped: [], survivors: [] }
|
|
12890
|
+
: await stopFlexibleThreadsEverywhere(store, { reason: "its owner's Claude sign-in for threads was removed", owner: acting.name, clock });
|
|
12891
|
+
const named = (ids) => ids.map(id => flexibleThreadTitleOf(store, id)).join(", ");
|
|
12892
|
+
const stoppedWords = report.stopped.length === 0 ? [] : [`Stopped ${report.stopped.length === 1 ? "1 running thread" : `${report.stopped.length} running threads`} (${named(report.stopped.map(one => one.thread))}).`];
|
|
12893
|
+
const leftWords = report.survivors.length === 0 ? [] : [`${named(report.survivors.map(one => one.thread))} couldn't be stopped yet; a running console keeps trying every few seconds.`];
|
|
12894
|
+
return succeed(write, json, command, { removed: removed.removed, stopped: report.stopped, survivors: report.survivors }, () => [removed.removed
|
|
12837
12895
|
? "Removed. 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."
|
|
12838
|
-
: "You had no Claude sign-in for threads saved. Nothing changed."]);
|
|
12896
|
+
: "You had no Claude sign-in for threads saved. Nothing changed.", ...stoppedWords, ...leftWords]);
|
|
12839
12897
|
}
|
|
12840
12898
|
const typeHidden = context.easySeams?.askHidden ?? (interactive() && !json ? askHidden : null);
|
|
12841
12899
|
if (typeHidden === null)
|
|
@@ -12857,3 +12915,163 @@ async function flexibleSignInConfig(action, extra, repoGiven, flags, context) {
|
|
|
12857
12915
|
const checked = saved.check === null ? { outcome: "not-checked" } : saved.check;
|
|
12858
12916
|
return succeed(write, json, command, { saved: true, replaced: saved.replaced, check: checked.outcome, signIn: statusData(flexibleSignInStatus(store, acting.name)) }, () => [`${saved.replaced ? "Replaced" : "Saved"}. ${signInCheckWords(checked)} It powers only threads you start; a password reset ends it.`]);
|
|
12859
12917
|
}
|
|
12918
|
+
function passwordFreeRefusal(store, flags, key, remote) {
|
|
12919
|
+
if (remote || ["as", "token", "token-file", "token-env"].some(name => flags.has(name)) || localOwnerRequested() || envValue(process.env, "LEAD_TOKEN") !== undefined)
|
|
12920
|
+
return null;
|
|
12921
|
+
const binding = localOwnerBinding(store);
|
|
12922
|
+
if (binding === null || store.accountOf(binding.account)?.passwordSet === true)
|
|
12923
|
+
return null;
|
|
12924
|
+
return `This Toolroll has no password yet, so this runs from Toolroll itself: run \`toolroll\`, select the task and press ${key}, or open it in the browser.`;
|
|
12925
|
+
}
|
|
12926
|
+
function soloOperatorOf(store) {
|
|
12927
|
+
if (installModeNow(store).mode !== "solo")
|
|
12928
|
+
return null;
|
|
12929
|
+
const operators = store.accountFacts().filter(one => store.isInstanceOperator(one.name)).map(one => one.name);
|
|
12930
|
+
return operators.length === 1 ? operators[0] : null;
|
|
12931
|
+
}
|
|
12932
|
+
function savedLoginName(context) {
|
|
12933
|
+
try {
|
|
12934
|
+
return readLoginFile(savedLoginFile(dirname(context.databaseFile)))?.name ?? null;
|
|
12935
|
+
}
|
|
12936
|
+
catch {
|
|
12937
|
+
return null;
|
|
12938
|
+
}
|
|
12939
|
+
}
|
|
12940
|
+
async function typedForCommand(flags, context, promptOnly = false) {
|
|
12941
|
+
const given = text(flags, "token");
|
|
12942
|
+
if (given !== undefined) {
|
|
12943
|
+
const name = text(flags, "as") ?? soloOperatorOf(context.store);
|
|
12944
|
+
return promptOnly || given === "" || name === null || name === undefined ? null : { name, token: given };
|
|
12945
|
+
}
|
|
12946
|
+
const typed = context.easySeams?.askHidden ?? (interactive() && !context.json ? askHidden : null);
|
|
12947
|
+
const named = context.easySeams?.ask ?? (interactive() && !context.json ? ask : null);
|
|
12948
|
+
if (typed === null)
|
|
12949
|
+
return null;
|
|
12950
|
+
const usual = soloOperatorOf(context.store) ?? savedLoginName(context);
|
|
12951
|
+
const answered = text(flags, "as") ?? (named === null ? undefined : await named(usual === null ? "username: " : `username [${usual}]: `));
|
|
12952
|
+
const name = answered === "" && usual !== null ? usual : answered;
|
|
12953
|
+
const password = await typed("password: ");
|
|
12954
|
+
if (name === undefined || name.length === 0 || password.length === 0)
|
|
12955
|
+
return null;
|
|
12956
|
+
return { name, token: password };
|
|
12957
|
+
}
|
|
12958
|
+
function flexibleNextStepWords(store, person) {
|
|
12959
|
+
const steps = [];
|
|
12960
|
+
if (flexibleSignInStatus(store, person).state !== "active")
|
|
12961
|
+
steps.push("your own Claude sign-in: run `claude setup-token`, then `toolroll config set flexible-sign-in`");
|
|
12962
|
+
steps.push("this project's terms: `toolroll project flexible enable --repo <path>`");
|
|
12963
|
+
return [`Next: ${steps.map((one, at) => `${at + 1}) ${one}`).join(" ")}.`];
|
|
12964
|
+
}
|
|
12965
|
+
async function threadCommand(positional, flags, context) {
|
|
12966
|
+
const { store, write, json, clock } = context;
|
|
12967
|
+
const verb = positional[0] ?? "list";
|
|
12968
|
+
const command = `thread ${verb}`;
|
|
12969
|
+
if (!["list", "show", "end", "remove", "ship"].includes(verb))
|
|
12970
|
+
return fail(write, json, command, "usage", "`toolroll thread list|show|end|remove|ship <thread>`", EXIT.usage);
|
|
12971
|
+
const personOnly = "Only you, as a person, work with your own threads here; never a token, the lead, a chat app or a machine.";
|
|
12972
|
+
if (machineActing() || process.env["TOOLROLL_LEAD_TOKEN"] !== undefined || process.env["TOOLROLL_REMOTE_TOKEN"] !== undefined)
|
|
12973
|
+
return fail(write, json, command, "person-only", personOnly, EXIT.refused);
|
|
12974
|
+
const pick = (owner) => {
|
|
12975
|
+
const asked = positional[1] ?? "";
|
|
12976
|
+
if (!/^[0-9a-f]{8,32}$/.test(asked))
|
|
12977
|
+
return null;
|
|
12978
|
+
const found = flexibleThreadRecords(store, { owner }).filter(one => one.id.startsWith(asked));
|
|
12979
|
+
return found.length === 1 ? found[0].id : null;
|
|
12980
|
+
};
|
|
12981
|
+
if (verb === "ship") {
|
|
12982
|
+
if (passwordFreeOwner(store))
|
|
12983
|
+
return fail(write, json, command, "laptop", "Nobody on this install has a password, so this thread ships from the workbench (`toolroll`), after its terms are read there.", EXIT.refused);
|
|
12984
|
+
const acting = await typedForCommand(flags, context, true);
|
|
12985
|
+
if (acting === null)
|
|
12986
|
+
return fail(write, json, command, "usage", "Shipping asks for your Toolroll password at a hidden prompt, typed for this command: run it in your own terminal (never --token).", EXIT.usage);
|
|
12987
|
+
const account = store.accountOf(acting.name);
|
|
12988
|
+
const thread = account === null ? null : pick(acting.name);
|
|
12989
|
+
if (account === null || thread === null)
|
|
12990
|
+
return fail(write, json, command, "not-found", "You have no such thread.", EXIT.refused);
|
|
12991
|
+
const by = { name: acting.name, generation: account.generation };
|
|
12992
|
+
const shown = await flexibleThreadShipTerms(store, { thread, by });
|
|
12993
|
+
if (!shown.ok)
|
|
12994
|
+
return fail(write, json, command, shown.reason, shown.message, EXIT.refused);
|
|
12995
|
+
const key = text(flags, "key");
|
|
12996
|
+
const changed = key !== undefined && key !== shown.summary.key;
|
|
12997
|
+
const lines = [...(changed ? ["The terms changed since the workbench showed them. Here they are again."] : []), "Ship approves exactly this:", ...summaryLines(shown.summary)];
|
|
12998
|
+
if (json)
|
|
12999
|
+
return fail(write, json, command, "usage", "Ship asks before it ships: run it in your own terminal.", EXIT.usage);
|
|
13000
|
+
for (const line of lines)
|
|
13001
|
+
write(line);
|
|
13002
|
+
const confirm = context.easySeams?.ask ?? (interactive() ? ask : null);
|
|
13003
|
+
const yes = confirm === null ? "" : await confirm("Ship exactly this? [y/N] ");
|
|
13004
|
+
if (!/^y(es)?$/i.test(yes.trim()))
|
|
13005
|
+
return fail(write, json, command, "declined", "Nothing was shipped.", EXIT.refused);
|
|
13006
|
+
const shipped = await shipFlexibleThread(store, null, { thread, by, proof: { kind: "password-now", password: acting.token }, shownDigest: shown.digest, shownKey: shown.summary.key, now: clock(), waitMs: 15_000 });
|
|
13007
|
+
if (!shipped.ok)
|
|
13008
|
+
return fail(write, json, command, shipped.reason, shipped.message, EXIT.refused);
|
|
13009
|
+
const ship = latestFlexibleShip(store, thread);
|
|
13010
|
+
return succeed(write, json, command, { thread, ship: ship?.id ?? null, seq: ship?.seq ?? null, task: ship?.taskId ?? null }, () => [`Shipping: checks run on commit ${ship?.candidate.slice(0, 12) ?? ""}; Toolroll merges it once they pass.`]);
|
|
13011
|
+
}
|
|
13012
|
+
const solo = !flags.has("token") ? soloOperatorOf(store) : null;
|
|
13013
|
+
let acting = solo !== null && (text(flags, "as") ?? solo) === solo ? { name: solo, token: "" } : null;
|
|
13014
|
+
if (acting === null) {
|
|
13015
|
+
if (passwordFreeOwner(store))
|
|
13016
|
+
return fail(write, json, command, "local-owner", "You haven't set a password yet, and this needs one. Set it first with `toolroll password set`, then run this again.", EXIT.refused);
|
|
13017
|
+
acting = await askCredentials(flags, context);
|
|
13018
|
+
}
|
|
13019
|
+
if (acting === null)
|
|
13020
|
+
return fail(write, json, command, "usage", "This needs your name and password: run it in your own terminal to be asked.", EXIT.usage);
|
|
13021
|
+
const who = { ...acting, solo: solo !== null && acting.name === solo && !flags.has("token") && acting.token.length === 0 };
|
|
13022
|
+
const proveNow = () => {
|
|
13023
|
+
if (who.solo)
|
|
13024
|
+
return soloOperatorOf(store) === who.name;
|
|
13025
|
+
const one = authenticateApprover(store, who.name, who.token);
|
|
13026
|
+
return one.ok && personProof(one.method);
|
|
13027
|
+
};
|
|
13028
|
+
const proved = store.transact(proveNow);
|
|
13029
|
+
if (!proved)
|
|
13030
|
+
return fail(write, json, command, "unauthenticated", personOnly, EXIT.refused);
|
|
13031
|
+
const account = store.accountOf(who.name);
|
|
13032
|
+
if (verb === "list") {
|
|
13033
|
+
const rows = flexibleThreadRecords(store, { owner: who.name });
|
|
13034
|
+
return succeed(write, json, command, { threads: rows }, () => rows.length === 0 ? ["You have no threads yet. Start one in the workbench (`toolroll`)."]
|
|
13035
|
+
: rows.map(one => `${one.id.slice(0, 8)} ${one.title} · ${threadStateWord(one)}${one.project === null ? "" : ` · ${one.project}`}${shipOutcomeWord(one.ship)}`));
|
|
13036
|
+
}
|
|
13037
|
+
const thread = pick(who.name);
|
|
13038
|
+
if (thread === null)
|
|
13039
|
+
return fail(write, json, command, "not-found", "You have no such thread.", EXIT.refused);
|
|
13040
|
+
const row = flexibleThreadRecords(store, { owner: who.name }).find(one => one.id === thread);
|
|
13041
|
+
if (verb === "show") {
|
|
13042
|
+
return succeed(write, json, command, { thread: row }, () => [`${row.title} (${row.id})`, `Project: ${row.project ?? row.repo}`,
|
|
13043
|
+
`Latest turn: ${row.turn ?? "none"}${row.endWords === null ? "" : `. ${row.endWords}`}`, ...(row.ended ? ["Ended."] : []),
|
|
13044
|
+
...(row.shipWords === null ? [] : [row.shipWords]), "Reply to it in the workbench (`toolroll`)."]);
|
|
13045
|
+
}
|
|
13046
|
+
if (verb === "end") {
|
|
13047
|
+
const done = await closeFlexibleThread(store, null, { thread, by: { name: who.name, generation: account.generation }, act: "end", clock, prove: proveNow });
|
|
13048
|
+
if (!done.ok)
|
|
13049
|
+
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
13050
|
+
if (done.stopPending)
|
|
13051
|
+
await stopFlexibleThreadsEverywhere(store, { reason: "its owner ended the thread", thread, clock });
|
|
13052
|
+
return succeed(write, json, command, { thread, already: done.already }, () => [done.already ? "This thread had already ended." : "Ended. You can still ship its work for a week; then its copy is tidied."]);
|
|
13053
|
+
}
|
|
13054
|
+
const removed = await removeFlexibleThreadCopy(store, { thread, by: who.name, now: clock(), prove: proveNow });
|
|
13055
|
+
return removed.ok ? succeed(write, json, command, { thread }, () => ["Removed its working copy. Its record stays."]) : fail(write, json, command, removed.reason, removed.message, EXIT.refused);
|
|
13056
|
+
}
|
|
13057
|
+
export function threadStateWord(one) {
|
|
13058
|
+
if (one.ended)
|
|
13059
|
+
return "Ended";
|
|
13060
|
+
if (one.turn === "admitted" || one.turn === "running")
|
|
13061
|
+
return "Working";
|
|
13062
|
+
if (one.ship !== null && ["approved", "imported", "armed", "completed", "merging"].includes(one.ship))
|
|
13063
|
+
return "Shipping";
|
|
13064
|
+
if (one.turn === "unknown")
|
|
13065
|
+
return "Outcome unknown";
|
|
13066
|
+
if (one.turn === "interrupted")
|
|
13067
|
+
return "Stopped";
|
|
13068
|
+
if (one.ship === "cancelled")
|
|
13069
|
+
return "Ship stopped";
|
|
13070
|
+
if (one.ship === "refused" || one.ship === "failed")
|
|
13071
|
+
return "Ship refused";
|
|
13072
|
+
return "Ready";
|
|
13073
|
+
}
|
|
13074
|
+
export function shipOutcomeWord(ship) {
|
|
13075
|
+
const word = ship === "merged" ? "Merged" : ship === "sent-back" ? "sent back" : null;
|
|
13076
|
+
return word === null ? "" : ` · Ship: ${word}`;
|
|
13077
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const V173_ADDED_COLUMNS = Object.freeze({
|
|
2
|
+
run: { plan_problems_json: { definition: "TEXT CHECK (plan_problems_json IS NULL OR length(plan_problems_json) BETWEEN 2 AND 4096)", saved: "NULL" } },
|
|
3
|
+
});
|
|
4
|
+
export const V173_STEPS = Object.freeze(["plan-problems-column"]);
|
package/dist/planner.js
CHANGED
|
@@ -29,6 +29,7 @@ import { CLAUDE_LIMITS, ACCEPTANCE_LIMITS } from "./scope.js";
|
|
|
29
29
|
import { normalizeStructuredJson, storeStructuredAttempt, validationErrorsJson, STRUCTURED_REPAIR_ATTEMPTS, STRUCTURED_REPAIR_MAX_TURNS, STRUCTURED_REPAIR_TIMEOUT_MS, } from "./structured-output.js";
|
|
30
30
|
import { contractChangesOf, describeContractChanges, plannerSourceBlock, } from "./planner-source.js";
|
|
31
31
|
import { canonicalJsonUndefinedAsNull } from "./canonical-json.js";
|
|
32
|
+
import { agentSaidTail } from "./agent-said.js";
|
|
32
33
|
const GIT = "git";
|
|
33
34
|
const AGENT_ENV_DENYLIST = [...TELEGRAM_TOKEN_ENVS];
|
|
34
35
|
const DEFAULT_PLAN_TIMEOUT_MS = 20 * 60_000;
|
|
@@ -578,7 +579,8 @@ export async function plan(store, request) {
|
|
|
578
579
|
}
|
|
579
580
|
return null;
|
|
580
581
|
};
|
|
581
|
-
const malformedOutcome = (payload) => ({
|
|
582
|
+
const malformedOutcome = (payload, said = {}) => ({
|
|
583
|
+
...said,
|
|
582
584
|
ok: false,
|
|
583
585
|
kind: "malformed",
|
|
584
586
|
reason: payload.kind === "decision" ? "malformed-decision" : "malformed-plan",
|
|
@@ -669,6 +671,7 @@ export async function plan(store, request) {
|
|
|
669
671
|
kind: "failure",
|
|
670
672
|
reason: "timeout",
|
|
671
673
|
message: `the planner made no observable progress for ${Math.round(timeoutMs / 60_000)} minutes and was stopped`,
|
|
674
|
+
...saidOf(result),
|
|
672
675
|
};
|
|
673
676
|
}
|
|
674
677
|
if (result.initFailed) {
|
|
@@ -678,11 +681,12 @@ export async function plan(store, request) {
|
|
|
678
681
|
kind: "failure",
|
|
679
682
|
reason: "provider-init",
|
|
680
683
|
message: "the provider harness never initialized — config, auth, or install, not the plan",
|
|
684
|
+
...saidOf(result),
|
|
681
685
|
};
|
|
682
686
|
}
|
|
683
687
|
if (result.code !== 0) {
|
|
684
688
|
cleanup(worktree, [mailbox, planFile]);
|
|
685
|
-
return { ok: false, kind: "failure", reason: "agent", message: `agent exit ${result.code}
|
|
689
|
+
return { ok: false, kind: "failure", reason: "agent", message: `agent exit ${result.code}`, ...saidOf(result) };
|
|
686
690
|
}
|
|
687
691
|
if (result.sessionId !== null) {
|
|
688
692
|
store.stampRun(request.runId, { sessionId: result.sessionId });
|
|
@@ -708,15 +712,16 @@ export async function plan(store, request) {
|
|
|
708
712
|
if (payload.state === "plan")
|
|
709
713
|
return draftedOutcome(root, request.runId, payload.plan);
|
|
710
714
|
if (!plannerPayloadIsRepairable(payload))
|
|
711
|
-
return malformedOutcome(payload);
|
|
715
|
+
return malformedOutcome(payload, saidOf(result));
|
|
712
716
|
const initialAuthority = payload.authorityAnchor;
|
|
713
717
|
let expectedKind = payload.expectedKind;
|
|
714
718
|
let problems = payload.problems;
|
|
715
719
|
let lastMalformed = payload;
|
|
716
720
|
let sessionId = result.sessionId ?? store.getRun(request.runId)?.sessionId ?? null;
|
|
717
721
|
let repairParentRun = request.runId;
|
|
722
|
+
let lastSaid = saidOf(result);
|
|
718
723
|
if (auditOf(provider).resume !== "native" || sessionId === null)
|
|
719
|
-
return malformedOutcome(lastMalformed);
|
|
724
|
+
return malformedOutcome(lastMalformed, lastSaid);
|
|
720
725
|
const parentRoute = store.runRoute(request.runId);
|
|
721
726
|
const parentStamp = parentRoute === null ? null : { routeDigest: parentRoute.routeDigest, phase: parentRoute.phase, provider: parentRoute.provider, model: parentRoute.model, chosen: parentRoute.chosen };
|
|
722
727
|
for (let correction = 0; correction < STRUCTURED_REPAIR_ATTEMPTS && sessionId !== null; correction += 1) {
|
|
@@ -843,6 +848,7 @@ export async function plan(store, request) {
|
|
|
843
848
|
ok: false,
|
|
844
849
|
kind: "failure",
|
|
845
850
|
reason,
|
|
851
|
+
...saidOf(turn),
|
|
846
852
|
message: turn.timedOut
|
|
847
853
|
? "the structured repair turn timed out"
|
|
848
854
|
: turn.initFailed
|
|
@@ -874,6 +880,7 @@ export async function plan(store, request) {
|
|
|
874
880
|
return draftedOutcome(root, request.runId, corrected.plan, correctionRun);
|
|
875
881
|
}
|
|
876
882
|
lastMalformed = corrected;
|
|
883
|
+
lastSaid = saidOf(turn);
|
|
877
884
|
problems = corrected.problems;
|
|
878
885
|
if (expectedKind === null)
|
|
879
886
|
expectedKind = corrected.expectedKind ?? corrected.kind;
|
|
@@ -883,11 +890,11 @@ export async function plan(store, request) {
|
|
|
883
890
|
now: clock(),
|
|
884
891
|
});
|
|
885
892
|
if (!plannerPayloadIsRepairable(corrected))
|
|
886
|
-
return malformedOutcome(corrected);
|
|
893
|
+
return malformedOutcome(corrected, lastSaid);
|
|
887
894
|
sessionId = turn.sessionId;
|
|
888
895
|
repairParentRun = correctionRun;
|
|
889
896
|
}
|
|
890
|
-
return malformedOutcome(lastMalformed);
|
|
897
|
+
return malformedOutcome(lastMalformed, lastSaid);
|
|
891
898
|
}
|
|
892
899
|
finally {
|
|
893
900
|
if (pulseTimer !== undefined)
|
|
@@ -904,3 +911,7 @@ function cleanup(worktree, names) {
|
|
|
904
911
|
}
|
|
905
912
|
}
|
|
906
913
|
}
|
|
914
|
+
function saidOf(result) {
|
|
915
|
+
const said = agentSaidTail(result.stderr.trim() !== "" ? result.stderr : result.finalMessage);
|
|
916
|
+
return said.length === 0 ? {} : { agentSaid: said };
|
|
917
|
+
}
|
package/dist/release-cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { journals, releaseGate } from "./release-gate.js";
|
|
|
10
10
|
import { rescueDeployment } from "./deploy-rescue.js";
|
|
11
11
|
import { settleDeployment, takeReleaseRun } from "./release-next.js";
|
|
12
12
|
import { databasePath, elapsedSeconds, latestReleaseStepTask, openStore, releaseProgressFor, revokeRelease } from "./store.js";
|
|
13
|
-
import { dur } from "./design/kit.js";
|
|
13
|
+
import { dur, plural } from "./design/kit.js";
|
|
14
14
|
import { carryRefusalWords, proveCarry, setAskEveryReleaseCommit, setUnsandboxedCarry } from "./release-carry.js";
|
|
15
15
|
import { authenticateApprover, machineActing, personProof, proveCredential } from "./scope.js";
|
|
16
16
|
import { allowAutoPublish, setReleaseApproval } from "./release-auto.js";
|
|
@@ -465,7 +465,7 @@ async function runAuthorityCommand(command, target, flags, write, json, deps) {
|
|
|
465
465
|
return answer(false, { reason: "usage", message: "carry takes --to <full commit id>." }, "carry takes --to <full commit id>.", 2);
|
|
466
466
|
const result = await proveCarry(store, { authority: id, to: flags.to, ...(flags.request === undefined ? {} : { requestId: flags.request }), now });
|
|
467
467
|
if (result.ok)
|
|
468
|
-
return answer(true, { release: id, task: result.taskId, retried: result.retried, carry: { files: result.carry.files, lines: result.carry.changedLines } }, `Carried release ${id} to ${flags.to.slice(0, 7)}: task ${result.taskId} (${result.carry.files
|
|
468
|
+
return answer(true, { release: id, task: result.taskId, retried: result.retried, carry: { files: result.carry.files, lines: result.carry.changedLines } }, `Carried release ${id} to ${flags.to.slice(0, 7)}: task ${result.taskId} (${plural(result.carry.files, "file", "files")}, ${plural(result.carry.changedLines, "line", "lines")}).`, 0);
|
|
469
469
|
return answer(false, { reason: result.reason, message: result.message, ...(result.path === undefined ? {} : { path: result.path }) }, carryRefusalWords(result, flags.to), 1);
|
|
470
470
|
}
|
|
471
471
|
finally {
|
package/dist/result-actions.js
CHANGED
|
@@ -167,7 +167,6 @@ export function createResultRevision(store, evidenceRoot, input, now) {
|
|
|
167
167
|
}
|
|
168
168
|
const candidateTitle = `${prefix.trimEnd() || "Task"}${suffix}`;
|
|
169
169
|
const title = validateTaskText({ title: candidateTitle }) === null ? candidateTitle : `Task${suffix}`;
|
|
170
|
-
const feedbackKind = comments.every(one => one.path !== null) ? "annotations" : "feedback";
|
|
171
170
|
const terminal = store.artifactsFor(id).find(one => one.kind === "terminal-diff");
|
|
172
171
|
if (terminal !== undefined) {
|
|
173
172
|
const proven = readVerifiedArtifact(evidenceRoot, terminal);
|
|
@@ -205,7 +204,7 @@ export function createResultRevision(store, evidenceRoot, input, now) {
|
|
|
205
204
|
brief: { evidenceRoot, key, sha256: createHash("sha256").update(briefBytes).digest("hex"), bytes: briefBytes.length, capture: "machine-authored revision brief (exit 0)" },
|
|
206
205
|
child: {
|
|
207
206
|
title: `Revise ${sourceTaskId} from ${comments.length} annotation${comments.length === 1 ? "" : "s"} on build #${id}`,
|
|
208
|
-
repair: `apply the ${
|
|
207
|
+
repair: `apply the ${comments.length === 1 ? "note" : `${comments.length} notes`} sent back on build #${id}`,
|
|
209
208
|
},
|
|
210
209
|
commentIds: comments.map(one => one.id),
|
|
211
210
|
coverage,
|
package/dist/retention-ui.js
CHANGED
|
@@ -26,6 +26,6 @@ export function retentionHtml(view, said) {
|
|
|
26
26
|
body: joinHtml([
|
|
27
27
|
said.problem ? notice(said.problem) : said.said ? infoLine(said.said) : "",
|
|
28
28
|
kitSectionForm({ proof: "retention", action: "/settings/retention", id: "retention-form", gate: true, body: joinHtml(rows) }),
|
|
29
|
-
note("Never removed: the action ledger, and anything a task still needs (unfinished tasks, results Ready
|
|
29
|
+
note("Never removed: the action ledger, and anything a task still needs (unfinished tasks, results Ready, anything on hold)."),
|
|
30
30
|
]) });
|
|
31
31
|
}
|