appostle-installer 0.0.13 → 0.0.14
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/appostle.js +428 -181
- package/dist/appostle.js.map +4 -4
- package/dist/worker.js +486 -222
- package/dist/worker.js.map +4 -4
- package/package.json +1 -1
package/dist/appostle.js
CHANGED
|
@@ -16,10 +16,10 @@ __export(rightfont_service_exports, {
|
|
|
16
16
|
isRightFontLibrary: () => isRightFontLibrary,
|
|
17
17
|
readRightFontLibrary: () => readRightFontLibrary
|
|
18
18
|
});
|
|
19
|
-
import { existsSync as
|
|
19
|
+
import { existsSync as existsSync11, readdirSync, readFileSync as readFileSync6 } from "node:fs";
|
|
20
20
|
import { join as join12 } from "node:path";
|
|
21
21
|
function isRightFontLibrary(libraryPath) {
|
|
22
|
-
return libraryPath.endsWith(".rightfontlibrary") &&
|
|
22
|
+
return libraryPath.endsWith(".rightfontlibrary") && existsSync11(join12(libraryPath, "fonts")) && existsSync11(join12(libraryPath, "metadata"));
|
|
23
23
|
}
|
|
24
24
|
function readRightFontLibrary(libraryPath) {
|
|
25
25
|
if (!isRightFontLibrary(libraryPath)) {
|
|
@@ -30,7 +30,7 @@ function readRightFontLibrary(libraryPath) {
|
|
|
30
30
|
const metadataListsDir = join12(libraryPath, "metadata", "fontlists");
|
|
31
31
|
const familyMap = /* @__PURE__ */ new Map();
|
|
32
32
|
let totalFonts = 0;
|
|
33
|
-
if (
|
|
33
|
+
if (existsSync11(metadataFontsDir)) {
|
|
34
34
|
const files = readdirSync(metadataFontsDir).filter((f) => f.endsWith(".rightfontmetadata"));
|
|
35
35
|
for (const file of files) {
|
|
36
36
|
try {
|
|
@@ -70,7 +70,7 @@ function readRightFontLibrary(libraryPath) {
|
|
|
70
70
|
fam.fonts.sort((a, b) => a.weight - b.weight || a.style.localeCompare(b.style));
|
|
71
71
|
}
|
|
72
72
|
const collections = [];
|
|
73
|
-
if (
|
|
73
|
+
if (existsSync11(metadataListsDir)) {
|
|
74
74
|
const files = readdirSync(metadataListsDir).filter((f) => f.endsWith(".rightfontmetadata"));
|
|
75
75
|
for (const file of files) {
|
|
76
76
|
try {
|
|
@@ -255,7 +255,7 @@ import { createRequire as createRequire5 } from "node:module";
|
|
|
255
255
|
import { Command as Command2 } from "commander";
|
|
256
256
|
|
|
257
257
|
// ../cli/src/utils/client.ts
|
|
258
|
-
import { existsSync as
|
|
258
|
+
import { existsSync as existsSync12, readFileSync as readFileSync7 } from "node:fs";
|
|
259
259
|
|
|
260
260
|
// ../server/src/server/bootstrap.ts
|
|
261
261
|
import express from "express";
|
|
@@ -700,18 +700,18 @@ function resolveNodePtyPackageRoot() {
|
|
|
700
700
|
return null;
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
|
-
function ensureExecutableBit(
|
|
704
|
-
if (!existsSync2(
|
|
703
|
+
function ensureExecutableBit(path29) {
|
|
704
|
+
if (!existsSync2(path29)) {
|
|
705
705
|
return;
|
|
706
706
|
}
|
|
707
|
-
const stat5 = statSync(
|
|
707
|
+
const stat5 = statSync(path29);
|
|
708
708
|
if (!stat5.isFile()) {
|
|
709
709
|
return;
|
|
710
710
|
}
|
|
711
711
|
if ((stat5.mode & 73) === 73) {
|
|
712
712
|
return;
|
|
713
713
|
}
|
|
714
|
-
chmodSync(
|
|
714
|
+
chmodSync(path29, stat5.mode | 73);
|
|
715
715
|
}
|
|
716
716
|
function ensureNodePtySpawnHelperExecutableForCurrentPlatform(options = {}) {
|
|
717
717
|
const platform2 = options.platform ?? process.platform;
|
|
@@ -793,11 +793,11 @@ function parseGitRevParsePath(stdout) {
|
|
|
793
793
|
if (lines.length !== 1) {
|
|
794
794
|
return null;
|
|
795
795
|
}
|
|
796
|
-
const
|
|
797
|
-
if (!
|
|
796
|
+
const path29 = lines[0]?.trim() ?? "";
|
|
797
|
+
if (!path29 || path29.startsWith("--")) {
|
|
798
798
|
return null;
|
|
799
799
|
}
|
|
800
|
-
return
|
|
800
|
+
return path29;
|
|
801
801
|
}
|
|
802
802
|
function resolveGitRevParsePath(cwd, stdout) {
|
|
803
803
|
const parsed = parseGitRevParsePath(stdout);
|
|
@@ -1570,9 +1570,9 @@ async function deleteAppostleWorktree({
|
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
|
-
async function pathExists(
|
|
1573
|
+
async function pathExists(path29) {
|
|
1574
1574
|
try {
|
|
1575
|
-
await stat(
|
|
1575
|
+
await stat(path29);
|
|
1576
1576
|
return true;
|
|
1577
1577
|
} catch (error) {
|
|
1578
1578
|
if (error.code === "ENOENT") {
|
|
@@ -1581,8 +1581,8 @@ async function pathExists(path28) {
|
|
|
1581
1581
|
throw error;
|
|
1582
1582
|
}
|
|
1583
1583
|
}
|
|
1584
|
-
async function removeDirectoryWithRetries(
|
|
1585
|
-
if (!await pathExists(
|
|
1584
|
+
async function removeDirectoryWithRetries(path29) {
|
|
1585
|
+
if (!await pathExists(path29)) {
|
|
1586
1586
|
return;
|
|
1587
1587
|
}
|
|
1588
1588
|
const delaysMs = [0, 100, 300, 700, 1500];
|
|
@@ -1592,17 +1592,17 @@ async function removeDirectoryWithRetries(path28) {
|
|
|
1592
1592
|
await new Promise((resolve12) => setTimeout(resolve12, delay));
|
|
1593
1593
|
}
|
|
1594
1594
|
try {
|
|
1595
|
-
await rm(
|
|
1596
|
-
if (!await pathExists(
|
|
1595
|
+
await rm(path29, { recursive: true, force: true });
|
|
1596
|
+
if (!await pathExists(path29)) {
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
|
-
lastError = new Error(`Directory still present after rm: ${
|
|
1599
|
+
lastError = new Error(`Directory still present after rm: ${path29}`);
|
|
1600
1600
|
} catch (error) {
|
|
1601
1601
|
lastError = error;
|
|
1602
1602
|
}
|
|
1603
1603
|
}
|
|
1604
|
-
if (await pathExists(
|
|
1605
|
-
throw lastError instanceof Error ? lastError : new Error(`Failed to remove worktree directory: ${
|
|
1604
|
+
if (await pathExists(path29)) {
|
|
1605
|
+
throw lastError instanceof Error ? lastError : new Error(`Failed to remove worktree directory: ${path29}`);
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
1608
|
var createWorktree = async ({
|
|
@@ -5105,6 +5105,50 @@ var LinkAccountResponseMessageSchema = z11.object({
|
|
|
5105
5105
|
})
|
|
5106
5106
|
])
|
|
5107
5107
|
});
|
|
5108
|
+
var ClaudeProfileLoginRequestMessageSchema = z11.object({
|
|
5109
|
+
type: z11.literal("claude_profile_login_request"),
|
|
5110
|
+
requestId: z11.string(),
|
|
5111
|
+
/** Username for the profile dir (~/.claude-{username}/). */
|
|
5112
|
+
username: z11.string().min(1)
|
|
5113
|
+
});
|
|
5114
|
+
var ClaudeProfileLoginUrlMessageSchema = z11.object({
|
|
5115
|
+
type: z11.literal("claude_profile_login_url"),
|
|
5116
|
+
requestId: z11.string(),
|
|
5117
|
+
url: z11.string().min(1)
|
|
5118
|
+
});
|
|
5119
|
+
var ClaudeProfileLoginCallbackMessageSchema = z11.object({
|
|
5120
|
+
type: z11.literal("claude_profile_login_callback"),
|
|
5121
|
+
requestId: z11.string(),
|
|
5122
|
+
callbackToken: z11.string().min(1)
|
|
5123
|
+
});
|
|
5124
|
+
var ClaudeProfileLoginResultMessageSchema = z11.object({
|
|
5125
|
+
type: z11.literal("claude_profile_login_result"),
|
|
5126
|
+
requestId: z11.string(),
|
|
5127
|
+
ok: z11.boolean(),
|
|
5128
|
+
error: z11.string().optional()
|
|
5129
|
+
});
|
|
5130
|
+
var ClaudeProfileRemoveRequestMessageSchema = z11.object({
|
|
5131
|
+
type: z11.literal("claude_profile_remove_request"),
|
|
5132
|
+
requestId: z11.string(),
|
|
5133
|
+
username: z11.string().min(1)
|
|
5134
|
+
});
|
|
5135
|
+
var ClaudeProfileRemoveResponseMessageSchema = z11.object({
|
|
5136
|
+
type: z11.literal("claude_profile_remove_response"),
|
|
5137
|
+
requestId: z11.string(),
|
|
5138
|
+
ok: z11.boolean(),
|
|
5139
|
+
error: z11.string().optional()
|
|
5140
|
+
});
|
|
5141
|
+
var ClaudeProfileStatusRequestMessageSchema = z11.object({
|
|
5142
|
+
type: z11.literal("claude_profile_status_request"),
|
|
5143
|
+
requestId: z11.string(),
|
|
5144
|
+
username: z11.string().min(1)
|
|
5145
|
+
});
|
|
5146
|
+
var ClaudeProfileStatusResponseMessageSchema = z11.object({
|
|
5147
|
+
type: z11.literal("claude_profile_status_response"),
|
|
5148
|
+
requestId: z11.string(),
|
|
5149
|
+
hasProfile: z11.boolean(),
|
|
5150
|
+
isAuthenticated: z11.boolean()
|
|
5151
|
+
});
|
|
5108
5152
|
var ListSessionUploadsRequestSchema = z11.object({
|
|
5109
5153
|
type: z11.literal("list_session_uploads_request"),
|
|
5110
5154
|
requestId: z11.string(),
|
|
@@ -5235,6 +5279,10 @@ var SessionInboundMessageSchema = z11.discriminatedUnion("type", [
|
|
|
5235
5279
|
AbortRequestMessageSchema,
|
|
5236
5280
|
AudioPlayedMessageSchema,
|
|
5237
5281
|
LinkAccountRequestMessageSchema,
|
|
5282
|
+
ClaudeProfileLoginRequestMessageSchema,
|
|
5283
|
+
ClaudeProfileLoginCallbackMessageSchema,
|
|
5284
|
+
ClaudeProfileStatusRequestMessageSchema,
|
|
5285
|
+
ClaudeProfileRemoveRequestMessageSchema,
|
|
5238
5286
|
FetchAgentsRequestMessageSchema,
|
|
5239
5287
|
FetchWorkspacesRequestMessageSchema,
|
|
5240
5288
|
FetchAgentRequestMessageSchema,
|
|
@@ -6960,6 +7008,10 @@ var SessionOutboundMessageSchema = z11.discriminatedUnion("type", [
|
|
|
6960
7008
|
GoogleFontsDownloadResponseSchema,
|
|
6961
7009
|
GetVapidPublicKeyResponseSchema,
|
|
6962
7010
|
LinkAccountResponseMessageSchema,
|
|
7011
|
+
ClaudeProfileLoginUrlMessageSchema,
|
|
7012
|
+
ClaudeProfileLoginResultMessageSchema,
|
|
7013
|
+
ClaudeProfileStatusResponseMessageSchema,
|
|
7014
|
+
ClaudeProfileRemoveResponseMessageSchema,
|
|
6963
7015
|
ListSessionUploadsResponseSchema,
|
|
6964
7016
|
DeleteSessionUploadResponseSchema,
|
|
6965
7017
|
ListSessionImagesResponseSchema,
|
|
@@ -6981,7 +7033,11 @@ var WSHelloMessageSchema = z11.object({
|
|
|
6981
7033
|
capabilities: z11.object({
|
|
6982
7034
|
voice: z11.boolean().optional(),
|
|
6983
7035
|
pushNotifications: z11.boolean().optional()
|
|
6984
|
-
}).passthrough().optional()
|
|
7036
|
+
}).passthrough().optional(),
|
|
7037
|
+
/** Auth-server userId of the connecting user. Used for per-user Claude profile selection. */
|
|
7038
|
+
userId: z11.string().optional(),
|
|
7039
|
+
/** Display name of the connecting user (for profile dir naming). */
|
|
7040
|
+
username: z11.string().optional()
|
|
6985
7041
|
});
|
|
6986
7042
|
var WSRecordingStateMessageSchema = z11.object({
|
|
6987
7043
|
type: z11.literal("recording_state"),
|
|
@@ -9410,14 +9466,14 @@ var DictationStreamManager = class {
|
|
|
9410
9466
|
PCM_CHANNELS,
|
|
9411
9467
|
PCM_BITS_PER_SAMPLE
|
|
9412
9468
|
);
|
|
9413
|
-
const
|
|
9469
|
+
const path29 = await maybePersistDictationDebugAudio(
|
|
9414
9470
|
wavBuffer,
|
|
9415
9471
|
{ sessionId: state.sessionId, dictationId: state.dictationId, format: "audio/wav" },
|
|
9416
9472
|
this.logger,
|
|
9417
9473
|
state.debugChunkWriter?.folder
|
|
9418
9474
|
);
|
|
9419
|
-
state.debugRecordingPath =
|
|
9420
|
-
return
|
|
9475
|
+
state.debugRecordingPath = path29;
|
|
9476
|
+
return path29;
|
|
9421
9477
|
}
|
|
9422
9478
|
failDictationStream(dictationId, error, retryable) {
|
|
9423
9479
|
this.emit({
|
|
@@ -11208,14 +11264,14 @@ function parseDiff(diffText) {
|
|
|
11208
11264
|
const firstLine = lines[0];
|
|
11209
11265
|
const isNew = section.includes("new file mode") || section.includes("--- /dev/null");
|
|
11210
11266
|
const isDeleted = section.includes("deleted file mode") || section.includes("+++ /dev/null");
|
|
11211
|
-
let
|
|
11267
|
+
let path29 = "unknown";
|
|
11212
11268
|
const pathMatch = firstLine.match(/a\/(.*?) b\//);
|
|
11213
11269
|
if (pathMatch) {
|
|
11214
|
-
|
|
11270
|
+
path29 = pathMatch[1];
|
|
11215
11271
|
} else {
|
|
11216
11272
|
const newFileMatch = firstLine.match(/b\/(.+)$/);
|
|
11217
11273
|
if (newFileMatch) {
|
|
11218
|
-
|
|
11274
|
+
path29 = newFileMatch[1];
|
|
11219
11275
|
}
|
|
11220
11276
|
}
|
|
11221
11277
|
const hunks = [];
|
|
@@ -11259,7 +11315,7 @@ function parseDiff(diffText) {
|
|
|
11259
11315
|
if (currentHunk) {
|
|
11260
11316
|
hunks.push(currentHunk);
|
|
11261
11317
|
}
|
|
11262
|
-
files.push({ path:
|
|
11318
|
+
files.push({ path: path29, isNew, isDeleted, additions, deletions, hunks });
|
|
11263
11319
|
}
|
|
11264
11320
|
return files;
|
|
11265
11321
|
}
|
|
@@ -11315,9 +11371,9 @@ function buildTokenLookup(lineMap, highlighted) {
|
|
|
11315
11371
|
}
|
|
11316
11372
|
return lookup2;
|
|
11317
11373
|
}
|
|
11318
|
-
function buildFullFileTokenLookup(fileContent,
|
|
11374
|
+
function buildFullFileTokenLookup(fileContent, path29) {
|
|
11319
11375
|
const lookup2 = /* @__PURE__ */ new Map();
|
|
11320
|
-
const highlighted = highlightCode(fileContent,
|
|
11376
|
+
const highlighted = highlightCode(fileContent, path29);
|
|
11321
11377
|
for (let i = 0; i < highlighted.length; i++) {
|
|
11322
11378
|
lookup2.set(i + 1, highlighted[i]);
|
|
11323
11379
|
}
|
|
@@ -13018,11 +13074,11 @@ async function listCheckoutFileChanges(cwd, ref, ignoreWhitespace = false) {
|
|
|
13018
13074
|
}
|
|
13019
13075
|
continue;
|
|
13020
13076
|
}
|
|
13021
|
-
const
|
|
13022
|
-
if (!
|
|
13077
|
+
const path29 = tabParts[1];
|
|
13078
|
+
if (!path29) continue;
|
|
13023
13079
|
const code = rawStatus[0];
|
|
13024
13080
|
changes.push({
|
|
13025
|
-
path:
|
|
13081
|
+
path: path29,
|
|
13026
13082
|
status: rawStatus,
|
|
13027
13083
|
isNew: code === "A",
|
|
13028
13084
|
isDeleted: code === "D"
|
|
@@ -13057,9 +13113,9 @@ async function listCheckoutFileChanges(cwd, ref, ignoreWhitespace = false) {
|
|
|
13057
13113
|
}
|
|
13058
13114
|
return Array.from(byPath.values());
|
|
13059
13115
|
}
|
|
13060
|
-
async function readGitFileContentAtRef(cwd, ref,
|
|
13116
|
+
async function readGitFileContentAtRef(cwd, ref, path29) {
|
|
13061
13117
|
try {
|
|
13062
|
-
const { stdout } = await runGitCommand(["show", `${ref}:${
|
|
13118
|
+
const { stdout } = await runGitCommand(["show", `${ref}:${path29}`], {
|
|
13063
13119
|
cwd,
|
|
13064
13120
|
env: READ_ONLY_GIT_ENV2
|
|
13065
13121
|
});
|
|
@@ -13120,21 +13176,21 @@ async function getTrackedNumstatByPath(cwd, ref, ignoreWhitespace = false) {
|
|
|
13120
13176
|
const additionsField = parts[0] ?? "";
|
|
13121
13177
|
const deletionsField = parts[1] ?? "";
|
|
13122
13178
|
const rawPath = parts.slice(2).join(" ");
|
|
13123
|
-
const
|
|
13124
|
-
if (!
|
|
13179
|
+
const path29 = normalizeNumstatPath(rawPath);
|
|
13180
|
+
if (!path29) {
|
|
13125
13181
|
continue;
|
|
13126
13182
|
}
|
|
13127
13183
|
if (additionsField === "-" || deletionsField === "-") {
|
|
13128
|
-
stats.set(
|
|
13184
|
+
stats.set(path29, { additions: 0, deletions: 0, isBinary: true });
|
|
13129
13185
|
continue;
|
|
13130
13186
|
}
|
|
13131
13187
|
const additions = Number.parseInt(additionsField, 10);
|
|
13132
13188
|
const deletions = Number.parseInt(deletionsField, 10);
|
|
13133
13189
|
if (Number.isNaN(additions) || Number.isNaN(deletions)) {
|
|
13134
|
-
stats.set(
|
|
13190
|
+
stats.set(path29, null);
|
|
13135
13191
|
continue;
|
|
13136
13192
|
}
|
|
13137
|
-
stats.set(
|
|
13193
|
+
stats.set(path29, { additions, deletions, isBinary: false });
|
|
13138
13194
|
}
|
|
13139
13195
|
return stats;
|
|
13140
13196
|
}
|
|
@@ -13719,10 +13775,10 @@ async function listUncommittedFiles(cwd) {
|
|
|
13719
13775
|
if (dest) results.push({ path: dest, changeType: code });
|
|
13720
13776
|
continue;
|
|
13721
13777
|
}
|
|
13722
|
-
const
|
|
13723
|
-
if (!
|
|
13778
|
+
const path29 = parts[1];
|
|
13779
|
+
if (!path29) continue;
|
|
13724
13780
|
if (code === "A" || code === "M" || code === "D") {
|
|
13725
|
-
results.push({ path:
|
|
13781
|
+
results.push({ path: path29, changeType: code });
|
|
13726
13782
|
}
|
|
13727
13783
|
}
|
|
13728
13784
|
} catch {
|
|
@@ -17465,12 +17521,12 @@ function extractPlanNameFromFrontmatter(content) {
|
|
|
17465
17521
|
return null;
|
|
17466
17522
|
}
|
|
17467
17523
|
function resolvePlanFilename(options) {
|
|
17468
|
-
const { originalPath, newSlug, existsSync:
|
|
17524
|
+
const { originalPath, newSlug, existsSync: existsSync16 } = options;
|
|
17469
17525
|
const dir = path8.dirname(originalPath);
|
|
17470
17526
|
const base = `${newSlug}.md`;
|
|
17471
17527
|
let candidate = path8.join(dir, base);
|
|
17472
17528
|
let counter = 2;
|
|
17473
|
-
while (candidate !== originalPath &&
|
|
17529
|
+
while (candidate !== originalPath && existsSync16(candidate)) {
|
|
17474
17530
|
candidate = path8.join(dir, `${newSlug}-${counter}.md`);
|
|
17475
17531
|
counter += 1;
|
|
17476
17532
|
}
|
|
@@ -21707,14 +21763,14 @@ function codexApplyPatchToUnifiedDiff(text) {
|
|
|
21707
21763
|
for (const line of lines) {
|
|
21708
21764
|
const directive = parseCodexApplyPatchDirective(line);
|
|
21709
21765
|
if (directive) {
|
|
21710
|
-
const
|
|
21711
|
-
if (
|
|
21766
|
+
const path29 = normalizeDiffHeaderPath(directive.path);
|
|
21767
|
+
if (path29.length > 0) {
|
|
21712
21768
|
if (output.length > 0 && output[output.length - 1] !== "") {
|
|
21713
21769
|
output.push("");
|
|
21714
21770
|
}
|
|
21715
|
-
const left = directive.kind === "add" ? "/dev/null" : `a/${
|
|
21716
|
-
const right = directive.kind === "delete" ? "/dev/null" : `b/${
|
|
21717
|
-
output.push(`diff --git a/${
|
|
21771
|
+
const left = directive.kind === "add" ? "/dev/null" : `a/${path29}`;
|
|
21772
|
+
const right = directive.kind === "delete" ? "/dev/null" : `b/${path29}`;
|
|
21773
|
+
output.push(`diff --git a/${path29} b/${path29}`);
|
|
21718
21774
|
output.push(`--- ${left}`);
|
|
21719
21775
|
output.push(`+++ ${right}`);
|
|
21720
21776
|
sawDiffContent = true;
|
|
@@ -21784,9 +21840,9 @@ function asEditTextFields(text) {
|
|
|
21784
21840
|
function normalizeRolloutEditInput(input) {
|
|
21785
21841
|
if (typeof input === "string") {
|
|
21786
21842
|
const textFields2 = asEditTextFields(input);
|
|
21787
|
-
const
|
|
21843
|
+
const path29 = extractPatchPrimaryFilePath(input);
|
|
21788
21844
|
return {
|
|
21789
|
-
...
|
|
21845
|
+
...path29 ? { path: path29 } : {},
|
|
21790
21846
|
...textFields2.unifiedDiff ? { patch: textFields2.unifiedDiff } : {},
|
|
21791
21847
|
...textFields2.newString ? { content: textFields2.newString } : {}
|
|
21792
21848
|
};
|
|
@@ -21934,12 +21990,12 @@ function parseFileChangeDiff(entry) {
|
|
|
21934
21990
|
]);
|
|
21935
21991
|
}
|
|
21936
21992
|
function toFileChangeEntry(entry, options, fallbackPath) {
|
|
21937
|
-
const
|
|
21938
|
-
if (!
|
|
21993
|
+
const path29 = parseFileChangePath(entry, options, fallbackPath);
|
|
21994
|
+
if (!path29) {
|
|
21939
21995
|
return null;
|
|
21940
21996
|
}
|
|
21941
21997
|
return {
|
|
21942
|
-
path:
|
|
21998
|
+
path: path29,
|
|
21943
21999
|
kind: parseFileChangeKind(entry),
|
|
21944
22000
|
diff: parseFileChangeDiff(entry)
|
|
21945
22001
|
};
|
|
@@ -21961,12 +22017,12 @@ function parseFileChangeEntries(changes, options) {
|
|
|
21961
22017
|
if (singleEntry) {
|
|
21962
22018
|
return [singleEntry];
|
|
21963
22019
|
}
|
|
21964
|
-
return Object.entries(changes).map(([
|
|
22020
|
+
return Object.entries(changes).map(([path29, value]) => {
|
|
21965
22021
|
if (isRecord2(value)) {
|
|
21966
|
-
return toFileChangeEntry(value, options,
|
|
22022
|
+
return toFileChangeEntry(value, options, path29);
|
|
21967
22023
|
}
|
|
21968
22024
|
if (typeof value === "string") {
|
|
21969
|
-
const normalizedPath = normalizeCodexFilePath(
|
|
22025
|
+
const normalizedPath = normalizeCodexFilePath(path29.trim(), options?.cwd);
|
|
21970
22026
|
if (!normalizedPath) {
|
|
21971
22027
|
return null;
|
|
21972
22028
|
}
|
|
@@ -22711,16 +22767,16 @@ function isObjectSchemaNode(schema) {
|
|
|
22711
22767
|
const type = schema.type;
|
|
22712
22768
|
return isSchemaRecord(schema.properties) || type === "object" || Array.isArray(type) && type.includes("object");
|
|
22713
22769
|
}
|
|
22714
|
-
function normalizeCodexOutputSchemaNode(schema,
|
|
22770
|
+
function normalizeCodexOutputSchemaNode(schema, path29) {
|
|
22715
22771
|
if (Array.isArray(schema)) {
|
|
22716
|
-
return schema.map((entry, index) => normalizeCodexOutputSchemaNode(entry, `${
|
|
22772
|
+
return schema.map((entry, index) => normalizeCodexOutputSchemaNode(entry, `${path29}[${index}]`));
|
|
22717
22773
|
}
|
|
22718
22774
|
if (!isSchemaRecord(schema)) {
|
|
22719
22775
|
return schema;
|
|
22720
22776
|
}
|
|
22721
22777
|
const normalized = {};
|
|
22722
22778
|
for (const [key, value] of Object.entries(schema)) {
|
|
22723
|
-
normalized[key] = normalizeCodexOutputSchemaNode(value, `${
|
|
22779
|
+
normalized[key] = normalizeCodexOutputSchemaNode(value, `${path29}.${key}`);
|
|
22724
22780
|
}
|
|
22725
22781
|
if (!isObjectSchemaNode(normalized)) {
|
|
22726
22782
|
return normalized;
|
|
@@ -22729,7 +22785,7 @@ function normalizeCodexOutputSchemaNode(schema, path28) {
|
|
|
22729
22785
|
normalized.additionalProperties = false;
|
|
22730
22786
|
} else if (normalized.additionalProperties !== false) {
|
|
22731
22787
|
throw new Error(
|
|
22732
|
-
`Codex structured outputs require ${
|
|
22788
|
+
`Codex structured outputs require ${path29} to set additionalProperties to false for object schemas.`
|
|
22733
22789
|
);
|
|
22734
22790
|
}
|
|
22735
22791
|
const properties = isSchemaRecord(normalized.properties) ? normalized.properties : null;
|
|
@@ -23493,8 +23549,8 @@ function parseCodexPatchChanges(changes) {
|
|
|
23493
23549
|
}
|
|
23494
23550
|
];
|
|
23495
23551
|
}
|
|
23496
|
-
return Object.entries(recordChanges).map(([
|
|
23497
|
-
const normalizedPath =
|
|
23552
|
+
return Object.entries(recordChanges).map(([path29, value]) => {
|
|
23553
|
+
const normalizedPath = path29.trim();
|
|
23498
23554
|
if (!normalizedPath) {
|
|
23499
23555
|
return null;
|
|
23500
23556
|
}
|
|
@@ -31255,8 +31311,8 @@ function buildZodValidator(schema, schemaName) {
|
|
|
31255
31311
|
return { ok: true, value: result.data };
|
|
31256
31312
|
}
|
|
31257
31313
|
const errors = result.error.issues.map((issue) => {
|
|
31258
|
-
const
|
|
31259
|
-
return `${
|
|
31314
|
+
const path29 = issue.path.length > 0 ? issue.path.join(".") : "(root)";
|
|
31315
|
+
return `${path29}: ${issue.message}`;
|
|
31260
31316
|
});
|
|
31261
31317
|
return { ok: false, errors };
|
|
31262
31318
|
}
|
|
@@ -31274,9 +31330,9 @@ function buildJsonSchemaValidator(schema) {
|
|
|
31274
31330
|
return { ok: true, value };
|
|
31275
31331
|
}
|
|
31276
31332
|
const errors = (validate.errors ?? []).map((error) => {
|
|
31277
|
-
const
|
|
31333
|
+
const path29 = error.instancePath && error.instancePath.length > 0 ? error.instancePath : "(root)";
|
|
31278
31334
|
const message = error.message ?? "is invalid";
|
|
31279
|
-
return `${
|
|
31335
|
+
return `${path29}: ${message}`;
|
|
31280
31336
|
});
|
|
31281
31337
|
return { ok: false, errors };
|
|
31282
31338
|
}
|
|
@@ -32763,15 +32819,15 @@ async function getProjectIcon(projectDir) {
|
|
|
32763
32819
|
|
|
32764
32820
|
// ../server/src/utils/path.ts
|
|
32765
32821
|
import os5 from "os";
|
|
32766
|
-
function expandTilde(
|
|
32767
|
-
if (
|
|
32822
|
+
function expandTilde(path29) {
|
|
32823
|
+
if (path29.startsWith("~/")) {
|
|
32768
32824
|
const homeDir3 = process.env.HOME || os5.homedir();
|
|
32769
|
-
return
|
|
32825
|
+
return path29.replace("~", homeDir3);
|
|
32770
32826
|
}
|
|
32771
|
-
if (
|
|
32827
|
+
if (path29 === "~") {
|
|
32772
32828
|
return process.env.HOME || os5.homedir();
|
|
32773
32829
|
}
|
|
32774
|
-
return
|
|
32830
|
+
return path29;
|
|
32775
32831
|
}
|
|
32776
32832
|
|
|
32777
32833
|
// ../server/src/server/skills/scanner.ts
|
|
@@ -35357,6 +35413,45 @@ async function generateAndApplyArtDirection(options) {
|
|
|
35357
35413
|
return { generatedCount: acceptedUpdates.size };
|
|
35358
35414
|
}
|
|
35359
35415
|
|
|
35416
|
+
// ../server/src/server/claude-profile.ts
|
|
35417
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync5, symlinkSync, rmSync as rmSync2 } from "node:fs";
|
|
35418
|
+
import path20 from "node:path";
|
|
35419
|
+
import os8 from "node:os";
|
|
35420
|
+
var SHARED_ITEMS = ["settings.json", "hooks", "agents", "skills", "plugins", "keybindings.json"];
|
|
35421
|
+
function getClaudeProfileDir(username) {
|
|
35422
|
+
return path20.join(os8.homedir(), `.claude-${username}`);
|
|
35423
|
+
}
|
|
35424
|
+
function ensureClaudeProfile(username, logger) {
|
|
35425
|
+
const profileDir = getClaudeProfileDir(username);
|
|
35426
|
+
const ownerDir = path20.join(os8.homedir(), ".claude");
|
|
35427
|
+
if (!existsSync10(ownerDir)) {
|
|
35428
|
+
throw new Error(`Owner claude config dir not found: ${ownerDir}`);
|
|
35429
|
+
}
|
|
35430
|
+
if (!existsSync10(profileDir)) {
|
|
35431
|
+
mkdirSync5(profileDir, { recursive: true });
|
|
35432
|
+
logger?.info({ profileDir, username }, "created claude profile directory");
|
|
35433
|
+
}
|
|
35434
|
+
for (const item of SHARED_ITEMS) {
|
|
35435
|
+
const target = path20.join(ownerDir, item);
|
|
35436
|
+
const link = path20.join(profileDir, item);
|
|
35437
|
+
if (!existsSync10(target)) continue;
|
|
35438
|
+
if (existsSync10(link)) continue;
|
|
35439
|
+
symlinkSync(target, link);
|
|
35440
|
+
logger?.info({ item, profileDir }, "symlinked shared config item");
|
|
35441
|
+
}
|
|
35442
|
+
return profileDir;
|
|
35443
|
+
}
|
|
35444
|
+
function hasClaudeAuth(username) {
|
|
35445
|
+
const profileDir = getClaudeProfileDir(username);
|
|
35446
|
+
return existsSync10(profileDir);
|
|
35447
|
+
}
|
|
35448
|
+
function removeClaudeProfile(username, logger) {
|
|
35449
|
+
const profileDir = getClaudeProfileDir(username);
|
|
35450
|
+
if (!existsSync10(profileDir)) return;
|
|
35451
|
+
rmSync2(profileDir, { recursive: true, force: true });
|
|
35452
|
+
logger?.info({ profileDir, username }, "removed claude profile directory");
|
|
35453
|
+
}
|
|
35454
|
+
|
|
35360
35455
|
// ../server/src/services/oauth-service.ts
|
|
35361
35456
|
import { createHash as createHash4, randomBytes as randomBytes2 } from "node:crypto";
|
|
35362
35457
|
import { mkdir as mkdir4, readFile as readFile3, rename, unlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
@@ -35602,57 +35697,57 @@ async function fetchGitLabUsername(fetchImpl, accessToken) {
|
|
|
35602
35697
|
return null;
|
|
35603
35698
|
}
|
|
35604
35699
|
}
|
|
35605
|
-
async function readCredential(
|
|
35700
|
+
async function readCredential(path29, log2) {
|
|
35606
35701
|
try {
|
|
35607
|
-
const raw = await readFile3(
|
|
35702
|
+
const raw = await readFile3(path29, "utf8");
|
|
35608
35703
|
const parsed = JSON.parse(raw);
|
|
35609
35704
|
return parsed.gitlab ?? null;
|
|
35610
35705
|
} catch (error) {
|
|
35611
35706
|
if (isNotFound(error)) return null;
|
|
35612
|
-
log2.warn({ err: error, path:
|
|
35707
|
+
log2.warn({ err: error, path: path29 }, "oauth.credentials.read_failed");
|
|
35613
35708
|
return null;
|
|
35614
35709
|
}
|
|
35615
35710
|
}
|
|
35616
|
-
async function persistCredential(
|
|
35617
|
-
await mkdir4(dirname4(
|
|
35711
|
+
async function persistCredential(path29, credential, log2) {
|
|
35712
|
+
await mkdir4(dirname4(path29), { recursive: true });
|
|
35618
35713
|
let current = {};
|
|
35619
35714
|
try {
|
|
35620
|
-
const raw = await readFile3(
|
|
35715
|
+
const raw = await readFile3(path29, "utf8");
|
|
35621
35716
|
current = JSON.parse(raw);
|
|
35622
35717
|
} catch (error) {
|
|
35623
35718
|
if (!isNotFound(error)) {
|
|
35624
|
-
log2.warn({ err: error, path:
|
|
35719
|
+
log2.warn({ err: error, path: path29 }, "oauth.credentials.read_failed_overwriting");
|
|
35625
35720
|
}
|
|
35626
35721
|
}
|
|
35627
35722
|
const next = { ...current, gitlab: credential };
|
|
35628
|
-
const tmpPath = `${
|
|
35723
|
+
const tmpPath = `${path29}.tmp-${process.pid}-${Date.now()}`;
|
|
35629
35724
|
await writeFile4(tmpPath, JSON.stringify(next, null, 2), { mode: 384 });
|
|
35630
|
-
await rename(tmpPath,
|
|
35725
|
+
await rename(tmpPath, path29);
|
|
35631
35726
|
}
|
|
35632
|
-
async function deleteCredential(
|
|
35727
|
+
async function deleteCredential(path29, log2) {
|
|
35633
35728
|
let current = {};
|
|
35634
35729
|
try {
|
|
35635
|
-
const raw = await readFile3(
|
|
35730
|
+
const raw = await readFile3(path29, "utf8");
|
|
35636
35731
|
current = JSON.parse(raw);
|
|
35637
35732
|
} catch (error) {
|
|
35638
35733
|
if (isNotFound(error)) return;
|
|
35639
|
-
log2.warn({ err: error, path:
|
|
35734
|
+
log2.warn({ err: error, path: path29 }, "oauth.credentials.delete_read_failed");
|
|
35640
35735
|
return;
|
|
35641
35736
|
}
|
|
35642
35737
|
delete current.gitlab;
|
|
35643
35738
|
if (Object.keys(current).length === 0) {
|
|
35644
35739
|
try {
|
|
35645
|
-
await unlink(
|
|
35740
|
+
await unlink(path29);
|
|
35646
35741
|
} catch (error) {
|
|
35647
35742
|
if (!isNotFound(error)) {
|
|
35648
|
-
log2.warn({ err: error, path:
|
|
35743
|
+
log2.warn({ err: error, path: path29 }, "oauth.credentials.unlink_failed");
|
|
35649
35744
|
}
|
|
35650
35745
|
}
|
|
35651
35746
|
return;
|
|
35652
35747
|
}
|
|
35653
|
-
const tmpPath = `${
|
|
35748
|
+
const tmpPath = `${path29}.tmp-${process.pid}-${Date.now()}`;
|
|
35654
35749
|
await writeFile4(tmpPath, JSON.stringify(current, null, 2), { mode: 384 });
|
|
35655
|
-
await rename(tmpPath,
|
|
35750
|
+
await rename(tmpPath, path29);
|
|
35656
35751
|
}
|
|
35657
35752
|
function defaultGlabConfigPath() {
|
|
35658
35753
|
const home = homedir4();
|
|
@@ -35667,15 +35762,15 @@ function defaultGlabConfigPath() {
|
|
|
35667
35762
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
35668
35763
|
return join11(xdg && xdg.length > 0 ? xdg : join11(home, ".config"), "glab-cli", "config.yml");
|
|
35669
35764
|
}
|
|
35670
|
-
async function writeGlabConfig(
|
|
35671
|
-
await mkdir4(dirname4(
|
|
35765
|
+
async function writeGlabConfig(path29, credential, log2) {
|
|
35766
|
+
await mkdir4(dirname4(path29), { recursive: true });
|
|
35672
35767
|
let doc;
|
|
35673
35768
|
try {
|
|
35674
|
-
const raw = await readFile3(
|
|
35769
|
+
const raw = await readFile3(path29, "utf8");
|
|
35675
35770
|
doc = YAML.parseDocument(raw);
|
|
35676
35771
|
if (doc.errors.length > 0) {
|
|
35677
35772
|
log2.warn(
|
|
35678
|
-
{ errors: doc.errors.map((e) => e.message), path:
|
|
35773
|
+
{ errors: doc.errors.map((e) => e.message), path: path29 },
|
|
35679
35774
|
"oauth.glab.parse_errors_replacing"
|
|
35680
35775
|
);
|
|
35681
35776
|
doc = YAML.parseDocument("{}");
|
|
@@ -35684,7 +35779,7 @@ async function writeGlabConfig(path28, credential, log2) {
|
|
|
35684
35779
|
if (isNotFound(error)) {
|
|
35685
35780
|
doc = YAML.parseDocument("{}");
|
|
35686
35781
|
} else {
|
|
35687
|
-
log2.warn({ err: error, path:
|
|
35782
|
+
log2.warn({ err: error, path: path29 }, "oauth.glab.read_failed_replacing");
|
|
35688
35783
|
doc = YAML.parseDocument("{}");
|
|
35689
35784
|
}
|
|
35690
35785
|
}
|
|
@@ -35697,18 +35792,18 @@ async function writeGlabConfig(path28, credential, log2) {
|
|
|
35697
35792
|
if (credential.username) {
|
|
35698
35793
|
hostEntry.set("user", credential.username);
|
|
35699
35794
|
}
|
|
35700
|
-
const tmpPath = `${
|
|
35795
|
+
const tmpPath = `${path29}.tmp-${process.pid}-${Date.now()}`;
|
|
35701
35796
|
await writeFile4(tmpPath, doc.toString(), { mode: 384 });
|
|
35702
|
-
await rename(tmpPath,
|
|
35797
|
+
await rename(tmpPath, path29);
|
|
35703
35798
|
}
|
|
35704
|
-
async function removeGlabHost(
|
|
35799
|
+
async function removeGlabHost(path29, log2) {
|
|
35705
35800
|
let doc;
|
|
35706
35801
|
try {
|
|
35707
|
-
const raw = await readFile3(
|
|
35802
|
+
const raw = await readFile3(path29, "utf8");
|
|
35708
35803
|
doc = YAML.parseDocument(raw);
|
|
35709
35804
|
} catch (error) {
|
|
35710
35805
|
if (isNotFound(error)) return;
|
|
35711
|
-
log2.warn({ err: error, path:
|
|
35806
|
+
log2.warn({ err: error, path: path29 }, "oauth.glab.remove_read_failed");
|
|
35712
35807
|
return;
|
|
35713
35808
|
}
|
|
35714
35809
|
const hosts = doc.get("hosts");
|
|
@@ -35717,9 +35812,9 @@ async function removeGlabHost(path28, log2) {
|
|
|
35717
35812
|
if (hosts.items.length === 0) {
|
|
35718
35813
|
doc.delete("hosts");
|
|
35719
35814
|
}
|
|
35720
|
-
const tmpPath = `${
|
|
35815
|
+
const tmpPath = `${path29}.tmp-${process.pid}-${Date.now()}`;
|
|
35721
35816
|
await writeFile4(tmpPath, doc.toString(), { mode: 384 });
|
|
35722
|
-
await rename(tmpPath,
|
|
35817
|
+
await rename(tmpPath, path29);
|
|
35723
35818
|
}
|
|
35724
35819
|
function ensureMap(doc, key) {
|
|
35725
35820
|
const existing = doc.get(key);
|
|
@@ -36835,6 +36930,8 @@ var Session = class _Session {
|
|
|
36835
36930
|
this.nextTerminalSlot = 0;
|
|
36836
36931
|
this.inflightRequests = 0;
|
|
36837
36932
|
this.peakInflightRequests = 0;
|
|
36933
|
+
/** In-progress `claude login` processes, keyed by requestId. */
|
|
36934
|
+
this.pendingClaudeLogins = /* @__PURE__ */ new Map();
|
|
36838
36935
|
this.checkoutDiffSubscriptions = /* @__PURE__ */ new Map();
|
|
36839
36936
|
this.workspaceGitWatchTargets = /* @__PURE__ */ new Map();
|
|
36840
36937
|
this.workspaceSetupSnapshots = /* @__PURE__ */ new Map();
|
|
@@ -36896,6 +36993,8 @@ var Session = class _Session {
|
|
|
36896
36993
|
this.clientId = clientId;
|
|
36897
36994
|
this.appVersion = appVersion ?? null;
|
|
36898
36995
|
this.sessionId = uuidv47();
|
|
36996
|
+
this.userId = options.userId ?? null;
|
|
36997
|
+
this.username = options.username ?? null;
|
|
36899
36998
|
this.onMessage = onMessage;
|
|
36900
36999
|
this.onBinaryMessage = onBinaryMessage ?? null;
|
|
36901
37000
|
this.onLifecycleIntent = onLifecycleIntent ?? null;
|
|
@@ -37515,6 +37614,18 @@ var Session = class _Session {
|
|
|
37515
37614
|
case "link_account_request":
|
|
37516
37615
|
await this.handleLinkAccountRequest(msg);
|
|
37517
37616
|
break;
|
|
37617
|
+
case "claude_profile_login_request":
|
|
37618
|
+
await this.handleClaudeProfileLoginRequest(msg);
|
|
37619
|
+
break;
|
|
37620
|
+
case "claude_profile_login_callback":
|
|
37621
|
+
await this.handleClaudeProfileLoginCallback(msg);
|
|
37622
|
+
break;
|
|
37623
|
+
case "claude_profile_status_request":
|
|
37624
|
+
await this.handleClaudeProfileStatusRequest(msg);
|
|
37625
|
+
break;
|
|
37626
|
+
case "claude_profile_remove_request":
|
|
37627
|
+
await this.handleClaudeProfileRemoveRequest(msg);
|
|
37628
|
+
break;
|
|
37518
37629
|
case "fetch_agents_request":
|
|
37519
37630
|
await this.handleFetchAgents(msg);
|
|
37520
37631
|
break;
|
|
@@ -38221,6 +38332,138 @@ var Session = class _Session {
|
|
|
38221
38332
|
respond({ ok: false, error: message });
|
|
38222
38333
|
}
|
|
38223
38334
|
}
|
|
38335
|
+
// ---------------------------------------------------------------------------
|
|
38336
|
+
// Claude profile login — per-user subscription on shared hosts
|
|
38337
|
+
// ---------------------------------------------------------------------------
|
|
38338
|
+
async handleClaudeProfileLoginRequest(msg) {
|
|
38339
|
+
const { requestId, username } = msg;
|
|
38340
|
+
const log2 = this.sessionLogger.child({ handler: "claude_profile_login" });
|
|
38341
|
+
try {
|
|
38342
|
+
const profileDir = ensureClaudeProfile(username, log2);
|
|
38343
|
+
const child = spawnProcess("claude", ["auth", "login"], {
|
|
38344
|
+
env: {
|
|
38345
|
+
...process.env,
|
|
38346
|
+
CLAUDE_CONFIG_DIR: profileDir
|
|
38347
|
+
},
|
|
38348
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
38349
|
+
});
|
|
38350
|
+
this.pendingClaudeLogins.set(requestId, { process: child, username });
|
|
38351
|
+
let stdoutBuffer = "";
|
|
38352
|
+
child.stdout?.on("data", (chunk) => {
|
|
38353
|
+
stdoutBuffer += chunk.toString();
|
|
38354
|
+
const urlMatch = stdoutBuffer.match(/(https?:\/\/[^\s]+)/);
|
|
38355
|
+
if (urlMatch) {
|
|
38356
|
+
this.emit({
|
|
38357
|
+
type: "claude_profile_login_url",
|
|
38358
|
+
requestId,
|
|
38359
|
+
url: urlMatch[1]
|
|
38360
|
+
});
|
|
38361
|
+
}
|
|
38362
|
+
});
|
|
38363
|
+
child.stderr?.on("data", (chunk) => {
|
|
38364
|
+
log2.debug({ stderr: chunk.toString() }, "claude login stderr");
|
|
38365
|
+
});
|
|
38366
|
+
child.on("close", (code) => {
|
|
38367
|
+
this.pendingClaudeLogins.delete(requestId);
|
|
38368
|
+
if (code === 0) {
|
|
38369
|
+
log2.info({ username }, "claude profile login succeeded");
|
|
38370
|
+
this.emit({
|
|
38371
|
+
type: "claude_profile_login_result",
|
|
38372
|
+
requestId,
|
|
38373
|
+
ok: true
|
|
38374
|
+
});
|
|
38375
|
+
} else {
|
|
38376
|
+
log2.warn({ username, code }, "claude profile login failed");
|
|
38377
|
+
this.emit({
|
|
38378
|
+
type: "claude_profile_login_result",
|
|
38379
|
+
requestId,
|
|
38380
|
+
ok: false,
|
|
38381
|
+
error: `claude login exited with code ${code}`
|
|
38382
|
+
});
|
|
38383
|
+
}
|
|
38384
|
+
});
|
|
38385
|
+
child.on("error", (err) => {
|
|
38386
|
+
this.pendingClaudeLogins.delete(requestId);
|
|
38387
|
+
log2.error({ err }, "claude login process error");
|
|
38388
|
+
this.emit({
|
|
38389
|
+
type: "claude_profile_login_result",
|
|
38390
|
+
requestId,
|
|
38391
|
+
ok: false,
|
|
38392
|
+
error: err.message
|
|
38393
|
+
});
|
|
38394
|
+
});
|
|
38395
|
+
} catch (err) {
|
|
38396
|
+
const message = err instanceof Error ? err.message : "unknown_error";
|
|
38397
|
+
log2.error({ err }, "claude profile login request failed");
|
|
38398
|
+
this.emit({
|
|
38399
|
+
type: "claude_profile_login_result",
|
|
38400
|
+
requestId,
|
|
38401
|
+
ok: false,
|
|
38402
|
+
error: message
|
|
38403
|
+
});
|
|
38404
|
+
}
|
|
38405
|
+
}
|
|
38406
|
+
async handleClaudeProfileLoginCallback(msg) {
|
|
38407
|
+
const { requestId, callbackToken } = msg;
|
|
38408
|
+
const pending = this.pendingClaudeLogins.get(requestId);
|
|
38409
|
+
if (!pending) {
|
|
38410
|
+
this.sessionLogger.warn({ requestId }, "claude_profile_login_callback: no pending login");
|
|
38411
|
+
this.emit({
|
|
38412
|
+
type: "claude_profile_login_result",
|
|
38413
|
+
requestId,
|
|
38414
|
+
ok: false,
|
|
38415
|
+
error: "no_pending_login"
|
|
38416
|
+
});
|
|
38417
|
+
return;
|
|
38418
|
+
}
|
|
38419
|
+
try {
|
|
38420
|
+
pending.process.stdin?.write(callbackToken + "\n");
|
|
38421
|
+
} catch (err) {
|
|
38422
|
+
this.sessionLogger.error({ err }, "failed to write callback token to claude login stdin");
|
|
38423
|
+
}
|
|
38424
|
+
}
|
|
38425
|
+
async handleClaudeProfileStatusRequest(msg) {
|
|
38426
|
+
const { requestId, username } = msg;
|
|
38427
|
+
const profileExists = hasClaudeAuth(username);
|
|
38428
|
+
let isAuthenticated = false;
|
|
38429
|
+
if (profileExists) {
|
|
38430
|
+
try {
|
|
38431
|
+
const profileDir = ensureClaudeProfile(username);
|
|
38432
|
+
const result = await execCommand("claude", ["auth", "status"], {
|
|
38433
|
+
env: { ...process.env, CLAUDE_CONFIG_DIR: profileDir },
|
|
38434
|
+
timeout: 5e3
|
|
38435
|
+
});
|
|
38436
|
+
isAuthenticated = !result.stdout.toLowerCase().includes("not logged in");
|
|
38437
|
+
} catch {
|
|
38438
|
+
}
|
|
38439
|
+
}
|
|
38440
|
+
this.emit({
|
|
38441
|
+
type: "claude_profile_status_response",
|
|
38442
|
+
requestId,
|
|
38443
|
+
hasProfile: profileExists,
|
|
38444
|
+
isAuthenticated
|
|
38445
|
+
});
|
|
38446
|
+
}
|
|
38447
|
+
async handleClaudeProfileRemoveRequest(msg) {
|
|
38448
|
+
const { requestId, username } = msg;
|
|
38449
|
+
try {
|
|
38450
|
+
removeClaudeProfile(username, this.sessionLogger);
|
|
38451
|
+
this.emit({
|
|
38452
|
+
type: "claude_profile_remove_response",
|
|
38453
|
+
requestId,
|
|
38454
|
+
ok: true
|
|
38455
|
+
});
|
|
38456
|
+
} catch (err) {
|
|
38457
|
+
const message = err instanceof Error ? err.message : "unknown_error";
|
|
38458
|
+
this.sessionLogger.error({ err, username }, "claude profile remove failed");
|
|
38459
|
+
this.emit({
|
|
38460
|
+
type: "claude_profile_remove_response",
|
|
38461
|
+
requestId,
|
|
38462
|
+
ok: false,
|
|
38463
|
+
error: message
|
|
38464
|
+
});
|
|
38465
|
+
}
|
|
38466
|
+
}
|
|
38224
38467
|
async handleRestartServerRequest(requestId, reason) {
|
|
38225
38468
|
const payload = {
|
|
38226
38469
|
status: "restart_requested",
|
|
@@ -39054,7 +39297,9 @@ var Session = class _Session {
|
|
|
39054
39297
|
{
|
|
39055
39298
|
labels,
|
|
39056
39299
|
workspaceId: resolvedWorkspace.workspaceId,
|
|
39057
|
-
initialPrompt: trimmedPrompt
|
|
39300
|
+
initialPrompt: trimmedPrompt,
|
|
39301
|
+
userId: this.userId ?? void 0,
|
|
39302
|
+
username: this.username ?? void 0
|
|
39058
39303
|
}
|
|
39059
39304
|
);
|
|
39060
39305
|
await this.forwardAgentUpdate(snapshot);
|
|
@@ -40522,7 +40767,7 @@ var Session = class _Session {
|
|
|
40522
40767
|
homeDir: process.env.HOME ?? homedir5(),
|
|
40523
40768
|
query: query2,
|
|
40524
40769
|
limit
|
|
40525
|
-
})).map((
|
|
40770
|
+
})).map((path29) => ({ path: path29, kind: "directory" }));
|
|
40526
40771
|
const directories = entries.filter((entry) => entry.kind === "directory").map((entry) => entry.path);
|
|
40527
40772
|
this.emit({
|
|
40528
40773
|
type: "directory_suggestions_response",
|
|
@@ -45863,16 +46108,16 @@ function isRelayClientWebSocketUrl(url) {
|
|
|
45863
46108
|
}
|
|
45864
46109
|
|
|
45865
46110
|
// ../server/src/server/config.ts
|
|
45866
|
-
import
|
|
46111
|
+
import path22 from "node:path";
|
|
45867
46112
|
import { z as z51 } from "zod";
|
|
45868
46113
|
|
|
45869
46114
|
// ../server/src/server/speech/speech-config-resolver.ts
|
|
45870
46115
|
import { z as z50 } from "zod";
|
|
45871
46116
|
|
|
45872
46117
|
// ../server/src/server/speech/providers/local/config.ts
|
|
45873
|
-
import
|
|
46118
|
+
import path21 from "node:path";
|
|
45874
46119
|
import { z as z48 } from "zod";
|
|
45875
|
-
var DEFAULT_LOCAL_MODELS_SUBDIR =
|
|
46120
|
+
var DEFAULT_LOCAL_MODELS_SUBDIR = path21.join("models", "local-speech");
|
|
45876
46121
|
var NumberLikeSchema2 = z48.union([z48.number(), z48.string().trim().min(1)]);
|
|
45877
46122
|
var OptionalFiniteNumberSchema2 = NumberLikeSchema2.pipe(z48.coerce.number().finite()).optional();
|
|
45878
46123
|
var OptionalIntegerSchema = NumberLikeSchema2.pipe(z48.coerce.number().int()).optional();
|
|
@@ -45899,7 +46144,7 @@ function resolveLocalSpeechConfig(params) {
|
|
|
45899
46144
|
const includeProviderConfig = shouldIncludeLocalProviderConfig(params);
|
|
45900
46145
|
const parsed = LocalSpeechResolutionSchema.parse({
|
|
45901
46146
|
includeProviderConfig,
|
|
45902
|
-
modelsDir: params.env.APPOSTLE_LOCAL_MODELS_DIR ?? params.persisted.providers?.local?.modelsDir ??
|
|
46147
|
+
modelsDir: params.env.APPOSTLE_LOCAL_MODELS_DIR ?? params.persisted.providers?.local?.modelsDir ?? path21.join(params.appostleHome, DEFAULT_LOCAL_MODELS_SUBDIR),
|
|
45903
46148
|
dictationLocalSttModel: params.env.APPOSTLE_DICTATION_LOCAL_STT_MODEL ?? persistedLocalFeatureModel(
|
|
45904
46149
|
params.providers.dictationStt.provider,
|
|
45905
46150
|
params.providers.dictationStt.enabled,
|
|
@@ -46155,7 +46400,7 @@ function loadConfig(appostleHome, options) {
|
|
|
46155
46400
|
chromeEnabled,
|
|
46156
46401
|
mcpDebug: env.MCP_DEBUG === "1",
|
|
46157
46402
|
daemonIcon,
|
|
46158
|
-
agentStoragePath:
|
|
46403
|
+
agentStoragePath: path22.join(appostleHome, "agents"),
|
|
46159
46404
|
staticDir: "public",
|
|
46160
46405
|
agentClients: {},
|
|
46161
46406
|
relayEnabled,
|
|
@@ -47405,12 +47650,12 @@ var DaemonClient = class {
|
|
|
47405
47650
|
timeout: 1e4
|
|
47406
47651
|
});
|
|
47407
47652
|
}
|
|
47408
|
-
async openInEditor(
|
|
47653
|
+
async openInEditor(path29, editorId, requestId) {
|
|
47409
47654
|
return this.sendCorrelatedSessionRequest({
|
|
47410
47655
|
requestId,
|
|
47411
47656
|
message: {
|
|
47412
47657
|
type: "open_in_editor_request",
|
|
47413
|
-
path:
|
|
47658
|
+
path: path29,
|
|
47414
47659
|
editorId
|
|
47415
47660
|
},
|
|
47416
47661
|
responseType: "open_in_editor_response",
|
|
@@ -48896,13 +49141,13 @@ var DaemonClient = class {
|
|
|
48896
49141
|
// ============================================================================
|
|
48897
49142
|
// File Explorer
|
|
48898
49143
|
// ============================================================================
|
|
48899
|
-
async exploreFileSystem(cwd,
|
|
49144
|
+
async exploreFileSystem(cwd, path29, mode = "list", requestId) {
|
|
48900
49145
|
return this.sendCorrelatedSessionRequest({
|
|
48901
49146
|
requestId,
|
|
48902
49147
|
message: {
|
|
48903
49148
|
type: "file_explorer_request",
|
|
48904
49149
|
cwd,
|
|
48905
|
-
path:
|
|
49150
|
+
path: path29,
|
|
48906
49151
|
mode
|
|
48907
49152
|
},
|
|
48908
49153
|
responseType: "file_explorer_response",
|
|
@@ -48914,13 +49159,13 @@ var DaemonClient = class {
|
|
|
48914
49159
|
* allowlists extensions (currently `.md` only) — callers don't need to
|
|
48915
49160
|
* re-check. Used by the plan-todos UI to rewrite plan-file frontmatter.
|
|
48916
49161
|
*/
|
|
48917
|
-
async writeFile(cwd,
|
|
49162
|
+
async writeFile(cwd, path29, content, requestId) {
|
|
48918
49163
|
return this.sendCorrelatedSessionRequest({
|
|
48919
49164
|
requestId,
|
|
48920
49165
|
message: {
|
|
48921
49166
|
type: "file_write_request",
|
|
48922
49167
|
cwd,
|
|
48923
|
-
path:
|
|
49168
|
+
path: path29,
|
|
48924
49169
|
content
|
|
48925
49170
|
},
|
|
48926
49171
|
responseType: "file_write_response",
|
|
@@ -48933,42 +49178,42 @@ var DaemonClient = class {
|
|
|
48933
49178
|
* action is the only consumer). Returns the daemon's structured response
|
|
48934
49179
|
* so callers can surface the error in the UI.
|
|
48935
49180
|
*/
|
|
48936
|
-
async deleteFile(cwd,
|
|
49181
|
+
async deleteFile(cwd, path29, requestId) {
|
|
48937
49182
|
return this.sendCorrelatedSessionRequest({
|
|
48938
49183
|
requestId,
|
|
48939
49184
|
message: {
|
|
48940
49185
|
type: "file_delete_request",
|
|
48941
49186
|
cwd,
|
|
48942
|
-
path:
|
|
49187
|
+
path: path29
|
|
48943
49188
|
},
|
|
48944
49189
|
responseType: "file_delete_response",
|
|
48945
49190
|
timeout: 1e4
|
|
48946
49191
|
});
|
|
48947
49192
|
}
|
|
48948
|
-
async requestDownloadToken(cwd,
|
|
49193
|
+
async requestDownloadToken(cwd, path29, requestId) {
|
|
48949
49194
|
return this.sendCorrelatedSessionRequest({
|
|
48950
49195
|
requestId,
|
|
48951
49196
|
message: {
|
|
48952
49197
|
type: "file_download_token_request",
|
|
48953
49198
|
cwd,
|
|
48954
|
-
path:
|
|
49199
|
+
path: path29
|
|
48955
49200
|
},
|
|
48956
49201
|
responseType: "file_download_token_response",
|
|
48957
49202
|
timeout: 1e4
|
|
48958
49203
|
});
|
|
48959
49204
|
}
|
|
48960
|
-
async explorerDeleteEntry(cwd,
|
|
49205
|
+
async explorerDeleteEntry(cwd, path29, requestId) {
|
|
48961
49206
|
return this.sendCorrelatedSessionRequest({
|
|
48962
49207
|
requestId,
|
|
48963
|
-
message: { type: "file_explorer_delete_request", cwd, path:
|
|
49208
|
+
message: { type: "file_explorer_delete_request", cwd, path: path29 },
|
|
48964
49209
|
responseType: "file_explorer_delete_response",
|
|
48965
49210
|
timeout: 1e4
|
|
48966
49211
|
});
|
|
48967
49212
|
}
|
|
48968
|
-
async explorerMkdir(cwd,
|
|
49213
|
+
async explorerMkdir(cwd, path29, requestId) {
|
|
48969
49214
|
return this.sendCorrelatedSessionRequest({
|
|
48970
49215
|
requestId,
|
|
48971
|
-
message: { type: "file_mkdir_request", cwd, path:
|
|
49216
|
+
message: { type: "file_mkdir_request", cwd, path: path29 },
|
|
48972
49217
|
responseType: "file_mkdir_response",
|
|
48973
49218
|
timeout: 1e4
|
|
48974
49219
|
});
|
|
@@ -49998,7 +50243,9 @@ var DaemonClient = class {
|
|
|
49998
50243
|
clientId: this.config.clientId,
|
|
49999
50244
|
clientType: this.config.clientType ?? "cli",
|
|
50000
50245
|
protocolVersion: 1,
|
|
50001
|
-
...this.config.appVersion ? { appVersion: this.config.appVersion } : {}
|
|
50246
|
+
...this.config.appVersion ? { appVersion: this.config.appVersion } : {},
|
|
50247
|
+
...this.config.userId ? { userId: this.config.userId } : {},
|
|
50248
|
+
...this.config.username ? { username: this.config.username } : {}
|
|
50002
50249
|
})
|
|
50003
50250
|
);
|
|
50004
50251
|
} catch (error) {
|
|
@@ -50394,7 +50641,7 @@ function resolveAgentConfig(options) {
|
|
|
50394
50641
|
}
|
|
50395
50642
|
|
|
50396
50643
|
// ../cli/src/utils/client.ts
|
|
50397
|
-
import
|
|
50644
|
+
import path23 from "node:path";
|
|
50398
50645
|
import WebSocket3 from "ws";
|
|
50399
50646
|
|
|
50400
50647
|
// ../cli/src/utils/client-id.ts
|
|
@@ -50470,8 +50717,8 @@ function isTcpDaemonHost(host) {
|
|
|
50470
50717
|
return host !== null && !isIpcDaemonHost(host);
|
|
50471
50718
|
}
|
|
50472
50719
|
function readPidSocketTarget(appostleHome) {
|
|
50473
|
-
const pidPath =
|
|
50474
|
-
if (!
|
|
50720
|
+
const pidPath = path23.join(appostleHome, PID_FILENAME);
|
|
50721
|
+
if (!existsSync12(pidPath)) {
|
|
50475
50722
|
return null;
|
|
50476
50723
|
}
|
|
50477
50724
|
try {
|
|
@@ -50939,12 +51186,12 @@ function relativeTime(date) {
|
|
|
50939
51186
|
if (seconds < 86400) return `${Math.floor(seconds / 3600)} hours ago`;
|
|
50940
51187
|
return `${Math.floor(seconds / 86400)} days ago`;
|
|
50941
51188
|
}
|
|
50942
|
-
function shortenPath(
|
|
51189
|
+
function shortenPath(path29) {
|
|
50943
51190
|
const home = process.env.HOME;
|
|
50944
|
-
if (home &&
|
|
50945
|
-
return "~" +
|
|
51191
|
+
if (home && path29.startsWith(home)) {
|
|
51192
|
+
return "~" + path29.slice(home.length);
|
|
50946
51193
|
}
|
|
50947
|
-
return
|
|
51194
|
+
return path29;
|
|
50948
51195
|
}
|
|
50949
51196
|
function normalizeModelId(modelId) {
|
|
50950
51197
|
if (typeof modelId !== "string") return null;
|
|
@@ -51801,10 +52048,10 @@ function addSendOptions(cmd) {
|
|
|
51801
52048
|
}
|
|
51802
52049
|
async function readImageFiles(imagePaths) {
|
|
51803
52050
|
const images = [];
|
|
51804
|
-
for (const
|
|
52051
|
+
for (const path29 of imagePaths) {
|
|
51805
52052
|
try {
|
|
51806
|
-
const buffer = await readFile5(
|
|
51807
|
-
const ext = extname5(
|
|
52053
|
+
const buffer = await readFile5(path29);
|
|
52054
|
+
const ext = extname5(path29).toLowerCase();
|
|
51808
52055
|
let mimeType = "image/jpeg";
|
|
51809
52056
|
switch (ext) {
|
|
51810
52057
|
case ".png":
|
|
@@ -51832,7 +52079,7 @@ async function readImageFiles(imagePaths) {
|
|
|
51832
52079
|
const message = err instanceof Error ? err.message : String(err);
|
|
51833
52080
|
const error = {
|
|
51834
52081
|
code: "IMAGE_READ_ERROR",
|
|
51835
|
-
message: `Failed to read image file: ${
|
|
52082
|
+
message: `Failed to read image file: ${path29}`,
|
|
51836
52083
|
details: message
|
|
51837
52084
|
};
|
|
51838
52085
|
throw error;
|
|
@@ -52005,12 +52252,12 @@ function createInspectSchema(agent) {
|
|
|
52005
52252
|
serialize: (_item) => agent
|
|
52006
52253
|
};
|
|
52007
52254
|
}
|
|
52008
|
-
function shortenPath2(
|
|
52255
|
+
function shortenPath2(path29) {
|
|
52009
52256
|
const home = process.env.HOME;
|
|
52010
|
-
if (home &&
|
|
52011
|
-
return "~" +
|
|
52257
|
+
if (home && path29.startsWith(home)) {
|
|
52258
|
+
return "~" + path29.slice(home.length);
|
|
52012
52259
|
}
|
|
52013
|
-
return
|
|
52260
|
+
return path29;
|
|
52014
52261
|
}
|
|
52015
52262
|
function formatCost(costUsd) {
|
|
52016
52263
|
if (costUsd === 0) return "$0.00";
|
|
@@ -52976,9 +53223,9 @@ import chalk3 from "chalk";
|
|
|
52976
53223
|
|
|
52977
53224
|
// ../cli/src/commands/daemon/local-daemon.ts
|
|
52978
53225
|
import { spawn as spawn7, spawnSync } from "node:child_process";
|
|
52979
|
-
import { existsSync as
|
|
53226
|
+
import { existsSync as existsSync13, readFileSync as readFileSync9 } from "node:fs";
|
|
52980
53227
|
import { createRequire as createRequire3 } from "node:module";
|
|
52981
|
-
import
|
|
53228
|
+
import path24 from "node:path";
|
|
52982
53229
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
52983
53230
|
var DETACHED_STARTUP_GRACE_MS = 1200;
|
|
52984
53231
|
var PID_POLL_INTERVAL_MS = 100;
|
|
@@ -53029,8 +53276,8 @@ function buildChildEnv(options) {
|
|
|
53029
53276
|
function resolveDaemonRunnerEntry() {
|
|
53030
53277
|
try {
|
|
53031
53278
|
const here = fileURLToPath3(import.meta.url);
|
|
53032
|
-
const sibling =
|
|
53033
|
-
if (
|
|
53279
|
+
const sibling = path24.join(path24.dirname(here), "supervisor-entrypoint.js");
|
|
53280
|
+
if (existsSync13(sibling)) {
|
|
53034
53281
|
return sibling;
|
|
53035
53282
|
}
|
|
53036
53283
|
} catch {
|
|
@@ -53043,23 +53290,23 @@ function resolveDaemonRunnerEntry() {
|
|
|
53043
53290
|
"Unable to resolve @appostle/server package root for daemon runner (and no sibling supervisor-entrypoint.js was bundled)"
|
|
53044
53291
|
);
|
|
53045
53292
|
}
|
|
53046
|
-
let currentDir =
|
|
53293
|
+
let currentDir = path24.dirname(serverExportPath);
|
|
53047
53294
|
while (true) {
|
|
53048
|
-
const packageJsonPath =
|
|
53049
|
-
if (
|
|
53295
|
+
const packageJsonPath = path24.join(currentDir, "package.json");
|
|
53296
|
+
if (existsSync13(packageJsonPath)) {
|
|
53050
53297
|
try {
|
|
53051
53298
|
const packageJson = JSON.parse(readFileSync9(packageJsonPath, "utf-8"));
|
|
53052
53299
|
if (packageJson.name === "@appostle/server") {
|
|
53053
|
-
const distRunner =
|
|
53054
|
-
if (
|
|
53300
|
+
const distRunner = path24.join(currentDir, "dist", "scripts", "supervisor-entrypoint.js");
|
|
53301
|
+
if (existsSync13(distRunner)) {
|
|
53055
53302
|
return distRunner;
|
|
53056
53303
|
}
|
|
53057
|
-
return
|
|
53304
|
+
return path24.join(currentDir, "scripts", "supervisor-entrypoint.ts");
|
|
53058
53305
|
}
|
|
53059
53306
|
} catch {
|
|
53060
53307
|
}
|
|
53061
53308
|
}
|
|
53062
|
-
const parentDir =
|
|
53309
|
+
const parentDir = path24.dirname(currentDir);
|
|
53063
53310
|
if (parentDir === currentDir) {
|
|
53064
53311
|
break;
|
|
53065
53312
|
}
|
|
@@ -53068,7 +53315,7 @@ function resolveDaemonRunnerEntry() {
|
|
|
53068
53315
|
throw new Error("Unable to resolve @appostle/server package root for daemon runner");
|
|
53069
53316
|
}
|
|
53070
53317
|
function pidFilePath(appostleHome) {
|
|
53071
|
-
return
|
|
53318
|
+
return path24.join(appostleHome, DAEMON_PID_FILENAME);
|
|
53072
53319
|
}
|
|
53073
53320
|
function readPidFile(pidPath) {
|
|
53074
53321
|
try {
|
|
@@ -53210,8 +53457,8 @@ function resolveLocalDaemonState(options = {}) {
|
|
|
53210
53457
|
const home = resolveAppostleHome(env);
|
|
53211
53458
|
const config = loadConfig(home, { env });
|
|
53212
53459
|
const pidPath = pidFilePath(home);
|
|
53213
|
-
const logPath =
|
|
53214
|
-
const pidInfo =
|
|
53460
|
+
const logPath = path24.join(home, DAEMON_LOG_FILENAME);
|
|
53461
|
+
const pidInfo = existsSync13(pidPath) ? readPidFile(pidPath) : null;
|
|
53215
53462
|
const running = pidInfo ? isProcessRunning(pidInfo.pid) : false;
|
|
53216
53463
|
const listen = pidInfo?.listen ?? config.listen;
|
|
53217
53464
|
return {
|
|
@@ -53225,7 +53472,7 @@ function resolveLocalDaemonState(options = {}) {
|
|
|
53225
53472
|
};
|
|
53226
53473
|
}
|
|
53227
53474
|
function tailDaemonLog(home, lines = 30) {
|
|
53228
|
-
const logPath =
|
|
53475
|
+
const logPath = path24.join(resolveLocalAppostleHome(home), DAEMON_LOG_FILENAME);
|
|
53229
53476
|
return tailFile(logPath, lines);
|
|
53230
53477
|
}
|
|
53231
53478
|
async function startLocalDaemonDetached(options) {
|
|
@@ -53234,7 +53481,7 @@ async function startLocalDaemonDetached(options) {
|
|
|
53234
53481
|
}
|
|
53235
53482
|
const childEnv = buildChildEnv(options);
|
|
53236
53483
|
const appostleHome = resolveAppostleHome(childEnv);
|
|
53237
|
-
const logPath =
|
|
53484
|
+
const logPath = path24.join(appostleHome, DAEMON_LOG_FILENAME);
|
|
53238
53485
|
const daemonRunnerEntry = resolveDaemonRunnerEntry();
|
|
53239
53486
|
const child = spawn7(
|
|
53240
53487
|
process.execPath,
|
|
@@ -55960,15 +56207,15 @@ import { Command as Command13 } from "commander";
|
|
|
55960
56207
|
// ../cli/src/commands/worktree/ls.ts
|
|
55961
56208
|
import { homedir as homedir7 } from "node:os";
|
|
55962
56209
|
import { basename as basename7, join as join16, sep as sep3 } from "node:path";
|
|
55963
|
-
function shortenPath3(
|
|
56210
|
+
function shortenPath3(path29) {
|
|
55964
56211
|
const home = process.env.HOME;
|
|
55965
|
-
if (home &&
|
|
55966
|
-
return "~" +
|
|
56212
|
+
if (home && path29.startsWith(home)) {
|
|
56213
|
+
return "~" + path29.slice(home.length);
|
|
55967
56214
|
}
|
|
55968
|
-
return
|
|
56215
|
+
return path29;
|
|
55969
56216
|
}
|
|
55970
|
-
function extractWorktreeName(
|
|
55971
|
-
return basename7(
|
|
56217
|
+
function extractWorktreeName(path29) {
|
|
56218
|
+
return basename7(path29);
|
|
55972
56219
|
}
|
|
55973
56220
|
function resolveAppostleHomePath() {
|
|
55974
56221
|
return process.env.APPOSTLE_HOME ?? join16(homedir7(), ".appostle");
|
|
@@ -56048,7 +56295,7 @@ async function runLsCommand7(options, _command) {
|
|
|
56048
56295
|
}
|
|
56049
56296
|
|
|
56050
56297
|
// ../cli/src/commands/worktree/archive.ts
|
|
56051
|
-
import
|
|
56298
|
+
import path25 from "path";
|
|
56052
56299
|
var archiveSchema2 = {
|
|
56053
56300
|
idField: "name",
|
|
56054
56301
|
columns: [
|
|
@@ -56092,7 +56339,7 @@ async function runArchiveCommand2(nameArg, options, _command) {
|
|
|
56092
56339
|
throw error;
|
|
56093
56340
|
}
|
|
56094
56341
|
const worktree = listResponse.worktrees.find((wt) => {
|
|
56095
|
-
const name =
|
|
56342
|
+
const name = path25.basename(wt.worktreePath);
|
|
56096
56343
|
return name === nameArg || wt.branchName === nameArg;
|
|
56097
56344
|
});
|
|
56098
56345
|
if (!worktree) {
|
|
@@ -56114,7 +56361,7 @@ async function runArchiveCommand2(nameArg, options, _command) {
|
|
|
56114
56361
|
};
|
|
56115
56362
|
throw error;
|
|
56116
56363
|
}
|
|
56117
|
-
const worktreeName =
|
|
56364
|
+
const worktreeName = path25.basename(worktree.worktreePath) || nameArg;
|
|
56118
56365
|
return {
|
|
56119
56366
|
type: "single",
|
|
56120
56367
|
data: {
|
|
@@ -56155,7 +56402,7 @@ function createWorktreeCommand() {
|
|
|
56155
56402
|
import { cancel, confirm, intro, isCancel, log, note, outro, spinner } from "@clack/prompts";
|
|
56156
56403
|
import { Command as Command14, Option as Option4 } from "commander";
|
|
56157
56404
|
import { writeFileSync as writeFileSync5 } from "node:fs";
|
|
56158
|
-
import
|
|
56405
|
+
import path26 from "node:path";
|
|
56159
56406
|
var DEFAULT_READY_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
56160
56407
|
var OnboardCancelledError = class extends Error {
|
|
56161
56408
|
};
|
|
@@ -56198,7 +56445,7 @@ function toCliOverrides(options) {
|
|
|
56198
56445
|
return cliOverrides;
|
|
56199
56446
|
}
|
|
56200
56447
|
function savePersistedConfig2(appostleHome, config) {
|
|
56201
|
-
const configPath =
|
|
56448
|
+
const configPath = path26.join(appostleHome, "config.json");
|
|
56202
56449
|
writeFileSync5(configPath, `${JSON.stringify(config, null, 2)}
|
|
56203
56450
|
`);
|
|
56204
56451
|
}
|
|
@@ -56319,7 +56566,7 @@ ${recentLogs}` : null
|
|
|
56319
56566
|
);
|
|
56320
56567
|
}
|
|
56321
56568
|
function printNextSteps(pairingUrl, appostleHome, richUi) {
|
|
56322
|
-
const daemonLogPath =
|
|
56569
|
+
const daemonLogPath = path26.join(appostleHome, "daemon.log");
|
|
56323
56570
|
const nextStepsLines = [
|
|
56324
56571
|
pairingUrl ? "1. Open Appostle and scan the QR code above, or paste the pairing link." : "1. Open Appostle and connect to your daemon.",
|
|
56325
56572
|
"2. Web app: https://appostle.app",
|
|
@@ -56571,21 +56818,21 @@ function createCli() {
|
|
|
56571
56818
|
}
|
|
56572
56819
|
|
|
56573
56820
|
// ../cli/src/classify.ts
|
|
56574
|
-
import { existsSync as
|
|
56821
|
+
import { existsSync as existsSync14, statSync as statSync3 } from "node:fs";
|
|
56575
56822
|
import { homedir as homedir8 } from "node:os";
|
|
56576
|
-
import
|
|
56823
|
+
import path27 from "node:path";
|
|
56577
56824
|
function expandUserPath2(inputPath) {
|
|
56578
56825
|
if (inputPath === "~") {
|
|
56579
56826
|
return homedir8();
|
|
56580
56827
|
}
|
|
56581
56828
|
if (inputPath.startsWith("~/")) {
|
|
56582
|
-
return
|
|
56829
|
+
return path27.join(homedir8(), inputPath.slice(2));
|
|
56583
56830
|
}
|
|
56584
56831
|
return inputPath;
|
|
56585
56832
|
}
|
|
56586
56833
|
function isExistingDirectory(input) {
|
|
56587
|
-
const resolvedPath =
|
|
56588
|
-
if (!
|
|
56834
|
+
const resolvedPath = path27.resolve(input.cwd, expandUserPath2(input.pathArg));
|
|
56835
|
+
if (!existsSync14(resolvedPath)) {
|
|
56589
56836
|
return false;
|
|
56590
56837
|
}
|
|
56591
56838
|
return statSync3(resolvedPath).isDirectory();
|
|
@@ -56604,25 +56851,25 @@ function classifyInvocation(input) {
|
|
|
56604
56851
|
if (isExistingDirectory({ pathArg: firstArg, cwd: input.cwd })) {
|
|
56605
56852
|
return {
|
|
56606
56853
|
kind: "open-project",
|
|
56607
|
-
resolvedPath:
|
|
56854
|
+
resolvedPath: path27.resolve(input.cwd, expandUserPath2(firstArg))
|
|
56608
56855
|
};
|
|
56609
56856
|
}
|
|
56610
56857
|
return { kind: "cli", argv: input.argv };
|
|
56611
56858
|
}
|
|
56612
56859
|
|
|
56613
56860
|
// ../cli/src/commands/open.ts
|
|
56614
|
-
import { existsSync as
|
|
56861
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
56615
56862
|
import { spawn as spawn8 } from "node:child_process";
|
|
56616
56863
|
import { homedir as homedir9 } from "node:os";
|
|
56617
|
-
import
|
|
56864
|
+
import path28 from "node:path";
|
|
56618
56865
|
function findDesktopApp() {
|
|
56619
56866
|
if (process.platform === "darwin") {
|
|
56620
56867
|
const candidates = [
|
|
56621
56868
|
"/Applications/Appostle.app",
|
|
56622
|
-
|
|
56869
|
+
path28.join(homedir9(), "Applications", "Appostle.app")
|
|
56623
56870
|
];
|
|
56624
56871
|
for (const candidate of candidates) {
|
|
56625
|
-
if (
|
|
56872
|
+
if (existsSync15(candidate)) {
|
|
56626
56873
|
return candidate;
|
|
56627
56874
|
}
|
|
56628
56875
|
}
|
|
@@ -56632,10 +56879,10 @@ function findDesktopApp() {
|
|
|
56632
56879
|
const candidates = [
|
|
56633
56880
|
"/usr/bin/Appostle",
|
|
56634
56881
|
"/opt/Appostle/Appostle",
|
|
56635
|
-
|
|
56882
|
+
path28.join(homedir9(), "Applications", "Appostle.AppImage")
|
|
56636
56883
|
];
|
|
56637
56884
|
for (const candidate of candidates) {
|
|
56638
|
-
if (
|
|
56885
|
+
if (existsSync15(candidate)) {
|
|
56639
56886
|
return candidate;
|
|
56640
56887
|
}
|
|
56641
56888
|
}
|
|
@@ -56646,8 +56893,8 @@ function findDesktopApp() {
|
|
|
56646
56893
|
if (!localAppData) {
|
|
56647
56894
|
return null;
|
|
56648
56895
|
}
|
|
56649
|
-
const candidate =
|
|
56650
|
-
return
|
|
56896
|
+
const candidate = path28.join(localAppData, "Programs", "Appostle", "Appostle.exe");
|
|
56897
|
+
return existsSync15(candidate) ? candidate : null;
|
|
56651
56898
|
}
|
|
56652
56899
|
return null;
|
|
56653
56900
|
}
|