@usepowerplant/cli 0.4.32 → 0.4.34
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 +351 -92
- 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]="e68dfa4d-9f44-5ddd-9585-453c496a0665")}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;
|
|
@@ -8780,7 +8780,7 @@ var require_ProcessDetector = __commonJS({
|
|
|
8780
8780
|
exports.processDetector = void 0;
|
|
8781
8781
|
var api_1 = (init_esm(), __toCommonJS(esm_exports));
|
|
8782
8782
|
var semconv_1 = require_semconv2();
|
|
8783
|
-
var
|
|
8783
|
+
var os32 = __require("os");
|
|
8784
8784
|
var ProcessDetector = class {
|
|
8785
8785
|
detect(_config) {
|
|
8786
8786
|
const attributes = {
|
|
@@ -8800,7 +8800,7 @@ var require_ProcessDetector = __commonJS({
|
|
|
8800
8800
|
attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
8801
8801
|
}
|
|
8802
8802
|
try {
|
|
8803
|
-
const userInfo =
|
|
8803
|
+
const userInfo = os32.userInfo();
|
|
8804
8804
|
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
|
|
8805
8805
|
} catch (e) {
|
|
8806
8806
|
api_1.diag.debug(`error obtaining process owner: ${e}`);
|
|
@@ -57450,22 +57450,6 @@ function boundText(redacted, maxBytes) {
|
|
|
57450
57450
|
|
|
57451
57451
|
// ../core/src/digest.ts
|
|
57452
57452
|
var TOOL_CALL_INPUT_MAX_BYTES = 65536;
|
|
57453
|
-
var tokenCount = external_exports.number().nonnegative();
|
|
57454
|
-
var costStateSchema = external_exports.object({
|
|
57455
|
-
sessionId: external_exports.string(),
|
|
57456
|
-
startTime: external_exports.number().positive(),
|
|
57457
|
-
hasUnknownModelCost: external_exports.boolean().optional(),
|
|
57458
|
-
modelUsage: external_exports.record(
|
|
57459
|
-
external_exports.string(),
|
|
57460
|
-
external_exports.object({
|
|
57461
|
-
costUSD: external_exports.number().nonnegative(),
|
|
57462
|
-
inputTokens: tokenCount,
|
|
57463
|
-
outputTokens: tokenCount,
|
|
57464
|
-
cacheReadInputTokens: tokenCount,
|
|
57465
|
-
cacheCreationInputTokens: tokenCount
|
|
57466
|
-
})
|
|
57467
|
-
)
|
|
57468
|
-
});
|
|
57469
57453
|
|
|
57470
57454
|
// ../core/src/collectorDiagnostics.ts
|
|
57471
57455
|
var count = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
@@ -57804,7 +57788,7 @@ function createCodexUsageReader(options = {}) {
|
|
|
57804
57788
|
const gap = {
|
|
57805
57789
|
inputTokens: Math.max(0, runningTotal.inputTokens - own2.inputTokens),
|
|
57806
57790
|
cachedInputTokens: Math.max(0, runningTotal.cachedInputTokens - own2.cachedInputTokens),
|
|
57807
|
-
cacheWriteInputTokens: null,
|
|
57791
|
+
cacheWriteInputTokens: runningTotal.cacheWriteInputTokens === null || own2.cacheWriteInputTokens === null ? null : Math.max(0, runningTotal.cacheWriteInputTokens - own2.cacheWriteInputTokens),
|
|
57808
57792
|
outputTokens: Math.max(0, runningTotal.outputTokens - own2.outputTokens)
|
|
57809
57793
|
};
|
|
57810
57794
|
if (gap.inputTokens === 0 && gap.outputTokens === 0) return;
|
|
@@ -78176,11 +78160,11 @@ function enrichInvokeAgentFromStream(callId, final, recordOutputs) {
|
|
|
78176
78160
|
}
|
|
78177
78161
|
const usage = isObjectLike(final.usage) ? final.usage : void 0;
|
|
78178
78162
|
if (usage) {
|
|
78179
|
-
const input2 =
|
|
78180
|
-
const output2 =
|
|
78163
|
+
const input2 = tokenCount(usage.inputTokens) ?? tokenCount(usage.promptTokens) ?? tokenCount(usage.tokens);
|
|
78164
|
+
const output2 = tokenCount(usage.outputTokens) ?? tokenCount(usage.completionTokens);
|
|
78181
78165
|
addTokensToSpan(span, Ra, input2);
|
|
78182
78166
|
addTokensToSpan(span, Pa, output2);
|
|
78183
|
-
addTokensToSpan(span, Ma,
|
|
78167
|
+
addTokensToSpan(span, Ma, tokenCount(usage.totalTokens) ?? sum(input2, output2));
|
|
78184
78168
|
}
|
|
78185
78169
|
if (recordOutputs) {
|
|
78186
78170
|
const parts = partsFromTextAndToolCalls(final.text, final.toolCalls);
|
|
@@ -78308,9 +78292,9 @@ function enrichSpanOnEnd(span, data, channelOptions) {
|
|
|
78308
78292
|
}
|
|
78309
78293
|
const usage = isObjectLike(result.usage) ? result.usage : void 0;
|
|
78310
78294
|
if (usage) {
|
|
78311
|
-
const inputTokens =
|
|
78312
|
-
const outputTokens =
|
|
78313
|
-
const totalTokens =
|
|
78295
|
+
const inputTokens = tokenCount(usage.inputTokens) ?? tokenCount(usage.promptTokens) ?? tokenCount(usage.tokens);
|
|
78296
|
+
const outputTokens = tokenCount(usage.outputTokens) ?? tokenCount(usage.completionTokens);
|
|
78297
|
+
const totalTokens = tokenCount(usage.totalTokens) ?? sum(inputTokens, outputTokens);
|
|
78314
78298
|
if (inputTokens !== void 0) {
|
|
78315
78299
|
span.setAttribute(Ra, inputTokens);
|
|
78316
78300
|
}
|
|
@@ -78359,7 +78343,7 @@ function getFinishReason(result) {
|
|
|
78359
78343
|
}
|
|
78360
78344
|
return isObjectLike(finishReason) ? asString(finishReason.unified) : void 0;
|
|
78361
78345
|
}
|
|
78362
|
-
function
|
|
78346
|
+
function tokenCount(value) {
|
|
78363
78347
|
return asNumber(value) ?? (isObjectLike(value) ? asNumber(value.total) : void 0);
|
|
78364
78348
|
}
|
|
78365
78349
|
function buildOutputMessages2(parts, finishReason) {
|
|
@@ -85324,7 +85308,7 @@ function _init2(options = {}, getDefaultIntegrationsImpl) {
|
|
|
85324
85308
|
import tls2 from "node:tls";
|
|
85325
85309
|
var import_undici = __toESM(require_undici(), 1);
|
|
85326
85310
|
var CLI_VERSION_HEADER = "x-powerplant-cli-version";
|
|
85327
|
-
var cliVersion = true ? "0.4.
|
|
85311
|
+
var cliVersion = true ? "0.4.34" : "0.0.0-checkout";
|
|
85328
85312
|
function cliVersionHeaders() {
|
|
85329
85313
|
return { [CLI_VERSION_HEADER]: cliVersion, "user-agent": `powerplant-cli/${cliVersion}` };
|
|
85330
85314
|
}
|
|
@@ -86420,13 +86404,16 @@ function captureDecision(cwd, policy) {
|
|
|
86420
86404
|
}
|
|
86421
86405
|
const repoFullName = policy.repoOf(cwd);
|
|
86422
86406
|
if (repoFullName === null) return { capture: false, reason: "no-github-repo" };
|
|
86423
|
-
|
|
86424
|
-
{ owners: policy.allowedOwners, repos: policy.allowedRepos }
|
|
86425
|
-
];
|
|
86426
|
-
return claims.some((workspace) => workspaceClaimsRepo(repoFullName, workspace)) ? { capture: true, via: "org-policy", repoFullName } : { capture: false, reason: "outside-policy" };
|
|
86407
|
+
return policyClaimsRepo(policy, repoFullName) ? { capture: true, via: "org-policy", repoFullName } : { capture: false, reason: "outside-policy" };
|
|
86427
86408
|
}
|
|
86428
86409
|
}
|
|
86429
86410
|
}
|
|
86411
|
+
function policyClaimsRepo(policy, repoFullName) {
|
|
86412
|
+
const claims = policy.workspaceClaims ?? [
|
|
86413
|
+
{ owners: policy.allowedOwners, repos: policy.allowedRepos }
|
|
86414
|
+
];
|
|
86415
|
+
return claims.some((workspace) => workspaceClaimsRepo(repoFullName, workspace));
|
|
86416
|
+
}
|
|
86430
86417
|
function memberChoice(cwd, policy) {
|
|
86431
86418
|
const repoFullName = policy.repoOf(cwd);
|
|
86432
86419
|
return {
|
|
@@ -94185,7 +94172,7 @@ function deleteCredentials(appEnv) {
|
|
|
94185
94172
|
// ../../apps/syncservice/src/enroll.ts
|
|
94186
94173
|
import { createHash as createHash8, randomBytes as randomBytes3 } from "node:crypto";
|
|
94187
94174
|
import http5 from "node:http";
|
|
94188
|
-
import
|
|
94175
|
+
import os19 from "node:os";
|
|
94189
94176
|
|
|
94190
94177
|
// ../../apps/syncservice/src/openUrl.ts
|
|
94191
94178
|
import { spawn as spawn6 } from "node:child_process";
|
|
@@ -94223,11 +94210,249 @@ import { promisify as promisify2 } from "node:util";
|
|
|
94223
94210
|
import { gzip } from "node:zlib";
|
|
94224
94211
|
|
|
94225
94212
|
// ../../apps/syncservice/src/claudeCode.ts
|
|
94226
|
-
import { readdirSync as
|
|
94227
|
-
import
|
|
94213
|
+
import { readdirSync as readdirSync11 } from "node:fs";
|
|
94214
|
+
import os18 from "node:os";
|
|
94228
94215
|
import path40 from "node:path";
|
|
94229
94216
|
import { setImmediate as yieldToEventLoop2 } from "node:timers/promises";
|
|
94230
94217
|
|
|
94218
|
+
// ../../apps/syncservice/src/parentFolderCapture.ts
|
|
94219
|
+
import { readdirSync as readdirSync10 } from "node:fs";
|
|
94220
|
+
import os17 from "node:os";
|
|
94221
|
+
var MAX_CHILD_FOLDERS = 200;
|
|
94222
|
+
function parentFolderOf(cwd, policy) {
|
|
94223
|
+
if (policy.mode !== "org-repos") return null;
|
|
94224
|
+
const environment = policy.environment ?? {};
|
|
94225
|
+
const platform2 = environment.platform ?? process.platform;
|
|
94226
|
+
const paths = pathRules(platform2);
|
|
94227
|
+
const root = paths.resolve(cwd);
|
|
94228
|
+
const home = paths.resolve(environment.homeDir ?? os17.homedir());
|
|
94229
|
+
if (root === paths.parse(root).root || paths.relative(root, home) === "") return null;
|
|
94230
|
+
if (unconsentedProtectedRoot(root, environment) !== null) return null;
|
|
94231
|
+
let childNames;
|
|
94232
|
+
try {
|
|
94233
|
+
childNames = readdirSync10(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
94234
|
+
} catch {
|
|
94235
|
+
return null;
|
|
94236
|
+
}
|
|
94237
|
+
if (childNames.length > MAX_CHILD_FOLDERS) return null;
|
|
94238
|
+
const synced = childNames.flatMap((name) => {
|
|
94239
|
+
const dir = paths.join(root, name);
|
|
94240
|
+
const repoFullName = policy.repoOf(dir);
|
|
94241
|
+
return repoFullName !== null && policyClaimsRepo(policy, repoFullName) ? [{ dir, repoFullName }] : [];
|
|
94242
|
+
});
|
|
94243
|
+
return synced.length > 0 ? { root, synced, childNames, platform: platform2, homeDir: home } : null;
|
|
94244
|
+
}
|
|
94245
|
+
var WRITE_TOOLS = /* @__PURE__ */ new Set(["Edit", "MultiEdit", "Write", "NotebookEdit"]);
|
|
94246
|
+
var SEARCH_TOOLS = /* @__PURE__ */ new Set(["Glob", "Grep"]);
|
|
94247
|
+
var SEARCH_COMMANDS = /* @__PURE__ */ new Set(["rg", "find", "fd", "ag", "ack", "tree"]);
|
|
94248
|
+
var FILE_WRITE_COMMANDS = /* @__PURE__ */ new Set(["mv", "cp", "rm", "mkdir", "touch", "patch", "tee"]);
|
|
94249
|
+
var GIT_WRITE_COMMANDS = /* @__PURE__ */ new Set(["commit", "push", "apply", "am", "mv", "rm"]);
|
|
94250
|
+
var REDIRECT = /(?<![0-9&])>(?!&)/;
|
|
94251
|
+
function writesFiles(program, args, segment) {
|
|
94252
|
+
if (FILE_WRITE_COMMANDS.has(program) || REDIRECT.test(segment)) return true;
|
|
94253
|
+
if (program === "git") return args.some((arg) => GIT_WRITE_COMMANDS.has(arg));
|
|
94254
|
+
if (program === "sed" || program === "perl") return args.some((arg) => /^-[a-z]*i/.test(arg));
|
|
94255
|
+
return false;
|
|
94256
|
+
}
|
|
94257
|
+
var toolUseSchema = external_exports.object({
|
|
94258
|
+
type: external_exports.literal("tool_use"),
|
|
94259
|
+
name: external_exports.string(),
|
|
94260
|
+
input: external_exports.record(external_exports.string(), external_exports.unknown()).catch({})
|
|
94261
|
+
});
|
|
94262
|
+
var contentSchema = external_exports.object({ content: external_exports.array(external_exports.unknown()) });
|
|
94263
|
+
var ParentFolderEvidence = class {
|
|
94264
|
+
constructor(folder) {
|
|
94265
|
+
this.folder = folder;
|
|
94266
|
+
}
|
|
94267
|
+
folder;
|
|
94268
|
+
touched = /* @__PURE__ */ new Set();
|
|
94269
|
+
written = /* @__PURE__ */ new Set();
|
|
94270
|
+
hold = null;
|
|
94271
|
+
addTranscript(text) {
|
|
94272
|
+
let cwd = this.folder.root;
|
|
94273
|
+
for (const record2 of parseJsonl(text)) {
|
|
94274
|
+
if (typeof record2.cwd === "string" && record2.cwd !== "") {
|
|
94275
|
+
cwd = record2.cwd;
|
|
94276
|
+
this.touch(this.locate(cwd, cwd));
|
|
94277
|
+
}
|
|
94278
|
+
const content = contentSchema.safeParse(record2.message);
|
|
94279
|
+
if (!content.success) continue;
|
|
94280
|
+
for (const block2 of content.data.content) {
|
|
94281
|
+
const call = toolUseSchema.safeParse(block2);
|
|
94282
|
+
if (call.success) this.addCall(call.data.name, call.data.input, cwd);
|
|
94283
|
+
}
|
|
94284
|
+
}
|
|
94285
|
+
}
|
|
94286
|
+
holdForUnreadSubagent() {
|
|
94287
|
+
this.hold ??= "unread-subagent";
|
|
94288
|
+
}
|
|
94289
|
+
verdict() {
|
|
94290
|
+
if (this.hold !== null) return { upload: false, reason: this.hold };
|
|
94291
|
+
if (this.touched.size > 1) return { upload: false, reason: "several-synced-repos" };
|
|
94292
|
+
const [repo] = this.written;
|
|
94293
|
+
return repo === void 0 ? { upload: false, reason: "no-synced-write" } : { upload: true, repo };
|
|
94294
|
+
}
|
|
94295
|
+
addCall(name, input2, cwd) {
|
|
94296
|
+
const commandFolder = [input2.cwd, input2.workdir].find((value) => typeof value === "string");
|
|
94297
|
+
if (typeof input2.command === "string") {
|
|
94298
|
+
this.addCommand(input2.command, commandFolder === void 0 ? cwd : this.resolve(commandFolder, cwd));
|
|
94299
|
+
}
|
|
94300
|
+
const strings = stringsIn(input2).filter(
|
|
94301
|
+
(value) => typeof input2.command !== "string" || value !== input2.command && value !== commandFolder
|
|
94302
|
+
);
|
|
94303
|
+
if (SEARCH_TOOLS.has(name)) {
|
|
94304
|
+
const patternStart = typeof input2.pattern === "string" ? input2.pattern.split(/[/\\]/, 1)[0] : "";
|
|
94305
|
+
const searched = typeof input2.path === "string" ? input2.path : name === "Glob" && this.childName(patternStart) !== void 0 ? patternStart : cwd;
|
|
94306
|
+
const place = this.locate(searched, cwd);
|
|
94307
|
+
if (place.kind === "root" || this.isAncestorOfRoot(searched, cwd)) this.holdFor("folder-wide-search");
|
|
94308
|
+
this.touch(place);
|
|
94309
|
+
return;
|
|
94310
|
+
}
|
|
94311
|
+
const isWrite = WRITE_TOOLS.has(name);
|
|
94312
|
+
for (const value of strings) {
|
|
94313
|
+
const isPathField = value === input2.file_path || value === input2.notebook_path;
|
|
94314
|
+
if (!isPathField && !this.isPathToken(value)) continue;
|
|
94315
|
+
const place = this.locate(value, cwd);
|
|
94316
|
+
this.touch(place.kind === "root" ? { kind: "other" } : place);
|
|
94317
|
+
if (isWrite && isPathField && place.kind === "synced") this.written.add(place.repo);
|
|
94318
|
+
}
|
|
94319
|
+
}
|
|
94320
|
+
/** A shell command, one segment at a time: `cd` and `git -C` move the
|
|
94321
|
+
* segment's folder, and each path-like token is located from there. */
|
|
94322
|
+
addCommand(command, recordCwd) {
|
|
94323
|
+
let cwd = recordCwd;
|
|
94324
|
+
for (const { segment, words: segmentWords } of shellSegments(withoutHeredocs(command), this.folder.platform)) {
|
|
94325
|
+
const words = segmentWords.map((word) => ({ ...word, text: word.text.replace(/^\d*[<>]+&?/, "") })).filter((word) => word.text !== "");
|
|
94326
|
+
const tokens = words.map((word) => word.text);
|
|
94327
|
+
const pathArgs = words.slice(1).filter((word) => word.prose ? this.isWrittenAsPath(word.text) : this.isPathToken(word.text)).map((word) => word.text);
|
|
94328
|
+
const [program, ...args] = tokens;
|
|
94329
|
+
if (program === void 0) continue;
|
|
94330
|
+
if (program === "cd" || program === "pushd") {
|
|
94331
|
+
cwd = this.resolve(args[0] ?? this.folder.homeDir, cwd);
|
|
94332
|
+
this.touch(this.locate(cwd, cwd));
|
|
94333
|
+
continue;
|
|
94334
|
+
}
|
|
94335
|
+
const segmentCwd = program === "git" && args[0] === "-C" && args[1] ? this.resolve(args[1], cwd) : cwd;
|
|
94336
|
+
const places = pathArgs.map((token) => this.locate(token.replace(/^-[^=]*=/, ""), segmentCwd));
|
|
94337
|
+
const here = this.locate(segmentCwd, segmentCwd);
|
|
94338
|
+
const recursiveGrep = program === "grep" && args.some((arg) => /^-[a-zA-Z]*[rR]|^--recursive$/.test(arg));
|
|
94339
|
+
const searches = SEARCH_COMMANDS.has(program) || recursiveGrep || program === "ls" && args.some((arg) => /^-[a-zA-Z]*R/.test(arg));
|
|
94340
|
+
if (searches && (places.some((place) => place.kind === "root") || places.length === 0 && here.kind === "root")) {
|
|
94341
|
+
this.holdFor("folder-wide-search");
|
|
94342
|
+
}
|
|
94343
|
+
for (const place of places) this.touch(place.kind === "root" ? { kind: "outside" } : place);
|
|
94344
|
+
this.touch(here);
|
|
94345
|
+
if (writesFiles(program, args, segment)) {
|
|
94346
|
+
for (const place of [here, ...places]) if (place.kind === "synced") this.written.add(place.repo);
|
|
94347
|
+
}
|
|
94348
|
+
}
|
|
94349
|
+
}
|
|
94350
|
+
touch(place) {
|
|
94351
|
+
if (place.kind === "other") this.holdFor("other-folder");
|
|
94352
|
+
if (place.kind === "synced") this.touched.add(place.repo);
|
|
94353
|
+
}
|
|
94354
|
+
holdFor(reason) {
|
|
94355
|
+
this.hold ??= reason;
|
|
94356
|
+
}
|
|
94357
|
+
/** Absolute and home paths, `./` and `../` paths, and relative paths whose
|
|
94358
|
+
* first segment names a child folder. Other words ("status", "src/x" when
|
|
94359
|
+
* no child is named src) are not paths into the parent. */
|
|
94360
|
+
isPathToken(token) {
|
|
94361
|
+
const value = token.replace(/^-[^=]*=/, "");
|
|
94362
|
+
return this.isWrittenAsPath(value) || this.childName(value.split(/[/\\]/, 1)[0]) !== void 0;
|
|
94363
|
+
}
|
|
94364
|
+
isWrittenAsPath(value) {
|
|
94365
|
+
return this.isAbsolute(value) || value === "." || value === ".." || /^\.\.?[/\\]/.test(value);
|
|
94366
|
+
}
|
|
94367
|
+
isAbsolute(value) {
|
|
94368
|
+
return value.startsWith("~") || pathRules(this.folder.platform).isAbsolute(value);
|
|
94369
|
+
}
|
|
94370
|
+
resolve(value, cwd) {
|
|
94371
|
+
const paths = pathRules(this.folder.platform);
|
|
94372
|
+
const expanded = value === "~" || /^~[/\\]/.test(value) ? paths.join(this.folder.homeDir, value.slice(1)) : value;
|
|
94373
|
+
return paths.resolve(cwd, expanded);
|
|
94374
|
+
}
|
|
94375
|
+
locate(value, cwd) {
|
|
94376
|
+
const paths = pathRules(this.folder.platform);
|
|
94377
|
+
const relative2 = paths.relative(this.folder.root, this.resolve(value, cwd));
|
|
94378
|
+
if (relative2 === "") return { kind: "root" };
|
|
94379
|
+
if (relative2.startsWith("..") || paths.isAbsolute(relative2)) return { kind: "outside" };
|
|
94380
|
+
const name = this.childName(relative2.split(paths.sep, 1)[0]);
|
|
94381
|
+
const repo = name === void 0 ? void 0 : this.folder.synced.find((child) => paths.basename(child.dir) === name);
|
|
94382
|
+
return repo === void 0 ? { kind: "other" } : { kind: "synced", repo };
|
|
94383
|
+
}
|
|
94384
|
+
isAncestorOfRoot(value, cwd) {
|
|
94385
|
+
const paths = pathRules(this.folder.platform);
|
|
94386
|
+
const relative2 = paths.relative(this.resolve(value, cwd), this.folder.root);
|
|
94387
|
+
return !relative2.startsWith("..") && !paths.isAbsolute(relative2);
|
|
94388
|
+
}
|
|
94389
|
+
/** The child folder's own name for `name`, ignoring case on Windows. */
|
|
94390
|
+
childName(name) {
|
|
94391
|
+
const key = (value) => this.folder.platform === "win32" ? value.toLowerCase() : value;
|
|
94392
|
+
return this.folder.childNames.find((child) => key(child) === key(name));
|
|
94393
|
+
}
|
|
94394
|
+
};
|
|
94395
|
+
function withoutHeredocs(command) {
|
|
94396
|
+
return command.replace(/<<-?\s*['"]?(\w+)['"]?[^\n]*\n[\s\S]*?\n\s*\1\s*(?=\n|$)/g, (match) => match.split("\n", 1)[0]);
|
|
94397
|
+
}
|
|
94398
|
+
function shellSegments(command, platform2) {
|
|
94399
|
+
const escapes = platform2 !== "win32";
|
|
94400
|
+
const segments = [];
|
|
94401
|
+
let words = [];
|
|
94402
|
+
let segmentStart = 0;
|
|
94403
|
+
let text = "";
|
|
94404
|
+
let prose = false;
|
|
94405
|
+
let started = false;
|
|
94406
|
+
let quote = null;
|
|
94407
|
+
const endWord = () => {
|
|
94408
|
+
if (started) words.push({ text, prose });
|
|
94409
|
+
text = "";
|
|
94410
|
+
prose = false;
|
|
94411
|
+
started = false;
|
|
94412
|
+
};
|
|
94413
|
+
const endSegment = (end, next) => {
|
|
94414
|
+
endWord();
|
|
94415
|
+
segments.push({ segment: command.slice(segmentStart, end), words });
|
|
94416
|
+
words = [];
|
|
94417
|
+
segmentStart = next;
|
|
94418
|
+
};
|
|
94419
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
94420
|
+
const char = command[index];
|
|
94421
|
+
const pair = command.slice(index, index + 2);
|
|
94422
|
+
if (quote !== null) {
|
|
94423
|
+
if (char === quote) quote = null;
|
|
94424
|
+
else if (escapes && char === "\\" && quote === '"' && index + 1 < command.length) text += command[++index];
|
|
94425
|
+
else {
|
|
94426
|
+
if (/\s/.test(char)) prose = true;
|
|
94427
|
+
text += char;
|
|
94428
|
+
}
|
|
94429
|
+
} else if (pair === "&&" || pair === "||") {
|
|
94430
|
+
endSegment(index, index + 2);
|
|
94431
|
+
index += 1;
|
|
94432
|
+
} else if (char === ";" || char === "|" || char === "\n") {
|
|
94433
|
+
endSegment(index, index + 1);
|
|
94434
|
+
} else if (char === "'" || char === '"') {
|
|
94435
|
+
quote = char;
|
|
94436
|
+
started = true;
|
|
94437
|
+
} else if (escapes && char === "\\" && index + 1 < command.length) {
|
|
94438
|
+
text += command[++index];
|
|
94439
|
+
started = true;
|
|
94440
|
+
} else if (/\s/.test(char)) {
|
|
94441
|
+
endWord();
|
|
94442
|
+
} else {
|
|
94443
|
+
text += char;
|
|
94444
|
+
started = true;
|
|
94445
|
+
}
|
|
94446
|
+
}
|
|
94447
|
+
endSegment(command.length, command.length);
|
|
94448
|
+
return segments;
|
|
94449
|
+
}
|
|
94450
|
+
function stringsIn(value) {
|
|
94451
|
+
if (typeof value === "string") return [value];
|
|
94452
|
+
if (typeof value === "object" && value !== null) return Object.values(value).flatMap(stringsIn);
|
|
94453
|
+
return [];
|
|
94454
|
+
}
|
|
94455
|
+
|
|
94231
94456
|
// ../../apps/syncservice/src/claudeCodeRecords.ts
|
|
94232
94457
|
function claudeLaunchOf(entrypoint) {
|
|
94233
94458
|
if (entrypoint === "sdk-cli") return "print";
|
|
@@ -94414,7 +94639,7 @@ function sessionKey(identity2) {
|
|
|
94414
94639
|
return JSON.stringify([identity2.harness, identity2.harnessSessionId]);
|
|
94415
94640
|
}
|
|
94416
94641
|
async function collectClaudeCodeSessions(options = {}) {
|
|
94417
|
-
const claudeDir = options.claudeDir ?? path40.join(
|
|
94642
|
+
const claudeDir = options.claudeDir ?? path40.join(os18.homedir(), ".claude");
|
|
94418
94643
|
const now = options.now ?? Date.now();
|
|
94419
94644
|
const capture2 = options.capture ?? captureEverythingUnresolved;
|
|
94420
94645
|
const maxBytes = options.maxTranscriptBytes ?? MAX_TRANSCRIPT_FILE_BYTES;
|
|
@@ -94424,6 +94649,11 @@ async function collectClaudeCodeSessions(options = {}) {
|
|
|
94424
94649
|
const candidates = [];
|
|
94425
94650
|
const unreadable = [];
|
|
94426
94651
|
let skippedTooLarge = 0;
|
|
94652
|
+
const parentFolders = /* @__PURE__ */ new Map();
|
|
94653
|
+
const parentFolderAt = (cwd) => {
|
|
94654
|
+
if (!parentFolders.has(cwd)) parentFolders.set(cwd, parentFolderOf(cwd, capture2));
|
|
94655
|
+
return parentFolders.get(cwd);
|
|
94656
|
+
};
|
|
94427
94657
|
const home = path40.dirname(claudeDir);
|
|
94428
94658
|
const lifecycle = options.lifecycle ?? readLifecycleJournal(home, now, ["claude-local"]);
|
|
94429
94659
|
for (const projectDir of listDirs(projectsDir)) {
|
|
@@ -94450,11 +94680,18 @@ async function collectClaudeCodeSessions(options = {}) {
|
|
|
94450
94680
|
try {
|
|
94451
94681
|
const cwd = transcriptCwd(transcriptPath);
|
|
94452
94682
|
const decision = captureDecision(cwd, capture2);
|
|
94453
|
-
|
|
94454
|
-
|
|
94455
|
-
|
|
94683
|
+
let admission;
|
|
94684
|
+
if (decision.capture) {
|
|
94685
|
+
admission = { kind: "decided", decision };
|
|
94686
|
+
} else {
|
|
94687
|
+
const folder = decision.reason === "no-github-repo" && cwd !== void 0 && !options.locationsOnly ? parentFolderAt(cwd) : null;
|
|
94688
|
+
if (folder === null) {
|
|
94689
|
+
countCaptureSkip(skips, decision.reason);
|
|
94690
|
+
continue;
|
|
94691
|
+
}
|
|
94692
|
+
admission = { kind: "parent-folder", folder };
|
|
94456
94693
|
}
|
|
94457
|
-
if (options.locationsOnly) {
|
|
94694
|
+
if (decision.capture && options.locationsOnly) {
|
|
94458
94695
|
items.push({
|
|
94459
94696
|
mtimeMs: stat.mtimeMs,
|
|
94460
94697
|
transcriptPath,
|
|
@@ -94471,7 +94708,7 @@ async function collectClaudeCodeSessions(options = {}) {
|
|
|
94471
94708
|
status,
|
|
94472
94709
|
endObservedAt,
|
|
94473
94710
|
...cwd && { cwd },
|
|
94474
|
-
|
|
94711
|
+
admission
|
|
94475
94712
|
});
|
|
94476
94713
|
} catch (error63) {
|
|
94477
94714
|
unreadable.push(`${sessionId}: ${describeReadError(error63)}`);
|
|
@@ -94497,20 +94734,39 @@ async function collectClaudeCodeSessions(options = {}) {
|
|
|
94497
94734
|
const chosen = options.maxSessions === void 0 ? candidates : candidates.slice(0, options.maxSessions);
|
|
94498
94735
|
for (const candidate of chosen) {
|
|
94499
94736
|
await yieldToEventLoop2();
|
|
94500
|
-
const { transcriptPath, sessionId, mtimeMs, subagents, status, endObservedAt,
|
|
94737
|
+
const { transcriptPath, sessionId, mtimeMs, subagents, status, endObservedAt, admission } = candidate;
|
|
94501
94738
|
try {
|
|
94502
94739
|
const transcript = readTranscriptIfExists(transcriptPath);
|
|
94503
94740
|
if (transcript === null) continue;
|
|
94504
94741
|
const summary = parseClaudeCodeTranscript(transcript.text);
|
|
94505
94742
|
if (!summary) continue;
|
|
94743
|
+
const check2 = admission.kind === "parent-folder" ? { ...admission, evidence: new ParentFolderEvidence(admission.folder) } : admission;
|
|
94744
|
+
if (check2.kind === "parent-folder") check2.evidence.addTranscript(transcript.text);
|
|
94506
94745
|
const usage = addSubagentUsage(
|
|
94507
94746
|
summary.usage,
|
|
94508
94747
|
summary.fastUsage,
|
|
94509
94748
|
subagents.files,
|
|
94510
|
-
{ maxBytes, sessionId, onFileDiagnostic: options.onFileDiagnostic }
|
|
94749
|
+
{ maxBytes, sessionId, onFileDiagnostic: options.onFileDiagnostic },
|
|
94750
|
+
check2.kind === "parent-folder" ? (text) => check2.evidence.addTranscript(text) : void 0
|
|
94511
94751
|
);
|
|
94512
94752
|
skippedTooLarge += usage.skippedTooLarge;
|
|
94513
94753
|
unreadable.push(...usage.unreadable);
|
|
94754
|
+
let decision;
|
|
94755
|
+
let cwd = candidate.cwd;
|
|
94756
|
+
if (check2.kind === "decided") {
|
|
94757
|
+
decision = check2.decision;
|
|
94758
|
+
} else {
|
|
94759
|
+
if (usage.skippedTooLarge > 0 || usage.capture.skippedUnreadable > 0 || subagents.workflows.count > 0) {
|
|
94760
|
+
check2.evidence.holdForUnreadSubagent();
|
|
94761
|
+
}
|
|
94762
|
+
const verdict = check2.evidence.verdict();
|
|
94763
|
+
if (!verdict.upload) {
|
|
94764
|
+
countCaptureSkip(skips, "outside-policy");
|
|
94765
|
+
continue;
|
|
94766
|
+
}
|
|
94767
|
+
decision = { capture: true, via: "org-policy-parent-folder", repoFullName: verdict.repo.repoFullName };
|
|
94768
|
+
cwd = verdict.repo.dir;
|
|
94769
|
+
}
|
|
94514
94770
|
const endedAt = endObservedAt ?? laterTimestamp(summary.endedAt, usage.endedAt);
|
|
94515
94771
|
items.push({
|
|
94516
94772
|
mtimeMs,
|
|
@@ -94553,7 +94809,9 @@ async function collectClaudeCodeSessions(options = {}) {
|
|
|
94553
94809
|
// The PR-join coordinates: the checkout's directory name (bare
|
|
94554
94810
|
// repo, not the local path) and the branch the work started on.
|
|
94555
94811
|
...cwd && { repoDir: path40.basename(cwd) },
|
|
94556
|
-
|
|
94812
|
+
// A parent-folder session's recorded branch is the parent's ("HEAD",
|
|
94813
|
+
// no checkout); branch facts observe the child repo's instead.
|
|
94814
|
+
...summary.gitBranch && check2.kind === "decided" && { gitBranch: summary.gitBranch },
|
|
94557
94815
|
...decision.repoFullName && { repoFullName: decision.repoFullName },
|
|
94558
94816
|
capturedVia: decision.via
|
|
94559
94817
|
}
|
|
@@ -94659,7 +94917,7 @@ function listWorkflowTranscripts(workflowsDir) {
|
|
|
94659
94917
|
}
|
|
94660
94918
|
function directoryEntries(dir) {
|
|
94661
94919
|
try {
|
|
94662
|
-
return
|
|
94920
|
+
return readdirSync11(dir, { withFileTypes: true });
|
|
94663
94921
|
} catch (error63) {
|
|
94664
94922
|
const code = error63.code;
|
|
94665
94923
|
return code === "ENOENT" || code === "ENOTDIR" ? [] : { error: error63 };
|
|
@@ -94669,7 +94927,7 @@ function subagentPart(entry) {
|
|
|
94669
94927
|
const match = /^agent-(.+)\.jsonl$/.exec(entry);
|
|
94670
94928
|
return match !== null && RAW_TRANSCRIPT_PART_PATTERN.test(match[1]) ? match[1] : null;
|
|
94671
94929
|
}
|
|
94672
|
-
function addSubagentUsage(main2, mainFast, subagentFiles, bounds) {
|
|
94930
|
+
function addSubagentUsage(main2, mainFast, subagentFiles, bounds, onTranscript) {
|
|
94673
94931
|
let total = main2;
|
|
94674
94932
|
let fast = mainFast;
|
|
94675
94933
|
let fastCoverageComplete = main2 === null || mainFast !== null;
|
|
@@ -94692,6 +94950,7 @@ function addSubagentUsage(main2, mainFast, subagentFiles, bounds) {
|
|
|
94692
94950
|
if (transcript === null) {
|
|
94693
94951
|
continue;
|
|
94694
94952
|
}
|
|
94953
|
+
onTranscript?.(transcript.text);
|
|
94695
94954
|
const part = subagentPart(entry);
|
|
94696
94955
|
if (part === null) capture2.skipped += 1;
|
|
94697
94956
|
else capture2.files.push({ part, path: sidecarPath, prefix: transcript.prefix });
|
|
@@ -94718,7 +94977,7 @@ function addSubagentUsage(main2, mainFast, subagentFiles, bounds) {
|
|
|
94718
94977
|
}
|
|
94719
94978
|
return { capture: capture2, total, fast: fastCoverageComplete ? fast : null, skippedTooLarge, unreadable, endedAt };
|
|
94720
94979
|
}
|
|
94721
|
-
function claudeCodeSessionCwd(sessionId, claudeDir = path40.join(
|
|
94980
|
+
function claudeCodeSessionCwd(sessionId, claudeDir = path40.join(os18.homedir(), ".claude")) {
|
|
94722
94981
|
if (!SESSION_UUID.test(sessionId)) return void 0;
|
|
94723
94982
|
for (const projectDir of listDirs(path40.join(claudeDir, "projects"))) {
|
|
94724
94983
|
const cwd = transcriptCwd(path40.join(projectDir, `${sessionId}.jsonl`));
|
|
@@ -95155,7 +95414,7 @@ function gotrueAuthClient(url2, key) {
|
|
|
95155
95414
|
}
|
|
95156
95415
|
async function runEnrollment(config2, options) {
|
|
95157
95416
|
const log3 = options.log ?? console.log;
|
|
95158
|
-
const name = options.name?.trim() ||
|
|
95417
|
+
const name = options.name?.trim() || os19.hostname();
|
|
95159
95418
|
let scopePaths = (options.scope ?? []).map((raw) => normalizeScopePath(raw));
|
|
95160
95419
|
let captureMode = scopePaths.length > 0 ? "scope" : "org-repos";
|
|
95161
95420
|
if (captureMode === "scope") {
|
|
@@ -95174,7 +95433,7 @@ async function runEnrollment(config2, options) {
|
|
|
95174
95433
|
const anyWorkspaceClaims = (orgPolicy?.workspaces ?? []).some(workspaceClaimsAnyRepo);
|
|
95175
95434
|
if (orgPolicy !== void 0 && orgPolicy.owners.length === 0 && orgPolicy.repos === null && !anyWorkspaceClaims) {
|
|
95176
95435
|
if (config2.appEnv === "development") {
|
|
95177
|
-
const home = normalizeScopePath(
|
|
95436
|
+
const home = normalizeScopePath(os19.homedir());
|
|
95178
95437
|
log3(
|
|
95179
95438
|
`No GitHub integration on org "${result.org.name}", syncing sessions under ${home} (your home folder, local DB only). Re-enroll with --scope <path> to narrow.`
|
|
95180
95439
|
);
|
|
@@ -95519,7 +95778,7 @@ function removeFolder2(config2, rawPath, enrollCommand, log3, deps = defaultDeps
|
|
|
95519
95778
|
}
|
|
95520
95779
|
|
|
95521
95780
|
// ../../apps/syncservice/src/protectedRepoDiscovery.ts
|
|
95522
|
-
import
|
|
95781
|
+
import os20 from "node:os";
|
|
95523
95782
|
import path41 from "node:path";
|
|
95524
95783
|
|
|
95525
95784
|
// ../../apps/syncservice/src/syncWindow.ts
|
|
@@ -95582,7 +95841,7 @@ var ProtectedRootTally = class {
|
|
|
95582
95841
|
homeDir;
|
|
95583
95842
|
roots = /* @__PURE__ */ new Map();
|
|
95584
95843
|
constructor(environment) {
|
|
95585
|
-
this.homeDir = path41.resolve(environment.homeDir ??
|
|
95844
|
+
this.homeDir = path41.resolve(environment.homeDir ?? os20.homedir());
|
|
95586
95845
|
}
|
|
95587
95846
|
add(root, folder, cwd, sessionCount = 1) {
|
|
95588
95847
|
const folders = this.roots.get(root) ?? /* @__PURE__ */ new Map();
|
|
@@ -95750,8 +96009,8 @@ function sameList(a, b2) {
|
|
|
95750
96009
|
}
|
|
95751
96010
|
|
|
95752
96011
|
// ../../apps/syncservice/src/harnessAdapters.ts
|
|
95753
|
-
import { existsSync as existsSync15, readdirSync as
|
|
95754
|
-
import
|
|
96012
|
+
import { existsSync as existsSync15, readdirSync as readdirSync12, realpathSync as realpathSync4, statSync as statSync7 } from "node:fs";
|
|
96013
|
+
import os21 from "node:os";
|
|
95755
96014
|
import path42 from "node:path";
|
|
95756
96015
|
var claudeLocal = {
|
|
95757
96016
|
harness: "claude-local",
|
|
@@ -95876,7 +96135,7 @@ var cursorLocal = {
|
|
|
95876
96135
|
};
|
|
95877
96136
|
var HARNESS_ADAPTERS = [claudeLocal, codexLocal, cursorLocal];
|
|
95878
96137
|
var CODEX_BUNDLE_ID = "com.openai.codex";
|
|
95879
|
-
function codexConfigPath(install, homeDir =
|
|
96138
|
+
function codexConfigPath(install, homeDir = os21.homedir()) {
|
|
95880
96139
|
return path42.join(install.configDir ?? path42.join(homeDir, ".codex"), "config.toml");
|
|
95881
96140
|
}
|
|
95882
96141
|
function installList(client, signerFor = () => void 0) {
|
|
@@ -95961,7 +96220,7 @@ function desktopClaude(context2) {
|
|
|
95961
96220
|
}
|
|
95962
96221
|
function listNames3(dir) {
|
|
95963
96222
|
try {
|
|
95964
|
-
return
|
|
96223
|
+
return readdirSync12(dir);
|
|
95965
96224
|
} catch {
|
|
95966
96225
|
return [];
|
|
95967
96226
|
}
|
|
@@ -96010,7 +96269,7 @@ function claudeConfigHomes(homeDir, env) {
|
|
|
96010
96269
|
};
|
|
96011
96270
|
let entries = [];
|
|
96012
96271
|
try {
|
|
96013
|
-
entries =
|
|
96272
|
+
entries = readdirSync12(homeDir);
|
|
96014
96273
|
} catch {
|
|
96015
96274
|
}
|
|
96016
96275
|
for (const entry of entries.sort()) {
|
|
@@ -96026,7 +96285,7 @@ function appBundles(applicationsDirs, namePrefixes) {
|
|
|
96026
96285
|
for (const dir of applicationsDirs) {
|
|
96027
96286
|
let entries;
|
|
96028
96287
|
try {
|
|
96029
|
-
entries =
|
|
96288
|
+
entries = readdirSync12(dir);
|
|
96030
96289
|
} catch {
|
|
96031
96290
|
continue;
|
|
96032
96291
|
}
|
|
@@ -96203,7 +96462,7 @@ async function checkCursor(mcpJsonPath, context2) {
|
|
|
96203
96462
|
|
|
96204
96463
|
// ../../apps/syncservice/src/harnessConnections.ts
|
|
96205
96464
|
import { mkdirSync as mkdirSync22, readFileSync as readFileSync20, renameSync as renameSync12, watch as fsWatch, writeFileSync as writeFileSync13 } from "node:fs";
|
|
96206
|
-
import
|
|
96465
|
+
import os22 from "node:os";
|
|
96207
96466
|
import path43 from "node:path";
|
|
96208
96467
|
var CONNECTION_STATES = [
|
|
96209
96468
|
"signed-in",
|
|
@@ -96237,7 +96496,7 @@ function defaultLocalAppDataDir(homeDir, env) {
|
|
|
96237
96496
|
return process.platform === "win32" ? env.LOCALAPPDATA ?? path43.join(homeDir, "AppData", "Local") : null;
|
|
96238
96497
|
}
|
|
96239
96498
|
function detectContext(options) {
|
|
96240
|
-
const homeDir = options.homeDir ??
|
|
96499
|
+
const homeDir = options.homeDir ?? os22.homedir();
|
|
96241
96500
|
const env = options.env ?? process.env;
|
|
96242
96501
|
return {
|
|
96243
96502
|
homeDir,
|
|
@@ -96709,18 +96968,18 @@ function startHarnessConnectionChecks(options) {
|
|
|
96709
96968
|
|
|
96710
96969
|
// ../../apps/syncservice/src/taskSchedulerService.ts
|
|
96711
96970
|
import { existsSync as existsSync16, mkdirSync as mkdirSync23, readFileSync as readFileSync21, rmSync as rmSync18, writeFileSync as writeFileSync14 } from "node:fs";
|
|
96712
|
-
import
|
|
96971
|
+
import os23 from "node:os";
|
|
96713
96972
|
import path45 from "node:path";
|
|
96714
96973
|
|
|
96715
96974
|
// ../../apps/syncservice/src/windowsElevation.ts
|
|
96716
|
-
import { readdirSync as
|
|
96975
|
+
import { readdirSync as readdirSync13 } from "node:fs";
|
|
96717
96976
|
import path44 from "node:path";
|
|
96718
96977
|
function elevatedSetupRefusal(notDone, retryCommand) {
|
|
96719
96978
|
return new ExpectedCliError(`\u2717 ${notDone} because this window runs as administrator`, {
|
|
96720
96979
|
details: [`Open PowerShell without "Run as administrator", then run \`${retryCommand}\`.`]
|
|
96721
96980
|
});
|
|
96722
96981
|
}
|
|
96723
|
-
function windowsProcessIsElevated(systemRoot, list =
|
|
96982
|
+
function windowsProcessIsElevated(systemRoot, list = readdirSync13) {
|
|
96724
96983
|
try {
|
|
96725
96984
|
list(path44.win32.join(systemRoot, "System32", "config", "systemprofile"));
|
|
96726
96985
|
return true;
|
|
@@ -96736,7 +96995,7 @@ var START_TIME_TOLERANCE_MS = 5e3;
|
|
|
96736
96995
|
var TaskSchedulerService = class {
|
|
96737
96996
|
constructor(appEnv, deps = {}) {
|
|
96738
96997
|
this.appEnv = appEnv;
|
|
96739
|
-
const homeDir = deps.homeDir ??
|
|
96998
|
+
const homeDir = deps.homeDir ?? os23.homedir();
|
|
96740
96999
|
this.homeDir = homeDir;
|
|
96741
97000
|
this.env = deps.env ?? process.env;
|
|
96742
97001
|
this.runPowerShell = deps.runPowerShell ?? runWindowsPowerShell;
|
|
@@ -96982,7 +97241,7 @@ var describeOutputSchema = external_exports.object({
|
|
|
96982
97241
|
task: external_exports.object({ state: external_exports.string(), current: external_exports.boolean() }).nullable(),
|
|
96983
97242
|
supervisor: external_exports.object({ startedAt: external_exports.string() }).nullable()
|
|
96984
97243
|
});
|
|
96985
|
-
function windowsServiceLogPath(appEnv, homeDir =
|
|
97244
|
+
function windowsServiceLogPath(appEnv, homeDir = os23.homedir()) {
|
|
96986
97245
|
return path45.join(homeDir, ".config", "powerplant", "logs", `sync-${appEnv}.log`);
|
|
96987
97246
|
}
|
|
96988
97247
|
function taskAction(command) {
|
|
@@ -97952,7 +98211,7 @@ function openWatchRecovery(options) {
|
|
|
97952
98211
|
|
|
97953
98212
|
// ../../apps/syncservice/src/watch.ts
|
|
97954
98213
|
import { existsSync as existsSync17, mkdirSync as mkdirSync25, watch as fsWatch3 } from "node:fs";
|
|
97955
|
-
import
|
|
98214
|
+
import os24 from "node:os";
|
|
97956
98215
|
import path48 from "node:path";
|
|
97957
98216
|
|
|
97958
98217
|
// ../../apps/syncservice/src/selfRestart.ts
|
|
@@ -98746,7 +99005,7 @@ function newSessionSyncOptions(shared, sinceMs, isNew) {
|
|
|
98746
99005
|
};
|
|
98747
99006
|
}
|
|
98748
99007
|
function startWatch(config2, homeDir, runtime = { version: "checkout" }) {
|
|
98749
|
-
const home = homeDir ??
|
|
99008
|
+
const home = homeDir ?? os24.homedir();
|
|
98750
99009
|
process.on("uncaughtException", (error63) => {
|
|
98751
99010
|
console.error(
|
|
98752
99011
|
`${(/* @__PURE__ */ new Date()).toISOString()} \u26A0 uncaught exception, exiting for a clean restart`,
|
|
@@ -99127,8 +99386,8 @@ function describeDelay(ms) {
|
|
|
99127
99386
|
}
|
|
99128
99387
|
|
|
99129
99388
|
// ../../apps/syncservice/src/localSessionFlags.ts
|
|
99130
|
-
import { existsSync as existsSync18, readdirSync as
|
|
99131
|
-
import
|
|
99389
|
+
import { existsSync as existsSync18, readdirSync as readdirSync14 } from "node:fs";
|
|
99390
|
+
import os25 from "node:os";
|
|
99132
99391
|
import path50 from "node:path";
|
|
99133
99392
|
|
|
99134
99393
|
// ../../apps/syncservice/src/codexReviewFlags.ts
|
|
@@ -99208,7 +99467,7 @@ var STORES = [
|
|
|
99208
99467
|
file: (home) => {
|
|
99209
99468
|
const directory = path50.join(home, ".codex");
|
|
99210
99469
|
if (!existsSync18(directory)) return null;
|
|
99211
|
-
const files =
|
|
99470
|
+
const files = readdirSync14(directory).filter((name) => /^state_\d+\.sqlite$/.test(name)).sort((a, b2) => Number(b2.match(/\d+/)?.[0]) - Number(a.match(/\d+/)?.[0]));
|
|
99212
99471
|
return files[0] ? path50.join(directory, files[0]) : null;
|
|
99213
99472
|
},
|
|
99214
99473
|
id: (externalId) => /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i.exec(externalId)?.[1],
|
|
@@ -99242,7 +99501,7 @@ var STORES = [
|
|
|
99242
99501
|
decode: (row) => row
|
|
99243
99502
|
}
|
|
99244
99503
|
];
|
|
99245
|
-
async function readLocalSessionFlags(sessions, onError2, home =
|
|
99504
|
+
async function readLocalSessionFlags(sessions, onError2, home = os25.homedir()) {
|
|
99246
99505
|
const result = /* @__PURE__ */ new Map();
|
|
99247
99506
|
for (const store of STORES) {
|
|
99248
99507
|
const wanted = sessions.filter((session) => session.source === store.source);
|
|
@@ -99432,14 +99691,14 @@ function nativeFailureRecord(error63) {
|
|
|
99432
99691
|
|
|
99433
99692
|
// src/desktopDiagnostics.ts
|
|
99434
99693
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
99435
|
-
import
|
|
99694
|
+
import os27 from "node:os";
|
|
99436
99695
|
import path54 from "node:path";
|
|
99437
99696
|
|
|
99438
99697
|
// src/memberSessions.ts
|
|
99439
99698
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
99440
99699
|
import { existsSync as existsSync19 } from "node:fs";
|
|
99441
99700
|
import { open as open2, readdir as readdir2 } from "node:fs/promises";
|
|
99442
|
-
import
|
|
99701
|
+
import os26 from "node:os";
|
|
99443
99702
|
import path53 from "node:path";
|
|
99444
99703
|
var memberSessionSchema = external_exports.object({
|
|
99445
99704
|
id: external_exports.string().min(1),
|
|
@@ -99554,7 +99813,7 @@ function detectClaudeDesktop(probe) {
|
|
|
99554
99813
|
return detectDesktopScheme(["Claude.app"], "claude", probe);
|
|
99555
99814
|
}
|
|
99556
99815
|
function detectDesktopScheme(bundles, scheme, probe = { exists: existsSync19, readUrlSchemes: realReadUrlSchemes }) {
|
|
99557
|
-
const roots = ["/Applications", path53.join(
|
|
99816
|
+
const roots = ["/Applications", path53.join(os26.homedir(), "Applications")];
|
|
99558
99817
|
return roots.some(
|
|
99559
99818
|
(root) => bundles.some((bundle) => {
|
|
99560
99819
|
const bundlePath = path53.join(root, bundle);
|
|
@@ -99586,7 +99845,7 @@ var claudeDesktopSessionSchema = external_exports.object({
|
|
|
99586
99845
|
* and still links: the flag must never cost the row its desktop link. */
|
|
99587
99846
|
isArchived: external_exports.unknown().optional()
|
|
99588
99847
|
});
|
|
99589
|
-
async function readClaudeDesktopSessions(wanted, root = path53.join(
|
|
99848
|
+
async function readClaudeDesktopSessions(wanted, root = path53.join(os26.homedir(), "Library/Application Support/Claude/claude-code-sessions")) {
|
|
99590
99849
|
const sessions = /* @__PURE__ */ new Map();
|
|
99591
99850
|
const ambiguous = /* @__PURE__ */ new Set();
|
|
99592
99851
|
if (wanted.size === 0) return sessions;
|
|
@@ -99675,7 +99934,7 @@ function recordingFetch(fetchImpl = fetch, now = () => performance.now()) {
|
|
|
99675
99934
|
};
|
|
99676
99935
|
return { fetch: recorded, requests };
|
|
99677
99936
|
}
|
|
99678
|
-
async function probeClaudeDesktopSessions(wanted, installed, reportFault, root = path54.join(
|
|
99937
|
+
async function probeClaudeDesktopSessions(wanted, installed, reportFault, root = path54.join(os27.homedir(), "Library/Application Support/Claude/claude-code-sessions"), read = readClaudeDesktopSessions) {
|
|
99679
99938
|
if (!installed || wanted.size === 0) {
|
|
99680
99939
|
return { sessions: /* @__PURE__ */ new Map(), diagnostic: { outcome: "not-needed" } };
|
|
99681
99940
|
}
|
|
@@ -100723,7 +100982,7 @@ function requestedAfter(file2, writtenAtMs) {
|
|
|
100723
100982
|
// src/connect.ts
|
|
100724
100983
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
100725
100984
|
import { mkdirSync as mkdirSync29, readFileSync as readFileSync28, statSync as statSync12, writeFileSync as writeFileSync18 } from "node:fs";
|
|
100726
|
-
import
|
|
100985
|
+
import os28 from "node:os";
|
|
100727
100986
|
import path59 from "node:path";
|
|
100728
100987
|
import { emitKeypressEvents } from "node:readline";
|
|
100729
100988
|
|
|
@@ -100942,9 +101201,9 @@ function displayName(client, all) {
|
|
|
100942
101201
|
const sameTarget = peers.filter((peer) => peer.configDir === client.configDir);
|
|
100943
101202
|
const details = [];
|
|
100944
101203
|
if (profiles.size > 1) {
|
|
100945
|
-
details.push(client.configDir?.replace(
|
|
101204
|
+
details.push(client.configDir?.replace(os28.homedir(), "~") ?? "default profile");
|
|
100946
101205
|
}
|
|
100947
|
-
if (sameTarget.length > 1) details.push(client.bin.replace(
|
|
101206
|
+
if (sameTarget.length > 1) details.push(client.bin.replace(os28.homedir(), "~"));
|
|
100948
101207
|
return details.length > 0 ? `${product} (${details.join(", ")})` : product;
|
|
100949
101208
|
}
|
|
100950
101209
|
function pickerAllowed(options) {
|
|
@@ -101327,7 +101586,7 @@ async function connectCursor(mcpJsonPath, name, deps) {
|
|
|
101327
101586
|
);
|
|
101328
101587
|
if (patch.error !== void 0 || patch.entry === void 0) {
|
|
101329
101588
|
return failed(
|
|
101330
|
-
`${mcpJsonPath.replace(
|
|
101589
|
+
`${mcpJsonPath.replace(os28.homedir(), "~")} is ${patch.error}, fix it by hand, then re-run ${deps.connectCommand}.`
|
|
101331
101590
|
);
|
|
101332
101591
|
}
|
|
101333
101592
|
if (patch.changed) deps.writeTextFile(mcpJsonPath, patch.content);
|
|
@@ -101383,7 +101642,7 @@ function aggregateDisconnectTargets(results) {
|
|
|
101383
101642
|
function disconnectTarget(agent, candidates, deps) {
|
|
101384
101643
|
let last = "failed";
|
|
101385
101644
|
for (const [index, candidate] of candidates.entries()) {
|
|
101386
|
-
const name = candidate.client === "cursor" ? `Cursor (${candidate.bin.replace(
|
|
101645
|
+
const name = candidate.client === "cursor" ? `Cursor (${candidate.bin.replace(os28.homedir(), "~")})` : describeBinary(candidate.bin);
|
|
101387
101646
|
try {
|
|
101388
101647
|
const refusal = unsigned(candidate, deps.verifySignature);
|
|
101389
101648
|
if (refusal !== null) deps.log(`\u2717 ${name}: ${refusal}`);
|
|
@@ -101457,7 +101716,7 @@ function disconnectCodex(install, unscoped) {
|
|
|
101457
101716
|
return "disconnected";
|
|
101458
101717
|
}
|
|
101459
101718
|
function disconnectCursor(mcpJsonPath, deps) {
|
|
101460
|
-
const name = `Cursor (${mcpJsonPath.replace(
|
|
101719
|
+
const name = `Cursor (${mcpJsonPath.replace(os28.homedir(), "~")})`;
|
|
101461
101720
|
const patch = unpatchCursorMcpJson(deps.readTextFile(mcpJsonPath), deps.serverName);
|
|
101462
101721
|
if (patch.error !== void 0) {
|
|
101463
101722
|
deps.log(`\u2717 ${name}: mcp.json is ${patch.error}, fix it by hand, then re-run ${deps.disconnectCommand}.`);
|
|
@@ -101488,11 +101747,11 @@ function anyClientStillConnected(clients, deps) {
|
|
|
101488
101747
|
});
|
|
101489
101748
|
}
|
|
101490
101749
|
function describeBinary(bin) {
|
|
101491
|
-
return `${path59.basename(bin)} (${bin.replace(
|
|
101750
|
+
return `${path59.basename(bin)} (${bin.replace(os28.homedir(), "~")})`;
|
|
101492
101751
|
}
|
|
101493
101752
|
function describeTarget(client) {
|
|
101494
101753
|
if (client.configDir === void 0) return describeBinary(client.bin);
|
|
101495
|
-
return `${path59.basename(client.bin)} (${client.configDir.replace(
|
|
101754
|
+
return `${path59.basename(client.bin)} (${client.configDir.replace(os28.homedir(), "~")})`;
|
|
101496
101755
|
}
|
|
101497
101756
|
async function fetchOfficialClients(apiUrl, log3) {
|
|
101498
101757
|
const inline = process.env.POWERPLANT_OFFICIAL_CLIENTS;
|
|
@@ -101561,7 +101820,7 @@ function realOpenUrl(url2, onFailure, platform2 = process.platform) {
|
|
|
101561
101820
|
}
|
|
101562
101821
|
function realAgentVersion(client) {
|
|
101563
101822
|
if (client.client === "cursor") {
|
|
101564
|
-
const applicationsDirs = process.platform === "darwin" ? ["/Applications", path59.join(
|
|
101823
|
+
const applicationsDirs = process.platform === "darwin" ? ["/Applications", path59.join(os28.homedir(), "Applications")] : [];
|
|
101565
101824
|
return cursorAppVersion(applicationsDirs, {
|
|
101566
101825
|
readBundleInfo: readBundleInfoSync,
|
|
101567
101826
|
verifySignature: verifyBundleSignatureSync
|
|
@@ -101580,7 +101839,7 @@ function realRunInteractive(bin, args, env) {
|
|
|
101580
101839
|
// src/liveTerminalSessions.ts
|
|
101581
101840
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
101582
101841
|
import { readdir as readdir3, readFile as readFile2 } from "node:fs/promises";
|
|
101583
|
-
import
|
|
101842
|
+
import os29 from "node:os";
|
|
101584
101843
|
import path60 from "node:path";
|
|
101585
101844
|
var sessionFileAsObserved = external_exports.looseObject({
|
|
101586
101845
|
pid: external_exports.number().int().positive(),
|
|
@@ -101589,7 +101848,7 @@ var sessionFileAsObserved = external_exports.looseObject({
|
|
|
101589
101848
|
});
|
|
101590
101849
|
var START_TIME_TOLERANCE_MS2 = 3e4;
|
|
101591
101850
|
var SESSION_FILE = /^(\d+)\.json$/;
|
|
101592
|
-
function claudeSessionsDir(homeDir =
|
|
101851
|
+
function claudeSessionsDir(homeDir = os29.homedir()) {
|
|
101593
101852
|
return path60.join(homeDir, ".claude", "sessions");
|
|
101594
101853
|
}
|
|
101595
101854
|
async function readLiveTerminalSessions(wanted, deps = {}) {
|
|
@@ -102846,7 +103105,7 @@ function runResumeSession(source, sessionId, deps = {}) {
|
|
|
102846
103105
|
}
|
|
102847
103106
|
|
|
102848
103107
|
// src/version.ts
|
|
102849
|
-
var CLI_VERSION = true ? "0.4.
|
|
103108
|
+
var CLI_VERSION = true ? "0.4.34" : "0.0.0-checkout";
|
|
102850
103109
|
var CLI_RELEASE_BUILD = true ? true : false;
|
|
102851
103110
|
var CLI_DEVELOPMENT_COPY = false;
|
|
102852
103111
|
function updateRefusal(tarball, developmentCopy = CLI_DEVELOPMENT_COPY) {
|
|
@@ -103446,7 +103705,7 @@ async function tryCredentialUpgradeLock(file2) {
|
|
|
103446
103705
|
|
|
103447
103706
|
// src/menubarApp.ts
|
|
103448
103707
|
import { existsSync as existsSync21, mkdirSync as mkdirSync32, renameSync as renameSync16, rmSync as rmSync21 } from "node:fs";
|
|
103449
|
-
import
|
|
103708
|
+
import os30 from "node:os";
|
|
103450
103709
|
import path63 from "node:path";
|
|
103451
103710
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
103452
103711
|
var MENUBAR_APP_ZIP = "dist/menubar/Powerplant.app.zip";
|
|
@@ -103496,7 +103755,7 @@ async function syncMenubarApp(ops, context2) {
|
|
|
103496
103755
|
}
|
|
103497
103756
|
}
|
|
103498
103757
|
function realMenubarAppOps(input2) {
|
|
103499
|
-
const candidates = menubarAppPaths(input2.homeDir ??
|
|
103758
|
+
const candidates = menubarAppPaths(input2.homeDir ?? os30.homedir());
|
|
103500
103759
|
const [userAppPath] = candidates;
|
|
103501
103760
|
return {
|
|
103502
103761
|
cliVersion: input2.cliVersion,
|
|
@@ -103605,7 +103864,7 @@ function tryKill(pid, signal2) {
|
|
|
103605
103864
|
}
|
|
103606
103865
|
|
|
103607
103866
|
// src/uninstall.ts
|
|
103608
|
-
import
|
|
103867
|
+
import os31 from "node:os";
|
|
103609
103868
|
async function runUninstall(deps) {
|
|
103610
103869
|
const uninstalled = deps.uninstall();
|
|
103611
103870
|
for (const line of uninstalled.lines) deps.log(line);
|
|
@@ -103615,7 +103874,7 @@ async function runUninstall(deps) {
|
|
|
103615
103874
|
deps.log(`Your coding agents are still connected to the Powerplant MCP server, remove those connections with: ${disconnectCommand}`);
|
|
103616
103875
|
}
|
|
103617
103876
|
}
|
|
103618
|
-
function uninstallThisMachine(config2, forget, service, production, home =
|
|
103877
|
+
function uninstallThisMachine(config2, forget, service, production, home = os31.homedir()) {
|
|
103619
103878
|
let lines;
|
|
103620
103879
|
let ok = true;
|
|
103621
103880
|
let serviceGone = false;
|
|
@@ -104899,4 +105158,4 @@ undici/lib/web/websocket/frame.js:
|
|
|
104899
105158
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
104900
105159
|
*/
|
|
104901
105160
|
|
|
104902
|
-
//# debugId=
|
|
105161
|
+
//# debugId=e68dfa4d-9f44-5ddd-9585-453c496a0665
|
|
Binary file
|