toolroll 0.9.108 → 0.9.110
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 +69 -0
- package/dist/advanced-view.js +0 -1
- package/dist/agent-detect.js +244 -0
- package/dist/agent-fence.js +47 -5
- package/dist/agent-state.js +5 -2
- package/dist/agentconfig.js +2 -2
- package/dist/approval-summary.js +344 -0
- package/dist/assignment-ui.js +5 -5
- package/dist/assignment.js +5 -2
- package/dist/attest.js +2 -2
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +37 -34
- package/dist/browser-crew.js +4 -4
- package/dist/browser-workspace.js +4 -11
- package/dist/builder.js +45 -3
- package/dist/chat-actions.js +24 -17
- package/dist/chat-controls.js +6 -5
- package/dist/chat-core.js +3 -1
- package/dist/chat-decide.js +102 -47
- package/dist/chat-delivery-state.js +2 -0
- package/dist/chat-delivery.js +3 -2
- package/dist/chat-live.js +2 -1
- package/dist/chat-quiet.js +3 -3
- package/dist/chat-task-actions.js +6 -0
- package/dist/chat-voice.js +2 -2
- package/dist/check-report.js +1 -1
- package/dist/cli-help.js +12 -13
- package/dist/cli.js +6 -3
- package/dist/console-chrome.js +10 -3
- package/dist/console-instance.js +10 -1
- package/dist/contracts/console-api.js +14 -8
- package/dist/contracts/engine-api.js +271 -0
- package/dist/contracts/handoff.js +4 -0
- package/dist/coordinator.js +2 -2
- package/dist/decision.js +17 -0
- package/dist/demo-chat.js +1 -1
- package/dist/demo.js +6 -0
- package/dist/design/kit.js +4 -3
- package/dist/discord-api.js +4 -3
- package/dist/discord-chat.js +3 -1
- package/dist/dispatch.js +3 -8
- package/dist/easy-start-args.js +7 -3
- package/dist/easy-start.js +25 -0
- package/dist/egress.js +72 -10
- package/dist/engine-handoff.js +34 -0
- package/dist/engine-reads.js +261 -0
- package/dist/eval-world.js +3 -2
- package/dist/evidence.js +2 -0
- package/dist/fast-start.js +55 -14
- package/dist/fast-terms.js +2 -2
- package/dist/first-run.js +10 -2
- package/dist/flexible-agents.js +234 -0
- package/dist/flexible-answers-schema.js +61 -0
- package/dist/flexible-answers.js +889 -0
- package/dist/flexible-available.js +1 -0
- package/dist/flexible-custody.js +494 -0
- package/dist/flexible-import.js +782 -0
- package/dist/flexible-launch-schema.js +72 -0
- package/dist/flexible-launch.js +331 -0
- package/dist/flexible-launcher.js +88 -0
- package/dist/flexible-levels.js +34 -0
- package/dist/flexible-merge-guard.js +47 -0
- package/dist/flexible-refs.js +47 -0
- package/dist/flexible-relay-cancel.js +19 -0
- package/dist/flexible-relay-schema.js +55 -0
- package/dist/flexible-relay-upstreams.js +36 -0
- package/dist/flexible-relay.js +1032 -0
- package/dist/flexible-schema.js +32 -0
- package/dist/flexible-session.js +732 -0
- package/dist/flexible-ship-schema.js +81 -0
- package/dist/flexible-ship.js +694 -0
- package/dist/flexible-start.js +80 -0
- package/dist/flexible-thread-schema.js +30 -0
- package/dist/flexible-thread.js +676 -0
- package/dist/flexible-turns-schema.js +69 -0
- package/dist/flexible-turns.js +490 -0
- package/dist/flexible-ui.js +44 -0
- package/dist/flexible.js +368 -0
- package/dist/flow-actions.js +6 -4
- package/dist/flow-steps.js +1 -1
- package/dist/flows-cli.js +2 -1
- package/dist/git-views.js +44 -41
- package/dist/guides.js +11 -10
- package/dist/install-mode.js +225 -0
- package/dist/keymap.js +1 -1
- package/dist/lead-context.js +1 -1
- package/dist/lead-doors.js +7 -1
- package/dist/limits-ui.js +8 -1
- package/dist/live-bus.js +70 -13
- package/dist/live-reply.js +6 -0
- package/dist/live-terminal.js +425 -29
- package/dist/local-owner.js +6 -0
- package/dist/model-choices.js +12 -6
- package/dist/needs-you.js +3 -3
- package/dist/nightly-github.js +2 -2
- package/dist/notification-delivery.js +11 -0
- package/dist/operate.js +185 -33
- package/dist/outbound-privacy.js +204 -0
- package/dist/passwordless.js +2 -1
- package/dist/project-delete-ui.js +2 -1
- package/dist/project-delete.js +15 -0
- package/dist/provider-auth.js +1 -1
- package/dist/provider-connection.js +5 -3
- package/dist/publish.js +5 -0
- package/dist/pull-request-flow.js +26 -7
- package/dist/push.js +5 -1
- package/dist/release-card.js +11 -3
- package/dist/release.js +11 -1
- package/dist/result-actions.js +3 -0
- package/dist/result-evidence-readers.js +8 -2
- package/dist/result-review.js +20 -9
- package/dist/route-store.js +2 -2
- package/dist/sandbox-launch.js +32 -8
- package/dist/sandbox-runtime.js +16 -7
- package/dist/sandbox-tools.js +176 -0
- package/dist/scope.js +12 -36
- package/dist/scout-net.js +7 -2
- package/dist/serve.js +90 -40
- package/dist/server/chat.js +9 -9
- package/dist/server/chrome.js +19 -17
- package/dist/server/console.css +33 -6
- package/dist/server/engine-api.js +378 -0
- package/dist/server/flows.js +2 -2
- package/dist/server/guards.js +10 -4
- package/dist/server/home.js +37 -5
- package/dist/server/http.js +11 -2
- package/dist/server/in-place.js +5 -4
- package/dist/server/kit.js +2 -2
- package/dist/server/link-redemption.js +52 -0
- package/dist/server/live.js +100 -10
- package/dist/server/mutation-key.js +21 -7
- package/dist/server/pages.js +129 -74
- package/dist/server/people-tokens.js +17 -41
- package/dist/server/render-chat.js +2 -1
- package/dist/server/render-history.js +18 -4
- package/dist/server/render-new-task.js +4 -4
- package/dist/server/render-pages.js +21 -39
- package/dist/server/render-people.js +2 -2
- package/dist/server/render-projects.js +5 -5
- package/dist/server/render-results.js +30 -14
- package/dist/server/render-tasks.js +155 -155
- package/dist/server/retired-routes.js +37 -4
- package/dist/server/route-policy.js +8 -0
- package/dist/server/route-table.js +43 -5
- package/dist/server/settings-computers.js +140 -0
- package/dist/server/settings-scripts.js +15 -0
- package/dist/server/settings-section-table.js +59 -0
- package/dist/server/settings-sections.js +291 -0
- package/dist/server/settings.js +247 -28
- package/dist/server/task-views.js +55 -15
- package/dist/server/tasks.js +168 -98
- package/dist/server/terminals.js +181 -28
- package/dist/server/welcome.js +40 -14
- package/dist/settings-groups-ui.js +26 -107
- package/dist/settings-proofs.js +18 -11
- package/dist/slack-api.js +4 -3
- package/dist/slack-chat.js +5 -3
- package/dist/spend.js +46 -12
- package/dist/sqlite-telemetry.js +70 -21
- package/dist/status-probe.js +343 -0
- package/dist/store.js +206 -10
- package/dist/task-link.js +64 -0
- package/dist/teams-api.js +4 -3
- package/dist/teams-chat.js +4 -2
- package/dist/telegram-lead.js +2 -1
- package/dist/telegram-live.js +2 -1
- package/dist/telegram-team.js +2 -1
- package/dist/telegram.js +17 -5
- package/dist/trusted-path.js +162 -0
- 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 +282 -0
- package/dist/tui-source.js +5 -3
- package/dist/tui.js +2 -2
- package/dist/typed-words-schema.js +18 -0
- package/dist/webhooks.js +8 -4
- package/dist/welcome-facts.js +25 -17
- package/dist/work-index.js +126 -29
- package/dist/work-reads.js +279 -0
- package/dist/workspace-ui.js +5 -0
- package/package.json +4 -2
- package/scripts/crash-canary.mjs +1 -1
- package/scripts/pilot.mjs +1 -1
- package/scripts/provider-canary.mjs +5 -3
package/dist/model-choices.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { isAcpProvider } from "./acp-agents.js";
|
|
3
|
-
import { currentLocalOwner, localModeOn, localOwnerInFlight, localOwnerStandsNow } from "./local-owner.js";
|
|
3
|
+
import { currentLocalOwner, localActNow, localModeOn, localOwnerInFlight, localOwnerStandsNow } from "./local-owner.js";
|
|
4
4
|
import { INSTALLATION_SCOPE, resolvePhaseAgent, resolveRouteCandidates } from "./agentconfig.js";
|
|
5
5
|
import { seenModels } from "./model-catalog.js";
|
|
6
|
-
import {
|
|
6
|
+
import { sessionStandsIn, soloNow } from "./install-mode.js";
|
|
7
7
|
import { exactModelId, recommendRoute, routeProblems } from "./phase-routing.js";
|
|
8
8
|
import { liveEarnedRules } from "./route-store.js";
|
|
9
9
|
import { isProviderId, validateSpec } from "./provider.js";
|
|
@@ -252,7 +252,10 @@ function applyLocked(store, input, authority, now) {
|
|
|
252
252
|
{
|
|
253
253
|
{
|
|
254
254
|
const account = store.accountOf(authority.actor);
|
|
255
|
-
const
|
|
255
|
+
const local = authority.method === "local-owner" ? localActNow(store, "change-models") : null;
|
|
256
|
+
const standsNow = authority.method === "local-owner"
|
|
257
|
+
? local !== null && local.account === authority.actor && soloNow(store)
|
|
258
|
+
: PERSON_PROOFS.has(authority.method) && ((authority.method !== "session" && authority.method !== "cli-login") || sessionStandsIn(store));
|
|
256
259
|
if (account === null || account.revokedAt !== null || account.generation !== authority.generation || !store.isInstanceOperator(authority.actor) || !authority.live() || !standsNow) {
|
|
257
260
|
throw new Refused({ ok: false, reason: "authority", problem: "Only an instance operator, signed in now, can change models." });
|
|
258
261
|
}
|
|
@@ -369,6 +372,7 @@ export function agentPresetChange(agent) {
|
|
|
369
372
|
export function defaultAgentOf(provider) {
|
|
370
373
|
return provider === "claude-subscription" ? "claude" : provider === "codex-subscription" ? "codex" : null;
|
|
371
374
|
}
|
|
375
|
+
export const FIRST_TASK_AGENT_FACT = "first-task-agent";
|
|
372
376
|
export function fillDefaultRouting(store, agent, actor, door, now) {
|
|
373
377
|
const refused = (reason, problem) => ({ filled: false, reason, problem });
|
|
374
378
|
return store.transact(() => {
|
|
@@ -378,13 +382,13 @@ export function fillDefaultRouting(store, agent, actor, door, now) {
|
|
|
378
382
|
return refused("authority", "Only this computer's owner, choosing an agent now, starts its models.");
|
|
379
383
|
}
|
|
380
384
|
}
|
|
381
|
-
else if (!localModeOn(store)) {
|
|
385
|
+
else if (door.kind === "first-start" && !localModeOn(store)) {
|
|
382
386
|
return refused("authority", "Only a laptop install's first start chooses its models by itself.");
|
|
383
387
|
}
|
|
384
388
|
const anyRow = store.handle.prepare("SELECT 1 FROM phase_config UNION ALL SELECT 1 FROM phase_tier_config UNION ALL SELECT 1 FROM phase_tier_alternate LIMIT 1").get();
|
|
385
389
|
if (anyRow !== undefined)
|
|
386
390
|
return refused("already-set", "Models are already chosen here.");
|
|
387
|
-
if (door.kind
|
|
391
|
+
if (door.kind !== "local-owner" && store.handle.prepare("SELECT 1 FROM models_generation LIMIT 1").get() !== undefined) {
|
|
388
392
|
return refused("already-set", "Models were chosen here before.");
|
|
389
393
|
}
|
|
390
394
|
store.handle.exec("SAVEPOINT default_routing");
|
|
@@ -398,9 +402,11 @@ export function fillDefaultRouting(store, agent, actor, door, now) {
|
|
|
398
402
|
else
|
|
399
403
|
store.setPhaseTierConfig(INSTALLATION_SCOPE, slot.phase, slot.tier, to.provider, to.model, actor, now);
|
|
400
404
|
store.recordAction({ at: now.toISOString(), actor, repo: null, taskId: null, runId: null, action: ACTION_OF(slot), outcome: "changed", source: "policy",
|
|
401
|
-
detail: `not set → ${pairWords(to)} (${AGENT_PRESETS[agent].label}, the default for the agent chosen)` });
|
|
405
|
+
detail: `not set → ${pairWords(to)} (${AGENT_PRESETS[agent].label}, ${door.kind === "detected" ? "the default for the agent found signed in on this computer" : "the default for the agent chosen"})` });
|
|
402
406
|
rows++;
|
|
403
407
|
}
|
|
408
|
+
if (door.kind === "detected")
|
|
409
|
+
store.recordInstallationFact(FIRST_TASK_AGENT_FACT, agent, now);
|
|
404
410
|
const checked = checkScope(store, null);
|
|
405
411
|
if (checked.kind !== "ok") {
|
|
406
412
|
store.handle.exec("ROLLBACK TO default_routing");
|
package/dist/needs-you.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const STORAGE_HOLD_PREFIX = "protected-storage — ";
|
|
2
|
-
export const START_BUILDER_HREF = "/start
|
|
3
|
-
export const startBuilderHref = (taskId) => taskId === null ? START_BUILDER_HREF :
|
|
2
|
+
export const START_BUILDER_HREF = "/settings/computers?section=start";
|
|
3
|
+
export const startBuilderHref = (taskId) => taskId === null ? START_BUILDER_HREF : `/settings/computers?task=${encodeURIComponent(taskId)}§ion=start`;
|
|
4
4
|
export const START_BUILDER_COMMAND = "toolroll up";
|
|
5
5
|
const always = () => true;
|
|
6
6
|
const build = (context) => context.build == null ? "the last build" : `build #${context.build}`;
|
|
@@ -14,7 +14,7 @@ export const NEEDS = {
|
|
|
14
14
|
"stop-unproven": { sentence: context => `Toolroll can't prove ${build(context)} stopped from this computer, so the work is held. Close anything of yours that is using its folder, then check again.`, action: { code: "recheck-stopped", label: "Check again" } },
|
|
15
15
|
hold: { sentence: () => "A hold is keeping this task from starting. Review it to release it.", action: { code: "inspect-hold", label: "Review hold" } },
|
|
16
16
|
storage: { sentence: () => "Toolroll couldn't finish checking other apps' data before starting. Allow it in Privacy & Security, then try again.", action: { code: "unhold", label: "Try again" }, useReason: always },
|
|
17
|
-
"choose-project": { sentence: () => "Choose a project so
|
|
17
|
+
"choose-project": { sentence: () => "Choose a project so it can start.", action: { code: "place-task", label: "Choose a project" } },
|
|
18
18
|
"define-task": { sentence: () => "Say what the task should do so it can be planned.", action: { code: "write-scope", label: "Define the task" } },
|
|
19
19
|
"fix-request": { sentence: () => "The request can't be planned as written. Edit it so the planner can start.", action: { code: "write-scope", label: "Edit the request" },
|
|
20
20
|
useReason: reason => /the planner can carry at most/.test(reason) },
|
package/dist/nightly-github.js
CHANGED
|
@@ -796,7 +796,7 @@ export function nightlyNeedsYou(store, shown) {
|
|
|
796
796
|
for (const failure of openFailures(store, repo)) {
|
|
797
797
|
needs.push({ key: `github-nightly-${failure.id}`, repo, title: `Nightly checks failed: ${laneName(store, repo, failure.laneId)}`,
|
|
798
798
|
reason: `On main at ${failure.sha.slice(0, 7)}. Releases wait until it passes again.`,
|
|
799
|
-
href: slug === null ? "
|
|
799
|
+
href: slug === null ? "/?view=board" : `https://github.com/${slug}/actions/runs/${failure.ghRun}/job/${failure.jobId}`, since: failure.openedAt });
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
const rows = store.handle.prepare("SELECT repo, run, sha, MIN(opened_at) AS since, COUNT(*) AS n FROM main_check_failure WHERE cleared_at IS NULL GROUP BY repo, run, sha ORDER BY since").all();
|
|
@@ -809,7 +809,7 @@ export function nightlyNeedsYou(store, shown) {
|
|
|
809
809
|
const items = store.handle.prepare("SELECT item FROM main_check_failure WHERE repo = ? AND run = ? AND cleared_at IS NULL ORDER BY item").all(repo, Number(row["run"])).map(one => String(one["item"]));
|
|
810
810
|
needs.push({ key: `main-check-${Number(row["run"])}`, repo, title: `Nightly check of main failed: ${failureSummary(items)}`,
|
|
811
811
|
reason: `On main at ${String(row["sha"]).slice(0, 7)}. Composed releases wait until a full check passes.`,
|
|
812
|
-
href: task === null ? "
|
|
812
|
+
href: task === null ? "/?view=board" : `/t/${encodeURIComponent(task)}`, since: String(row["since"]) });
|
|
813
813
|
}
|
|
814
814
|
return needs.sort((a, b) => a.since.localeCompare(b.since));
|
|
815
815
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { envTwins } from "./names.js";
|
|
3
|
+
import { outboundPrivate, safeWords } from "./outbound-privacy.js";
|
|
4
|
+
export function notificationCommandEnv(row) {
|
|
5
|
+
const withheld = outboundPrivate([row.subject, row.body]);
|
|
6
|
+
return {
|
|
7
|
+
...envTwins("KIND", row.kind),
|
|
8
|
+
...envTwins("SUBJECT", withheld ? safeWords({ project: row.project }) : row.subject),
|
|
9
|
+
...envTwins("BODY", withheld ? "" : row.body),
|
|
10
|
+
...envTwins("DEDUPE_KEY", row.dedupeKey),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
2
13
|
export function notificationDestination(kind, target) {
|
|
3
14
|
return `${kind}:${createHash("sha256").update(target).digest("hex")}`;
|
|
4
15
|
}
|
package/dist/operate.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { FLEXIBLE_CANDIDATE_FIXED, FLEXIBLE_FILED_PREFIX, flexibleMergeRefusal } from "./flexible-merge-guard.js";
|
|
2
|
+
import { flexibleArmedPass } from "./flexible-ship.js";
|
|
1
3
|
import { runCardCommand } from "./card-cli.js";
|
|
2
4
|
import { mintSecret } from "./secret-mint.js";
|
|
3
5
|
import { ACP_AGENTS, ACP_PROVIDER_IDS, isAcpProvider, isKeyedProvider } from "./acp-agents.js";
|
|
4
6
|
import { inspectAcpAgent } from "./acp-inspect.js";
|
|
5
7
|
import { runAcpChecks } from "./acp-check.js";
|
|
6
8
|
import { verifyLaunch } from "./acp-attest.js";
|
|
7
|
-
import { notificationClaimHeld, claimNotifications, finalizeNotification, notificationDestination } from "./notification-delivery.js";
|
|
9
|
+
import { notificationClaimHeld, claimNotifications, finalizeNotification, notificationCommandEnv, notificationDestination } from "./notification-delivery.js";
|
|
8
10
|
import { adapterPolicy } from "./server/route-policy.js";
|
|
9
11
|
import { UNSENT_REPLY_MS } from "./telegram-settings.js";
|
|
10
12
|
import { checkPublicCommand } from "./public-check.js";
|
|
@@ -87,6 +89,7 @@ import { scheduledTidy } from "./memory-tidy.js";
|
|
|
87
89
|
import { CI_READ_EVERY_MS, ciCursorKey, ciRepositoriesOf, observeCiAttempts } from "./flaky-ci.js";
|
|
88
90
|
import { runKnowledgeApply, runKnowledgeCommand } from "./knowledge-cli.js";
|
|
89
91
|
import { FLOWS_VALUE_FLAGS, runFlowsCommand } from "./flows-cli.js";
|
|
92
|
+
import { approvalSummaryFor, approvalSummaryOf, describeScope, summaryContextOf } from "./approval-summary.js";
|
|
90
93
|
import { runAssignmentCommand } from "./assignment-adapters.js";
|
|
91
94
|
import { applyProjectProfile, runProjectCommand } from "./project-cli.js";
|
|
92
95
|
import { passwordFreeOwner, passwordFreeShell, passwordFreeShellWords, proveTaskBuildsStopped, pullRequestLines, runLocalCompletion, runLocalRevision, runTaskMergeCommand, runTaskOutcomeCommand } from "./task-outcome-cli.js";
|
|
@@ -109,7 +112,7 @@ import { addRepos, removeRepos, updateRepos, loadRepos, loadProjectRegistry, upd
|
|
|
109
112
|
import { deleteProject, holdingsWords, projectHoldings, projectRunning } from "./project-delete.js";
|
|
110
113
|
import { pushPass } from "./push.js";
|
|
111
114
|
import { chmodSync, closeSync, constants as fsConstants, existsSync, fstatSync, fsyncSync, mkdirSync, openSync, readFileSync, readSync, realpathSync, renameSync, unlinkSync, writeSync, writeFileSync } from "node:fs";
|
|
112
|
-
import { BRANCH_PREFIX,
|
|
115
|
+
import { BRANCH_PREFIX, envValue, existingOrFirst, taskBranches } from "./names.js";
|
|
113
116
|
import { claimActor, currentActor, withActor } from "./actor.js";
|
|
114
117
|
import { parseLeadToken } from "./api-tokens.js";
|
|
115
118
|
import { MAX_NETWORK_HOSTS, normalizeHost } from "./egress.js";
|
|
@@ -166,7 +169,7 @@ function planContractLines(store, evidenceRoot, taskId) {
|
|
|
166
169
|
}
|
|
167
170
|
import { verdictWords as proofVerdictWords, matrixWords, plainReasonWords, semanticCoverage, coverageWords } from "./proof.js";
|
|
168
171
|
import { probeRepo } from "./probe.js";
|
|
169
|
-
import { agentlessFirstRun, diagnoseTaskDispatch, diagnosisIsDispatchable, NO_AGENT_TITLE, scopeApprovedForDispatch, } from "./dispatch.js";
|
|
172
|
+
import { agentlessFirstRun, buildersFor, diagnoseTaskDispatch, diagnosisIsDispatchable, NO_AGENT_TITLE, scopeApprovedForDispatch, } from "./dispatch.js";
|
|
170
173
|
import { createDecisionServer, SIGN_IN_LINK_MS } from "./serve.js";
|
|
171
174
|
import { readTailnetNames } from "./tailnet.js";
|
|
172
175
|
import { daemonLaunchCommand, daemonStatus, installReplacingLegacy, installedLegacyDaemon, planDaemon, uninstallDaemon, awaitFreshHeartbeat, } from "./daemon.js";
|
|
@@ -200,7 +203,7 @@ import { serveMcp } from "./mcp.js";
|
|
|
200
203
|
import { createInterface } from "node:readline";
|
|
201
204
|
import { hashPassword } from "./scope.js";
|
|
202
205
|
import { noticeDueOnce, CONTAINMENT_NOTICE_FACT, passwordResetRefusal, resetAccountPassword } from "./store.js";
|
|
203
|
-
import { propose, approve, addApprover, authenticateAccount, authenticateApprover as passwordApprover,
|
|
206
|
+
import { propose, approve, addApprover, authenticateAccount, authenticateApprover as passwordApprover, approvalOf, hashToken as hashApproverToken, modeFilingCoverage, acceptanceLinesToInput, parseAcceptanceCriteria, splitAcceptanceRubric, rubricIsPlaceholder, isCommitSha, credentialProof, rememberedLogin, personApprovalOf } from "./scope.js";
|
|
204
207
|
import { CHAT_APPROVE_ALL, presetTerms, modeTermsJson, modeDigestOf, modeTermsFromJson, modeWords, MODE_MAX_DAYS } from "./modes.js";
|
|
205
208
|
import { WorktreePool } from "./worktree.js";
|
|
206
209
|
import { baseStandingWords, freshBaseFor, taskBaseOf } from "./task-base.js";
|
|
@@ -232,7 +235,7 @@ import { fileGithubItem, readGithubItem } from "./github-import.js";
|
|
|
232
235
|
import { runRelease } from "./release.js";
|
|
233
236
|
import { releaseAdapters } from "./release-adapters.js";
|
|
234
237
|
import { routeChangeOf, routeLegacyPlans } from "./route-change.js";
|
|
235
|
-
import {
|
|
238
|
+
import { sessionStandsIn } from "./install-mode.js";
|
|
236
239
|
import { parseDemoUrl, projectDemoUrl, saveProjectDemo } from "./project-demo.js";
|
|
237
240
|
import { effectiveConcurrency, maySlotTake, parseProjectConcurrency, PROJECT_CONCURRENCY_DEFAULT, ProjectPasses, projectConcurrency, saveProjectConcurrency, savedProjectConcurrency } from "./project-concurrency.js";
|
|
238
241
|
import { activeWebhookTargets, webhookPass, LEGACY_WEBHOOK_WARNING, loadWebhookTargets, effectivePrimary, isMessagingChannel, loadConsoleUrl, phoneOrigin, readUpConsoleUrl, saveConsoleUrl, savePrimary, UP_CONSOLE_FILE } from "./webhooks.js";
|
|
@@ -263,6 +266,8 @@ import { latestRelease, newerRelease, notifySecurityRelease, notifyVersionLive,
|
|
|
263
266
|
import { installMethod } from "./install-method.js";
|
|
264
267
|
import { PACKAGE_VERSION } from "./version.js";
|
|
265
268
|
import { machineActing } from "./scope.js";
|
|
269
|
+
import { FLEXIBLE_AVAILABLE } from "./flexible-available.js";
|
|
270
|
+
import { enableFlexible, FLEXIBLE_LAPSE_WORDS, FLEXIBLE_LEVEL_WORDS, FLEXIBLE_UNAVAILABLE, flexibleStanding, flexibleTermsWords, isFlexibleLevel, lowerFlexible, proposedFlexibleTerms, turnFlexibleOff } from "./flexible.js";
|
|
266
271
|
import { reevaluateResultRecords } from "./route-results.js";
|
|
267
272
|
import { holdRuleOff, routeRulesPass, taskEvidenceWords } from "./route-rules.js";
|
|
268
273
|
import { ruleHoldOf } from "./route-store.js";
|
|
@@ -445,7 +450,7 @@ External trackers — build what a tracker nominates, under local approvals
|
|
|
445
450
|
toolroll task scope <id> --goal <what success is>
|
|
446
451
|
[--not <text>] [--touches a,b] [--budget-usd <n>]
|
|
447
452
|
toolroll task approve <id> the yes — interactive, or
|
|
448
|
-
--yes --digest <d> --as <you> --token <t>
|
|
453
|
+
--yes --digest <d> --terms <key> --as <you> --token <t>
|
|
449
454
|
toolroll task requeue <id> --as <you> --token <t>
|
|
450
455
|
exit a stall: incidents resolved,
|
|
451
456
|
strikes cleared, queued again
|
|
@@ -706,7 +711,7 @@ export const SECRET_VALUE_FLAGS = new Set(["token", "password"]);
|
|
|
706
711
|
export const OPERATE_VALUE_FLAGS = new Set([
|
|
707
712
|
"key", "db", "runner", "ttl", "state", "flow", "on", "reason", "until", "id", "backend", "build", "from",
|
|
708
713
|
"allow", "selector", "paths", "credentials", "repo", "token", "capacity", "agents",
|
|
709
|
-
"goal", "not", "touches", "acceptance", "candidate", "by", "digest", "as", "branch", "pool", "base", "model", "turns",
|
|
714
|
+
"goal", "not", "touches", "acceptance", "candidate", "by", "digest", "terms", "as", "branch", "pool", "base", "model", "turns",
|
|
710
715
|
"max", "cap", "probe", "kind", "expires", "cmd", "since", "repair-model",
|
|
711
716
|
"choose", "choice", "claim", "revision", "note", "max-open-decisions", "name", "days", "publication", "auto-approve", "review-auto", "port", "host", "allow-host",
|
|
712
717
|
"for", "tick-every", "bridge-every", "reconcile-every", "incarnation",
|
|
@@ -734,6 +739,7 @@ export const OPERATE_VALUE_FLAGS = new Set([
|
|
|
734
739
|
"token-name",
|
|
735
740
|
"request",
|
|
736
741
|
"read-deny", "mach",
|
|
742
|
+
"default",
|
|
737
743
|
"release",
|
|
738
744
|
"despite",
|
|
739
745
|
]);
|
|
@@ -1160,6 +1166,8 @@ async function dispatch(command, positional, flags, context) {
|
|
|
1160
1166
|
return projectCheckAccessCommand(positional, flags, context);
|
|
1161
1167
|
if (positional[0] === "sandbox")
|
|
1162
1168
|
return projectSandboxCommand(positional, flags, context);
|
|
1169
|
+
if (positional[0] === "flexible")
|
|
1170
|
+
return projectFlexibleCommand(positional, flags, context);
|
|
1163
1171
|
if (positional[0] === "checks")
|
|
1164
1172
|
return projectChecksCommand(positional, flags, context);
|
|
1165
1173
|
if (positional[0] === "demo")
|
|
@@ -3443,7 +3451,7 @@ async function startConsole(options) {
|
|
|
3443
3451
|
stopMonitoring,
|
|
3444
3452
|
startBudgetAlerts(context.store),
|
|
3445
3453
|
startTokenNotices(context.store),
|
|
3446
|
-
startSignInProbes(context.store, createConnectionChecker()),
|
|
3454
|
+
startSignInProbes(context.store, createConnectionChecker({ store: context.store })),
|
|
3447
3455
|
startBackups(context.store, context.databaseFile),
|
|
3448
3456
|
startCodexLimits(context.store),
|
|
3449
3457
|
startUpdateChecks(context.store, dirname(context.databaseFile), PACKAGE_VERSION, installMethod(context.installBin).updateCommand, context.releaseIo ?? {}),
|
|
@@ -3853,10 +3861,20 @@ async function agentsCommand(positional, flags, context) {
|
|
|
3853
3861
|
const latest = store.acpChecksFor(id, 1)[0] ?? null;
|
|
3854
3862
|
return { provider: id, name: ACP_AGENTS[id].name, installed: seen.found ? seen.realpath : null, checked, latestCheck: latest === null ? null : { id: latest.id, state: latest.state, model: latest.model, result: latest.result } };
|
|
3855
3863
|
});
|
|
3864
|
+
const { detectAgents, detectionReport } = await import("./agent-detect.js");
|
|
3865
|
+
const { agentsReadOf } = await import("./engine-reads.js");
|
|
3866
|
+
const { acpCheckedHere, firstTaskRouted } = await import("./welcome-facts.js");
|
|
3867
|
+
const detection = await detectAgents({ routed: firstTaskRouted(store), acpChecked: acpCheckedHere(store), store,
|
|
3868
|
+
...(context.easySeams?.check === undefined ? {} : { check: context.easySeams.check }) });
|
|
3869
|
+
const { version: _version, ...detected } = agentsReadOf(detection);
|
|
3856
3870
|
if (json) {
|
|
3857
|
-
write(envelopeJson({ ok: true, command: "agents", agents: rows }));
|
|
3871
|
+
write(envelopeJson({ ok: true, command: "agents", detected: { ...detected, tookMs: detection.tookMs }, agents: rows }));
|
|
3858
3872
|
return EXIT.ok;
|
|
3859
3873
|
}
|
|
3874
|
+
for (const line of detectionReport(detection))
|
|
3875
|
+
write(line);
|
|
3876
|
+
write("");
|
|
3877
|
+
write("Checks (agents that run over ACP)");
|
|
3860
3878
|
for (const row of rows) {
|
|
3861
3879
|
write(` ${row.name.padEnd(10)} ${row.installed === null ? "not installed" : row.installed}`);
|
|
3862
3880
|
for (const one of row.checked)
|
|
@@ -5469,6 +5487,18 @@ async function runWatchLoop(args) {
|
|
|
5469
5487
|
reconciliationReady = true;
|
|
5470
5488
|
if (recovered)
|
|
5471
5489
|
wakes.poke();
|
|
5490
|
+
if (!stopping()) {
|
|
5491
|
+
try {
|
|
5492
|
+
const shipped = await flexibleArmedPass(store, { root: context.evidenceRoot, ...(context.publishExec === undefined ? {} : { exec: context.publishExec }) });
|
|
5493
|
+
if (shipped.ok && shipped.merged > 0)
|
|
5494
|
+
progress(`watch: merged ${shipped.merged} Flexible result(s) whose checks passed`);
|
|
5495
|
+
if (shipped.ok && shipped.cancelled > 0)
|
|
5496
|
+
progress(`watch: stopped ${shipped.cancelled} Flexible merge(s) whose terms no longer held`);
|
|
5497
|
+
}
|
|
5498
|
+
catch (error) {
|
|
5499
|
+
progress(`watch: the Flexible ship pass failed — ${describe(error)}; retrying on its next interval`);
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5472
5502
|
if (!stopping() && store.openedPublications().length > 0) {
|
|
5473
5503
|
try {
|
|
5474
5504
|
const checks = await observeChecks(store, {
|
|
@@ -6047,7 +6077,7 @@ async function onboardCommand(flags, context) {
|
|
|
6047
6077
|
const loginFile = savedLoginFile(dirname(context.databaseFile));
|
|
6048
6078
|
const gitRun = context.gitRunner ?? ((file, args, opts) => run(file, [...args], { ...(opts?.cwd === undefined ? {} : { cwd: opts.cwd }), timeoutMs: 10_000 }));
|
|
6049
6079
|
const registryPath = registryPathOf(context);
|
|
6050
|
-
const checker = createConnectionChecker({ home, env });
|
|
6080
|
+
const checker = createConnectionChecker({ home, env, store: context.store });
|
|
6051
6081
|
const code = await runOnboard({
|
|
6052
6082
|
write,
|
|
6053
6083
|
json,
|
|
@@ -6869,7 +6899,7 @@ async function publishCommand(positional, flags, context) {
|
|
|
6869
6899
|
return EXIT.refused;
|
|
6870
6900
|
}
|
|
6871
6901
|
const acting = await askCredentials(flags, context);
|
|
6872
|
-
const verified = acting === null ? null :
|
|
6902
|
+
const verified = acting === null ? null : credentialApprover(store, acting.name, acting.token, repo);
|
|
6873
6903
|
if (acting === null || !verified?.ok)
|
|
6874
6904
|
return refuseApprover(context, "publish setup", verified, "turning on pull requests takes --as <you> --token <your password>", acting?.name);
|
|
6875
6905
|
savePublishing(store, plan, acting.name, settings, clock());
|
|
@@ -6918,7 +6948,7 @@ async function publishCommand(positional, flags, context) {
|
|
|
6918
6948
|
return EXIT.refused;
|
|
6919
6949
|
}
|
|
6920
6950
|
const acting = await askCredentials(flags, context);
|
|
6921
|
-
const verified = acting === null ? null :
|
|
6951
|
+
const verified = acting === null ? null : credentialApprover(store, acting.name, acting.token);
|
|
6922
6952
|
if (acting === null || !verified?.ok)
|
|
6923
6953
|
return refuseApprover(context, "publish grant", verified, "granting takes --as <you> --token <your password> — pushing your repos is a person's yes", acting?.name);
|
|
6924
6954
|
const { name: asWho, token } = acting;
|
|
@@ -6968,6 +6998,9 @@ async function publishCommand(positional, flags, context) {
|
|
|
6968
6998
|
const publication = store.openedPublications().find(one => one.prNumber === pr);
|
|
6969
6999
|
if (publication === undefined)
|
|
6970
7000
|
return fail(write, json, `publish ${action}`, "unknown", `no open publication holds PR #${pr}`, EXIT.refused);
|
|
7001
|
+
const flexibleHold = flexibleMergeRefusal(store, store.refForId(publication.taskRef)?.externalId ?? null, action === "merge" ? "publish-merge" : "publish-refire");
|
|
7002
|
+
if (flexibleHold !== null)
|
|
7003
|
+
return fail(write, json, `publish ${action}`, "flexible", flexibleHold, EXIT.refused);
|
|
6971
7004
|
const intent = store.mergeIntentFor(publication.id);
|
|
6972
7005
|
if (intent === null)
|
|
6973
7006
|
return fail(write, json, `publish ${action}`, "no-intent", `PR #${pr} has no merge intent yet — the sweep writes one when a merge-capable grant covers it`, EXIT.refused);
|
|
@@ -7139,12 +7172,7 @@ async function outboxCommand(positional, flags, context) {
|
|
|
7139
7172
|
}
|
|
7140
7173
|
const sent = await run("sh", ["-lc", command], {
|
|
7141
7174
|
timeoutMs: 30_000,
|
|
7142
|
-
env:
|
|
7143
|
-
...envTwins("KIND", one.kind),
|
|
7144
|
-
...envTwins("SUBJECT", one.subject),
|
|
7145
|
-
...envTwins("BODY", one.body),
|
|
7146
|
-
...envTwins("DEDUPE_KEY", one.dedupeKey),
|
|
7147
|
-
},
|
|
7175
|
+
env: notificationCommandEnv(one),
|
|
7148
7176
|
});
|
|
7149
7177
|
if (sent.code === 0) {
|
|
7150
7178
|
const receipt = sent.stdout.split("\n")[0]?.trim() ?? "";
|
|
@@ -7385,7 +7413,7 @@ async function integrationIoFor(context) {
|
|
|
7385
7413
|
env: process.env,
|
|
7386
7414
|
repos,
|
|
7387
7415
|
gh: (file, args, options) => run(file, [...args], options),
|
|
7388
|
-
checkConnection: createConnectionChecker(),
|
|
7416
|
+
checkConnection: createConnectionChecker({ store: context.store }),
|
|
7389
7417
|
clock: context.clock,
|
|
7390
7418
|
...seams,
|
|
7391
7419
|
};
|
|
@@ -7671,13 +7699,32 @@ async function addTask(positional, flags, context) {
|
|
|
7671
7699
|
return fail(write, json, "task add", "checks-fixed", chosen.message, EXIT.refused);
|
|
7672
7700
|
}
|
|
7673
7701
|
const link = consoleLinkFor(context, `/t/${encodeURIComponent(outcome.task.id)}`);
|
|
7702
|
+
let noAgent = null;
|
|
7703
|
+
const filedRef = placedIn === undefined || remote !== null ? null : store.lookupRef(outcome.task.id);
|
|
7704
|
+
if (filedRef !== null && filedRef.repo !== null) {
|
|
7705
|
+
try {
|
|
7706
|
+
const agentless = agentlessFirstRun(store, filedRef, true, buildersFor(store, filedRef.repo, now).alive.map(one => one.name));
|
|
7707
|
+
if (agentless !== null)
|
|
7708
|
+
noAgent = `${NO_AGENT_TITLE}. Run \`${agentless.command}\` so it can be planned.`;
|
|
7709
|
+
}
|
|
7710
|
+
catch {
|
|
7711
|
+
noAgent = null;
|
|
7712
|
+
}
|
|
7713
|
+
}
|
|
7714
|
+
const next = filedRef !== null && filedRef.repo !== null && filedRef.plan === null && !flags.has("report")
|
|
7715
|
+
? "Next: open `toolroll` and press p on it to ask for its plan." : null;
|
|
7674
7716
|
return succeed(write, json, "task add", {
|
|
7675
7717
|
task: outcome.task,
|
|
7676
7718
|
...(replaces === undefined ? {} : { replaces }),
|
|
7677
7719
|
repo: placedIn === undefined ? null : resolve(placedIn),
|
|
7678
7720
|
...(checks === undefined ? {} : { checks }),
|
|
7679
7721
|
...(link === null ? {} : { links: { task: link } }),
|
|
7680
|
-
|
|
7722
|
+
...(noAgent === null ? {} : { waiting: noAgent }),
|
|
7723
|
+
...(next === null ? {} : { next }),
|
|
7724
|
+
}, () => [`Queued ${outcome.task.id} — ${outcome.task.title}${flags.has("report") ? " (a scout task: it delivers a report)" : ""}${checks === undefined ? "" : ` · checks: ${CHECK_LEVEL_WORDS[checks]}`}`, ...(replaces === undefined ? [] : [` It replaces ${replaces}.`]), ...(noAgent === null ? [] : [` ${noAgent}`]),
|
|
7725
|
+
...(placedIn === undefined && remote === null ? [" It has no project yet: choose one on its page in Toolroll, or file it with `--repo <folder>`."] : []),
|
|
7726
|
+
...(next === null ? [] : [` ${next}`]),
|
|
7727
|
+
...(link === null ? [] : [` ${link}`])]);
|
|
7681
7728
|
}
|
|
7682
7729
|
function latestBuildResult(store, taskId) {
|
|
7683
7730
|
const family = store.taskFamilyOf(taskId, null, true);
|
|
@@ -7994,6 +8041,7 @@ function showTask(positional, context) {
|
|
|
7994
8041
|
pullRequest: newestPullRequestOf(store, store.taskFamilyOf(id, null, true)?.versions.map(one => one.id) ?? [id]),
|
|
7995
8042
|
steering: store.listSteerNotes(ref.id).map(one => ({ id: one.id, author: one.author, createdAt: one.createdAt, note: one.note,
|
|
7996
8043
|
standing: steerStandingOf(one, steeringLive), words: steerStandingWords(one, steeringLive, utcMinute) })),
|
|
8044
|
+
approvalTerms: scope === null ? null : approvalSummaryOf(scope, summaryContextOf(store, id, scope, now)).key,
|
|
7997
8045
|
};
|
|
7998
8046
|
return succeed(write, json, "task show", detail, () => [
|
|
7999
8047
|
`${task.id} ${task.state}${ref.deliverable === "report" ? " (scout — delivers a report)" : ""}`,
|
|
@@ -8040,8 +8088,8 @@ function showTask(positional, context) {
|
|
|
8040
8088
|
: [` control: review #${detail.control.run} was stopped by ${detail.control.stop.requestedBy} — inspect its saved result and give feedback; separate model review has been removed`]),
|
|
8041
8089
|
...(detail.automaticReview === null ? reviewStatusLines(detail.review, latestFinished?.id ?? null) : buildReviewLines(detail.automaticReview)),
|
|
8042
8090
|
...(scope === null
|
|
8043
|
-
? [" no
|
|
8044
|
-
: describeScope(scope, readiness, taskEvidenceWords(store, task.id, now))),
|
|
8091
|
+
? [" no plan yet — nothing is built until one is written and approved"]
|
|
8092
|
+
: describeScope(scope, readiness, taskEvidenceWords(store, task.id, now), summaryContextOf(store, task.id, scope, now))),
|
|
8045
8093
|
...planContractLines(store, context.evidenceRoot, id),
|
|
8046
8094
|
...taskRouteStandingLines(id, routed, detail.dispatch?.summary === NO_AGENT_TITLE),
|
|
8047
8095
|
...detail.runs
|
|
@@ -8583,6 +8631,8 @@ async function scopeTask(positional, flags, context) {
|
|
|
8583
8631
|
return fail(write, json, "task scope", "usage", "`toolroll task scope <id> --goal <what success is> --acceptance <rubric> [--not <text>] [--touches a,b] [--candidate <commit>] [--budget-usd <n>]`", EXIT.usage);
|
|
8584
8632
|
if (store.getTask(id) === null)
|
|
8585
8633
|
return fail(write, json, "task scope", "unknown-task", `no task \`${id}\``, EXIT.refused);
|
|
8634
|
+
if (store.filedViaOf(id)?.startsWith(FLEXIBLE_FILED_PREFIX) === true)
|
|
8635
|
+
return fail(write, json, "task scope", "flexible", FLEXIBLE_CANDIDATE_FIXED, EXIT.refused);
|
|
8586
8636
|
const acceptanceGiven = text(flags, "acceptance");
|
|
8587
8637
|
if (acceptanceGiven === undefined) {
|
|
8588
8638
|
return fail(write, json, "task scope", "acceptance-required", "a scope needs at least one signed acceptance criterion — `--acceptance \"<statement>|<evidence,kinds>\"`, `;`-separated for more than one; evidence kinds are check, screenshot, changed-path, manual-review", EXIT.usage);
|
|
@@ -8704,13 +8754,13 @@ async function scopeTask(positional, flags, context) {
|
|
|
8704
8754
|
if (filed.modeRefusedCoordinator === true) {
|
|
8705
8755
|
return succeed(write, json, "task scope", { scope, approvedUnderMode: false, quarantined: true }, () => [
|
|
8706
8756
|
`Scope written for ${id} — but coordinator-filed: mode coverage cannot admit it; sign the scope.`,
|
|
8707
|
-
...describeScope(scope),
|
|
8757
|
+
...describeScope(scope, undefined, null, summaryContextOf(store, id, scope, now)),
|
|
8708
8758
|
]);
|
|
8709
8759
|
}
|
|
8710
8760
|
if (filed.sealedUnderMode) {
|
|
8711
8761
|
return succeed(write, json, "task scope", { scope, approvedUnderMode: true }, () => [
|
|
8712
8762
|
`Scope written AND approved for ${id} — your operating mode covered it; it dispatches on the next pass.`,
|
|
8713
|
-
...describeScope(scope),
|
|
8763
|
+
...describeScope(scope, undefined, null, summaryContextOf(store, id, scope, now)),
|
|
8714
8764
|
]);
|
|
8715
8765
|
}
|
|
8716
8766
|
const replanned = (store.lookupRef(id)?.planningGeneration ?? 0) > generationBefore;
|
|
@@ -8719,7 +8769,7 @@ async function scopeTask(positional, flags, context) {
|
|
|
8719
8769
|
replanned
|
|
8720
8770
|
? `Scope written for ${id}. The scope changed, so planning starts again; nothing builds until somebody approves the new plan.`
|
|
8721
8771
|
: `Scope written for ${id}. Nothing will build it until somebody approves it.`,
|
|
8722
|
-
...describeScope(scope),
|
|
8772
|
+
...describeScope(scope, undefined, null, summaryContextOf(store, id, scope, now)),
|
|
8723
8773
|
"",
|
|
8724
8774
|
` toolroll task approve ${id} --yes`,
|
|
8725
8775
|
]);
|
|
@@ -8840,6 +8890,8 @@ async function approveTask(positional, flags, context) {
|
|
|
8840
8890
|
if (store.lookupRef(id)?.plan === "requested")
|
|
8841
8891
|
return fail(write, json, "task approve", "planning", `${id} is waiting on a planner — approval is blocked until the drafted plan lands`, EXIT.refused);
|
|
8842
8892
|
let saw = text(flags, "digest");
|
|
8893
|
+
const summary = approvalSummaryOf(scope, summaryContextOf(store, id, scope, now));
|
|
8894
|
+
let shownTerms = text(flags, "terms");
|
|
8843
8895
|
let { name: asWho, token } = credentialsFrom(flags, context);
|
|
8844
8896
|
let confirmedAloud = false;
|
|
8845
8897
|
if ((!flags.has("yes") || saw === undefined || asWho === undefined || token === undefined) &&
|
|
@@ -8851,7 +8903,7 @@ async function approveTask(positional, flags, context) {
|
|
|
8851
8903
|
write(changed);
|
|
8852
8904
|
write("");
|
|
8853
8905
|
}
|
|
8854
|
-
for (const line of describeScope(scope))
|
|
8906
|
+
for (const line of describeScope(scope, undefined, null, summaryContextOf(store, id, scope, now)))
|
|
8855
8907
|
write(line);
|
|
8856
8908
|
for (const line of planContractLines(store, context.evidenceRoot, id))
|
|
8857
8909
|
write(line);
|
|
@@ -8862,6 +8914,7 @@ async function approveTask(positional, flags, context) {
|
|
|
8862
8914
|
return EXIT.refused;
|
|
8863
8915
|
}
|
|
8864
8916
|
saw ??= scope.digest;
|
|
8917
|
+
shownTerms ??= summary.key;
|
|
8865
8918
|
const acting = await askCredentials(flags, context);
|
|
8866
8919
|
if (acting === null)
|
|
8867
8920
|
return fail(write, json, "task approve", "usage", "approval needs who is agreeing", EXIT.usage);
|
|
@@ -8873,7 +8926,7 @@ async function approveTask(positional, flags, context) {
|
|
|
8873
8926
|
saw !== undefined && asWho !== undefined && token !== undefined;
|
|
8874
8927
|
if (!armed) {
|
|
8875
8928
|
if (json) {
|
|
8876
|
-
write(envelopeJson({ ok: false, command: "task approve", reason: "unconfirmed", scope }));
|
|
8929
|
+
write(envelopeJson({ ok: false, command: "task approve", reason: "unconfirmed", scope, terms: summary.key }));
|
|
8877
8930
|
return EXIT.refused;
|
|
8878
8931
|
}
|
|
8879
8932
|
write(`Would approve this, and let a builder work on ${id}:`);
|
|
@@ -8883,18 +8936,33 @@ async function approveTask(positional, flags, context) {
|
|
|
8883
8936
|
write(changed);
|
|
8884
8937
|
write("");
|
|
8885
8938
|
}
|
|
8886
|
-
for (const line of describeScope(scope))
|
|
8939
|
+
for (const line of describeScope(scope, undefined, null, summaryContextOf(store, id, scope, now)))
|
|
8887
8940
|
write(line);
|
|
8888
8941
|
for (const line of planContractLines(store, context.evidenceRoot, id))
|
|
8889
8942
|
write(line);
|
|
8890
8943
|
write("");
|
|
8891
8944
|
write("Nothing has been approved. Agree to this exact scope with:");
|
|
8892
|
-
write(` toolroll task approve ${id} --yes --digest ${scope.digest} --as <you> --token <your password>`);
|
|
8945
|
+
write(` toolroll task approve ${id} --yes --digest ${scope.digest} --terms ${summary.key} --as <you> --token <your password>`);
|
|
8893
8946
|
return EXIT.refused;
|
|
8894
8947
|
}
|
|
8895
8948
|
if (saw === undefined || asWho === undefined || token === undefined)
|
|
8896
|
-
return fail(write, json, "task approve", "usage", "approving non-interactively takes --yes --digest <d> --as <you> --token <t>", EXIT.usage);
|
|
8897
|
-
|
|
8949
|
+
return fail(write, json, "task approve", "usage", "approving non-interactively takes --yes --digest <d> --terms <key> --as <you> --token <t>", EXIT.usage);
|
|
8950
|
+
if (shownTerms === undefined) {
|
|
8951
|
+
if (json) {
|
|
8952
|
+
write(envelopeJson({ ok: false, command: "task approve", reason: "unconfirmed", message: "Name the terms you read: --terms <key>. Nothing was approved.", scope, terms: summary.key }));
|
|
8953
|
+
return EXIT.refused;
|
|
8954
|
+
}
|
|
8955
|
+
write(`Name the terms you read. Nothing was approved. ${id} would be approved on exactly this:`);
|
|
8956
|
+
write("");
|
|
8957
|
+
for (const line of describeScope(scope, undefined, null, summaryContextOf(store, id, scope, now)))
|
|
8958
|
+
write(line);
|
|
8959
|
+
write("");
|
|
8960
|
+
write(` toolroll task approve ${id} --yes --digest ${scope.digest} --terms ${summary.key} --as <you> --token <your password>`);
|
|
8961
|
+
return EXIT.refused;
|
|
8962
|
+
}
|
|
8963
|
+
const terms = shownTerms;
|
|
8964
|
+
const approved = store.transact(() => terms !== undefined && approvalSummaryFor(store, id, now)?.key !== terms ? { ok: false, reason: "changed" }
|
|
8965
|
+
: approve(store, id, asWho, now, saw, token, mutationFrom(flags, now)));
|
|
8898
8966
|
if (!approved.ok) {
|
|
8899
8967
|
if (approved.reason === "policy")
|
|
8900
8968
|
return fail(write, json, "task approve", "policy", `${id}: ${approved.message}`, EXIT.refused);
|
|
@@ -8902,7 +8970,7 @@ async function approveTask(positional, flags, context) {
|
|
|
8902
8970
|
}
|
|
8903
8971
|
return succeed(write, json, "task approve", { scope: approved.scope }, () => [
|
|
8904
8972
|
`Approved. A builder may now work on ${id}, within this scope:`,
|
|
8905
|
-
...describeScope(approved.scope),
|
|
8973
|
+
...describeScope(approved.scope, undefined, null, summaryContextOf(store, id, approved.scope, now)),
|
|
8906
8974
|
]);
|
|
8907
8975
|
}
|
|
8908
8976
|
function describeApproveFailure(reason, id) {
|
|
@@ -11798,7 +11866,7 @@ async function newTaskCommand(positional, flags, context) {
|
|
|
11798
11866
|
if (local === null && (json || !personAtTerminal(context)))
|
|
11799
11867
|
return fail(write, json, command, "person-only", "`task new` asks a person at a terminal. Use `task add` from a script or an agent.", EXIT.refused);
|
|
11800
11868
|
const { name, token } = credentialsFrom(flags, context);
|
|
11801
|
-
const passwordFree = token !== undefined && (local !== null ||
|
|
11869
|
+
const passwordFree = token !== undefined && (local !== null || sessionStandsIn(store));
|
|
11802
11870
|
const facts = { passwordless: local === null && passwordFree, localOwner: local !== null, freshAt: null, returnTo: "/" };
|
|
11803
11871
|
const buildNow = (preview, digest) => fastStartBuild(store, { preview, digest, actor: name ?? "", via: local === null ? "cli" : "terminal-ui", password: facts,
|
|
11804
11872
|
approveNow: (taskId, sawDigest, fast) => approve(store, taskId, name ?? "", clock(), sawDigest, token ?? "", {}, fast) }, clock());
|
|
@@ -12491,3 +12559,87 @@ function shellCallerFacts(context) {
|
|
|
12491
12559
|
terminal: context.easySeams?.terminal ?? (process.stdin.isTTY === true && process.stdout.isTTY === true),
|
|
12492
12560
|
};
|
|
12493
12561
|
}
|
|
12562
|
+
async function projectFlexibleCommand(positional, flags, context) {
|
|
12563
|
+
const action = positional[1] ?? "show";
|
|
12564
|
+
const command = `project flexible ${action}`;
|
|
12565
|
+
const { write, json } = context;
|
|
12566
|
+
if (!FLEXIBLE_AVAILABLE)
|
|
12567
|
+
return fail(write, json, command, "not-available", FLEXIBLE_UNAVAILABLE, EXIT.refused);
|
|
12568
|
+
const options = { show: [], enable: ["max", "default", "digest"], lower: ["max"], off: [] };
|
|
12569
|
+
const own = options[action];
|
|
12570
|
+
if (own === undefined || positional.length > 2)
|
|
12571
|
+
return fail(write, json, command, "usage", "Use project flexible [show | enable [--max <level>] [--default <level>] [--digest <d>] | lower --max <level> | off] --repo <project path>.", EXIT.usage);
|
|
12572
|
+
const allowed = new Set(["repo", "db", "json", ...own, ...(action === "show" ? [] : ["as", "token", "token-file", "token-env"])]);
|
|
12573
|
+
for (const name of flags.keys())
|
|
12574
|
+
if (!allowed.has(name))
|
|
12575
|
+
return fail(write, json, command, "usage", `--${name} is not a project flexible ${action} option.`, EXIT.usage);
|
|
12576
|
+
const repoFlag = text(flags, "repo");
|
|
12577
|
+
if (repoFlag === undefined)
|
|
12578
|
+
return fail(write, json, command, "usage", "Name the project with --repo <path>.", EXIT.usage);
|
|
12579
|
+
const level = (name) => { const value = text(flags, name); return value === undefined ? undefined : isFlexibleLevel(value) ? value : null; };
|
|
12580
|
+
const max = level("max"), chosenDefault = level("default");
|
|
12581
|
+
if (max === null || chosenDefault === null)
|
|
12582
|
+
return fail(write, json, command, "usage", "A level is supervised, auto or full.", EXIT.usage);
|
|
12583
|
+
const repo = await knownProject(context, repoFlag, { listed: true, canonical: true });
|
|
12584
|
+
if (repo === undefined)
|
|
12585
|
+
return fail(write, json, command, "not-found", "That isn't a project Toolroll knows.", EXIT.refused);
|
|
12586
|
+
const store = context.store;
|
|
12587
|
+
const termsLines = (terms, digest) => [...flexibleTermsWords(terms), `Terms ${digest}`];
|
|
12588
|
+
const shown = (standing) => {
|
|
12589
|
+
if (standing.state === "secure")
|
|
12590
|
+
return { data: { state: "secure" }, lines: [`${repo}: Secure. Work is planned and approved before it starts.`] };
|
|
12591
|
+
if (standing.state === "unreadable")
|
|
12592
|
+
return { data: { state: "unreadable" }, lines: [`${repo}: its Flexible terms can't be read, so they allow nothing. Turn Flexible off, then on again.`] };
|
|
12593
|
+
const data = { state: standing.state, digest: standing.digest, terms: standing.terms, signedBy: standing.signedBy, signedAt: standing.signedAt, ...(standing.state === "lapsed" ? { lapse: standing.reason } : {}) };
|
|
12594
|
+
if (standing.state === "lapsed")
|
|
12595
|
+
return { data, lines: [`${repo}: Flexible terms no longer count. ${FLEXIBLE_LAPSE_WORDS[standing.reason]} Turn it on again to sign new terms.`] };
|
|
12596
|
+
return { data, lines: [`${repo}: Flexible, turned on by ${standing.signedBy}.`, ...termsLines(standing.terms, standing.digest)] };
|
|
12597
|
+
};
|
|
12598
|
+
if (action === "show") {
|
|
12599
|
+
const now = shown(flexibleStanding(store, repo));
|
|
12600
|
+
return succeed(write, json, command, { repo, flexible: now.data }, () => now.lines);
|
|
12601
|
+
}
|
|
12602
|
+
const refused = (message) => fail(write, json, command, "person-only", message, EXIT.refused);
|
|
12603
|
+
if (machineActing() || process.env["TOOLROLL_LEAD_TOKEN"] !== undefined || process.env["TOOLROLL_REMOTE_TOKEN"] !== undefined)
|
|
12604
|
+
return refused("Only a person changes a project's Flexible terms, never the lead, a token or a chat app.");
|
|
12605
|
+
const acting = await askCredentials(flags, context);
|
|
12606
|
+
if (acting === null)
|
|
12607
|
+
return refused(`${action === "enable" ? "Turning on Flexible needs your password" : "This needs your sign-in"}: pass --as and --token.`);
|
|
12608
|
+
if (action === "enable") {
|
|
12609
|
+
const proved = credentialApprover(store, acting.name, acting.token, repo);
|
|
12610
|
+
if (!proved.ok)
|
|
12611
|
+
return refused("Only an approver of this project, with their password typed now, turns on Flexible.");
|
|
12612
|
+
const choice = { ...(max === undefined ? {} : { max }), ...(chosenDefault === undefined ? {} : { default: chosenDefault }) };
|
|
12613
|
+
const proposed = proposedFlexibleTerms(store, repo, acting.name, choice);
|
|
12614
|
+
if (!proposed.ok)
|
|
12615
|
+
return fail(write, json, command, proposed.reason, proposed.message, EXIT.refused);
|
|
12616
|
+
let digest = text(flags, "digest");
|
|
12617
|
+
if (digest === undefined) {
|
|
12618
|
+
if (!interactive() || json)
|
|
12619
|
+
return fail(write, json, command, "review-terms", [...termsLines(proposed.terms, proposed.digest), `Read these terms, then run again with --digest ${proposed.digest} to agree to them. Nothing changed.`].join("\n"), EXIT.refused, { digest: proposed.digest, terms: proposed.terms });
|
|
12620
|
+
write(termsLines(proposed.terms, proposed.digest).join("\n"));
|
|
12621
|
+
if (!(await confirm("Turn on Flexible with these terms? [y/N] ")))
|
|
12622
|
+
return fail(write, json, command, "declined", "Nothing changed.", EXIT.refused);
|
|
12623
|
+
digest = proposed.digest;
|
|
12624
|
+
}
|
|
12625
|
+
const done = enableFlexible(store, { repo, by: acting.name, proof: proved.method, choice, shownDigest: digest, now: context.clock() });
|
|
12626
|
+
if (!done.ok)
|
|
12627
|
+
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
12628
|
+
return succeed(write, json, command, { repo, flexible: shown(flexibleStanding(store, repo)).data, replaced: done.replaced }, () => [`${repo} is Flexible.`, ...termsLines(done.terms, done.digest)]);
|
|
12629
|
+
}
|
|
12630
|
+
const proved = authenticateApprover(store, acting.name, acting.token, repo);
|
|
12631
|
+
if (!proved.ok || !personProof(proved.method))
|
|
12632
|
+
return refused("Only an approver of this project, signed in as a person, changes its Flexible terms.");
|
|
12633
|
+
if (action === "lower") {
|
|
12634
|
+
if (max === undefined)
|
|
12635
|
+
return fail(write, json, command, "usage", "Name the highest level with --max supervised, auto or full.", EXIT.usage);
|
|
12636
|
+
const done = lowerFlexible(store, { repo, by: acting.name, max, now: context.clock() });
|
|
12637
|
+
if (!done.ok)
|
|
12638
|
+
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
12639
|
+
return succeed(write, json, command, { repo, changed: done.changed, flexible: shown(flexibleStanding(store, repo)).data }, () => [done.changed ? `Lowered: threads in ${repo} run at ${FLEXIBLE_LEVEL_WORDS[done.terms.max]} at most. New threads start under these terms only.` : "Nothing changed.", ...termsLines(done.terms, done.digest)]);
|
|
12640
|
+
}
|
|
12641
|
+
const done = turnFlexibleOff(store, { repo, by: acting.name, now: context.clock() });
|
|
12642
|
+
if (!done.ok)
|
|
12643
|
+
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
12644
|
+
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
|
+
}
|