toolroll 0.9.118 → 0.9.120
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 +63 -0
- package/README.md +22 -22
- package/dist/assignment.js +43 -30
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +32 -31
- package/dist/builder.js +288 -237
- package/dist/central-recovery-stage.js +3 -3
- package/dist/check-failure.js +2 -2
- package/dist/check-levels.js +3 -0
- package/dist/check-report.js +58 -7
- package/dist/cli-help.js +1 -0
- package/dist/codex-limits.js +40 -22
- package/dist/contracts/console-api.js +6 -1
- package/dist/contracts/engine-api.js +1 -0
- package/dist/contracts/release-check.js +7 -4
- package/dist/contracts/release-terms.js +11 -2
- package/dist/contracts/verification-receipt.js +1 -1
- package/dist/deploy-gate.js +7 -1
- package/dist/direct-chat.js +3 -3
- package/dist/easy-start.js +8 -6
- package/dist/engine-reads.js +74 -0
- package/dist/flexible-conversation-schema.js +24 -0
- package/dist/flexible-conversation.js +162 -0
- package/dist/flexible-custody.js +3 -0
- package/dist/flexible-import.js +89 -0
- package/dist/flexible-save.js +128 -0
- package/dist/flexible-session.js +93 -13
- package/dist/flexible-ship.js +3 -3
- package/dist/flexible-thread.js +2 -2
- package/dist/install-mode.js +1 -1
- package/dist/local-checks.js +32 -0
- package/dist/local-landing.js +758 -0
- package/dist/local-owner.js +3 -0
- package/dist/operate.js +165 -26
- package/dist/passwordless.js +1 -1
- package/dist/plan-limits-demand.js +48 -0
- package/dist/project-delete.js +1 -0
- package/dist/rehearsal.js +27 -0
- package/dist/release-adapters.js +170 -2
- package/dist/release-approval.js +11 -8
- package/dist/release-card.js +7 -2
- package/dist/release-carry.js +1 -1
- package/dist/release-cli.js +115 -14
- package/dist/release-main-proof.js +49 -0
- package/dist/release-main.js +110 -0
- package/dist/release-recheck.js +10 -3
- package/dist/release.js +221 -33
- package/dist/reply-shape.js +6 -1
- package/dist/result-actions.js +7 -1
- package/dist/result-follow-ups.js +30 -12
- package/dist/review-context.js +2 -1
- package/dist/serve.js +31 -14
- package/dist/server/direct-chat.js +109 -3
- package/dist/server/engine-api.js +65 -6
- package/dist/server/render-results.js +8 -4
- package/dist/server/render-tasks.js +10 -1
- package/dist/server/route-table.js +15 -1
- package/dist/server/send-back-build.js +4 -0
- package/dist/server/settings.js +33 -7
- package/dist/server/task-views.js +20 -0
- package/dist/server/tasks.js +108 -6
- package/dist/settings-groups-ui.js +3 -3
- package/dist/store.js +29 -4
- package/dist/subscription-usage.js +11 -5
- package/dist/surface.js +11 -2
- package/dist/task-base.js +23 -4
- package/dist/task-outcome-cli.js +10 -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/verification-evidence.js +20 -7
- package/dist/workspace-ui.js +1 -1
- package/package.json +2 -1
- package/scripts/release-proof.mjs +240 -0
package/dist/local-owner.js
CHANGED
|
@@ -15,6 +15,7 @@ export const LOCAL_OWNER_ACTS = Object.freeze([
|
|
|
15
15
|
"pause-run",
|
|
16
16
|
"resume-run",
|
|
17
17
|
"complete-task",
|
|
18
|
+
"land-task",
|
|
18
19
|
"request-revision",
|
|
19
20
|
"archive-task",
|
|
20
21
|
"add-project",
|
|
@@ -29,6 +30,7 @@ export const LOCAL_OWNER_ACTS = Object.freeze([
|
|
|
29
30
|
"memory-review",
|
|
30
31
|
"request-plan",
|
|
31
32
|
"retry-build",
|
|
33
|
+
"run-checks",
|
|
32
34
|
"view-preference",
|
|
33
35
|
"take-over",
|
|
34
36
|
"start-thread",
|
|
@@ -43,6 +45,7 @@ export const LOCAL_OWNER_ACTS = Object.freeze([
|
|
|
43
45
|
"flexible-switch",
|
|
44
46
|
"ship-thread",
|
|
45
47
|
"cancel-ship",
|
|
48
|
+
"save-thread",
|
|
46
49
|
"flexible-sign-in-save",
|
|
47
50
|
"flexible-sign-in-check",
|
|
48
51
|
"flexible-sign-in-clear",
|
package/dist/operate.js
CHANGED
|
@@ -4,6 +4,7 @@ import { readStoredGeminiStatus, refreshSubscriptions } from "./subscription-usa
|
|
|
4
4
|
import { liveCommandsShown } from "./live-detail.js";
|
|
5
5
|
import { flexibleArmedPass } from "./flexible-ship.js";
|
|
6
6
|
import { directChatArmedPass } from "./direct-chat-ship.js";
|
|
7
|
+
import { saveFlexibleBranch } from "./flexible-save.js";
|
|
7
8
|
import { closeFlexibleThread, flexibleShipNeedsFor, flexibleThreadRecords, flexibleThreadShipTerms, flexibleThreadTitleOf, latestFlexibleShip, removeFlexibleThreadCopy, shipFlexibleThread, stopFlexibleThreadsEverywhere } from "./flexible-session.js";
|
|
8
9
|
import { runCardCommand } from "./card-cli.js";
|
|
9
10
|
import { mintSecret } from "./secret-mint.js";
|
|
@@ -126,6 +127,7 @@ import { isWritesMode, writesWords } from "./writes-mode.js";
|
|
|
126
127
|
import { linuxFenceAvailable, macosFenceAvailable } from "./agent-fence.js";
|
|
127
128
|
import { parseMachLookup, parseReadDeny, readDenyWords } from "./project-sandbox.js";
|
|
128
129
|
import { LOCAL_POLICY } from "./surface.js";
|
|
130
|
+
import { handoffWords, land, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "./local-landing.js";
|
|
129
131
|
import { asLocalOwner, currentLocalOwner, localActNow, LOCAL_MODE_CONFINES, localModeOn, localOwnerRefusal, localOwnerRequested } from "./local-owner.js";
|
|
130
132
|
import { CHECK_ACCESS_WARNINGS, checkAccessRunsAs, checkAccessWords, isCheckAccess, signInHostsMissing, signInsUnavailableWords, widerThan } from "./check-access.js";
|
|
131
133
|
import { CLI_PASSWORD_SOURCE, withPasswordSource } from "./sign-in-guard.js";
|
|
@@ -364,6 +366,8 @@ export const OPERATE_HELP = `toolroll — operating the queue
|
|
|
364
366
|
remotely, name a token with --token-name)
|
|
365
367
|
toolroll task complete <id> mark the current result complete (--digest for JSON/agents);
|
|
366
368
|
[--pull-request] --pull-request also opens its pull request
|
|
369
|
+
toolroll task land <id> put accepted work on the project's own branch (no pull requests): shows what lands
|
|
370
|
+
where, then --yes --key <key> lands it as one commit; --undo reverts it
|
|
367
371
|
toolroll task merge <id> --as <you> --token <t>
|
|
368
372
|
merge the task's pull request once checks pass
|
|
369
373
|
[--anyway] merge without waiting for the full check
|
|
@@ -720,7 +724,7 @@ export const TASK_ACTIONS = [
|
|
|
720
724
|
"add", "new", "keep", "list", "show", "wait", "state", "block", "unblock", "next", "steer", "pause", "continue", "assign",
|
|
721
725
|
"reopen", "scope", "approve", "hold", "unhold", "require", "requeue", "regate", "plan",
|
|
722
726
|
"review", "accept", "repair", "route", "stop", "resume", "complete", "revise", "merge", "ask",
|
|
723
|
-
"checks", "add-tests", "archive", "restore", "tidy", "ship", "ready", "handover", "before-after", "failing-first",
|
|
727
|
+
"checks", "add-tests", "archive", "restore", "tidy", "ship", "ready", "handover", "before-after", "failing-first", "land",
|
|
724
728
|
];
|
|
725
729
|
export const PUBLISH_ACTIONS = ["setup", "grant", "revoke", "status", "unblock", "rearm", "merge", "refire"];
|
|
726
730
|
export const CONFIG_ACTIONS = ["show", "set", "clear"];
|
|
@@ -737,6 +741,7 @@ export const OPERATE_VALUE_FLAGS = new Set([
|
|
|
737
741
|
"for", "tick-every", "bridge-every", "reconcile-every", "incarnation",
|
|
738
742
|
"say", "ceiling-usd", "cap-usd",
|
|
739
743
|
"incident",
|
|
744
|
+
"into",
|
|
740
745
|
"case", "k", "world", "deny", "abandon",
|
|
741
746
|
"token-file", "bin", "poll", "github", "remote", "head-prefix", "password",
|
|
742
747
|
"not-requester", "protect", "protect-paths",
|
|
@@ -769,6 +774,8 @@ export const OPERATE_BOOLEAN_FLAGS = new Set([
|
|
|
769
774
|
"preview",
|
|
770
775
|
"diagnostic", "keep",
|
|
771
776
|
"no-carry",
|
|
777
|
+
"from-main", "full-check",
|
|
778
|
+
"rehearsal",
|
|
772
779
|
"json", "yes", "all", "brief", "local", "history", "latest-watch", "dry-run", "file",
|
|
773
780
|
"clear", "follow", "ready", "all-tasks", "inbound-only", "help", "undo", "anyone", "allow-dispatch", "allow-merge", "merge-delete-branch",
|
|
774
781
|
"no-open", "single-process", "laptop", "web", "remove", "no-verify", "no-follow", "end", "report", "off", "tmux",
|
|
@@ -3438,14 +3445,17 @@ async function decideCommand(positional, flags, context) {
|
|
|
3438
3445
|
"The task returns to the ready set; the next tick resumes it with your answer in hand.",
|
|
3439
3446
|
]);
|
|
3440
3447
|
}
|
|
3441
|
-
async function startConsole(options) {
|
|
3448
|
+
export async function startConsole(options) {
|
|
3442
3449
|
const { context } = options;
|
|
3443
|
-
|
|
3450
|
+
const rehearsal = options.rehearsal === true;
|
|
3451
|
+
if (!rehearsal)
|
|
3452
|
+
noticeGitIncidents(context.store, context.clock);
|
|
3444
3453
|
const identities = projectIdentities(context.folderLook);
|
|
3445
3454
|
const server = createDecisionServer({
|
|
3446
3455
|
identities,
|
|
3447
3456
|
store: context.store,
|
|
3448
|
-
backgroundChecks:
|
|
3457
|
+
backgroundChecks: !rehearsal,
|
|
3458
|
+
...(rehearsal ? { rehearsal: true } : {}),
|
|
3449
3459
|
...(context.desktopIdentity === undefined ? {} : { desktopIdentity: context.desktopIdentity }),
|
|
3450
3460
|
...(context.additionalProjectRepos === undefined || options.currentRepos === undefined ? {} : { additionalProjectRepos: options.currentRepos }),
|
|
3451
3461
|
evidenceRoot: context.evidenceRoot,
|
|
@@ -3455,7 +3465,7 @@ async function startConsole(options) {
|
|
|
3455
3465
|
...(options.localRunner === undefined ? {} : { localRunner: options.localRunner }),
|
|
3456
3466
|
poolRoot: options.poolRoot,
|
|
3457
3467
|
...(options.allowedHosts === undefined ? {} : { allowedHosts: options.allowedHosts }),
|
|
3458
|
-
tailnetNames: context.tailnetNames ?? (() => readTailnetNames()),
|
|
3468
|
+
tailnetNames: rehearsal ? (async () => []) : context.tailnetNames ?? (() => readTailnetNames()),
|
|
3459
3469
|
leadByDefault: true,
|
|
3460
3470
|
...(options.setupCode === undefined ? {} : { setupCode: options.setupCode }),
|
|
3461
3471
|
...(options.repos === undefined ? {} : { repos: options.repos }),
|
|
@@ -3477,6 +3487,11 @@ async function startConsole(options) {
|
|
|
3477
3487
|
}).catch(error => {
|
|
3478
3488
|
throw new Error(`could not listen on ${options.host}:${options.port} — ${describe(error)}`);
|
|
3479
3489
|
});
|
|
3490
|
+
const bound = server.address();
|
|
3491
|
+
const port = typeof bound === "object" && bound !== null ? bound.port : options.port;
|
|
3492
|
+
const shown = options.host === "0.0.0.0" || options.host === "::" ? "localhost" : options.host;
|
|
3493
|
+
if (rehearsal)
|
|
3494
|
+
return { server, port, url: `http://${shown}:${port}/` };
|
|
3480
3495
|
consoleIdentitiesInBackground(identities, [...options.repos ?? [], ...options.projectRoots ?? [], ...context.store.listProjects().map(one => one.path), ...context.store.knownRepos()]);
|
|
3481
3496
|
const stopMonitoring = startMonitoring({
|
|
3482
3497
|
store: context.store, settings: () => readMonitoring(dirname(context.databaseFile)),
|
|
@@ -3494,18 +3509,19 @@ async function startConsole(options) {
|
|
|
3494
3509
|
];
|
|
3495
3510
|
server.on("close", () => { for (const stop of besideConsole)
|
|
3496
3511
|
stop(); });
|
|
3497
|
-
const bound = server.address();
|
|
3498
|
-
const port = typeof bound === "object" && bound !== null ? bound.port : options.port;
|
|
3499
|
-
const shown = options.host === "0.0.0.0" || options.host === "::" ? "localhost" : options.host;
|
|
3500
3512
|
return { server, port, url: `http://${shown}:${port}/` };
|
|
3501
3513
|
}
|
|
3502
3514
|
async function serveCommand(flags, context) {
|
|
3503
3515
|
const { store, write, json } = context;
|
|
3504
3516
|
const portGiven = text(flags, "port");
|
|
3505
3517
|
const port = Number(portGiven ?? 4180);
|
|
3506
|
-
|
|
3518
|
+
const rehearsal = flags.get("rehearsal") === true;
|
|
3519
|
+
if (portGiven !== undefined && (!Number.isInteger(port) || port < (rehearsal ? 0 : 1) || port >= 65536))
|
|
3507
3520
|
return fail(write, json, "serve", "usage", "--port is a whole number under 65536", EXIT.usage);
|
|
3508
3521
|
const host = text(flags, "host") ?? "127.0.0.1";
|
|
3522
|
+
if (rehearsal && (host !== "127.0.0.1" || ["allow-host", "public-url", "runner", "editor", "repo", "project-root"].some(one => flags.has(one)))) {
|
|
3523
|
+
return fail(write, json, "serve", "usage", "--rehearsal serves 127.0.0.1 only, with no --allow-host, --public-url, --runner, --editor, --repo or --project-root", EXIT.usage);
|
|
3524
|
+
}
|
|
3509
3525
|
const allow = text(flags, "allow-host");
|
|
3510
3526
|
const repoFlag = text(flags, "repo");
|
|
3511
3527
|
const rootFlag = text(flags, "project-root");
|
|
@@ -3522,6 +3538,7 @@ async function serveCommand(flags, context) {
|
|
|
3522
3538
|
context,
|
|
3523
3539
|
host,
|
|
3524
3540
|
port,
|
|
3541
|
+
...(rehearsal ? { rehearsal: true } : {}),
|
|
3525
3542
|
...(setupCode === undefined ? {} : { setupCode }),
|
|
3526
3543
|
...(localRunner === undefined ? {} : { localRunner }),
|
|
3527
3544
|
...(publicUrl === undefined ? {} : { publicUrl }),
|
|
@@ -4651,10 +4668,17 @@ async function verifyCommand(positional, flags, context) {
|
|
|
4651
4668
|
const { store, write, json } = context;
|
|
4652
4669
|
const clock = context.clock ?? (() => new Date());
|
|
4653
4670
|
const action = positional[0] ?? "show";
|
|
4654
|
-
const
|
|
4671
|
+
const raw = text(flags, "repo");
|
|
4672
|
+
if (raw !== undefined && activeRemote() !== null && !isAbsolute(raw))
|
|
4673
|
+
return fail(write, json, `verify ${action}`, "usage", "name the project's full path: --repo <path>", EXIT.usage);
|
|
4674
|
+
const repo = raw === undefined ? undefined : verifyRepoOf(store, raw);
|
|
4675
|
+
const legacy = raw !== undefined && raw !== repo && !isAbsolute(raw) && store.liveVerifyCommand(raw) !== null ? raw : null;
|
|
4676
|
+
const legacyNote = legacy === null ? [] : [`An older check command saved under the name "${legacy}" applies to no project. Set the command for ${repo} again; \`toolroll verify clear --repo ${legacy}\` removes the old one.`];
|
|
4655
4677
|
if (action === "show") {
|
|
4656
4678
|
if (repo === undefined)
|
|
4657
4679
|
return fail(write, json, "verify show", "usage", "which repo? --repo <path>", EXIT.usage);
|
|
4680
|
+
for (const line of json ? [] : legacyNote)
|
|
4681
|
+
write(line);
|
|
4658
4682
|
const live = store.liveVerifyCommand(repo);
|
|
4659
4683
|
const quick = liveQuickCommand(store, repo);
|
|
4660
4684
|
const level = projectCheckLevel(store, repo);
|
|
@@ -4705,7 +4729,9 @@ async function verifyCommand(positional, flags, context) {
|
|
|
4705
4729
|
if (acting === null || !verified?.ok)
|
|
4706
4730
|
return refuseApprover(context, `verify ${action}`, verified, "an approved verification command runs unattended after every future build — changing it takes `--as <you> --token <t>`", repo);
|
|
4707
4731
|
if (action === "clear") {
|
|
4708
|
-
|
|
4732
|
+
if (legacy !== null && !quickClear)
|
|
4733
|
+
store.clearVerifyCommand(legacy, acting.name, clock());
|
|
4734
|
+
const cleared = store.clearVerifyCommand(grantKey, acting.name, clock()) || (legacy !== null && !quickClear);
|
|
4709
4735
|
if (quickClear)
|
|
4710
4736
|
return succeed(write, json, "verify clear", { repo, cleared, level: "quick" }, () => [
|
|
4711
4737
|
cleared ? `Cleared the quick command — Quick builds of ${repo} run the full check now.` : `No quick command was set for ${repo}.`,
|
|
@@ -7694,6 +7720,8 @@ function taskAction(action, rest, flags, context) {
|
|
|
7694
7720
|
return reviewTaskCommand(rest, flags, context);
|
|
7695
7721
|
case "accept":
|
|
7696
7722
|
return acceptTaskProof(rest, flags, context);
|
|
7723
|
+
case "land":
|
|
7724
|
+
return landTaskCommand(rest, flags, context);
|
|
7697
7725
|
case "repair":
|
|
7698
7726
|
return repairTaskCommand(rest, flags, context);
|
|
7699
7727
|
case "route":
|
|
@@ -7810,7 +7838,7 @@ async function addTask(positional, flags, context) {
|
|
|
7810
7838
|
}
|
|
7811
7839
|
}
|
|
7812
7840
|
const next = filedRef !== null && filedRef.repo !== null && filedRef.plan === null && !flags.has("report")
|
|
7813
|
-
? "Next: run `toolroll`, select it and press p to ask for a plan." : null;
|
|
7841
|
+
? "Next: run `toolroll`, select it and press p to ask for a plan. To build without a plan, file it with `toolroll task new` instead." : null;
|
|
7814
7842
|
return succeed(write, json, "task add", {
|
|
7815
7843
|
task: outcome.task,
|
|
7816
7844
|
...(replaces === undefined ? {} : { replaces }),
|
|
@@ -8081,7 +8109,7 @@ function listTasks(flags, context) {
|
|
|
8081
8109
|
}
|
|
8082
8110
|
function showTask(positional, context) {
|
|
8083
8111
|
const { store, write, json, now } = context;
|
|
8084
|
-
const id = positional[0];
|
|
8112
|
+
const id = positional[0] === undefined ? undefined : resolveTaskId(store, positional[0]);
|
|
8085
8113
|
if (id === undefined)
|
|
8086
8114
|
return fail(write, json, "task show", "usage", "which task?", EXIT.usage);
|
|
8087
8115
|
const task = store.getTask(id);
|
|
@@ -8151,7 +8179,8 @@ function showTask(positional, context) {
|
|
|
8151
8179
|
` ${task.title}`,
|
|
8152
8180
|
...(detail.work === null ? [] : [
|
|
8153
8181
|
` status: ${shared?.headline ?? detail.work.status.label}${shared === null ? "" : `${shared.headline === "On hold" ? " · " : " — "}${shared.sentence}`}`,
|
|
8154
|
-
...(primaryAction === null
|
|
8182
|
+
...(primaryAction === null || (checkedByPerson && (primaryAction.code === "open-result" || primaryAction.code === "inspect-run")) ? []
|
|
8183
|
+
: [` next: ${primaryAction.label}${primaryAction.target.decisionId === null ? "" : ` — decision #${primaryAction.target.decisionId}`}`]),
|
|
8155
8184
|
]),
|
|
8156
8185
|
...(task.state !== "done" || detail.proofVerdict === null
|
|
8157
8186
|
? []
|
|
@@ -8753,6 +8782,11 @@ async function scopeTask(positional, flags, context) {
|
|
|
8753
8782
|
let releaseTerms;
|
|
8754
8783
|
let releaseCheck;
|
|
8755
8784
|
let releaseNote = null;
|
|
8785
|
+
const fromMain = flags.get("from-main") === true;
|
|
8786
|
+
if ((fromMain || flags.get("full-check") === true) && releaseGiven === undefined)
|
|
8787
|
+
return fail(write, json, "task scope", "usage", "--from-main and --full-check go with --release <version>:<pull request>:<branch>", EXIT.usage);
|
|
8788
|
+
if (flags.get("full-check") === true && !fromMain)
|
|
8789
|
+
return fail(write, json, "task scope", "usage", "--full-check goes with --from-main", EXIT.usage);
|
|
8756
8790
|
if (releaseGiven !== undefined) {
|
|
8757
8791
|
const spec = /^(\d+\.\d+\.\d+):([1-9][0-9]*):([A-Za-z0-9._/-]+)$/.exec(releaseGiven);
|
|
8758
8792
|
if (spec === null || candidateGiven === undefined)
|
|
@@ -8760,6 +8794,16 @@ async function scopeTask(positional, flags, context) {
|
|
|
8760
8794
|
const repo = store.lookupRef(id)?.repo ?? null;
|
|
8761
8795
|
if (repo === null)
|
|
8762
8796
|
return fail(write, json, "task scope", "usage", "a release scope's task has to be placed in its project first", EXIT.usage);
|
|
8797
|
+
if (fromMain) {
|
|
8798
|
+
const purpose = releaseCheckPurposeFor(store, { repo, version: spec[1], pr: Number(spec[2]), branch: spec[3], candidate: candidateGiven, main: { check: flags.get("full-check") === true ? "full" : "deploy" } });
|
|
8799
|
+
if (!purpose.ok)
|
|
8800
|
+
return fail(write, json, "task scope", "refused", `This release from main can't be filed: ${purpose.why}.`, EXIT.refused);
|
|
8801
|
+
releaseCheck = purpose.purpose;
|
|
8802
|
+
}
|
|
8803
|
+
}
|
|
8804
|
+
if (releaseGiven !== undefined && candidateGiven !== undefined && !fromMain) {
|
|
8805
|
+
const spec = /^(\d+\.\d+\.\d+):([1-9][0-9]*):([A-Za-z0-9._/-]+)$/.exec(releaseGiven);
|
|
8806
|
+
const repo = store.lookupRef(id).repo;
|
|
8763
8807
|
const made = releaseTermsFor(store, { repo, version: spec[1], pr: Number(spec[2]), branch: spec[3], candidate: candidateGiven, now, noCarry: flags.get("no-carry") === true });
|
|
8764
8808
|
if (made.ok)
|
|
8765
8809
|
releaseTerms = made.terms;
|
|
@@ -9238,6 +9282,8 @@ async function askCredentials(flags, context) {
|
|
|
9238
9282
|
const local = currentLocalOwner();
|
|
9239
9283
|
if (local !== null)
|
|
9240
9284
|
return { name: local.account, token: "" };
|
|
9285
|
+
if (name === undefined && token !== undefined && activeRemote() === null)
|
|
9286
|
+
name = soloOperatorOf(context.store) ?? undefined;
|
|
9241
9287
|
if ((name === undefined || token === undefined) && interactive() && !context.json) {
|
|
9242
9288
|
const usual = name === undefined ? soloOperatorOf(context.store) : null;
|
|
9243
9289
|
if (name === undefined) {
|
|
@@ -11863,7 +11909,7 @@ async function releaseApproveCommand(positional, flags, context) {
|
|
|
11863
11909
|
const repo = repoFlag === undefined ? null : resolve(repoFlag);
|
|
11864
11910
|
const stateDir = dirname(context.databaseFile);
|
|
11865
11911
|
const { journals, unreadable } = waitingJournals(stateDir, name => journalFile(stateDir, name));
|
|
11866
|
-
const named = branch === undefined ? journals : journals.filter(one => one.branch === branch);
|
|
11912
|
+
const named = branch === undefined ? journals : journals.filter(one => one.branch === branch || (/^\d+\.\d+\.\d+$/.test(branch) && one.version === branch && one.file.endsWith(`/from-main/${branch}.json`)));
|
|
11867
11913
|
if (branch !== undefined && named.length === 0 && unreadable.includes(basename(journalFile(stateDir, branch)))) {
|
|
11868
11914
|
return fail(write, json, command, "unreadable", `${branch}'s release journal can't be read as one; nothing was approved. Run \`toolroll release ${branch}\` again.`, EXIT.refused);
|
|
11869
11915
|
}
|
|
@@ -12742,11 +12788,11 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12742
12788
|
if (standing.state === "secure")
|
|
12743
12789
|
return { data: { state: "secure" }, lines: [`${repo}: Secure. Work is planned and approved before it starts.`] };
|
|
12744
12790
|
if (standing.state === "unreadable")
|
|
12745
|
-
return { data: { state: "unreadable" }, lines: [`${repo}: its
|
|
12791
|
+
return { data: { state: "unreadable" }, lines: [`${repo}: its thread terms can't be read, so they allow nothing. Turn interactive agent threads off for it, then on again.`] };
|
|
12746
12792
|
const data = { state: standing.state, digest: standing.digest, terms: standing.terms, signedBy: standing.signedBy, signedAt: standing.signedAt, ...(standing.state === "lapsed" ? { lapse: standing.reason } : {}) };
|
|
12747
12793
|
if (standing.state === "lapsed")
|
|
12748
12794
|
return { data, lines: [`${repo}: Flexible terms no longer count. ${FLEXIBLE_LAPSE_WORDS[standing.reason]} Turn it on again to sign new terms.`] };
|
|
12749
|
-
return { data, lines: [`${repo}:
|
|
12795
|
+
return { data, lines: [`${repo}: interactive agent threads are on, turned on by ${standing.signedBy}.`, ...termsLines(standing.terms, standing.digest)] };
|
|
12750
12796
|
};
|
|
12751
12797
|
if (action === "show") {
|
|
12752
12798
|
const now = shown(flexibleStanding(store, repo));
|
|
@@ -12754,16 +12800,16 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12754
12800
|
}
|
|
12755
12801
|
const refused = (message) => fail(write, json, command, "person-only", message, EXIT.refused);
|
|
12756
12802
|
if (machineActing() || process.env["TOOLROLL_LEAD_TOKEN"] !== undefined || process.env["TOOLROLL_REMOTE_TOKEN"] !== undefined)
|
|
12757
|
-
return refused("Only a person changes a project's
|
|
12803
|
+
return refused("Only a person changes a project's thread terms, never the lead, a token or a chat app.");
|
|
12758
12804
|
const acting = await askCredentials(flags, context);
|
|
12759
12805
|
if (acting === null)
|
|
12760
|
-
return refused(`${action === "enable" ? "Turning on
|
|
12806
|
+
return refused(`${action === "enable" ? "Turning on interactive agent threads needs your password" : "This needs your sign-in"}: pass --as and --token.`);
|
|
12761
12807
|
if (action === "enable") {
|
|
12762
12808
|
if (!flexibleAvailable(store))
|
|
12763
12809
|
return fail(write, json, command, "not-available", FLEXIBLE_UNAVAILABLE, EXIT.refused);
|
|
12764
12810
|
const proved = credentialApprover(store, acting.name, acting.token, repo);
|
|
12765
12811
|
if (!proved.ok)
|
|
12766
|
-
return refused("Only an approver of this project, with their password typed now, turns on
|
|
12812
|
+
return refused("Only an approver of this project, with their password typed now, turns on interactive agent threads.");
|
|
12767
12813
|
const choice = { ...(max === undefined ? {} : { max }), ...(chosenDefault === undefined ? {} : { default: chosenDefault }) };
|
|
12768
12814
|
const proposed = proposedFlexibleTerms(store, repo, acting.name, choice);
|
|
12769
12815
|
if (!proposed.ok)
|
|
@@ -12773,18 +12819,18 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12773
12819
|
if (!interactive() || json)
|
|
12774
12820
|
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 });
|
|
12775
12821
|
write(termsLines(proposed.terms, proposed.digest).join("\n"));
|
|
12776
|
-
if (!(await confirm("Turn on
|
|
12822
|
+
if (!(await confirm("Turn on interactive agent threads in this project with these terms?")))
|
|
12777
12823
|
return fail(write, json, command, "declined", "Nothing changed.", EXIT.refused);
|
|
12778
12824
|
digest = proposed.digest;
|
|
12779
12825
|
}
|
|
12780
12826
|
const done = enableFlexible(store, { repo, by: acting.name, proof: proved.method, choice, shownDigest: digest, now: context.clock() });
|
|
12781
12827
|
if (!done.ok)
|
|
12782
12828
|
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
12783
|
-
return succeed(write, json, command, { repo, flexible: shown(flexibleStanding(store, repo)).data, replaced: done.replaced }, () => [
|
|
12829
|
+
return succeed(write, json, command, { repo, flexible: shown(flexibleStanding(store, repo)).data, replaced: done.replaced }, () => [`Interactive agent threads are on in ${repo} (terms ${done.digest}). Start one with T in the terminal workbench.`]);
|
|
12784
12830
|
}
|
|
12785
12831
|
const proved = authenticateApprover(store, acting.name, acting.token, repo);
|
|
12786
12832
|
if (!proved.ok || !personProof(proved.method))
|
|
12787
|
-
return refused("Only an approver of this project, signed in as a person, changes its
|
|
12833
|
+
return refused("Only an approver of this project, signed in as a person, changes its thread terms.");
|
|
12788
12834
|
if (action === "lower") {
|
|
12789
12835
|
if (max === undefined)
|
|
12790
12836
|
return fail(write, json, command, "usage", "Name the highest level with --max supervised, auto or full.", EXIT.usage);
|
|
@@ -12796,7 +12842,7 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12796
12842
|
const done = turnFlexibleOff(store, { repo, by: acting.name, now: context.clock() });
|
|
12797
12843
|
if (!done.ok)
|
|
12798
12844
|
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
12799
|
-
return succeed(write, json, command, { repo, changed: done.changed, flexible: { state: "secure" } }, () => [done.changed ?
|
|
12845
|
+
return succeed(write, json, command, { repo, changed: done.changed, flexible: { state: "secure" } }, () => [done.changed ? `Interactive agent threads are off in ${repo}. No new ones start.` : `Interactive agent threads are already off in ${repo}.`]);
|
|
12800
12846
|
}
|
|
12801
12847
|
async function taskSizingConfig(action, value, repoGiven, flags, context) {
|
|
12802
12848
|
const { store, write, json, clock } = context;
|
|
@@ -13064,8 +13110,8 @@ async function threadCommand(positional, flags, context) {
|
|
|
13064
13110
|
const { store, write, json, clock } = context;
|
|
13065
13111
|
const verb = positional[0] ?? "list";
|
|
13066
13112
|
const command = `thread ${verb}`;
|
|
13067
|
-
if (!["list", "show", "end", "remove", "ship"].includes(verb))
|
|
13068
|
-
return fail(write, json, command, "usage", "`toolroll thread list|show|end|remove|ship <thread>`", EXIT.usage);
|
|
13113
|
+
if (!["list", "show", "end", "remove", "ship", "save"].includes(verb))
|
|
13114
|
+
return fail(write, json, command, "usage", "`toolroll thread list|show|end|remove|ship|save <thread>`", EXIT.usage);
|
|
13069
13115
|
const personOnly = "Only you, as a person, work with your own threads here; never a token, the lead, a chat app or a machine.";
|
|
13070
13116
|
if (machineActing() || process.env["TOOLROLL_LEAD_TOKEN"] !== undefined || process.env["TOOLROLL_REMOTE_TOKEN"] !== undefined)
|
|
13071
13117
|
return fail(write, json, command, "person-only", personOnly, EXIT.refused);
|
|
@@ -13152,6 +13198,12 @@ async function threadCommand(positional, flags, context) {
|
|
|
13152
13198
|
await stopFlexibleThreadsEverywhere(store, { reason: "its owner ended the thread", thread, clock });
|
|
13153
13199
|
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."]);
|
|
13154
13200
|
}
|
|
13201
|
+
if (verb === "save") {
|
|
13202
|
+
const saved = await saveFlexibleBranch(store, { thread, by: { name: who.name, generation: account.generation }, now: clock(), prove: proveNow });
|
|
13203
|
+
if (!saved.ok)
|
|
13204
|
+
return fail(write, json, command, saved.reason, saved.message, EXIT.refused);
|
|
13205
|
+
return succeed(write, json, command, { thread, branch: saved.branch, commit: saved.candidate, already: saved.already, files: saved.changedPaths, next: saved.next }, () => [saved.already ? `Already saved as ${saved.branch} (commit ${saved.candidate.slice(0, 12)}).` : `Saved as ${saved.branch} (commit ${saved.candidate.slice(0, 12)}, ${saved.changedPaths.length} file${saved.changedPaths.length === 1 ? "" : "s"}).`, saved.next]);
|
|
13206
|
+
}
|
|
13155
13207
|
const removed = await removeFlexibleThreadCopy(store, { thread, by: who.name, now: clock(), prove: proveNow });
|
|
13156
13208
|
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);
|
|
13157
13209
|
}
|
|
@@ -13336,3 +13388,90 @@ async function requestCommand(positional, flags, context) {
|
|
|
13336
13388
|
}
|
|
13337
13389
|
return fail(context.write, context.json, "request", "usage", "Use `toolroll request [list [--all]|show <id>|wait <id>|decline <id>|clear]`.", EXIT.usage);
|
|
13338
13390
|
}
|
|
13391
|
+
async function landTaskCommand(positional, flags, context) {
|
|
13392
|
+
const { store, write, json, now } = context;
|
|
13393
|
+
const command = "task land";
|
|
13394
|
+
const allowed = new Set(["json", "db", "into", "undo", "yes", "key", "as", "token", "token-file", "token-env"]);
|
|
13395
|
+
for (const key of flags.keys())
|
|
13396
|
+
if (!allowed.has(key))
|
|
13397
|
+
return fail(write, json, command, "usage", `--${key} is not a ${command} option.`, EXIT.usage);
|
|
13398
|
+
const id = positional[0] === undefined ? undefined : resolveTaskId(store, positional[0]);
|
|
13399
|
+
if (id === undefined || positional.length !== 1)
|
|
13400
|
+
return fail(write, json, command, "usage", "Use `toolroll task land <id>` to see what landing does, then `--yes --key <key>` to land it.", EXIT.usage);
|
|
13401
|
+
const into = text(flags, "into"), undo = flags.get("undo") === true, yes = flags.get("yes") === true, key = text(flags, "key");
|
|
13402
|
+
if (flags.has("into") && into === undefined)
|
|
13403
|
+
return fail(write, json, command, "usage", "--into needs a branch name.", EXIT.usage);
|
|
13404
|
+
if (undo && into !== undefined)
|
|
13405
|
+
return fail(write, json, command, "usage", "--undo lands on the branch the work landed on; it takes no --into.", EXIT.usage);
|
|
13406
|
+
const landRepo = store.lookupRef(id)?.repo ?? null;
|
|
13407
|
+
if (landRepo !== null && publishesThroughPullRequests(store, landRepo))
|
|
13408
|
+
return fail(write, json, command, "pull-requests", PULL_REQUESTS_INSTEAD, EXIT.refused);
|
|
13409
|
+
const local = currentLocalOwner();
|
|
13410
|
+
const localRepos = local === null ? null : store.knownRepos().filter(repo => store.accountCanAccess(local.account, repo));
|
|
13411
|
+
const options = { root: context.evidenceRoot, ...(into === undefined ? {} : { into }), ...(undo ? { undo: true } : {}) };
|
|
13412
|
+
if (!yes) {
|
|
13413
|
+
if (key !== undefined)
|
|
13414
|
+
return fail(write, json, command, "usage", "--key goes with --yes.", EXIT.usage);
|
|
13415
|
+
const read = await readLanding(store, id, { repos: localRepos }, now, options);
|
|
13416
|
+
if (!read.ok)
|
|
13417
|
+
return fail(write, json, command, read.reason, read.message, EXIT.refused);
|
|
13418
|
+
if (!("plan" in read))
|
|
13419
|
+
return succeed(write, json, command, { landed: read.landed }, () => [`${id} · Landed on ${read.landed.ref.replace(/^refs\/heads\//, "")} (${read.landed.commit.slice(0, 7)}).`]);
|
|
13420
|
+
const plan = read.plan;
|
|
13421
|
+
return succeed(write, json, command, { plan }, () => [...landingWords(plan),
|
|
13422
|
+
`To ${undo ? "undo it" : "land it"}: toolroll task land ${id}${into === undefined ? "" : ` --into ${into}`}${undo ? " --undo" : ""} --yes --key ${plan.key}${local === null ? " --as <you>" : ""}`,
|
|
13423
|
+
...(local === null ? ["That asks for your Toolroll password."] : [])]);
|
|
13424
|
+
}
|
|
13425
|
+
if (key === undefined || !/^[0-9a-f]{16}$/.test(key))
|
|
13426
|
+
return fail(write, json, command, "usage", "--yes needs the --key `toolroll task land` showed you, so what lands is what you read.", EXIT.usage);
|
|
13427
|
+
let authority;
|
|
13428
|
+
if (local !== null)
|
|
13429
|
+
authority = { kind: "local" };
|
|
13430
|
+
else {
|
|
13431
|
+
const acting = await askCredentials(flags, context);
|
|
13432
|
+
const ref = store.lookupRef(id);
|
|
13433
|
+
const repos = store.knownRepos().filter(repo => acting !== null && store.accountCanAccess(acting.name, repo));
|
|
13434
|
+
const proved = acting === null || ref === null ? null : verifyApproverByPassword(store, acting.name, acting.token, repos);
|
|
13435
|
+
if (proved === null || !proved.ok)
|
|
13436
|
+
return fail(write, json, command, "unauthenticated", "Landing work is a person's act: it takes `--as <you>` and your password.", EXIT.refused);
|
|
13437
|
+
authority = { kind: "person", who: proved.who };
|
|
13438
|
+
}
|
|
13439
|
+
const access = { repos: authority.kind === "person" ? authority.who.repos : localRepos };
|
|
13440
|
+
const result = await land(store, id, { key, ...(into === undefined ? {} : { into }), ...(undo ? { undo: true } : {}) }, authority, access, now, { root: context.evidenceRoot });
|
|
13441
|
+
if (!result.ok)
|
|
13442
|
+
return fail(write, json, command, result.reason, result.message, EXIT.refused);
|
|
13443
|
+
if (result.handoff !== null) {
|
|
13444
|
+
const handoff = result.handoff;
|
|
13445
|
+
return succeed(write, json, command, { landing: result }, () => [
|
|
13446
|
+
`${id} · Landing commit ${result.commit.slice(0, 7)} is ready (kept at ${handoff.ref}). Your project folder has ${result.branch} checked out, so Toolroll didn't touch it.`,
|
|
13447
|
+
handoffWords(handoff, result.commit)
|
|
13448
|
+
]);
|
|
13449
|
+
}
|
|
13450
|
+
return succeed(write, json, command, { landing: result }, () => [
|
|
13451
|
+
`${id} · ${result.replayed ? "Already " : ""}${result.kind === "undo" ? "Undone" : "Landed"} on ${result.branch} (${result.commit.slice(0, 7)})${result.mode === "ref" ? "; no folder had it open" : result.mode === "files" ? "; your project folder's files are updated" : ""}.`,
|
|
13452
|
+
...(result.warning === null ? [] : [result.warning])
|
|
13453
|
+
]);
|
|
13454
|
+
}
|
|
13455
|
+
function resolveTaskId(store, typed) {
|
|
13456
|
+
if (store.getTask(typed) !== null || typed.startsWith("task-"))
|
|
13457
|
+
return typed;
|
|
13458
|
+
return store.getTask(`task-${typed}`) !== null ? `task-${typed}` : typed;
|
|
13459
|
+
}
|
|
13460
|
+
function verifyRepoOf(store, raw) {
|
|
13461
|
+
const absolute = isAbsolute(raw) ? raw : resolve(process.cwd(), raw);
|
|
13462
|
+
let real;
|
|
13463
|
+
try {
|
|
13464
|
+
real = realpathSync(absolute);
|
|
13465
|
+
}
|
|
13466
|
+
catch {
|
|
13467
|
+
return absolute;
|
|
13468
|
+
}
|
|
13469
|
+
for (const known of new Set([...store.listProjects().map(one => one.path), ...store.knownRepos()])) {
|
|
13470
|
+
try {
|
|
13471
|
+
if (known === absolute || realpathSync(known) === real)
|
|
13472
|
+
return known;
|
|
13473
|
+
}
|
|
13474
|
+
catch { }
|
|
13475
|
+
}
|
|
13476
|
+
return absolute;
|
|
13477
|
+
}
|
package/dist/passwordless.js
CHANGED
|
@@ -17,7 +17,7 @@ export function setPasswordless(store, on, by, now) {
|
|
|
17
17
|
if (setting.on === on && (on || setting.at !== null))
|
|
18
18
|
return { changed: false };
|
|
19
19
|
store.recordAction({ at: now.toISOString(), actor: by, repo: null, taskId: null, runId: null, action: PASSWORDLESS_ACTION, outcome: on ? "on" : "off", source: "policy",
|
|
20
|
-
detail: on ? "Passwordless on:
|
|
20
|
+
detail: on ? "Passwordless on: approvals need no password" : "Passwordless off: step-ups ask for the password again" });
|
|
21
21
|
store.bumpWake();
|
|
22
22
|
return { changed: true };
|
|
23
23
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const PLAN_LIMITS_VIEW_WINDOW_MS = 10 * 60_000;
|
|
2
|
+
const QUEUED_RECENTLY_MS = 60 * 60_000;
|
|
3
|
+
const RUNNING_AT_MOST_MS = 6 * 3_600_000;
|
|
4
|
+
const viewedAt = new WeakMap();
|
|
5
|
+
const listeners = new WeakMap();
|
|
6
|
+
export function notePlanLimitsViewed(store, at) {
|
|
7
|
+
viewedAt.set(store, at.getTime());
|
|
8
|
+
for (const listener of listeners.get(store) ?? []) {
|
|
9
|
+
try {
|
|
10
|
+
listener();
|
|
11
|
+
}
|
|
12
|
+
catch { }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function onPlanLimitsViewed(store, listener) {
|
|
16
|
+
const set = listeners.get(store) ?? new Set();
|
|
17
|
+
set.add(listener);
|
|
18
|
+
listeners.set(store, set);
|
|
19
|
+
return () => { set.delete(listener); };
|
|
20
|
+
}
|
|
21
|
+
function any(store, sql, ...values) {
|
|
22
|
+
try {
|
|
23
|
+
return store.handle.prepare(sql).get(...values) !== undefined;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function agentWorkActive(store, now) {
|
|
30
|
+
const queuedSince = new Date(now.getTime() - QUEUED_RECENTLY_MS).toISOString();
|
|
31
|
+
const runningSince = new Date(now.getTime() - RUNNING_AT_MOST_MS).toISOString();
|
|
32
|
+
return any(store, "SELECT 1 FROM task WHERE state = 'running' OR (state = 'queued' AND updated_at > ?) LIMIT 1", queuedSince)
|
|
33
|
+
|| any(store, "SELECT 1 FROM run WHERE outcome IS NULL AND started_at > ? LIMIT 1", runningSince)
|
|
34
|
+
|| any(store, "SELECT 1 FROM thread_turn WHERE status IN ('admitted', 'running') AND admitted_at > ? LIMIT 1", runningSince)
|
|
35
|
+
|| any(store, "SELECT 1 FROM direct_chat_turn WHERE status = 'running' AND created_at > ? LIMIT 1", runningSince)
|
|
36
|
+
|| any(store, "SELECT 1 FROM lead_queue WHERE status IN ('queued', 'running') LIMIT 1");
|
|
37
|
+
}
|
|
38
|
+
export function planLimitsWanted(store, now) {
|
|
39
|
+
const viewed = viewedAt.get(store);
|
|
40
|
+
if (viewed !== undefined && now.getTime() - viewed >= 0 && now.getTime() - viewed < PLAN_LIMITS_VIEW_WINDOW_MS)
|
|
41
|
+
return true;
|
|
42
|
+
return agentWorkActive(store, now);
|
|
43
|
+
}
|
|
44
|
+
export function directChatRunning(store, provider, now) {
|
|
45
|
+
const since = new Date(now.getTime() - RUNNING_AT_MOST_MS).toISOString();
|
|
46
|
+
return any(store, `SELECT 1 FROM direct_chat_turn JOIN direct_chat_thread ON direct_chat_thread.id = direct_chat_turn.thread_id
|
|
47
|
+
WHERE direct_chat_turn.status = 'running' AND direct_chat_turn.created_at > ? AND direct_chat_thread.provider = ? LIMIT 1`, since, provider);
|
|
48
|
+
}
|
package/dist/project-delete.js
CHANGED
|
@@ -311,6 +311,7 @@ function deleteRows(store, repo, d, now) {
|
|
|
311
311
|
del("thread_relay_pending", flexibleThreads, repo);
|
|
312
312
|
del("flexible_relay_grant", flexibleThreads, repo);
|
|
313
313
|
del("thread_turn", flexibleThreads, repo);
|
|
314
|
+
del("flexible_turn_said", flexibleThreads, repo);
|
|
314
315
|
del("flexible_thread_launch", flexibleThreads, repo);
|
|
315
316
|
del("flexible_thread_level", flexibleThreads, repo);
|
|
316
317
|
del("flexible_thread", "repo = ? AND state IN ('removed', 'failed')", repo);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
let depth = 0;
|
|
2
|
+
let realKill = null;
|
|
3
|
+
export function inRehearsal() { return depth > 0; }
|
|
4
|
+
export const REHEARSAL_SIGNAL_REFUSED = "a rehearsal never signals a process: every pid in its database copy belongs to the real computer";
|
|
5
|
+
export function enterRehearsal() {
|
|
6
|
+
if (depth === 0) {
|
|
7
|
+
realKill = process.kill.bind(process);
|
|
8
|
+
const real = realKill;
|
|
9
|
+
process.kill = ((pid, signal) => {
|
|
10
|
+
if ((signal === 0 || signal === "0") || pid === process.pid)
|
|
11
|
+
return real(pid, signal);
|
|
12
|
+
throw Object.assign(new Error(`${REHEARSAL_SIGNAL_REFUSED} (pid ${pid}, ${String(signal ?? "SIGTERM")})`), { code: "EPERM" });
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
depth += 1;
|
|
16
|
+
let left = false;
|
|
17
|
+
return () => {
|
|
18
|
+
if (left)
|
|
19
|
+
return;
|
|
20
|
+
left = true;
|
|
21
|
+
depth -= 1;
|
|
22
|
+
if (depth === 0 && realKill !== null) {
|
|
23
|
+
process.kill = realKill;
|
|
24
|
+
realKill = null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|