@usepowerplant/cli 0.4.30 → 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 +173 -81
- 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) {
|
|
@@ -92202,7 +92222,7 @@ function lockInstallForChange(deps) {
|
|
|
92202
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.`);
|
|
92203
92223
|
}
|
|
92204
92224
|
const refusal = deps.setupRefusal();
|
|
92205
|
-
if (refusal !== null) throw
|
|
92225
|
+
if (refusal !== null) throw refusal;
|
|
92206
92226
|
return lock;
|
|
92207
92227
|
} catch (error63) {
|
|
92208
92228
|
lock.release();
|
|
@@ -92284,9 +92304,6 @@ import path31 from "node:path";
|
|
|
92284
92304
|
function isPackageCopy(entryPath2) {
|
|
92285
92305
|
return entryPath2.replaceAll("\\", "/").includes(`/node_modules/${CLI_PACKAGE_NAME}/`);
|
|
92286
92306
|
}
|
|
92287
|
-
function perUserAccount(platform2) {
|
|
92288
|
-
return `this ${RELEASE_PLATFORMS[platform2.release].displayName} account`;
|
|
92289
|
-
}
|
|
92290
92307
|
function perUserCopyFor(lookup) {
|
|
92291
92308
|
const { read } = lookup;
|
|
92292
92309
|
if (!isPackageCopy(lookup.entryPath) || read.kind === "missing") return null;
|
|
@@ -92296,9 +92313,9 @@ function perUserCopyFor(lookup) {
|
|
|
92296
92313
|
if (installHolding(read, lookup.entryPath) !== null) return null;
|
|
92297
92314
|
return installedCommand(read.record, path31.join(read.record.location, read.record.version));
|
|
92298
92315
|
}
|
|
92299
|
-
function runPerUserCopy(command, args, installCommand
|
|
92316
|
+
function runPerUserCopy(command, args, installCommand) {
|
|
92300
92317
|
const [program, programArgs] = spawnArguments(command, args);
|
|
92301
|
-
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}`);
|
|
92302
92319
|
return new Promise((resolve2, reject) => {
|
|
92303
92320
|
let child;
|
|
92304
92321
|
const ignore = () => {
|
|
@@ -92352,7 +92369,7 @@ async function installPerUserCopy(deps, fetched, stopService) {
|
|
|
92352
92369
|
}
|
|
92353
92370
|
const work = early ?? newWorkFolder(deps);
|
|
92354
92371
|
try {
|
|
92355
|
-
deps.log(`Installing Powerplant ${release2.version}
|
|
92372
|
+
deps.log(`Installing the signed Powerplant program ${release2.version} that runs background sync\u2026`);
|
|
92356
92373
|
const tarball = path31.join(work, "powerplant.tgz");
|
|
92357
92374
|
if (early === null) await downloadRelease(release2, tarball, deps.fetchImpl);
|
|
92358
92375
|
const installed = await installRelease({
|
|
@@ -92443,10 +92460,10 @@ async function registerUnlessInstalled(deps, register2) {
|
|
|
92443
92460
|
}
|
|
92444
92461
|
}
|
|
92445
92462
|
async function initFromNpmCopy(deps) {
|
|
92446
|
-
if (deps.setupRefusal !== null) throw
|
|
92463
|
+
if (deps.setupRefusal !== null) throw deps.setupRefusal;
|
|
92447
92464
|
const { platform: platform2 } = deps;
|
|
92448
92465
|
const installCommand = platform2.installCommandFor(deps.apiUrl);
|
|
92449
|
-
const run2 = deps.run ?? ((command, args) => runPerUserCopy(command, args, installCommand
|
|
92466
|
+
const run2 = deps.run ?? ((command, args) => runPerUserCopy(command, args, installCommand));
|
|
92450
92467
|
let read = readInstallRecord(deps.recordFile);
|
|
92451
92468
|
if (read.kind === "missing" && platform2.installsThroughNpm) {
|
|
92452
92469
|
const plan = planLegacyInit(await fetchReleaseOffer(deps), () => platform2.unsupportedHardware());
|
|
@@ -92526,7 +92543,7 @@ function reportUnsupportedHardware(reason) {
|
|
|
92526
92543
|
]);
|
|
92527
92544
|
}
|
|
92528
92545
|
async function updateFromNpmCopy(deps) {
|
|
92529
|
-
if (deps.setupRefusal !== null) throw
|
|
92546
|
+
if (deps.setupRefusal !== null) throw deps.setupRefusal;
|
|
92530
92547
|
const { displayName: displayName2 } = RELEASE_PLATFORMS[deps.platform.release];
|
|
92531
92548
|
const release2 = await fetchServedRelease(deps);
|
|
92532
92549
|
if (release2 === null) {
|
|
@@ -92547,12 +92564,12 @@ async function updateFromNpmCopy(deps) {
|
|
|
92547
92564
|
moved = deps.moveService(perUser);
|
|
92548
92565
|
} catch (error63) {
|
|
92549
92566
|
throw new ExpectedCliError(
|
|
92550
|
-
`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)}`
|
|
92551
92568
|
);
|
|
92552
92569
|
}
|
|
92553
|
-
const installed = `Installed Powerplant${version2}
|
|
92570
|
+
const installed = `Installed the signed Powerplant program${version2}.`;
|
|
92554
92571
|
deps.log(
|
|
92555
|
-
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)}`
|
|
92556
92573
|
);
|
|
92557
92574
|
}
|
|
92558
92575
|
function fetchServedRelease(deps) {
|
|
@@ -92688,7 +92705,7 @@ function thisCopy(input2) {
|
|
|
92688
92705
|
kind: "package",
|
|
92689
92706
|
route: "forward",
|
|
92690
92707
|
service: other(),
|
|
92691
|
-
forward: (args) => runPerUserCopy(forwardTo, args, installCommand
|
|
92708
|
+
forward: (args) => runPerUserCopy(forwardTo, args, installCommand)
|
|
92692
92709
|
};
|
|
92693
92710
|
}
|
|
92694
92711
|
function environmentService(input2) {
|
|
@@ -92732,7 +92749,7 @@ function installedCopy(input2, platform2, record2) {
|
|
|
92732
92749
|
restartCommand: ["powerplant restart", ...envArgs(appEnv)].join(" "),
|
|
92733
92750
|
// The legacy agent's job syncs without the lock, so an update's
|
|
92734
92751
|
// health check would run a second worker beside it.
|
|
92735
|
-
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
|
|
92736
92753
|
});
|
|
92737
92754
|
const checkStarts = (command, version2) => checkNewVersionStarts(command, version2, { appEnv });
|
|
92738
92755
|
return {
|
|
@@ -93973,6 +93990,8 @@ function parseClaudeCodeTranscript(text) {
|
|
|
93973
93990
|
const modelCounts = /* @__PURE__ */ new Map();
|
|
93974
93991
|
const timestamps = [];
|
|
93975
93992
|
let title;
|
|
93993
|
+
let firstPrompt;
|
|
93994
|
+
let firstCommand;
|
|
93976
93995
|
let cwd;
|
|
93977
93996
|
let gitBranch;
|
|
93978
93997
|
let entrypoint;
|
|
@@ -93997,14 +94016,19 @@ function parseClaudeCodeTranscript(text) {
|
|
|
93997
94016
|
gitBranch ??= record2.gitBranch;
|
|
93998
94017
|
}
|
|
93999
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
|
+
}
|
|
94000
94024
|
if (record2.type !== "assistant") continue;
|
|
94001
94025
|
const message3 = record2.message;
|
|
94002
|
-
if (!message3 || message3.model
|
|
94003
|
-
const id =
|
|
94026
|
+
if (!message3 || !isClaudeCodeCall(message3.model)) continue;
|
|
94027
|
+
const id = claudeCodeCallId(record2, message3) ?? `anon-${anonCounter++}`;
|
|
94004
94028
|
const previousMessage = usageByMessage.get(id);
|
|
94005
94029
|
const isNewMessage = previousMessage === void 0;
|
|
94006
94030
|
const speedValue = message3.usage?.speed;
|
|
94007
|
-
const observedSpeed =
|
|
94031
|
+
const observedSpeed = claudeCodeSpeed(speedValue);
|
|
94008
94032
|
const messageSpeed = observedSpeed ?? previousMessage?.speedMode;
|
|
94009
94033
|
if (speedValue !== void 0) speedMode = observedSpeed ?? "unknown";
|
|
94010
94034
|
if (message3.usage) {
|
|
@@ -94037,7 +94061,7 @@ function parseClaudeCodeTranscript(text) {
|
|
|
94037
94061
|
usage: usageByMessage.size > 0 ? summed : null,
|
|
94038
94062
|
fastUsage,
|
|
94039
94063
|
...speedMode && { speedMode },
|
|
94040
|
-
title,
|
|
94064
|
+
title: title ?? fallbackTitle(firstPrompt ?? firstCommand),
|
|
94041
94065
|
turnCount: usageByMessage.size,
|
|
94042
94066
|
cwd,
|
|
94043
94067
|
gitBranch,
|
|
@@ -94046,14 +94070,16 @@ function parseClaudeCodeTranscript(text) {
|
|
|
94046
94070
|
};
|
|
94047
94071
|
}
|
|
94048
94072
|
var STOPPED_TURN_TEXT = "[Request interrupted by user";
|
|
94049
|
-
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)>/;
|
|
94050
94075
|
var messageContentSchema = external_exports.object({ content: external_exports.union([external_exports.string(), external_exports.array(external_exports.unknown())]) });
|
|
94051
94076
|
var textBlockSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string() });
|
|
94052
94077
|
function abortedTurnOf(record2) {
|
|
94053
94078
|
if (record2.type !== "user" && record2.type !== "assistant" || record2.isSidechain === true) return void 0;
|
|
94054
94079
|
if (record2.type === "assistant") return record2.isApiErrorMessage === true;
|
|
94055
|
-
const text =
|
|
94056
|
-
|
|
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);
|
|
94057
94083
|
}
|
|
94058
94084
|
function claudeCodeEndsWithAbortedTurn(tail) {
|
|
94059
94085
|
const records = [...parseJsonl(tail)];
|
|
@@ -94063,16 +94089,64 @@ function claudeCodeEndsWithAbortedTurn(tail) {
|
|
|
94063
94089
|
}
|
|
94064
94090
|
return false;
|
|
94065
94091
|
}
|
|
94066
|
-
|
|
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) {
|
|
94067
94142
|
const parsed = messageContentSchema.safeParse(message3);
|
|
94068
|
-
if (!parsed.success) return
|
|
94143
|
+
if (!parsed.success) return [];
|
|
94069
94144
|
const { content } = parsed.data;
|
|
94070
|
-
if (typeof content === "string") return content;
|
|
94071
|
-
|
|
94145
|
+
if (typeof content === "string") return [content];
|
|
94146
|
+
return content.flatMap((block2) => {
|
|
94072
94147
|
const text = textBlockSchema.safeParse(block2);
|
|
94073
|
-
|
|
94074
|
-
}
|
|
94075
|
-
return "";
|
|
94148
|
+
return text.success ? [text.data.text] : [];
|
|
94149
|
+
});
|
|
94076
94150
|
}
|
|
94077
94151
|
function claudeLaunchOf(entrypoint) {
|
|
94078
94152
|
if (entrypoint === "sdk-cli") return "print";
|
|
@@ -94261,9 +94335,6 @@ function toUsage(u) {
|
|
|
94261
94335
|
output: n(u.output_tokens)
|
|
94262
94336
|
};
|
|
94263
94337
|
}
|
|
94264
|
-
function speedModeOf(value) {
|
|
94265
|
-
return value === "fast" || value === "standard" ? value : void 0;
|
|
94266
|
-
}
|
|
94267
94338
|
function addUsage(a, b2) {
|
|
94268
94339
|
return {
|
|
94269
94340
|
input: a.input + b2.input,
|
|
@@ -96373,8 +96444,10 @@ import path45 from "node:path";
|
|
|
96373
96444
|
// ../../apps/syncservice/src/windowsElevation.ts
|
|
96374
96445
|
import { readdirSync as readdirSync12 } from "node:fs";
|
|
96375
96446
|
import path44 from "node:path";
|
|
96376
|
-
function elevatedSetupRefusal(retryCommand) {
|
|
96377
|
-
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
|
+
});
|
|
96378
96451
|
}
|
|
96379
96452
|
function windowsProcessIsElevated(systemRoot, list = readdirSync12) {
|
|
96380
96453
|
try {
|
|
@@ -96443,7 +96516,7 @@ var TaskSchedulerService = class {
|
|
|
96443
96516
|
}
|
|
96444
96517
|
install(command) {
|
|
96445
96518
|
const refusal = this.setupRefusal("init");
|
|
96446
|
-
if (refusal !== null) throw
|
|
96519
|
+
if (refusal !== null) throw refusal;
|
|
96447
96520
|
const xml = this.taskXml(this.action(command));
|
|
96448
96521
|
this.refuseMissingProgram(xml);
|
|
96449
96522
|
const described = this.describe(null);
|
|
@@ -96492,7 +96565,9 @@ var TaskSchedulerService = class {
|
|
|
96492
96565
|
* off, the task itself runs as administrator, and its supervisor points
|
|
96493
96566
|
* the task at each update. */
|
|
96494
96567
|
setupRefusal(subcommand) {
|
|
96495
|
-
|
|
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));
|
|
96496
96571
|
}
|
|
96497
96572
|
/** The task starts only the installed Powerplant's windowless copy
|
|
96498
96573
|
* (taskAction). */
|
|
@@ -99252,6 +99327,9 @@ function releaseNotServed(managerOutput) {
|
|
|
99252
99327
|
function updateLogPath(homeDir) {
|
|
99253
99328
|
return path55.join(collectorStateDir(homeDir), "cli-update.log");
|
|
99254
99329
|
}
|
|
99330
|
+
function backgroundUpdateLog(inspection, serviceLog) {
|
|
99331
|
+
return isPerUserInstall(inspection) ? serviceLog : updateLogPath();
|
|
99332
|
+
}
|
|
99255
99333
|
function updateProgressView(progress, cliVersion2, now) {
|
|
99256
99334
|
if (progress === null || progress.state === "up-to-date") return { kind: "none" };
|
|
99257
99335
|
const reached = progress.target === null ? null : compareReleaseVersions(cliVersion2, progress.target);
|
|
@@ -99390,6 +99468,11 @@ function launchBackgroundUpdate(deps) {
|
|
|
99390
99468
|
}
|
|
99391
99469
|
return "started";
|
|
99392
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
|
+
}
|
|
99393
99476
|
function updatedMessage(version2, restart) {
|
|
99394
99477
|
const landed = version2 === null ? "Updated, but could not read the installed version (check with: powerplant status)." : `Updated to v${version2}.`;
|
|
99395
99478
|
return restart === "restarted" ? `${landed} Background sync restarted.` : landed;
|
|
@@ -99597,7 +99680,7 @@ function renderMenu(i) {
|
|
|
99597
99680
|
target: progress.kind === "none" ? i.latestVersion : progress.target,
|
|
99598
99681
|
...progress.kind === "failed" && { detail: failedUpdateDetail(i, progress) },
|
|
99599
99682
|
run: ["update", "--background", ...envArgs2],
|
|
99600
|
-
logPath:
|
|
99683
|
+
logPath: i.update.logPath
|
|
99601
99684
|
}
|
|
99602
99685
|
},
|
|
99603
99686
|
...i.update.progress?.state === "up-to-date" && { cliUpToDateAt: i.update.progress.finishedAt },
|
|
@@ -99630,7 +99713,7 @@ function updateItems(i, progress, envArgs2, problem) {
|
|
|
99630
99713
|
return [
|
|
99631
99714
|
problem(`Updating ${release2} didn't finish`, failedUpdateDetail(i, progress)),
|
|
99632
99715
|
action("Retry updating"),
|
|
99633
|
-
{ type: "action", title: "View update log", file:
|
|
99716
|
+
{ type: "action", title: "View update log", file: i.update.logPath }
|
|
99634
99717
|
];
|
|
99635
99718
|
case "none":
|
|
99636
99719
|
return [action("Update")];
|
|
@@ -101140,7 +101223,12 @@ async function readMenuServer(deps) {
|
|
|
101140
101223
|
};
|
|
101141
101224
|
}
|
|
101142
101225
|
function readMenuSetup(deps) {
|
|
101143
|
-
return {
|
|
101226
|
+
return {
|
|
101227
|
+
codexDesktop: detectCodexDesktop(),
|
|
101228
|
+
...deps.readService(),
|
|
101229
|
+
updateInPlace: deps.updateInPlace(),
|
|
101230
|
+
updateLogPath: deps.updateLogPath()
|
|
101231
|
+
};
|
|
101144
101232
|
}
|
|
101145
101233
|
async function readMenuLocalDetails(deps, credentials, listing) {
|
|
101146
101234
|
const here = (listing?.sessions ?? []).filter((session) => credentials !== null && session.machineId === credentials.machineId);
|
|
@@ -101188,7 +101276,7 @@ function menuInputs(deps, { server, local, setup }, extra) {
|
|
|
101188
101276
|
claudeDesktopSessions: local.claudeDesktopSessions,
|
|
101189
101277
|
desktopDiagnostic: desktopDiagnostic ?? { ...local.desktopDiagnostic, requests: server.requests },
|
|
101190
101278
|
liveTerminalSessions: local.liveTerminalSessions,
|
|
101191
|
-
update: { inPlace: setup.updateInPlace, progress: deps.readUpdateProgress() },
|
|
101279
|
+
update: { inPlace: setup.updateInPlace, progress: deps.readUpdateProgress(), logPath: setup.updateLogPath },
|
|
101192
101280
|
...rest
|
|
101193
101281
|
};
|
|
101194
101282
|
}
|
|
@@ -101932,7 +102020,7 @@ async function waitForEnrollment(output2, enroll2) {
|
|
|
101932
102020
|
return output2.activity("Waiting for approval in your browser\u2026", () => enrolling);
|
|
101933
102021
|
}
|
|
101934
102022
|
async function runInit(deps) {
|
|
101935
|
-
if (deps.setupRefusal !== null) throw
|
|
102023
|
+
if (deps.setupRefusal !== null) throw deps.setupRefusal;
|
|
101936
102024
|
const { command, stage } = deps.terminal;
|
|
101937
102025
|
const existing = deps.loadCredentials();
|
|
101938
102026
|
command.log("\u26A1 Powerplant");
|
|
@@ -102244,7 +102332,7 @@ function runResumeSession(source, sessionId, deps = {}) {
|
|
|
102244
102332
|
}
|
|
102245
102333
|
|
|
102246
102334
|
// src/version.ts
|
|
102247
|
-
var CLI_VERSION = true ? "0.4.
|
|
102335
|
+
var CLI_VERSION = true ? "0.4.31" : "0.0.0-checkout";
|
|
102248
102336
|
var CLI_RELEASE_BUILD = true ? true : false;
|
|
102249
102337
|
var CLI_DEVELOPMENT_COPY = false;
|
|
102250
102338
|
function updateRefusal(tarball, developmentCopy = CLI_DEVELOPMENT_COPY) {
|
|
@@ -102584,6 +102672,12 @@ function skippable(line, place) {
|
|
|
102584
102672
|
if (/`[^`]+`|https:\/\//.test(line)) return false;
|
|
102585
102673
|
return place.level === "stage" ? !place.detail : place.detail;
|
|
102586
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
|
+
}
|
|
102587
102681
|
function styleLine(line, place) {
|
|
102588
102682
|
if (skippable(line, place)) return dim(line);
|
|
102589
102683
|
return styleCommands(styleUrls(colorPrefix(line)));
|
|
@@ -102850,7 +102944,7 @@ function forgetFirstLaunchAttempt(domain2) {
|
|
|
102850
102944
|
const result = spawnSync7("/usr/bin/defaults", ["delete", domain2, FIRST_LAUNCH_ATTEMPT_KEY], { encoding: "utf8", timeout: 1e4 });
|
|
102851
102945
|
if (result.status === 0) return null;
|
|
102852
102946
|
const detail = result.error?.message ?? result.stderr.trim();
|
|
102853
|
-
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}`;
|
|
102854
102948
|
}
|
|
102855
102949
|
function menubarAppPaths(homeDir) {
|
|
102856
102950
|
return [path62.join(homeDir, "Applications", MENUBAR_APP_NAME), path62.join("/Applications", MENUBAR_APP_NAME)];
|
|
@@ -103814,7 +103908,7 @@ The access you granted these agents stays on your Powerplant account until you r
|
|
|
103814
103908
|
tarball,
|
|
103815
103909
|
background: values.background === true,
|
|
103816
103910
|
waiting: (label2) => terminal.command.startActivity(label2),
|
|
103817
|
-
startDetached: () => startBackgroundUpdate(config2, copy, null, tarball)
|
|
103911
|
+
startDetached: () => startBackgroundUpdate(backgroundUpdateDeps(config2, copy, null, tarball))
|
|
103818
103912
|
});
|
|
103819
103913
|
return;
|
|
103820
103914
|
}
|
|
@@ -103830,7 +103924,7 @@ The access you granted these agents stays on your Powerplant account until you r
|
|
|
103830
103924
|
const inspection = inspectThisInstall(copy);
|
|
103831
103925
|
if (values.background) {
|
|
103832
103926
|
if (!inspection.inPlace.ok) throw new ExpectedCliError(inspection.inPlace.reason);
|
|
103833
|
-
startBackgroundUpdate(config2, copy, await cachedAvailableVersion(config2, loadCredentialsSafely(config2).credentials));
|
|
103927
|
+
startBackgroundUpdate(backgroundUpdateDeps(config2, copy, await cachedAvailableVersion(config2, loadCredentialsSafely(config2).credentials)));
|
|
103834
103928
|
return;
|
|
103835
103929
|
}
|
|
103836
103930
|
await runUpdate({
|
|
@@ -104014,6 +104108,7 @@ function menuSourceDeps(config2, copy, report, lap) {
|
|
|
104014
104108
|
oldestSupportedVersion: oldestSupportedFor,
|
|
104015
104109
|
readService: () => readServiceSafely(copy.service),
|
|
104016
104110
|
updateInPlace: () => inspectThisInstall(copy).inPlace.ok,
|
|
104111
|
+
updateLogPath: () => backgroundUpdateLog(inspectThisInstall(copy), serviceLogPath2(config2.appEnv)),
|
|
104017
104112
|
readUpdateProgress: updateProgress.read,
|
|
104018
104113
|
moveToInstalledCopy: () => moveToInstalledCopy(config2, copy),
|
|
104019
104114
|
report,
|
|
@@ -104115,30 +104210,30 @@ function cachedAvailableVersion(config2, credentials, fetchImpl = fetch) {
|
|
|
104115
104210
|
fetchLatest: () => fetchAvailableVersion(config2, credentials, fetchImpl)
|
|
104116
104211
|
});
|
|
104117
104212
|
}
|
|
104118
|
-
function
|
|
104119
|
-
if (copy.kind === "installed") {
|
|
104120
|
-
const asked = copy.askService({ target, tarball });
|
|
104121
|
-
if (asked !== null) return asked;
|
|
104122
|
-
}
|
|
104213
|
+
function backgroundUpdateDeps(config2, copy, target, tarball = null) {
|
|
104123
104214
|
const tarballArgs = tarball === null || tarball === void 0 ? [] : ["--tarball", tarball.file, "--sha256", tarball.sha256];
|
|
104124
|
-
return
|
|
104125
|
-
target,
|
|
104126
|
-
|
|
104127
|
-
|
|
104128
|
-
|
|
104129
|
-
|
|
104130
|
-
|
|
104131
|
-
|
|
104132
|
-
|
|
104133
|
-
|
|
104134
|
-
|
|
104135
|
-
|
|
104136
|
-
|
|
104137
|
-
|
|
104138
|
-
|
|
104139
|
-
|
|
104140
|
-
|
|
104141
|
-
|
|
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
|
+
};
|
|
104142
104237
|
}
|
|
104143
104238
|
var MANAGER_STDERR_KEEP = 16 * 1024;
|
|
104144
104239
|
function automaticUpdateCheck(config2, copy) {
|
|
@@ -104164,9 +104259,8 @@ function automaticUpdateCheck(config2, copy) {
|
|
|
104164
104259
|
now: Date.now()
|
|
104165
104260
|
});
|
|
104166
104261
|
if (decision.kind === "update") {
|
|
104167
|
-
|
|
104168
|
-
|
|
104169
|
-
}
|
|
104262
|
+
const started = startBackgroundUpdate(backgroundUpdateDeps(config2, copy, decision.target));
|
|
104263
|
+
if (started !== "already-running") log3(`automatic update to ${decision.target} started (log: ${started.log})`);
|
|
104170
104264
|
return;
|
|
104171
104265
|
}
|
|
104172
104266
|
if (decision.reason === "cannot-update-in-place" && !saidCannot) {
|
|
@@ -104268,9 +104362,7 @@ async function runCommand() {
|
|
|
104268
104362
|
}
|
|
104269
104363
|
runCommand().catch(async (error63) => {
|
|
104270
104364
|
if (error63 instanceof ExpectedCliError) {
|
|
104271
|
-
|
|
104272
|
-
terminalUsesEffects(process.stderr.isTTY === true, process.env) ? styleLine(error63.message, { level: "command", detail: false }) : error63.message
|
|
104273
|
-
);
|
|
104365
|
+
printExpectedError(error63, process.stderr, process.env);
|
|
104274
104366
|
} else {
|
|
104275
104367
|
console.error(error63);
|
|
104276
104368
|
}
|
|
@@ -104288,4 +104380,4 @@ undici/lib/web/websocket/frame.js:
|
|
|
104288
104380
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
104289
104381
|
*/
|
|
104290
104382
|
|
|
104291
|
-
//# debugId=
|
|
104383
|
+
//# debugId=70311df7-2e4d-5e8c-9d0b-135dffb81341
|
|
Binary file
|