@usepowerplant/cli 0.4.29 → 0.4.31
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/dist/main.js +228 -102
- package/dist/menubar/Powerplant.app.zip +0 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="70311df7-2e4d-5e8c-9d0b-135dffb81341")}catch(e){}}();
|
|
3
3
|
import { createRequire as __cliCreateRequire } from 'node:module';
|
|
4
4
|
const require = __cliCreateRequire(import.meta.url);
|
|
5
5
|
var __create = Object.create;
|
|
@@ -56714,6 +56714,16 @@ var menubarEventSchema = external_exports.discriminatedUnion("event", [
|
|
|
56714
56714
|
mcpWarningDismissalSchema.extend({ event: external_exports.literal(MENUBAR_MCP_WARNING_REMOVE) })
|
|
56715
56715
|
]);
|
|
56716
56716
|
|
|
56717
|
+
// ../core/src/callIdentity.ts
|
|
56718
|
+
var CLAUDE_CODE_NO_MODEL = "<synthetic>";
|
|
56719
|
+
var isClaudeCodeCall = (model) => model !== CLAUDE_CODE_NO_MODEL;
|
|
56720
|
+
function claudeCodeCallId(record2, message3) {
|
|
56721
|
+
for (const id of [message3.id, record2.requestId, record2.uuid]) {
|
|
56722
|
+
if (typeof id === "string" && id !== "") return id;
|
|
56723
|
+
}
|
|
56724
|
+
return null;
|
|
56725
|
+
}
|
|
56726
|
+
|
|
56717
56727
|
// ../core/src/rawTranscriptBundle.ts
|
|
56718
56728
|
var RAW_TRANSCRIPT_BUNDLE_CONTENT_TYPE = "application/vnd.powerplant.raw-transcript-bundle";
|
|
56719
56729
|
var RAW_TRANSCRIPT_PART_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
@@ -57704,6 +57714,9 @@ function codexPageTotals(read) {
|
|
|
57704
57714
|
return { ...totals, fast: tierKnown ? fast : null };
|
|
57705
57715
|
}
|
|
57706
57716
|
|
|
57717
|
+
// ../core/src/priceWords.ts
|
|
57718
|
+
var claudeCodeSpeed = (value) => SESSION_SPEED_MODES.find((mode) => mode === value);
|
|
57719
|
+
|
|
57707
57720
|
// ../core/src/sessionViews.ts
|
|
57708
57721
|
function describeSessionSource(source) {
|
|
57709
57722
|
switch (source) {
|
|
@@ -75589,12 +75602,12 @@ function parseProxyResponse(socket) {
|
|
|
75589
75602
|
return;
|
|
75590
75603
|
}
|
|
75591
75604
|
const headerParts = buffered.subarray(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
75592
|
-
const
|
|
75593
|
-
if (!
|
|
75605
|
+
const firstLine2 = headerParts.shift();
|
|
75606
|
+
if (!firstLine2) {
|
|
75594
75607
|
socket.destroy();
|
|
75595
75608
|
return reject(new Error("No header received from proxy CONNECT response"));
|
|
75596
75609
|
}
|
|
75597
|
-
const firstLineParts =
|
|
75610
|
+
const firstLineParts = firstLine2.split(" ");
|
|
75598
75611
|
const statusCode = +(firstLineParts[1] || 0);
|
|
75599
75612
|
const statusText = firstLineParts.slice(2).join(" ");
|
|
75600
75613
|
const headers = {};
|
|
@@ -75616,7 +75629,7 @@ function parseProxyResponse(socket) {
|
|
|
75616
75629
|
headers[key] = value;
|
|
75617
75630
|
}
|
|
75618
75631
|
}
|
|
75619
|
-
debugLog("got proxy server response: %o %o",
|
|
75632
|
+
debugLog("got proxy server response: %o %o", firstLine2, headers);
|
|
75620
75633
|
cleanup();
|
|
75621
75634
|
resolve2({
|
|
75622
75635
|
connect: {
|
|
@@ -85111,7 +85124,7 @@ function _init2(options = {}, getDefaultIntegrationsImpl) {
|
|
|
85111
85124
|
import tls2 from "node:tls";
|
|
85112
85125
|
var import_undici = __toESM(require_undici(), 1);
|
|
85113
85126
|
var CLI_VERSION_HEADER = "x-powerplant-cli-version";
|
|
85114
|
-
var cliVersion = true ? "0.4.
|
|
85127
|
+
var cliVersion = true ? "0.4.31" : "0.0.0-checkout";
|
|
85115
85128
|
function cliVersionHeaders() {
|
|
85116
85129
|
return { [CLI_VERSION_HEADER]: cliVersion, "user-agent": `powerplant-cli/${cliVersion}` };
|
|
85117
85130
|
}
|
|
@@ -85354,6 +85367,13 @@ function createRawUploadFailures(report, now = Date.now) {
|
|
|
85354
85367
|
};
|
|
85355
85368
|
}
|
|
85356
85369
|
var ExpectedCliError = class extends Error {
|
|
85370
|
+
/** Detail lines under the message, such as the command that fixes it
|
|
85371
|
+
* (docs/cli-output-rules.md, Nesting). */
|
|
85372
|
+
details;
|
|
85373
|
+
constructor(message3, { details = [], ...options } = {}) {
|
|
85374
|
+
super(message3, options);
|
|
85375
|
+
this.details = details;
|
|
85376
|
+
}
|
|
85357
85377
|
};
|
|
85358
85378
|
var OFFLINE_ERROR_PATTERN = /couldn't reach|fetch failed|ENOTFOUND|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENETDOWN|ENETUNREACH|EHOSTUNREACH|headers timeout|socket hang up|session has been destroyed|other side closed/i;
|
|
85359
85379
|
function isOfflineError(error63) {
|
|
@@ -87392,6 +87412,9 @@ async function collectCodexSessions(options = {}) {
|
|
|
87392
87412
|
mtimeMs,
|
|
87393
87413
|
codexClient: summary.codexClient,
|
|
87394
87414
|
...summary.noninteractive && { codexNoninteractive: true },
|
|
87415
|
+
// Only a dedicated review is seen to skip hooks (three runs checked
|
|
87416
|
+
// 2026-09-18). A terminal `codex exec` run is still judged.
|
|
87417
|
+
...isAutomationRun(summary) && { hookRecordOptional: true },
|
|
87395
87418
|
transcriptPath: parent.transcriptPath,
|
|
87396
87419
|
transcriptPrefix: parent.prefix,
|
|
87397
87420
|
subagents: children2.capture,
|
|
@@ -89259,13 +89282,19 @@ function createHookHealthTracker(deps) {
|
|
|
89259
89282
|
};
|
|
89260
89283
|
const admit = (session, nowMs) => {
|
|
89261
89284
|
const harness = NATIVE_HOOK_NAME_BY_HARNESS[session.item.harness];
|
|
89262
|
-
if (session.item.
|
|
89285
|
+
if (session.item.startedAt === void 0) return;
|
|
89263
89286
|
if (!(Date.parse(session.item.startedAt) > installedAtMs)) return;
|
|
89264
89287
|
const sessionId = hookSessionId(harness, session.item.harnessSessionId);
|
|
89265
89288
|
if (sessionId === null) return;
|
|
89266
89289
|
const key = `${harness}:${sessionId}`;
|
|
89267
89290
|
if (judged.has(key) || candidates.has(key)) return;
|
|
89268
|
-
candidates.set(key, {
|
|
89291
|
+
candidates.set(key, {
|
|
89292
|
+
harness,
|
|
89293
|
+
sessionId,
|
|
89294
|
+
startedAt: session.item.startedAt,
|
|
89295
|
+
firstSeenMs: nowMs,
|
|
89296
|
+
recordOptional: session.hookRecordOptional === true
|
|
89297
|
+
});
|
|
89269
89298
|
};
|
|
89270
89299
|
const judge = (candidate, fired, nowMs) => {
|
|
89271
89300
|
const { harness } = candidate;
|
|
@@ -89279,6 +89308,7 @@ function createHookHealthTracker(deps) {
|
|
|
89279
89308
|
);
|
|
89280
89309
|
return true;
|
|
89281
89310
|
}
|
|
89311
|
+
if (candidate.recordOptional) return false;
|
|
89282
89312
|
const silence = describeHookSilence(harness, inspect(harness), home);
|
|
89283
89313
|
if (current.silence?.problem === silence.problem) return false;
|
|
89284
89314
|
health[harness] = {
|
|
@@ -92192,7 +92222,7 @@ function lockInstallForChange(deps) {
|
|
|
92192
92222
|
throw new ExpectedCliError(`Background sync is running without the install lock, so it cannot change the install now. Run \`${deps.restartCommand}\`, then try again.`);
|
|
92193
92223
|
}
|
|
92194
92224
|
const refusal = deps.setupRefusal();
|
|
92195
|
-
if (refusal !== null) throw
|
|
92225
|
+
if (refusal !== null) throw refusal;
|
|
92196
92226
|
return lock;
|
|
92197
92227
|
} catch (error63) {
|
|
92198
92228
|
lock.release();
|
|
@@ -92274,9 +92304,6 @@ import path31 from "node:path";
|
|
|
92274
92304
|
function isPackageCopy(entryPath2) {
|
|
92275
92305
|
return entryPath2.replaceAll("\\", "/").includes(`/node_modules/${CLI_PACKAGE_NAME}/`);
|
|
92276
92306
|
}
|
|
92277
|
-
function perUserAccount(platform2) {
|
|
92278
|
-
return `this ${RELEASE_PLATFORMS[platform2.release].displayName} account`;
|
|
92279
|
-
}
|
|
92280
92307
|
function perUserCopyFor(lookup) {
|
|
92281
92308
|
const { read } = lookup;
|
|
92282
92309
|
if (!isPackageCopy(lookup.entryPath) || read.kind === "missing") return null;
|
|
@@ -92286,9 +92313,9 @@ function perUserCopyFor(lookup) {
|
|
|
92286
92313
|
if (installHolding(read, lookup.entryPath) !== null) return null;
|
|
92287
92314
|
return installedCommand(read.record, path31.join(read.record.location, read.record.version));
|
|
92288
92315
|
}
|
|
92289
|
-
function runPerUserCopy(command, args, installCommand
|
|
92316
|
+
function runPerUserCopy(command, args, installCommand) {
|
|
92290
92317
|
const [program, programArgs] = spawnArguments(command, args);
|
|
92291
|
-
const failed2 = (error63) => new ExpectedCliError(`Powerplant
|
|
92318
|
+
const failed2 = (error63) => new ExpectedCliError(`The signed Powerplant program could not start from ${program} (${error63 instanceof Error ? error63.message : String(error63)}). Install it again with: ${installCommand}`);
|
|
92292
92319
|
return new Promise((resolve2, reject) => {
|
|
92293
92320
|
let child;
|
|
92294
92321
|
const ignore = () => {
|
|
@@ -92342,7 +92369,7 @@ async function installPerUserCopy(deps, fetched, stopService) {
|
|
|
92342
92369
|
}
|
|
92343
92370
|
const work = early ?? newWorkFolder(deps);
|
|
92344
92371
|
try {
|
|
92345
|
-
deps.log(`Installing Powerplant ${release2.version}
|
|
92372
|
+
deps.log(`Installing the signed Powerplant program ${release2.version} that runs background sync\u2026`);
|
|
92346
92373
|
const tarball = path31.join(work, "powerplant.tgz");
|
|
92347
92374
|
if (early === null) await downloadRelease(release2, tarball, deps.fetchImpl);
|
|
92348
92375
|
const installed = await installRelease({
|
|
@@ -92433,10 +92460,10 @@ async function registerUnlessInstalled(deps, register2) {
|
|
|
92433
92460
|
}
|
|
92434
92461
|
}
|
|
92435
92462
|
async function initFromNpmCopy(deps) {
|
|
92436
|
-
if (deps.setupRefusal !== null) throw
|
|
92463
|
+
if (deps.setupRefusal !== null) throw deps.setupRefusal;
|
|
92437
92464
|
const { platform: platform2 } = deps;
|
|
92438
92465
|
const installCommand = platform2.installCommandFor(deps.apiUrl);
|
|
92439
|
-
const run2 = deps.run ?? ((command, args) => runPerUserCopy(command, args, installCommand
|
|
92466
|
+
const run2 = deps.run ?? ((command, args) => runPerUserCopy(command, args, installCommand));
|
|
92440
92467
|
let read = readInstallRecord(deps.recordFile);
|
|
92441
92468
|
if (read.kind === "missing" && platform2.installsThroughNpm) {
|
|
92442
92469
|
const plan = planLegacyInit(await fetchReleaseOffer(deps), () => platform2.unsupportedHardware());
|
|
@@ -92516,7 +92543,7 @@ function reportUnsupportedHardware(reason) {
|
|
|
92516
92543
|
]);
|
|
92517
92544
|
}
|
|
92518
92545
|
async function updateFromNpmCopy(deps) {
|
|
92519
|
-
if (deps.setupRefusal !== null) throw
|
|
92546
|
+
if (deps.setupRefusal !== null) throw deps.setupRefusal;
|
|
92520
92547
|
const { displayName: displayName2 } = RELEASE_PLATFORMS[deps.platform.release];
|
|
92521
92548
|
const release2 = await fetchServedRelease(deps);
|
|
92522
92549
|
if (release2 === null) {
|
|
@@ -92537,12 +92564,12 @@ async function updateFromNpmCopy(deps) {
|
|
|
92537
92564
|
moved = deps.moveService(perUser);
|
|
92538
92565
|
} catch (error63) {
|
|
92539
92566
|
throw new ExpectedCliError(
|
|
92540
|
-
`Installed Powerplant${version2}
|
|
92567
|
+
`Installed the signed Powerplant program${version2}, but background sync did not move to it (${error63 instanceof Error ? error63.message : String(error63)}). To finish, run: ${initCommand(deps.appEnv)}`
|
|
92541
92568
|
);
|
|
92542
92569
|
}
|
|
92543
|
-
const installed = `Installed Powerplant${version2}
|
|
92570
|
+
const installed = `Installed the signed Powerplant program${version2}.`;
|
|
92544
92571
|
deps.log(
|
|
92545
|
-
moved === "moved" ? `${installed} Background sync
|
|
92572
|
+
moved === "moved" ? `${installed} Background sync runs it, and the powerplant command now passes each command to it.` : `${installed} To set up background sync, run: ${initCommand(deps.appEnv)}`
|
|
92546
92573
|
);
|
|
92547
92574
|
}
|
|
92548
92575
|
function fetchServedRelease(deps) {
|
|
@@ -92678,7 +92705,7 @@ function thisCopy(input2) {
|
|
|
92678
92705
|
kind: "package",
|
|
92679
92706
|
route: "forward",
|
|
92680
92707
|
service: other(),
|
|
92681
|
-
forward: (args) => runPerUserCopy(forwardTo, args, installCommand
|
|
92708
|
+
forward: (args) => runPerUserCopy(forwardTo, args, installCommand)
|
|
92682
92709
|
};
|
|
92683
92710
|
}
|
|
92684
92711
|
function environmentService(input2) {
|
|
@@ -92722,7 +92749,7 @@ function installedCopy(input2, platform2, record2) {
|
|
|
92722
92749
|
restartCommand: ["powerplant restart", ...envArgs(appEnv)].join(" "),
|
|
92723
92750
|
// The legacy agent's job syncs without the lock, so an update's
|
|
92724
92751
|
// health check would run a second worker beside it.
|
|
92725
|
-
setupRefusal: () => service?.replacedServiceLoaded?.() === true ? `Run \`${["powerplant init", ...envArgs(appEnv)].join(" ")}\` to finish moving to the new install, then update.` : service?.setupRefusal?.("update") ?? null
|
|
92752
|
+
setupRefusal: () => service?.replacedServiceLoaded?.() === true ? new ExpectedCliError(`Run \`${["powerplant init", ...envArgs(appEnv)].join(" ")}\` to finish moving to the new install, then update.`) : service?.setupRefusal?.("update") ?? null
|
|
92726
92753
|
});
|
|
92727
92754
|
const checkStarts = (command, version2) => checkNewVersionStarts(command, version2, { appEnv });
|
|
92728
92755
|
return {
|
|
@@ -93963,6 +93990,8 @@ function parseClaudeCodeTranscript(text) {
|
|
|
93963
93990
|
const modelCounts = /* @__PURE__ */ new Map();
|
|
93964
93991
|
const timestamps = [];
|
|
93965
93992
|
let title;
|
|
93993
|
+
let firstPrompt;
|
|
93994
|
+
let firstCommand;
|
|
93966
93995
|
let cwd;
|
|
93967
93996
|
let gitBranch;
|
|
93968
93997
|
let entrypoint;
|
|
@@ -93987,14 +94016,19 @@ function parseClaudeCodeTranscript(text) {
|
|
|
93987
94016
|
gitBranch ??= record2.gitBranch;
|
|
93988
94017
|
}
|
|
93989
94018
|
if (typeof record2.timestamp === "string") timestamps.push(record2.timestamp);
|
|
94019
|
+
if (firstPrompt === void 0) {
|
|
94020
|
+
const typed = typedLineOf(record2);
|
|
94021
|
+
if (typed?.isCommand === true) firstCommand ??= typed.line;
|
|
94022
|
+
else if (typed) firstPrompt = typed.line;
|
|
94023
|
+
}
|
|
93990
94024
|
if (record2.type !== "assistant") continue;
|
|
93991
94025
|
const message3 = record2.message;
|
|
93992
|
-
if (!message3 || message3.model
|
|
93993
|
-
const id =
|
|
94026
|
+
if (!message3 || !isClaudeCodeCall(message3.model)) continue;
|
|
94027
|
+
const id = claudeCodeCallId(record2, message3) ?? `anon-${anonCounter++}`;
|
|
93994
94028
|
const previousMessage = usageByMessage.get(id);
|
|
93995
94029
|
const isNewMessage = previousMessage === void 0;
|
|
93996
94030
|
const speedValue = message3.usage?.speed;
|
|
93997
|
-
const observedSpeed =
|
|
94031
|
+
const observedSpeed = claudeCodeSpeed(speedValue);
|
|
93998
94032
|
const messageSpeed = observedSpeed ?? previousMessage?.speedMode;
|
|
93999
94033
|
if (speedValue !== void 0) speedMode = observedSpeed ?? "unknown";
|
|
94000
94034
|
if (message3.usage) {
|
|
@@ -94027,23 +94061,25 @@ function parseClaudeCodeTranscript(text) {
|
|
|
94027
94061
|
usage: usageByMessage.size > 0 ? summed : null,
|
|
94028
94062
|
fastUsage,
|
|
94029
94063
|
...speedMode && { speedMode },
|
|
94030
|
-
title,
|
|
94064
|
+
title: title ?? fallbackTitle(firstPrompt ?? firstCommand),
|
|
94031
94065
|
turnCount: usageByMessage.size,
|
|
94032
94066
|
cwd,
|
|
94033
94067
|
gitBranch,
|
|
94034
|
-
entrypoint,
|
|
94068
|
+
launch: claudeLaunchOf(entrypoint),
|
|
94035
94069
|
endsWithAbortedTurn
|
|
94036
94070
|
};
|
|
94037
94071
|
}
|
|
94038
94072
|
var STOPPED_TURN_TEXT = "[Request interrupted by user";
|
|
94039
|
-
var
|
|
94073
|
+
var COMMAND_INPUT = /^\s*<(?:command-name|command-message|bash-input)>/;
|
|
94074
|
+
var COMMAND_OUTPUT = /^\s*<(?:local-command-caveat|local-command-stdout|local-command-stderr|bash-stdout|bash-stderr)>/;
|
|
94040
94075
|
var messageContentSchema = external_exports.object({ content: external_exports.union([external_exports.string(), external_exports.array(external_exports.unknown())]) });
|
|
94041
94076
|
var textBlockSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string() });
|
|
94042
94077
|
function abortedTurnOf(record2) {
|
|
94043
94078
|
if (record2.type !== "user" && record2.type !== "assistant" || record2.isSidechain === true) return void 0;
|
|
94044
94079
|
if (record2.type === "assistant") return record2.isApiErrorMessage === true;
|
|
94045
|
-
const text =
|
|
94046
|
-
|
|
94080
|
+
const text = textBlocks(record2.message)[0] ?? "";
|
|
94081
|
+
if (COMMAND_INPUT.test(text) || COMMAND_OUTPUT.test(text)) return void 0;
|
|
94082
|
+
return text.startsWith(STOPPED_TURN_TEXT);
|
|
94047
94083
|
}
|
|
94048
94084
|
function claudeCodeEndsWithAbortedTurn(tail) {
|
|
94049
94085
|
const records = [...parseJsonl(tail)];
|
|
@@ -94053,20 +94089,69 @@ function claudeCodeEndsWithAbortedTurn(tail) {
|
|
|
94053
94089
|
}
|
|
94054
94090
|
return false;
|
|
94055
94091
|
}
|
|
94056
|
-
|
|
94092
|
+
var COMMAND_NAME = /<command-name>([^<]*)<\/command-name>/;
|
|
94093
|
+
var COMMAND_ARGS = /<command-args>([\s\S]*?)<\/command-args>/;
|
|
94094
|
+
var BASH_INPUT = /<bash-input>([\s\S]*?)<\/bash-input>/;
|
|
94095
|
+
var LEADING_CONTEXT_BLOCK = /^<(system-reminder|task-notification|ci-monitor-event|ide_(?:opened_file|selection))\b[^>]*>[\s\S]*?<\/\1>/;
|
|
94096
|
+
var humanOriginSchema = external_exports.object({ kind: external_exports.literal("human") });
|
|
94097
|
+
function typedLineOf(record2) {
|
|
94098
|
+
if (record2.isSidechain === true || record2.isMeta === true || record2.isCompactSummary === true) return void 0;
|
|
94099
|
+
if (record2.type === "system" && record2.subtype === "local_command" && typeof record2.content === "string") {
|
|
94100
|
+
const command = typedCommand(record2.content);
|
|
94101
|
+
return command === void 0 ? void 0 : { line: command, isCommand: true };
|
|
94102
|
+
}
|
|
94103
|
+
if (record2.type !== "user") return void 0;
|
|
94104
|
+
if (record2.origin !== void 0 && !humanOriginSchema.safeParse(record2.origin).success) return void 0;
|
|
94105
|
+
for (const block2 of textBlocks(record2.message)) {
|
|
94106
|
+
const command = typedCommand(block2);
|
|
94107
|
+
if (command !== void 0) return { line: command, isCommand: true };
|
|
94108
|
+
if (COMMAND_INPUT.test(block2)) continue;
|
|
94109
|
+
const text = withoutLeadingContextBlocks(block2.trim());
|
|
94110
|
+
if (text === "" || COMMAND_OUTPUT.test(text) || text.startsWith(STOPPED_TURN_TEXT)) continue;
|
|
94111
|
+
return { line: firstLine(text), isCommand: false };
|
|
94112
|
+
}
|
|
94113
|
+
return void 0;
|
|
94114
|
+
}
|
|
94115
|
+
function withoutLeadingContextBlocks(text) {
|
|
94116
|
+
const block2 = LEADING_CONTEXT_BLOCK.exec(text);
|
|
94117
|
+
return block2 === null ? text : withoutLeadingContextBlocks(text.slice(block2[0].length).trim());
|
|
94118
|
+
}
|
|
94119
|
+
function typedCommand(text) {
|
|
94120
|
+
if (!COMMAND_INPUT.test(text)) return void 0;
|
|
94121
|
+
const bash = BASH_INPUT.exec(text)?.[1]?.trim();
|
|
94122
|
+
if (bash) return `!${firstLine(redactText(bash))}`;
|
|
94123
|
+
const name = COMMAND_NAME.exec(text)?.[1]?.trim();
|
|
94124
|
+
if (!name) return void 0;
|
|
94125
|
+
return firstLine(`${name} ${redactText(COMMAND_ARGS.exec(text)?.[1]?.trim() ?? "")}`);
|
|
94126
|
+
}
|
|
94127
|
+
var FALLBACK_TITLE_MAX_WORDS = 8;
|
|
94128
|
+
var FALLBACK_TITLE_MAX_CHARS = 80;
|
|
94129
|
+
function fallbackTitle(line) {
|
|
94130
|
+
if (line === void 0) return void 0;
|
|
94131
|
+
const words = redactText(line).split(/\s+/);
|
|
94132
|
+
const kept = words.slice(0, FALLBACK_TITLE_MAX_WORDS).join(" ");
|
|
94133
|
+
if (kept.length <= FALLBACK_TITLE_MAX_CHARS) return words.length > FALLBACK_TITLE_MAX_WORDS ? `${kept}\u2026` : kept;
|
|
94134
|
+
const head = kept.slice(0, FALLBACK_TITLE_MAX_CHARS);
|
|
94135
|
+
const lastSpace = head.lastIndexOf(" ");
|
|
94136
|
+
return `${lastSpace > 0 ? head.slice(0, lastSpace) : head}\u2026`;
|
|
94137
|
+
}
|
|
94138
|
+
function firstLine(text) {
|
|
94139
|
+
return text.split("\n", 1)[0].trim();
|
|
94140
|
+
}
|
|
94141
|
+
function textBlocks(message3) {
|
|
94057
94142
|
const parsed = messageContentSchema.safeParse(message3);
|
|
94058
|
-
if (!parsed.success) return
|
|
94143
|
+
if (!parsed.success) return [];
|
|
94059
94144
|
const { content } = parsed.data;
|
|
94060
|
-
if (typeof content === "string") return content;
|
|
94061
|
-
|
|
94145
|
+
if (typeof content === "string") return [content];
|
|
94146
|
+
return content.flatMap((block2) => {
|
|
94062
94147
|
const text = textBlockSchema.safeParse(block2);
|
|
94063
|
-
|
|
94064
|
-
}
|
|
94065
|
-
return "";
|
|
94148
|
+
return text.success ? [text.data.text] : [];
|
|
94149
|
+
});
|
|
94066
94150
|
}
|
|
94067
|
-
|
|
94068
|
-
|
|
94069
|
-
|
|
94151
|
+
function claudeLaunchOf(entrypoint) {
|
|
94152
|
+
if (entrypoint === "sdk-cli") return "print";
|
|
94153
|
+
if (entrypoint === "sdk-py" || entrypoint === "sdk-ts") return "agent-sdk";
|
|
94154
|
+
return "interactive";
|
|
94070
94155
|
}
|
|
94071
94156
|
function sessionKey(identity) {
|
|
94072
94157
|
return JSON.stringify([identity.harness, identity.harnessSessionId]);
|
|
@@ -94172,6 +94257,7 @@ async function collectClaudeCodeSessions(options = {}) {
|
|
|
94172
94257
|
const endedAt = endObservedAt ?? laterTimestamp(summary.endedAt, usage.endedAt);
|
|
94173
94258
|
items.push({
|
|
94174
94259
|
mtimeMs,
|
|
94260
|
+
...summary.launch !== "interactive" && { hookRecordOptional: true },
|
|
94175
94261
|
endsWithAbortedTurn: summary.endsWithAbortedTurn,
|
|
94176
94262
|
transcriptPath,
|
|
94177
94263
|
transcriptPrefix: transcript.prefix,
|
|
@@ -94206,7 +94292,7 @@ async function collectClaudeCodeSessions(options = {}) {
|
|
|
94206
94292
|
fastCacheWriteTokens: usage.fast.cacheCreation
|
|
94207
94293
|
},
|
|
94208
94294
|
...summary.title && { title: redactText(summary.title).slice(0, 500) },
|
|
94209
|
-
...
|
|
94295
|
+
...summary.launch === "agent-sdk" && { automation: true },
|
|
94210
94296
|
// The PR-join coordinates: the checkout's directory name (bare
|
|
94211
94297
|
// repo, not the local path) and the branch the work started on.
|
|
94212
94298
|
...cwd && { repoDir: path40.basename(cwd) },
|
|
@@ -94249,9 +94335,6 @@ function toUsage(u) {
|
|
|
94249
94335
|
output: n(u.output_tokens)
|
|
94250
94336
|
};
|
|
94251
94337
|
}
|
|
94252
|
-
function speedModeOf(value) {
|
|
94253
|
-
return value === "fast" || value === "standard" ? value : void 0;
|
|
94254
|
-
}
|
|
94255
94338
|
function addUsage(a, b2) {
|
|
94256
94339
|
return {
|
|
94257
94340
|
input: a.input + b2.input,
|
|
@@ -96361,8 +96444,10 @@ import path45 from "node:path";
|
|
|
96361
96444
|
// ../../apps/syncservice/src/windowsElevation.ts
|
|
96362
96445
|
import { readdirSync as readdirSync12 } from "node:fs";
|
|
96363
96446
|
import path44 from "node:path";
|
|
96364
|
-
function elevatedSetupRefusal(retryCommand) {
|
|
96365
|
-
return
|
|
96447
|
+
function elevatedSetupRefusal(notDone, retryCommand) {
|
|
96448
|
+
return new ExpectedCliError(`\u2717 ${notDone} because this window runs as administrator`, {
|
|
96449
|
+
details: [`Open PowerShell without "Run as administrator", then run \`${retryCommand}\`.`]
|
|
96450
|
+
});
|
|
96366
96451
|
}
|
|
96367
96452
|
function windowsProcessIsElevated(systemRoot, list = readdirSync12) {
|
|
96368
96453
|
try {
|
|
@@ -96431,7 +96516,7 @@ var TaskSchedulerService = class {
|
|
|
96431
96516
|
}
|
|
96432
96517
|
install(command) {
|
|
96433
96518
|
const refusal = this.setupRefusal("init");
|
|
96434
|
-
if (refusal !== null) throw
|
|
96519
|
+
if (refusal !== null) throw refusal;
|
|
96435
96520
|
const xml = this.taskXml(this.action(command));
|
|
96436
96521
|
this.refuseMissingProgram(xml);
|
|
96437
96522
|
const described = this.describe(null);
|
|
@@ -96480,7 +96565,9 @@ var TaskSchedulerService = class {
|
|
|
96480
96565
|
* off, the task itself runs as administrator, and its supervisor points
|
|
96481
96566
|
* the task at each update. */
|
|
96482
96567
|
setupRefusal(subcommand) {
|
|
96483
|
-
|
|
96568
|
+
if (!this.isElevated()) return null;
|
|
96569
|
+
const notDone = subcommand === "init" ? "Not set up" : subcommand === "update" ? "Not updated" : "Not installed";
|
|
96570
|
+
return elevatedSetupRefusal(notDone, this.typedCommand(subcommand));
|
|
96484
96571
|
}
|
|
96485
96572
|
/** The task starts only the installed Powerplant's windowless copy
|
|
96486
96573
|
* (taskAction). */
|
|
@@ -99240,6 +99327,9 @@ function releaseNotServed(managerOutput) {
|
|
|
99240
99327
|
function updateLogPath(homeDir) {
|
|
99241
99328
|
return path55.join(collectorStateDir(homeDir), "cli-update.log");
|
|
99242
99329
|
}
|
|
99330
|
+
function backgroundUpdateLog(inspection, serviceLog) {
|
|
99331
|
+
return isPerUserInstall(inspection) ? serviceLog : updateLogPath();
|
|
99332
|
+
}
|
|
99243
99333
|
function updateProgressView(progress, cliVersion2, now) {
|
|
99244
99334
|
if (progress === null || progress.state === "up-to-date") return { kind: "none" };
|
|
99245
99335
|
const reached = progress.target === null ? null : compareReleaseVersions(cliVersion2, progress.target);
|
|
@@ -99378,6 +99468,11 @@ function launchBackgroundUpdate(deps) {
|
|
|
99378
99468
|
}
|
|
99379
99469
|
return "started";
|
|
99380
99470
|
}
|
|
99471
|
+
function startBackgroundUpdate(deps) {
|
|
99472
|
+
const asked = deps.askService();
|
|
99473
|
+
if (asked !== null) return asked === "already-running" ? asked : { log: deps.serviceLog };
|
|
99474
|
+
return deps.launch() === "started" ? { log: updateLogPath() } : "already-running";
|
|
99475
|
+
}
|
|
99381
99476
|
function updatedMessage(version2, restart) {
|
|
99382
99477
|
const landed = version2 === null ? "Updated, but could not read the installed version (check with: powerplant status)." : `Updated to v${version2}.`;
|
|
99383
99478
|
return restart === "restarted" ? `${landed} Background sync restarted.` : landed;
|
|
@@ -99585,7 +99680,7 @@ function renderMenu(i) {
|
|
|
99585
99680
|
target: progress.kind === "none" ? i.latestVersion : progress.target,
|
|
99586
99681
|
...progress.kind === "failed" && { detail: failedUpdateDetail(i, progress) },
|
|
99587
99682
|
run: ["update", "--background", ...envArgs2],
|
|
99588
|
-
logPath:
|
|
99683
|
+
logPath: i.update.logPath
|
|
99589
99684
|
}
|
|
99590
99685
|
},
|
|
99591
99686
|
...i.update.progress?.state === "up-to-date" && { cliUpToDateAt: i.update.progress.finishedAt },
|
|
@@ -99618,7 +99713,7 @@ function updateItems(i, progress, envArgs2, problem) {
|
|
|
99618
99713
|
return [
|
|
99619
99714
|
problem(`Updating ${release2} didn't finish`, failedUpdateDetail(i, progress)),
|
|
99620
99715
|
action("Retry updating"),
|
|
99621
|
-
{ type: "action", title: "View update log", file:
|
|
99716
|
+
{ type: "action", title: "View update log", file: i.update.logPath }
|
|
99622
99717
|
];
|
|
99623
99718
|
case "none":
|
|
99624
99719
|
return [action("Update")];
|
|
@@ -101128,7 +101223,12 @@ async function readMenuServer(deps) {
|
|
|
101128
101223
|
};
|
|
101129
101224
|
}
|
|
101130
101225
|
function readMenuSetup(deps) {
|
|
101131
|
-
return {
|
|
101226
|
+
return {
|
|
101227
|
+
codexDesktop: detectCodexDesktop(),
|
|
101228
|
+
...deps.readService(),
|
|
101229
|
+
updateInPlace: deps.updateInPlace(),
|
|
101230
|
+
updateLogPath: deps.updateLogPath()
|
|
101231
|
+
};
|
|
101132
101232
|
}
|
|
101133
101233
|
async function readMenuLocalDetails(deps, credentials, listing) {
|
|
101134
101234
|
const here = (listing?.sessions ?? []).filter((session) => credentials !== null && session.machineId === credentials.machineId);
|
|
@@ -101176,7 +101276,7 @@ function menuInputs(deps, { server, local, setup }, extra) {
|
|
|
101176
101276
|
claudeDesktopSessions: local.claudeDesktopSessions,
|
|
101177
101277
|
desktopDiagnostic: desktopDiagnostic ?? { ...local.desktopDiagnostic, requests: server.requests },
|
|
101178
101278
|
liveTerminalSessions: local.liveTerminalSessions,
|
|
101179
|
-
update: { inPlace: setup.updateInPlace, progress: deps.readUpdateProgress() },
|
|
101279
|
+
update: { inPlace: setup.updateInPlace, progress: deps.readUpdateProgress(), logPath: setup.updateLogPath },
|
|
101180
101280
|
...rest
|
|
101181
101281
|
};
|
|
101182
101282
|
}
|
|
@@ -101881,6 +101981,10 @@ async function confirmResume(deps, output2) {
|
|
|
101881
101981
|
var MACOS_BLOCKED_FOLDER_REMEDY = "To allow it, open System Settings > Privacy & Security > Files and Folders, enable the folder for node, then run `powerplant init`.";
|
|
101882
101982
|
|
|
101883
101983
|
// src/init.ts
|
|
101984
|
+
var INIT_PREFLIGHT_LABELS = {
|
|
101985
|
+
move: "Finishing background sync setup\u2026",
|
|
101986
|
+
restart: "Restarting background sync\u2026"
|
|
101987
|
+
};
|
|
101884
101988
|
function syncNote(credentials) {
|
|
101885
101989
|
const org = credentials.orgName ?? "your organization";
|
|
101886
101990
|
const boundary = storedCaptureBoundary(credentials);
|
|
@@ -101916,11 +102020,12 @@ async function waitForEnrollment(output2, enroll2) {
|
|
|
101916
102020
|
return output2.activity("Waiting for approval in your browser\u2026", () => enrolling);
|
|
101917
102021
|
}
|
|
101918
102022
|
async function runInit(deps) {
|
|
101919
|
-
if (deps.setupRefusal !== null) throw
|
|
102023
|
+
if (deps.setupRefusal !== null) throw deps.setupRefusal;
|
|
101920
102024
|
const { command, stage } = deps.terminal;
|
|
101921
102025
|
const existing = deps.loadCredentials();
|
|
101922
102026
|
command.log("\u26A1 Powerplant");
|
|
101923
102027
|
command.detail(`${existing ? "Checking" : "Setting up"} this machine \xB7 ${deps.environmentName}`);
|
|
102028
|
+
const preflightDidWork = await deps.prepareCredentialUpgrade?.(command) ?? false;
|
|
101924
102029
|
command.log("");
|
|
101925
102030
|
command.log("1/3 Enroll this machine");
|
|
101926
102031
|
let enrolled = false;
|
|
@@ -102045,7 +102150,7 @@ async function runInit(deps) {
|
|
|
102045
102150
|
command.log("");
|
|
102046
102151
|
const connectDidWork = outcome !== null && outcome.connected + outcome.configured > outcome.unchanged;
|
|
102047
102152
|
const connectSettled = outcome !== null && outcome.found > 0 && outcome.pending === 0 && outcome.failed === 0 && outcome.skipped === 0 && outcome.unchanged === outcome.found && !connectDidWork;
|
|
102048
|
-
if (!enrolled && !installed && !menubarDidWork && !repoDiscoveryDidWork && !protectedFoldersNeedAttention && pauseOffer === "not-paused" && connectSettled) {
|
|
102153
|
+
if (!preflightDidWork && !enrolled && !installed && !menubarDidWork && !repoDiscoveryDidWork && !protectedFoldersNeedAttention && pauseOffer === "not-paused" && connectSettled) {
|
|
102049
102154
|
command.log("\u2713 Everything is already set up");
|
|
102050
102155
|
return "already-set-up";
|
|
102051
102156
|
}
|
|
@@ -102227,7 +102332,7 @@ function runResumeSession(source, sessionId, deps = {}) {
|
|
|
102227
102332
|
}
|
|
102228
102333
|
|
|
102229
102334
|
// src/version.ts
|
|
102230
|
-
var CLI_VERSION = true ? "0.4.
|
|
102335
|
+
var CLI_VERSION = true ? "0.4.31" : "0.0.0-checkout";
|
|
102231
102336
|
var CLI_RELEASE_BUILD = true ? true : false;
|
|
102232
102337
|
var CLI_DEVELOPMENT_COPY = false;
|
|
102233
102338
|
function updateRefusal(tarball, developmentCopy = CLI_DEVELOPMENT_COPY) {
|
|
@@ -102567,6 +102672,12 @@ function skippable(line, place) {
|
|
|
102567
102672
|
if (/`[^`]+`|https:\/\//.test(line)) return false;
|
|
102568
102673
|
return place.level === "stage" ? !place.detail : place.detail;
|
|
102569
102674
|
}
|
|
102675
|
+
function printExpectedError(error63, stderr, env) {
|
|
102676
|
+
const effects = terminalUsesEffects(stderr.isTTY === true, env);
|
|
102677
|
+
const output2 = createTerminalOutput({ interactive: effects, color: effects, write: (chunk) => stderr.write(chunk) }).command;
|
|
102678
|
+
output2.log(error63.message);
|
|
102679
|
+
for (const detail of error63.details) output2.detail(detail);
|
|
102680
|
+
}
|
|
102570
102681
|
function styleLine(line, place) {
|
|
102571
102682
|
if (skippable(line, place)) return dim(line);
|
|
102572
102683
|
return styleCommands(styleUrls(colorPrefix(line)));
|
|
@@ -102682,8 +102793,11 @@ async function prepareCredentialUpgrade(deps) {
|
|
|
102682
102793
|
if (!deps.launcherCurrent()) {
|
|
102683
102794
|
lock.assertHeld();
|
|
102684
102795
|
deps.install();
|
|
102685
|
-
|
|
102796
|
+
} else if (deps.movesSync && !deps.startingNextWorker()) {
|
|
102797
|
+
lock.assertHeld();
|
|
102798
|
+
deps.restart();
|
|
102686
102799
|
}
|
|
102800
|
+
if (deps.movesSync) deadline = deps.now() + 3e4;
|
|
102687
102801
|
for (; ; ) {
|
|
102688
102802
|
lock.assertHeld();
|
|
102689
102803
|
if (!deps.needsMigration()) return "ready";
|
|
@@ -102830,7 +102944,7 @@ function forgetFirstLaunchAttempt(domain2) {
|
|
|
102830
102944
|
const result = spawnSync7("/usr/bin/defaults", ["delete", domain2, FIRST_LAUNCH_ATTEMPT_KEY], { encoding: "utf8", timeout: 1e4 });
|
|
102831
102945
|
if (result.status === 0) return null;
|
|
102832
102946
|
const detail = result.error?.message ?? result.stderr.trim();
|
|
102833
|
-
return /does not exist|not found/.test(detail) ? null : detail || `exit ${result.status ?? result.signal}`;
|
|
102947
|
+
return /does not exist|Could not find key|not found/.test(detail) ? null : detail || `exit ${result.status ?? result.signal}`;
|
|
102834
102948
|
}
|
|
102835
102949
|
function menubarAppPaths(homeDir) {
|
|
102836
102950
|
return [path62.join(homeDir, "Applications", MENUBAR_APP_NAME), path62.join("/Applications", MENUBAR_APP_NAME)];
|
|
@@ -103346,9 +103460,16 @@ ${USAGE}`);
|
|
|
103346
103460
|
write: (chunk) => process.stdout.write(chunk)
|
|
103347
103461
|
});
|
|
103348
103462
|
const writesFolders = command === "folders" && ["add", "remove"].includes(positionals[1] ?? "") && positionals[2] !== void 0;
|
|
103349
|
-
|
|
103350
|
-
|
|
103351
|
-
|
|
103463
|
+
const needsCredentialPreflight = (["menu", "init", "enroll", "sync"].includes(command) || writesFolders) && !values["dry-run"];
|
|
103464
|
+
const movesSync = command === "init" && service?.installRetiresReplaced === true;
|
|
103465
|
+
const restartService2 = () => {
|
|
103466
|
+
if (requireBackgroundService(service).restart() === "not-installed") {
|
|
103467
|
+
throw new ExpectedCliError("Background sync is not installed. Rerun `powerplant init`.");
|
|
103468
|
+
}
|
|
103469
|
+
};
|
|
103470
|
+
const credentialPreflight = async (output2) => {
|
|
103471
|
+
let changed = false;
|
|
103472
|
+
let stopProgress;
|
|
103352
103473
|
const outcome = await prepareCredentialUpgrade({
|
|
103353
103474
|
needsMigration: () => credentialsNeedMigration(config2.appEnv),
|
|
103354
103475
|
serviceExists: () => serviceState2(service) !== "not-installed",
|
|
@@ -103365,15 +103486,22 @@ ${USAGE}`);
|
|
|
103365
103486
|
// (credentialMigration.ts), and only init moves sync to it.
|
|
103366
103487
|
launcherCurrent: () => service?.installRetiresReplaced === true && !movesSync || service?.upToDate(watchCommand(config2, copy)) === true,
|
|
103367
103488
|
install: () => {
|
|
103368
|
-
if (movesSync)
|
|
103489
|
+
if (movesSync) stopProgress = output2.startActivity(INIT_PREFLIGHT_LABELS.move);
|
|
103369
103490
|
requireBackgroundService(service).install(watchCommand(config2, copy));
|
|
103491
|
+
changed = true;
|
|
103370
103492
|
},
|
|
103493
|
+
restart: () => {
|
|
103494
|
+
stopProgress = output2.startActivity(INIT_PREFLIGHT_LABELS.restart);
|
|
103495
|
+
restartService2();
|
|
103496
|
+
changed = true;
|
|
103497
|
+
},
|
|
103498
|
+
startingNextWorker: () => describeDaemonState(readCollectorStatus(config2.appEnv)).state === "restarting",
|
|
103371
103499
|
tryLock: () => tryCredentialUpgradeLock(path63.join(collectorStateDir(), `credential-upgrade-${config2.appEnv}.lock`)),
|
|
103372
103500
|
now: Date.now,
|
|
103373
103501
|
sleep: () => new Promise((resolve2) => setTimeout(resolve2, 250)),
|
|
103374
103502
|
savesCredentials: command !== "menu",
|
|
103375
103503
|
movesSync
|
|
103376
|
-
}).finally(() =>
|
|
103504
|
+
}).finally(() => stopProgress?.()).catch((error63) => {
|
|
103377
103505
|
if (error63 instanceof ExpectedCliError && credentialUpgradeBlock !== void 0) {
|
|
103378
103506
|
reportDaily(
|
|
103379
103507
|
new Error(`Credential upgrade blocked: ${credentialUpgradeBlock}`, { cause: error63 }),
|
|
@@ -103387,7 +103515,10 @@ ${USAGE}`);
|
|
|
103387
103515
|
if (outcome === "busy" && command !== "menu") {
|
|
103388
103516
|
throw new ExpectedCliError("Powerplant is updating background sync. Try this command again after the update finishes.");
|
|
103389
103517
|
}
|
|
103390
|
-
|
|
103518
|
+
return changed;
|
|
103519
|
+
};
|
|
103520
|
+
const preflightUnderInitHeader = needsCredentialPreflight && movesSync;
|
|
103521
|
+
if (needsCredentialPreflight && !preflightUnderInitHeader) await credentialPreflight(terminal.command);
|
|
103391
103522
|
const withEnv = (cmd) => config2.appEnv === "production" ? cmd : `${cmd} --env ${config2.appEnv}`;
|
|
103392
103523
|
const connectCommand = withEnv("powerplant connect");
|
|
103393
103524
|
const disconnectCommand = withEnv("powerplant disconnect");
|
|
@@ -103544,11 +103675,7 @@ ${USAGE}`);
|
|
|
103544
103675
|
const daemon = describeDaemonState(readCollectorStatus(config2.appEnv));
|
|
103545
103676
|
return daemon.state === "running" ? daemon.status : null;
|
|
103546
103677
|
},
|
|
103547
|
-
restart:
|
|
103548
|
-
if (requireBackgroundService(service).restart() === "not-installed") {
|
|
103549
|
-
throw new ExpectedCliError("Background sync is not installed. Rerun `powerplant init`.");
|
|
103550
|
-
}
|
|
103551
|
-
},
|
|
103678
|
+
restart: restartService2,
|
|
103552
103679
|
now: Date.now,
|
|
103553
103680
|
sleep: () => new Promise((resolve2) => setTimeout(resolve2, 250))
|
|
103554
103681
|
}),
|
|
@@ -103563,7 +103690,8 @@ ${USAGE}`);
|
|
|
103563
103690
|
connectCommand,
|
|
103564
103691
|
environmentName: config2.appEnv,
|
|
103565
103692
|
webUrl: config2.webUrl,
|
|
103566
|
-
setupRefusal
|
|
103693
|
+
setupRefusal,
|
|
103694
|
+
prepareCredentialUpgrade: preflightUnderInitHeader ? credentialPreflight : null
|
|
103567
103695
|
});
|
|
103568
103696
|
process.exitCode = initExitCode(summary);
|
|
103569
103697
|
return;
|
|
@@ -103780,7 +103908,7 @@ The access you granted these agents stays on your Powerplant account until you r
|
|
|
103780
103908
|
tarball,
|
|
103781
103909
|
background: values.background === true,
|
|
103782
103910
|
waiting: (label2) => terminal.command.startActivity(label2),
|
|
103783
|
-
startDetached: () => startBackgroundUpdate(config2, copy, null, tarball)
|
|
103911
|
+
startDetached: () => startBackgroundUpdate(backgroundUpdateDeps(config2, copy, null, tarball))
|
|
103784
103912
|
});
|
|
103785
103913
|
return;
|
|
103786
103914
|
}
|
|
@@ -103796,7 +103924,7 @@ The access you granted these agents stays on your Powerplant account until you r
|
|
|
103796
103924
|
const inspection = inspectThisInstall(copy);
|
|
103797
103925
|
if (values.background) {
|
|
103798
103926
|
if (!inspection.inPlace.ok) throw new ExpectedCliError(inspection.inPlace.reason);
|
|
103799
|
-
startBackgroundUpdate(config2, copy, await cachedAvailableVersion(config2, loadCredentialsSafely(config2).credentials));
|
|
103927
|
+
startBackgroundUpdate(backgroundUpdateDeps(config2, copy, await cachedAvailableVersion(config2, loadCredentialsSafely(config2).credentials)));
|
|
103800
103928
|
return;
|
|
103801
103929
|
}
|
|
103802
103930
|
await runUpdate({
|
|
@@ -103980,6 +104108,7 @@ function menuSourceDeps(config2, copy, report, lap) {
|
|
|
103980
104108
|
oldestSupportedVersion: oldestSupportedFor,
|
|
103981
104109
|
readService: () => readServiceSafely(copy.service),
|
|
103982
104110
|
updateInPlace: () => inspectThisInstall(copy).inPlace.ok,
|
|
104111
|
+
updateLogPath: () => backgroundUpdateLog(inspectThisInstall(copy), serviceLogPath2(config2.appEnv)),
|
|
103983
104112
|
readUpdateProgress: updateProgress.read,
|
|
103984
104113
|
moveToInstalledCopy: () => moveToInstalledCopy(config2, copy),
|
|
103985
104114
|
report,
|
|
@@ -104081,30 +104210,30 @@ function cachedAvailableVersion(config2, credentials, fetchImpl = fetch) {
|
|
|
104081
104210
|
fetchLatest: () => fetchAvailableVersion(config2, credentials, fetchImpl)
|
|
104082
104211
|
});
|
|
104083
104212
|
}
|
|
104084
|
-
function
|
|
104085
|
-
if (copy.kind === "installed") {
|
|
104086
|
-
const asked = copy.askService({ target, tarball });
|
|
104087
|
-
if (asked !== null) return asked;
|
|
104088
|
-
}
|
|
104213
|
+
function backgroundUpdateDeps(config2, copy, target, tarball = null) {
|
|
104089
104214
|
const tarballArgs = tarball === null || tarball === void 0 ? [] : ["--tarball", tarball.file, "--sha256", tarball.sha256];
|
|
104090
|
-
return
|
|
104091
|
-
target,
|
|
104092
|
-
|
|
104093
|
-
|
|
104094
|
-
|
|
104095
|
-
|
|
104096
|
-
|
|
104097
|
-
|
|
104098
|
-
|
|
104099
|
-
|
|
104100
|
-
|
|
104101
|
-
|
|
104102
|
-
|
|
104103
|
-
|
|
104104
|
-
|
|
104105
|
-
|
|
104106
|
-
|
|
104107
|
-
|
|
104215
|
+
return {
|
|
104216
|
+
askService: () => copy.kind === "installed" ? copy.askService({ target, tarball }) : null,
|
|
104217
|
+
launch: () => launchBackgroundUpdate({
|
|
104218
|
+
target,
|
|
104219
|
+
now: Date.now,
|
|
104220
|
+
isProcessAlive: processIsAlive2,
|
|
104221
|
+
readProgress: updateProgress.read,
|
|
104222
|
+
writeProgress: updateProgress.write,
|
|
104223
|
+
spawnChild: () => {
|
|
104224
|
+
mkdirSync32(path63.dirname(updateLogPath()), { recursive: true });
|
|
104225
|
+
const log3 = openSync13(updateLogPath(), "a");
|
|
104226
|
+
const child = spawn8(...spawnArguments(thisPowerplant(), ["update", ...envArgsFor(config2), ...tarballArgs]), {
|
|
104227
|
+
detached: true,
|
|
104228
|
+
stdio: ["ignore", log3, log3],
|
|
104229
|
+
env: { ...process.env, [UPDATE_CHILD_ENV]: "1" }
|
|
104230
|
+
});
|
|
104231
|
+
child.unref();
|
|
104232
|
+
return child.pid;
|
|
104233
|
+
}
|
|
104234
|
+
}),
|
|
104235
|
+
serviceLog: serviceLogPath2(config2.appEnv)
|
|
104236
|
+
};
|
|
104108
104237
|
}
|
|
104109
104238
|
var MANAGER_STDERR_KEEP = 16 * 1024;
|
|
104110
104239
|
function automaticUpdateCheck(config2, copy) {
|
|
@@ -104130,9 +104259,8 @@ function automaticUpdateCheck(config2, copy) {
|
|
|
104130
104259
|
now: Date.now()
|
|
104131
104260
|
});
|
|
104132
104261
|
if (decision.kind === "update") {
|
|
104133
|
-
|
|
104134
|
-
|
|
104135
|
-
}
|
|
104262
|
+
const started = startBackgroundUpdate(backgroundUpdateDeps(config2, copy, decision.target));
|
|
104263
|
+
if (started !== "already-running") log3(`automatic update to ${decision.target} started (log: ${started.log})`);
|
|
104136
104264
|
return;
|
|
104137
104265
|
}
|
|
104138
104266
|
if (decision.reason === "cannot-update-in-place" && !saidCannot) {
|
|
@@ -104234,9 +104362,7 @@ async function runCommand() {
|
|
|
104234
104362
|
}
|
|
104235
104363
|
runCommand().catch(async (error63) => {
|
|
104236
104364
|
if (error63 instanceof ExpectedCliError) {
|
|
104237
|
-
|
|
104238
|
-
terminalUsesEffects(process.stderr.isTTY === true, process.env) ? styleLine(error63.message, { level: "command", detail: false }) : error63.message
|
|
104239
|
-
);
|
|
104365
|
+
printExpectedError(error63, process.stderr, process.env);
|
|
104240
104366
|
} else {
|
|
104241
104367
|
console.error(error63);
|
|
104242
104368
|
}
|
|
@@ -104254,4 +104380,4 @@ undici/lib/web/websocket/frame.js:
|
|
|
104254
104380
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
104255
104381
|
*/
|
|
104256
104382
|
|
|
104257
|
-
//# debugId=
|
|
104383
|
+
//# debugId=70311df7-2e4d-5e8c-9d0b-135dffb81341
|
|
Binary file
|