@rubytech/create-maxy-code 0.1.4 → 0.1.6
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/package.json +1 -1
- package/payload/platform/services/claude-session-manager/dist/config.d.ts +0 -1
- package/payload/platform/services/claude-session-manager/dist/config.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/config.js +0 -2
- package/payload/platform/services/claude-session-manager/dist/config.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +2 -10
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/premium-plugins/real-agency/specs/00-architecture-and-customization.md +122 -0
- package/payload/premium-plugins/real-agency/specs/01-morning-round.md +76 -0
- package/payload/premium-plugins/real-agency/specs/02-valuation-prep.md +81 -0
- package/payload/premium-plugins/real-agency/specs/03-new-instruction.md +100 -0
- package/payload/premium-plugins/real-agency/specs/04-chase-progression.md +120 -0
- package/payload/premium-plugins/real-agency/specs/05-month-end-close.md +79 -0
- package/payload/server/{chunk-6YL26HQW.js → chunk-IDKWGLM5.js} +581 -67
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/server.js +84 -262
- package/payload/server/chunk-5FM432JB.js +0 -4148
- package/payload/server/chunk-6S5JTXAN.js +0 -1544
- package/payload/server/chunk-RNW625CL.js +0 -759
- package/payload/server/cloudflare-task-tracker-VC7QVU5H.js +0 -22
package/payload/server/server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ACCOUNTS_DIR,
|
|
2
3
|
BIN_DIR,
|
|
3
4
|
BRAND_NAME,
|
|
4
5
|
CDP_PORT,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
Hono,
|
|
9
10
|
LOG_DIR,
|
|
10
11
|
MAXY_DIR,
|
|
12
|
+
PLATFORM_ROOT,
|
|
11
13
|
RFB_PORT,
|
|
12
14
|
TELEGRAM_ADMIN_WEBHOOK_SECRET_FILE,
|
|
13
15
|
TELEGRAM_WEBHOOK_SECRET_FILE,
|
|
@@ -15,6 +17,8 @@ import {
|
|
|
15
17
|
VNC_DISPLAY,
|
|
16
18
|
WEBSOCKIFY_PORT,
|
|
17
19
|
agentLogStream,
|
|
20
|
+
appendStreamLogLine,
|
|
21
|
+
autoDeliverPremiumPlugins,
|
|
18
22
|
browserViewerLog,
|
|
19
23
|
canAccessAdmin,
|
|
20
24
|
checkRateLimit,
|
|
@@ -24,21 +28,23 @@ import {
|
|
|
24
28
|
compactSession,
|
|
25
29
|
completeGrantSetup,
|
|
26
30
|
createRemoteSession,
|
|
31
|
+
emitMissingOnResolve,
|
|
27
32
|
findMissingPlugins,
|
|
28
33
|
fingerprintSessionKey,
|
|
29
34
|
getAccountIdForSession,
|
|
30
35
|
getAgentNameForSession,
|
|
36
|
+
getBundleMtimeIso,
|
|
31
37
|
getConversationIdForSession,
|
|
32
38
|
getDefaultAccountId,
|
|
33
39
|
getGrantForSession,
|
|
34
40
|
getGroupSlugForSession,
|
|
35
41
|
getRoleForSession,
|
|
42
|
+
getSessionKeyByConversationId,
|
|
36
43
|
getSessionMessages,
|
|
37
44
|
getStreamLogHandle,
|
|
38
45
|
getUserIdForSession,
|
|
39
46
|
getUserNameForSession,
|
|
40
47
|
getVisitorIdForSession,
|
|
41
|
-
hasStubAccountDir,
|
|
42
48
|
hashPassword,
|
|
43
49
|
httpLog,
|
|
44
50
|
invokeAgent,
|
|
@@ -47,7 +53,7 @@ import {
|
|
|
47
53
|
isRemoteAuthConfigured,
|
|
48
54
|
launchAction,
|
|
49
55
|
listAdminSessionsInProgress,
|
|
50
|
-
|
|
56
|
+
reconcileEnabledPlugins,
|
|
51
57
|
recordFailedAttempt,
|
|
52
58
|
registerGrantSession,
|
|
53
59
|
registerResumedSession,
|
|
@@ -69,6 +75,7 @@ import {
|
|
|
69
75
|
setWantsPriorConversation,
|
|
70
76
|
sigtermFlushStreamLogs,
|
|
71
77
|
streamLogPathFor,
|
|
78
|
+
stripAttachmentMetaSuffix,
|
|
72
79
|
tryCookieBridgeForConversation,
|
|
73
80
|
unregisterSession,
|
|
74
81
|
validateAgentSlug,
|
|
@@ -77,8 +84,9 @@ import {
|
|
|
77
84
|
verifyPassword,
|
|
78
85
|
verifyRemotePassword,
|
|
79
86
|
vncLog,
|
|
80
|
-
waitForExit
|
|
81
|
-
|
|
87
|
+
waitForExit,
|
|
88
|
+
walkPremiumBundles
|
|
89
|
+
} from "./chunk-IDKWGLM5.js";
|
|
82
90
|
import {
|
|
83
91
|
CLOUDFLARE_TASK_DIAGNOSTICS,
|
|
84
92
|
appendCloudflareSteps,
|
|
@@ -642,8 +650,8 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
642
650
|
};
|
|
643
651
|
|
|
644
652
|
// server/index.ts
|
|
645
|
-
import { readFileSync as
|
|
646
|
-
import { resolve as
|
|
653
|
+
import { readFileSync as readFileSync22, existsSync as existsSync25, watchFile } from "fs";
|
|
654
|
+
import { resolve as resolve25, join as join13, basename as basename5 } from "path";
|
|
647
655
|
import { homedir as homedir5 } from "os";
|
|
648
656
|
|
|
649
657
|
// app/lib/agent-slug-pattern.ts
|
|
@@ -1625,7 +1633,7 @@ var credsSaveQueue = Promise.resolve();
|
|
|
1625
1633
|
async function drainCredsSaveQueue(timeoutMs = 5e3) {
|
|
1626
1634
|
console.error(`${TAG3} draining credential save queue\u2026`);
|
|
1627
1635
|
const timer2 = new Promise(
|
|
1628
|
-
(
|
|
1636
|
+
(resolve26) => setTimeout(() => resolve26("timeout"), timeoutMs)
|
|
1629
1637
|
);
|
|
1630
1638
|
const result = await Promise.race([
|
|
1631
1639
|
credsSaveQueue.then(() => "drained"),
|
|
@@ -1753,11 +1761,11 @@ async function createWaSocket(opts) {
|
|
|
1753
1761
|
return sock;
|
|
1754
1762
|
}
|
|
1755
1763
|
async function waitForConnection(sock) {
|
|
1756
|
-
return new Promise((
|
|
1764
|
+
return new Promise((resolve26, reject) => {
|
|
1757
1765
|
const handler = (update) => {
|
|
1758
1766
|
if (update.connection === "open") {
|
|
1759
1767
|
sock.ev.off("connection.update", handler);
|
|
1760
|
-
|
|
1768
|
+
resolve26();
|
|
1761
1769
|
}
|
|
1762
1770
|
if (update.connection === "close") {
|
|
1763
1771
|
sock.ev.off("connection.update", handler);
|
|
@@ -1871,14 +1879,14 @@ ${inspected}`;
|
|
|
1871
1879
|
return inspect2(err, INSPECT_OPTS2);
|
|
1872
1880
|
}
|
|
1873
1881
|
function withTimeout(label, promise, timeoutMs) {
|
|
1874
|
-
return new Promise((
|
|
1882
|
+
return new Promise((resolve26, reject) => {
|
|
1875
1883
|
const timer2 = setTimeout(() => {
|
|
1876
1884
|
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
1877
1885
|
}, timeoutMs);
|
|
1878
1886
|
promise.then(
|
|
1879
1887
|
(value) => {
|
|
1880
1888
|
clearTimeout(timer2);
|
|
1881
|
-
|
|
1889
|
+
resolve26(value);
|
|
1882
1890
|
},
|
|
1883
1891
|
(err) => {
|
|
1884
1892
|
clearTimeout(timer2);
|
|
@@ -2413,8 +2421,8 @@ async function persistWhatsAppMessage(input) {
|
|
|
2413
2421
|
const { givenName, familyName } = splitName(input.pushName);
|
|
2414
2422
|
const prev = sessionWriteLocks.get(input.cacheKey);
|
|
2415
2423
|
let release;
|
|
2416
|
-
const mine = new Promise((
|
|
2417
|
-
release =
|
|
2424
|
+
const mine = new Promise((resolve26) => {
|
|
2425
|
+
release = resolve26;
|
|
2418
2426
|
});
|
|
2419
2427
|
const chained = (prev ?? Promise.resolve()).then(() => mine);
|
|
2420
2428
|
sessionWriteLocks.set(input.cacheKey, chained);
|
|
@@ -2598,11 +2606,6 @@ async function ensureWhatsAppConversation(input) {
|
|
|
2598
2606
|
}
|
|
2599
2607
|
}
|
|
2600
2608
|
|
|
2601
|
-
// app/lib/claude-agent/account.ts
|
|
2602
|
-
var ACCOUNTS_DIR = "";
|
|
2603
|
-
var PLATFORM_ROOT = "";
|
|
2604
|
-
var resolveAccount2 = (..._args) => null;
|
|
2605
|
-
|
|
2606
2609
|
// ../lib/account-enumeration/src/index.ts
|
|
2607
2610
|
import { readdirSync, readFileSync as readFileSync4 } from "fs";
|
|
2608
2611
|
import { resolve as resolve3 } from "path";
|
|
@@ -3456,11 +3459,11 @@ async function connectWithReconnect(conn) {
|
|
|
3456
3459
|
console.error(
|
|
3457
3460
|
`${TAG13} reconnecting account=${conn.accountId} in ${delay}ms (attempt ${decision.nextAttempts}/${maxAttempts})`
|
|
3458
3461
|
);
|
|
3459
|
-
await new Promise((
|
|
3460
|
-
const timer2 = setTimeout(
|
|
3462
|
+
await new Promise((resolve26) => {
|
|
3463
|
+
const timer2 = setTimeout(resolve26, delay);
|
|
3461
3464
|
conn.abortController.signal.addEventListener("abort", () => {
|
|
3462
3465
|
clearTimeout(timer2);
|
|
3463
|
-
|
|
3466
|
+
resolve26();
|
|
3464
3467
|
}, { once: true });
|
|
3465
3468
|
});
|
|
3466
3469
|
}
|
|
@@ -3468,16 +3471,16 @@ async function connectWithReconnect(conn) {
|
|
|
3468
3471
|
}
|
|
3469
3472
|
}
|
|
3470
3473
|
function waitForDisconnectEvent(conn) {
|
|
3471
|
-
return new Promise((
|
|
3474
|
+
return new Promise((resolve26) => {
|
|
3472
3475
|
if (!conn.sock) {
|
|
3473
|
-
|
|
3476
|
+
resolve26();
|
|
3474
3477
|
return;
|
|
3475
3478
|
}
|
|
3476
3479
|
const sock = conn.sock;
|
|
3477
3480
|
const handler = (update) => {
|
|
3478
3481
|
if (update.connection === "close") {
|
|
3479
3482
|
sock.ev.off("connection.update", handler);
|
|
3480
|
-
|
|
3483
|
+
resolve26();
|
|
3481
3484
|
}
|
|
3482
3485
|
};
|
|
3483
3486
|
sock.ev.on("connection.update", handler);
|
|
@@ -3739,8 +3742,8 @@ async function handleInboundMessage(conn, msg) {
|
|
|
3739
3742
|
const conversationKey = isGroup ? remoteJid : senderPhone;
|
|
3740
3743
|
const debounceKey = `${conn.accountId}:${conversationKey}:${senderPhone}`;
|
|
3741
3744
|
let resolvePending;
|
|
3742
|
-
const sttPending = new Promise((
|
|
3743
|
-
resolvePending =
|
|
3745
|
+
const sttPending = new Promise((resolve26) => {
|
|
3746
|
+
resolvePending = resolve26;
|
|
3744
3747
|
});
|
|
3745
3748
|
if (conn.debouncer) conn.debouncer.registerPending(debounceKey, sttPending);
|
|
3746
3749
|
try {
|
|
@@ -4157,20 +4160,20 @@ async function probeApiKey() {
|
|
|
4157
4160
|
return result.status;
|
|
4158
4161
|
}
|
|
4159
4162
|
function checkPort(port2, timeoutMs = 500) {
|
|
4160
|
-
return new Promise((
|
|
4163
|
+
return new Promise((resolve26) => {
|
|
4161
4164
|
const socket = createConnection2(port2, "127.0.0.1");
|
|
4162
4165
|
socket.setTimeout(timeoutMs);
|
|
4163
4166
|
socket.once("connect", () => {
|
|
4164
4167
|
socket.destroy();
|
|
4165
|
-
|
|
4168
|
+
resolve26(true);
|
|
4166
4169
|
});
|
|
4167
4170
|
socket.once("error", () => {
|
|
4168
4171
|
socket.destroy();
|
|
4169
|
-
|
|
4172
|
+
resolve26(false);
|
|
4170
4173
|
});
|
|
4171
4174
|
socket.once("timeout", () => {
|
|
4172
4175
|
socket.destroy();
|
|
4173
|
-
|
|
4176
|
+
resolve26(false);
|
|
4174
4177
|
});
|
|
4175
4178
|
});
|
|
4176
4179
|
}
|
|
@@ -6697,8 +6700,8 @@ async function startLogin(opts) {
|
|
|
6697
6700
|
resetActiveLogin(accountId);
|
|
6698
6701
|
let resolveQr = null;
|
|
6699
6702
|
let rejectQr = null;
|
|
6700
|
-
const qrPromise = new Promise((
|
|
6701
|
-
resolveQr =
|
|
6703
|
+
const qrPromise = new Promise((resolve26, reject) => {
|
|
6704
|
+
resolveQr = resolve26;
|
|
6702
6705
|
rejectQr = reject;
|
|
6703
6706
|
});
|
|
6704
6707
|
const qrTimer = setTimeout(
|
|
@@ -7659,17 +7662,6 @@ app8.post("/set-pin", async (c) => {
|
|
|
7659
7662
|
if (existingUsers !== null && existingUsers.length > 0) {
|
|
7660
7663
|
return c.json({ error: "PIN is already configured." }, 409);
|
|
7661
7664
|
}
|
|
7662
|
-
const stubCheck = hasStubAccountDir();
|
|
7663
|
-
if (stubCheck.stub) {
|
|
7664
|
-
console.error(
|
|
7665
|
-
`[onboarding] set-pin REFUSED reason=stub-account-dirs dirs=${stubCheck.dirs.join(",")}`
|
|
7666
|
-
);
|
|
7667
|
-
return c.json({
|
|
7668
|
-
error: `Onboarding refused: data/accounts/ contains ${stubCheck.dirs.length} directory/ies without account.json (${stubCheck.dirs.join(", ")}). Resolve the stub before setting up.`,
|
|
7669
|
-
code: "STUB_ACCOUNT_DIR",
|
|
7670
|
-
dirs: stubCheck.dirs
|
|
7671
|
-
}, 409);
|
|
7672
|
-
}
|
|
7673
7665
|
let body;
|
|
7674
7666
|
try {
|
|
7675
7667
|
body = await c.req.json();
|
|
@@ -7996,6 +7988,7 @@ var client_error_default = app9;
|
|
|
7996
7988
|
import { readFileSync as readFileSync14, readdirSync as readdirSync4, statSync as statSync4, writeFileSync as writeFileSync10, existsSync as existsSync12 } from "fs";
|
|
7997
7989
|
import { join as join9 } from "path";
|
|
7998
7990
|
import { createHash as createHash2 } from "crypto";
|
|
7991
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
7999
7992
|
var deprecationLogged = /* @__PURE__ */ new Set();
|
|
8000
7993
|
function hashPin2(pin) {
|
|
8001
7994
|
return createHash2("sha256").update(pin).digest("hex");
|
|
@@ -8071,7 +8064,7 @@ async function resolveUserIdentity(accountId, userId) {
|
|
|
8071
8064
|
async function createAdminSession(accountId, thinkingView, userId, userName, role, avatar) {
|
|
8072
8065
|
const account = resolveAccount();
|
|
8073
8066
|
const effectiveThinkingView = thinkingView ?? account?.config.thinkingView ?? "default";
|
|
8074
|
-
const signedSessionToken =
|
|
8067
|
+
const signedSessionToken = randomUUID7();
|
|
8075
8068
|
const cacheKey = fingerprintSessionKey(signedSessionToken);
|
|
8076
8069
|
registerSession(cacheKey, "admin", accountId, void 0, userId, userName, role);
|
|
8077
8070
|
if (userId) setWantsPriorConversation(cacheKey);
|
|
@@ -8373,9 +8366,6 @@ app13.post("/", requireAdminSession, async (c) => {
|
|
|
8373
8366
|
});
|
|
8374
8367
|
var new_session_submit_default = app13;
|
|
8375
8368
|
|
|
8376
|
-
// app/lib/claude-agent/stream-log-writer.ts
|
|
8377
|
-
var appendStreamLogLine = (..._args) => null;
|
|
8378
|
-
|
|
8379
8369
|
// server/routes/admin/failure-report.ts
|
|
8380
8370
|
var SESSION_KEY_RE = /^sk_[0-9a-f]{16}$/i;
|
|
8381
8371
|
var UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -8544,12 +8534,6 @@ function resolveSessionLogPaths(filename, logDirs) {
|
|
|
8544
8534
|
return { hits, tried };
|
|
8545
8535
|
}
|
|
8546
8536
|
|
|
8547
|
-
// app/lib/claude-agent/session-store.ts
|
|
8548
|
-
var getSessionKeyByConversationId = (..._args) => null;
|
|
8549
|
-
|
|
8550
|
-
// app/lib/claude-agent/logging.ts
|
|
8551
|
-
var emitMissingOnResolve = (..._args) => null;
|
|
8552
|
-
|
|
8553
8537
|
// server/routes/admin/logs.ts
|
|
8554
8538
|
var TAIL_BYTES = 8192;
|
|
8555
8539
|
var app17 = new Hono();
|
|
@@ -8859,9 +8843,6 @@ import crypto2 from "crypto";
|
|
|
8859
8843
|
import { resolve as resolvePath } from "path";
|
|
8860
8844
|
import { existsSync as existsSync17 } from "fs";
|
|
8861
8845
|
|
|
8862
|
-
// app/lib/claude-agent/summary-helpers.ts
|
|
8863
|
-
var stripAttachmentMetaSuffix = (..._args) => null;
|
|
8864
|
-
|
|
8865
8846
|
// app/lib/synthetic-marker.ts
|
|
8866
8847
|
var CLOUDFLARE_MARKER_PREFIX = "Cloudflare setup completed (actionId: ";
|
|
8867
8848
|
var COMPONENT_DONE_PREFIX = '{"_componentDone"';
|
|
@@ -9457,19 +9438,9 @@ function managerBase() {
|
|
|
9457
9438
|
const port2 = Number(process.env.CLAUDE_SESSION_MANAGER_PORT ?? "19400");
|
|
9458
9439
|
return `http://127.0.0.1:${port2}`;
|
|
9459
9440
|
}
|
|
9460
|
-
function flagOn() {
|
|
9461
|
-
return process.env.CLAUDE_SESSION_MANAGER_ENABLED === "true";
|
|
9462
|
-
}
|
|
9463
|
-
function flagOffResponse() {
|
|
9464
|
-
return new Response(
|
|
9465
|
-
JSON.stringify({ error: "CLAUDE_SESSION_MANAGER_ENABLED=false" }),
|
|
9466
|
-
{ status: 503, headers: { "content-type": "application/json" } }
|
|
9467
|
-
);
|
|
9468
|
-
}
|
|
9469
9441
|
var app22 = new Hono();
|
|
9470
9442
|
app22.use("*", requireAdminSession);
|
|
9471
9443
|
app22.post("/", async (c) => {
|
|
9472
|
-
if (!flagOn()) return flagOffResponse();
|
|
9473
9444
|
const cacheKey = c.get("cacheKey") ?? "";
|
|
9474
9445
|
const senderId = getAccountIdForSession(cacheKey) ?? "";
|
|
9475
9446
|
if (!senderId) {
|
|
@@ -9494,7 +9465,6 @@ app22.post("/", async (c) => {
|
|
|
9494
9465
|
return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
|
|
9495
9466
|
});
|
|
9496
9467
|
app22.get("/", async (c) => {
|
|
9497
|
-
if (!flagOn()) return flagOffResponse();
|
|
9498
9468
|
const cacheKey = c.get("cacheKey") ?? "";
|
|
9499
9469
|
const senderId = getAccountIdForSession(cacheKey) ?? "";
|
|
9500
9470
|
if (!senderId) return c.json({ error: "admin-account-not-resolved" }, 500);
|
|
@@ -9508,7 +9478,6 @@ app22.get("/", async (c) => {
|
|
|
9508
9478
|
return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
|
|
9509
9479
|
});
|
|
9510
9480
|
app22.delete("/:sessionId", async (c) => {
|
|
9511
|
-
if (!flagOn()) return flagOffResponse();
|
|
9512
9481
|
const sessionId = c.req.param("sessionId");
|
|
9513
9482
|
const upstream = await fetch(
|
|
9514
9483
|
`${managerBase()}/${encodeURIComponent(sessionId)}`,
|
|
@@ -9521,7 +9490,6 @@ app22.delete("/:sessionId", async (c) => {
|
|
|
9521
9490
|
return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
|
|
9522
9491
|
});
|
|
9523
9492
|
app22.post("/:sessionId/input", async (c) => {
|
|
9524
|
-
if (!flagOn()) return flagOffResponse();
|
|
9525
9493
|
const sessionId = c.req.param("sessionId");
|
|
9526
9494
|
const body = await c.req.text();
|
|
9527
9495
|
const upstream = await fetch(
|
|
@@ -9539,7 +9507,6 @@ app22.post("/:sessionId/input", async (c) => {
|
|
|
9539
9507
|
return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
|
|
9540
9508
|
});
|
|
9541
9509
|
app22.get("/:sessionId/log", async (c) => {
|
|
9542
|
-
if (!flagOn()) return flagOffResponse();
|
|
9543
9510
|
const sessionId = c.req.param("sessionId");
|
|
9544
9511
|
const follow = c.req.query("follow") === "1" ? "?follow=1" : "";
|
|
9545
9512
|
const upstream = await fetch(
|
|
@@ -10081,9 +10048,6 @@ var CLOUDFLARE_SETUP_FORM_SCHEMA = {
|
|
|
10081
10048
|
secretFields: ["password", "session_key", "messageId"]
|
|
10082
10049
|
};
|
|
10083
10050
|
|
|
10084
|
-
// app/lib/claude-agent/spawn-env.ts
|
|
10085
|
-
var getBundleMtimeIso = (..._args) => null;
|
|
10086
|
-
|
|
10087
10051
|
// server/routes/admin/cloudflare.ts
|
|
10088
10052
|
var SETUP_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
10089
10053
|
var DOMAINS_TIMEOUT_MS = 40 * 1e3;
|
|
@@ -10336,8 +10300,8 @@ app27.get("/tunnels", requireAdminSession, async (c) => {
|
|
|
10336
10300
|
if (!correlationId) return err("session", "No active conversation for session \u2014 refresh chat.");
|
|
10337
10301
|
streamLogPath = streamLogPathFor(accountId, correlationId).streamLogPath;
|
|
10338
10302
|
const certPath = resolve16(homedir4(), brand.configDir, "cloudflared", "cert.pem");
|
|
10339
|
-
const { existsSync:
|
|
10340
|
-
if (!
|
|
10303
|
+
const { existsSync: existsSync26 } = await import("fs");
|
|
10304
|
+
if (!existsSync26(certPath)) {
|
|
10341
10305
|
return err("cert", `Cloudflare origin certificate is not on disk yet (${certPath}). Complete the Cloudflare login first by submitting the form once \u2014 the OAuth flow writes cert.pem.`);
|
|
10342
10306
|
}
|
|
10343
10307
|
const result = await runFormSpawn({
|
|
@@ -10477,7 +10441,7 @@ app27.post("/setup", requireAdminSession, async (c) => {
|
|
|
10477
10441
|
} catch (e) {
|
|
10478
10442
|
log(`retry-decision lookup-failed reason="${e instanceof Error ? e.message : String(e)}" branch=proceed`);
|
|
10479
10443
|
}
|
|
10480
|
-
const account =
|
|
10444
|
+
const account = resolveAccount();
|
|
10481
10445
|
if (!account) {
|
|
10482
10446
|
return err("script", "No account on disk for this device \u2014 re-run installer.");
|
|
10483
10447
|
}
|
|
@@ -13660,152 +13624,10 @@ function startGraphHealthTimer() {
|
|
|
13660
13624
|
if (typeof timer.unref === "function") timer.unref();
|
|
13661
13625
|
}
|
|
13662
13626
|
|
|
13663
|
-
// app/lib/claude-agent/plugin-manifest.ts
|
|
13664
|
-
import { resolve as resolve24, join as join13 } from "path";
|
|
13665
|
-
import {
|
|
13666
|
-
readFileSync as readFileSync21,
|
|
13667
|
-
writeFileSync as writeFileSync12,
|
|
13668
|
-
readdirSync as readdirSync7,
|
|
13669
|
-
existsSync as existsSync24,
|
|
13670
|
-
statSync as statSync8,
|
|
13671
|
-
cpSync
|
|
13672
|
-
} from "fs";
|
|
13673
|
-
function readBundleSubPlugins(bundlePath) {
|
|
13674
|
-
if (!existsSync24(bundlePath)) return [];
|
|
13675
|
-
let raw;
|
|
13676
|
-
try {
|
|
13677
|
-
raw = readFileSync21(bundlePath, "utf-8");
|
|
13678
|
-
} catch {
|
|
13679
|
-
return [];
|
|
13680
|
-
}
|
|
13681
|
-
const fm = raw.match(/^---\n([\s\S]*?)\n---/);
|
|
13682
|
-
if (!fm) return [];
|
|
13683
|
-
const subs = [];
|
|
13684
|
-
let inPlugins = false;
|
|
13685
|
-
for (const line of fm[1].split("\n")) {
|
|
13686
|
-
if (/^plugins:/.test(line)) {
|
|
13687
|
-
inPlugins = true;
|
|
13688
|
-
continue;
|
|
13689
|
-
}
|
|
13690
|
-
if (inPlugins) {
|
|
13691
|
-
const m = line.match(/^\s+- (.+)/);
|
|
13692
|
-
if (m) subs.push(m[1].trim());
|
|
13693
|
-
else break;
|
|
13694
|
-
}
|
|
13695
|
-
}
|
|
13696
|
-
return subs;
|
|
13697
|
-
}
|
|
13698
|
-
function walkPremiumBundles() {
|
|
13699
|
-
if (BRAND_NAME === "maxy") return [];
|
|
13700
|
-
const stagingRoot = resolve24(PLATFORM_ROOT, "../premium-plugins");
|
|
13701
|
-
if (!existsSync24(stagingRoot)) return [];
|
|
13702
|
-
let entries;
|
|
13703
|
-
try {
|
|
13704
|
-
entries = readdirSync7(stagingRoot);
|
|
13705
|
-
} catch {
|
|
13706
|
-
return [];
|
|
13707
|
-
}
|
|
13708
|
-
const result = [];
|
|
13709
|
-
for (const bundle of entries) {
|
|
13710
|
-
const bundleDir = resolve24(stagingRoot, bundle);
|
|
13711
|
-
try {
|
|
13712
|
-
if (!statSync8(bundleDir).isDirectory()) continue;
|
|
13713
|
-
} catch {
|
|
13714
|
-
continue;
|
|
13715
|
-
}
|
|
13716
|
-
const declared = readBundleSubPlugins(join13(bundleDir, "BUNDLE.md"));
|
|
13717
|
-
result.push({ bundle, subs: declared.length > 0 ? declared : [bundle] });
|
|
13718
|
-
}
|
|
13719
|
-
return result;
|
|
13720
|
-
}
|
|
13721
|
-
function autoDeliverPremiumPlugins() {
|
|
13722
|
-
const TAG20 = "[premium-auto-deliver]";
|
|
13723
|
-
const bundles = walkPremiumBundles();
|
|
13724
|
-
if (bundles.length === 0) return;
|
|
13725
|
-
const stagingRoot = resolve24(PLATFORM_ROOT, "../premium-plugins");
|
|
13726
|
-
const pluginsDir = resolve24(PLATFORM_ROOT, "plugins");
|
|
13727
|
-
for (const { bundle, subs } of bundles) {
|
|
13728
|
-
const stagingDir = resolve24(stagingRoot, bundle);
|
|
13729
|
-
const bundlePath = join13(stagingDir, "BUNDLE.md");
|
|
13730
|
-
const isBundle = existsSync24(bundlePath);
|
|
13731
|
-
if (isBundle) {
|
|
13732
|
-
let delivered = 0;
|
|
13733
|
-
let skipped = 0;
|
|
13734
|
-
for (const sub of subs) {
|
|
13735
|
-
const target = resolve24(pluginsDir, sub);
|
|
13736
|
-
if (existsSync24(resolve24(target, "PLUGIN.md"))) {
|
|
13737
|
-
skipped++;
|
|
13738
|
-
continue;
|
|
13739
|
-
}
|
|
13740
|
-
const source = resolve24(stagingDir, "plugins", sub);
|
|
13741
|
-
if (!existsSync24(source)) {
|
|
13742
|
-
console.log(`${TAG20} ${bundle}/${sub}: source missing in staging, skipping`);
|
|
13743
|
-
continue;
|
|
13744
|
-
}
|
|
13745
|
-
try {
|
|
13746
|
-
cpSync(source, target, { recursive: true });
|
|
13747
|
-
delivered++;
|
|
13748
|
-
} catch (err) {
|
|
13749
|
-
console.log(`${TAG20} ${bundle}/${sub}: copy failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
13750
|
-
}
|
|
13751
|
-
}
|
|
13752
|
-
console.log(`${TAG20} ${bundle} (bundle): ${delivered} delivered, ${skipped} already present`);
|
|
13753
|
-
} else {
|
|
13754
|
-
const target = resolve24(pluginsDir, bundle);
|
|
13755
|
-
if (existsSync24(resolve24(target, "PLUGIN.md"))) {
|
|
13756
|
-
console.log(`${TAG20} ${bundle}: already present, skipping`);
|
|
13757
|
-
} else {
|
|
13758
|
-
try {
|
|
13759
|
-
cpSync(stagingDir, target, { recursive: true });
|
|
13760
|
-
console.log(`${TAG20} ${bundle} (standalone): delivered`);
|
|
13761
|
-
} catch (err) {
|
|
13762
|
-
console.log(`${TAG20} ${bundle}: copy failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
13763
|
-
}
|
|
13764
|
-
}
|
|
13765
|
-
}
|
|
13766
|
-
}
|
|
13767
|
-
}
|
|
13768
|
-
function reconcileEnabledPlugins(accountDir, config) {
|
|
13769
|
-
const TAG20 = "[premium-auto-deliver]";
|
|
13770
|
-
if (!accountDir || !config) return;
|
|
13771
|
-
const bundles = walkPremiumBundles();
|
|
13772
|
-
const pluginsDir = resolve24(PLATFORM_ROOT, "plugins");
|
|
13773
|
-
const bundleNames = [];
|
|
13774
|
-
const allSubs = [];
|
|
13775
|
-
for (const { bundle, subs } of bundles) {
|
|
13776
|
-
bundleNames.push(bundle);
|
|
13777
|
-
for (const sub of subs) {
|
|
13778
|
-
if (!existsSync24(resolve24(pluginsDir, sub, "PLUGIN.md"))) continue;
|
|
13779
|
-
allSubs.push(sub);
|
|
13780
|
-
}
|
|
13781
|
-
}
|
|
13782
|
-
const current = Array.isArray(config.enabledPlugins) ? config.enabledPlugins : [];
|
|
13783
|
-
const currentSet = new Set(current);
|
|
13784
|
-
const added = [];
|
|
13785
|
-
for (const sub of allSubs) {
|
|
13786
|
-
if (currentSet.has(sub)) continue;
|
|
13787
|
-
currentSet.add(sub);
|
|
13788
|
-
added.push(sub);
|
|
13789
|
-
}
|
|
13790
|
-
console.log(`${TAG20} brand=${BRAND_NAME} bundles=[${bundleNames.join(",")}] subs=[${allSubs.join(",")}] stamped=${added.length}`);
|
|
13791
|
-
if (added.length === 0) return;
|
|
13792
|
-
const merged = [...currentSet];
|
|
13793
|
-
const configPath2 = resolve24(accountDir, "account.json");
|
|
13794
|
-
try {
|
|
13795
|
-
const raw = readFileSync21(configPath2, "utf-8");
|
|
13796
|
-
const parsed = JSON.parse(raw);
|
|
13797
|
-
parsed.enabledPlugins = merged;
|
|
13798
|
-
writeFileSync12(configPath2, JSON.stringify(parsed, null, 2) + "\n");
|
|
13799
|
-
config.enabledPlugins = merged;
|
|
13800
|
-
} catch (err) {
|
|
13801
|
-
console.error(`${TAG20} enabled-stamp write failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
13802
|
-
}
|
|
13803
|
-
}
|
|
13804
|
-
|
|
13805
13627
|
// ../lib/entitlement/src/index.ts
|
|
13806
13628
|
import { createPublicKey, createHash as createHash3, verify as cryptoVerify } from "crypto";
|
|
13807
|
-
import { existsSync as
|
|
13808
|
-
import { resolve as
|
|
13629
|
+
import { existsSync as existsSync24, readFileSync as readFileSync21, statSync as statSync8 } from "fs";
|
|
13630
|
+
import { resolve as resolve24 } from "path";
|
|
13809
13631
|
|
|
13810
13632
|
// ../lib/entitlement/src/canonicalize.ts
|
|
13811
13633
|
function canonicalize(value) {
|
|
@@ -13840,7 +13662,7 @@ var PUBKEY_SHA256 = "8eee6bcb33545fd13b16d3199a5735ca5db5062834c7b49dfe4f23801d9
|
|
|
13840
13662
|
var GRACE_DAYS = 7;
|
|
13841
13663
|
var GRACE_MS = GRACE_DAYS * 24 * 60 * 60 * 1e3;
|
|
13842
13664
|
function pubkeyPath(brand) {
|
|
13843
|
-
return
|
|
13665
|
+
return resolve24(brand.platformRoot, "lib", "entitlement", "rubytech-pubkey.pem");
|
|
13844
13666
|
}
|
|
13845
13667
|
var memo = null;
|
|
13846
13668
|
function memoKey(mtimeMs, account) {
|
|
@@ -13852,11 +13674,11 @@ function resolveEntitlement(brand, account) {
|
|
|
13852
13674
|
if (brand.commercialMode !== true) {
|
|
13853
13675
|
return logResolved(implicitTrust(account), null);
|
|
13854
13676
|
}
|
|
13855
|
-
const entitlementPath =
|
|
13856
|
-
if (!
|
|
13677
|
+
const entitlementPath = resolve24(brand.configDir, "entitlement.json");
|
|
13678
|
+
if (!existsSync24(entitlementPath)) {
|
|
13857
13679
|
return logResolved(anonymousFallback("missing"), { reason: "missing" });
|
|
13858
13680
|
}
|
|
13859
|
-
const stat7 =
|
|
13681
|
+
const stat7 = statSync8(entitlementPath);
|
|
13860
13682
|
const key = memoKey(stat7.mtimeMs, account);
|
|
13861
13683
|
if (memo && memo.key === key) {
|
|
13862
13684
|
return memo.result;
|
|
@@ -13868,7 +13690,7 @@ function resolveEntitlement(brand, account) {
|
|
|
13868
13690
|
function verifyAndResolve(brand, entitlementPath, account) {
|
|
13869
13691
|
let pubkeyPem;
|
|
13870
13692
|
try {
|
|
13871
|
-
pubkeyPem =
|
|
13693
|
+
pubkeyPem = readFileSync21(pubkeyPath(brand), "utf-8");
|
|
13872
13694
|
} catch (err) {
|
|
13873
13695
|
return logResolved(anonymousFallback("pubkey-missing"), {
|
|
13874
13696
|
reason: "pubkey-missing"
|
|
@@ -13882,7 +13704,7 @@ function verifyAndResolve(brand, entitlementPath, account) {
|
|
|
13882
13704
|
}
|
|
13883
13705
|
let envelope;
|
|
13884
13706
|
try {
|
|
13885
|
-
envelope = JSON.parse(
|
|
13707
|
+
envelope = JSON.parse(readFileSync21(entitlementPath, "utf-8"));
|
|
13886
13708
|
} catch {
|
|
13887
13709
|
return logResolved(anonymousFallback("malformed"), { reason: "malformed" });
|
|
13888
13710
|
}
|
|
@@ -14043,14 +13865,14 @@ function clientFrom(c) {
|
|
|
14043
13865
|
);
|
|
14044
13866
|
}
|
|
14045
13867
|
var PLATFORM_ROOT9 = process.env.MAXY_PLATFORM_ROOT || "";
|
|
14046
|
-
var BRAND_JSON_PATH = PLATFORM_ROOT9 ?
|
|
13868
|
+
var BRAND_JSON_PATH = PLATFORM_ROOT9 ? join13(PLATFORM_ROOT9, "config", "brand.json") : "";
|
|
14047
13869
|
var BRAND = { productName: "Maxy", hostname: "maxy", configDir: ".maxy", domain: "getmaxy.com" };
|
|
14048
|
-
if (BRAND_JSON_PATH && !
|
|
13870
|
+
if (BRAND_JSON_PATH && !existsSync25(BRAND_JSON_PATH)) {
|
|
14049
13871
|
console.error(`[brand] WARNING: brand.json not found at ${BRAND_JSON_PATH} \u2014 using Maxy defaults`);
|
|
14050
13872
|
}
|
|
14051
|
-
if (BRAND_JSON_PATH &&
|
|
13873
|
+
if (BRAND_JSON_PATH && existsSync25(BRAND_JSON_PATH)) {
|
|
14052
13874
|
try {
|
|
14053
|
-
const parsed = JSON.parse(
|
|
13875
|
+
const parsed = JSON.parse(readFileSync22(BRAND_JSON_PATH, "utf-8"));
|
|
14054
13876
|
BRAND = { ...BRAND, ...parsed };
|
|
14055
13877
|
} catch (err) {
|
|
14056
13878
|
console.error(`[brand] Failed to parse brand.json: ${err.message}`);
|
|
@@ -14069,11 +13891,11 @@ var brandLoginOpts = {
|
|
|
14069
13891
|
bodyFont: BRAND.defaultFonts?.body,
|
|
14070
13892
|
logoContainsName: !!BRAND.logoContainsName
|
|
14071
13893
|
};
|
|
14072
|
-
var ALIAS_DOMAINS_PATH2 =
|
|
13894
|
+
var ALIAS_DOMAINS_PATH2 = join13(homedir5(), BRAND.configDir, "alias-domains.json");
|
|
14073
13895
|
function loadAliasDomains() {
|
|
14074
13896
|
try {
|
|
14075
|
-
if (!
|
|
14076
|
-
const parsed = JSON.parse(
|
|
13897
|
+
if (!existsSync25(ALIAS_DOMAINS_PATH2)) return null;
|
|
13898
|
+
const parsed = JSON.parse(readFileSync22(ALIAS_DOMAINS_PATH2, "utf-8"));
|
|
14077
13899
|
if (!Array.isArray(parsed)) {
|
|
14078
13900
|
console.error("[alias-domains] malformed alias-domains.json \u2014 expected array");
|
|
14079
13901
|
return null;
|
|
@@ -14447,20 +14269,20 @@ app42.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
14447
14269
|
console.error(`[agent-assets] no-account slug=${slug} file=${filename}`);
|
|
14448
14270
|
return c.text("Not found", 404);
|
|
14449
14271
|
}
|
|
14450
|
-
const filePath =
|
|
14451
|
-
const expectedDir =
|
|
14272
|
+
const filePath = resolve25(account.accountDir, "agents", slug, "assets", filename);
|
|
14273
|
+
const expectedDir = resolve25(account.accountDir, "agents", slug, "assets");
|
|
14452
14274
|
if (!filePath.startsWith(expectedDir + "/")) {
|
|
14453
14275
|
console.error(`[agent-assets] path-traversal-rejected slug=${slug} file=${filename}`);
|
|
14454
14276
|
return c.text("Forbidden", 403);
|
|
14455
14277
|
}
|
|
14456
|
-
if (!
|
|
14278
|
+
if (!existsSync25(filePath)) {
|
|
14457
14279
|
console.error(`[agent-assets] serve slug=${slug} file=${filename} status=404`);
|
|
14458
14280
|
return c.text("Not found", 404);
|
|
14459
14281
|
}
|
|
14460
14282
|
const ext = "." + filename.split(".").pop()?.toLowerCase();
|
|
14461
14283
|
const contentType = IMAGE_MIME[ext] || "application/octet-stream";
|
|
14462
14284
|
console.log(`[agent-assets] serve slug=${slug} file=${filename} status=200`);
|
|
14463
|
-
const body =
|
|
14285
|
+
const body = readFileSync22(filePath);
|
|
14464
14286
|
return c.body(body, 200, {
|
|
14465
14287
|
"Content-Type": contentType,
|
|
14466
14288
|
"Cache-Control": "public, max-age=3600"
|
|
@@ -14477,20 +14299,20 @@ app42.get("/generated/:filename", (c) => {
|
|
|
14477
14299
|
console.error(`[generated] serve file=${filename} status=404`);
|
|
14478
14300
|
return c.text("Not found", 404);
|
|
14479
14301
|
}
|
|
14480
|
-
const filePath =
|
|
14481
|
-
const expectedDir =
|
|
14302
|
+
const filePath = resolve25(account.accountDir, "generated", filename);
|
|
14303
|
+
const expectedDir = resolve25(account.accountDir, "generated");
|
|
14482
14304
|
if (!filePath.startsWith(expectedDir + "/")) {
|
|
14483
14305
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
14484
14306
|
return c.text("Forbidden", 403);
|
|
14485
14307
|
}
|
|
14486
|
-
if (!
|
|
14308
|
+
if (!existsSync25(filePath)) {
|
|
14487
14309
|
console.error(`[generated] serve file=${filename} status=404`);
|
|
14488
14310
|
return c.text("Not found", 404);
|
|
14489
14311
|
}
|
|
14490
14312
|
const ext = "." + filename.split(".").pop()?.toLowerCase();
|
|
14491
14313
|
const contentType = IMAGE_MIME[ext] || "application/octet-stream";
|
|
14492
14314
|
console.log(`[generated] serve file=${filename} status=200`);
|
|
14493
|
-
const body =
|
|
14315
|
+
const body = readFileSync22(filePath);
|
|
14494
14316
|
return c.body(body, 200, {
|
|
14495
14317
|
"Content-Type": contentType,
|
|
14496
14318
|
"Cache-Control": "public, max-age=86400"
|
|
@@ -14500,9 +14322,9 @@ app42.route("/sites", sites_default);
|
|
|
14500
14322
|
var htmlCache = /* @__PURE__ */ new Map();
|
|
14501
14323
|
var brandLogoPath = "/brand/maxy-monochrome.png";
|
|
14502
14324
|
var brandIconPath = "/brand/maxy-monochrome.png";
|
|
14503
|
-
if (BRAND_JSON_PATH &&
|
|
14325
|
+
if (BRAND_JSON_PATH && existsSync25(BRAND_JSON_PATH)) {
|
|
14504
14326
|
try {
|
|
14505
|
-
const fullBrand = JSON.parse(
|
|
14327
|
+
const fullBrand = JSON.parse(readFileSync22(BRAND_JSON_PATH, "utf-8"));
|
|
14506
14328
|
if (fullBrand.assets?.logo) brandLogoPath = `/brand/${fullBrand.assets.logo}`;
|
|
14507
14329
|
brandIconPath = fullBrand.assets?.icon ? `/brand/${fullBrand.assets.icon}` : brandLogoPath;
|
|
14508
14330
|
} catch {
|
|
@@ -14519,9 +14341,9 @@ var brandScript = `<script>window.__BRAND__=${JSON.stringify({
|
|
|
14519
14341
|
function readInstalledVersion() {
|
|
14520
14342
|
try {
|
|
14521
14343
|
if (!PLATFORM_ROOT9) return "unknown";
|
|
14522
|
-
const versionFile =
|
|
14523
|
-
if (!
|
|
14524
|
-
const content =
|
|
14344
|
+
const versionFile = join13(PLATFORM_ROOT9, "config", `.${BRAND.hostname}-version`);
|
|
14345
|
+
if (!existsSync25(versionFile)) return "unknown";
|
|
14346
|
+
const content = readFileSync22(versionFile, "utf-8").trim();
|
|
14525
14347
|
return content || "unknown";
|
|
14526
14348
|
} catch {
|
|
14527
14349
|
return "unknown";
|
|
@@ -14562,7 +14384,7 @@ var clientErrorReporterScript = `<script>
|
|
|
14562
14384
|
function cachedHtml(file) {
|
|
14563
14385
|
let html = htmlCache.get(file);
|
|
14564
14386
|
if (!html) {
|
|
14565
|
-
html =
|
|
14387
|
+
html = readFileSync22(resolve25(process.cwd(), "public", file), "utf-8");
|
|
14566
14388
|
const productNameEsc = escapeHtml(BRAND.productName);
|
|
14567
14389
|
html = html.replace(/<title>([^<]*)<\/title>/, (_match, inner) => `<title>${escapeHtml(inner).replace(/Maxy/g, productNameEsc)}</title>`);
|
|
14568
14390
|
html = html.replace('href="/favicon.ico"', `href="${escapeHtml(brandFaviconPath)}"`);
|
|
@@ -14578,26 +14400,26 @@ ${clientErrorReporterScript}
|
|
|
14578
14400
|
}
|
|
14579
14401
|
var brandedHtmlCache = /* @__PURE__ */ new Map();
|
|
14580
14402
|
function loadBrandingCache(agentSlug) {
|
|
14581
|
-
const configDir2 =
|
|
14403
|
+
const configDir2 = join13(homedir5(), BRAND.configDir);
|
|
14582
14404
|
try {
|
|
14583
|
-
const accountJsonPath =
|
|
14584
|
-
if (!
|
|
14585
|
-
const account = JSON.parse(
|
|
14405
|
+
const accountJsonPath = join13(configDir2, "account.json");
|
|
14406
|
+
if (!existsSync25(accountJsonPath)) return null;
|
|
14407
|
+
const account = JSON.parse(readFileSync22(accountJsonPath, "utf-8"));
|
|
14586
14408
|
const accountId = account.accountId;
|
|
14587
14409
|
if (!accountId) return null;
|
|
14588
|
-
const cachePath =
|
|
14589
|
-
if (!
|
|
14590
|
-
return JSON.parse(
|
|
14410
|
+
const cachePath = join13(configDir2, "branding-cache", accountId, `${agentSlug}.json`);
|
|
14411
|
+
if (!existsSync25(cachePath)) return null;
|
|
14412
|
+
return JSON.parse(readFileSync22(cachePath, "utf-8"));
|
|
14591
14413
|
} catch {
|
|
14592
14414
|
return null;
|
|
14593
14415
|
}
|
|
14594
14416
|
}
|
|
14595
14417
|
function resolveDefaultSlug() {
|
|
14596
14418
|
try {
|
|
14597
|
-
const configDir2 =
|
|
14598
|
-
const accountJsonPath =
|
|
14599
|
-
if (!
|
|
14600
|
-
const account = JSON.parse(
|
|
14419
|
+
const configDir2 = join13(homedir5(), BRAND.configDir);
|
|
14420
|
+
const accountJsonPath = join13(configDir2, "account.json");
|
|
14421
|
+
if (!existsSync25(accountJsonPath)) return null;
|
|
14422
|
+
const account = JSON.parse(readFileSync22(accountJsonPath, "utf-8"));
|
|
14601
14423
|
return account.defaultAgent || null;
|
|
14602
14424
|
} catch {
|
|
14603
14425
|
return null;
|
|
@@ -14670,7 +14492,7 @@ app42.use("/vnc-popout.html", logViewerFetch);
|
|
|
14670
14492
|
app42.get("/vnc-popout.html", (c) => {
|
|
14671
14493
|
let html = htmlCache.get("vnc-popout.html");
|
|
14672
14494
|
if (!html) {
|
|
14673
|
-
html =
|
|
14495
|
+
html = readFileSync22(resolve25(process.cwd(), "public", "vnc-popout.html"), "utf-8");
|
|
14674
14496
|
const name = escapeHtml(BRAND.productName);
|
|
14675
14497
|
html = html.replace("<title>Browser \u2014 Maxy</title>", `<title>${name}</title>`);
|
|
14676
14498
|
html = html.replace("</head>", ` ${brandScript}
|
|
@@ -14780,8 +14602,8 @@ try {
|
|
|
14780
14602
|
}
|
|
14781
14603
|
(async () => {
|
|
14782
14604
|
try {
|
|
14783
|
-
if (!
|
|
14784
|
-
const usersRaw =
|
|
14605
|
+
if (!existsSync25(USERS_FILE)) return;
|
|
14606
|
+
const usersRaw = readFileSync22(USERS_FILE, "utf-8").trim();
|
|
14785
14607
|
if (!usersRaw) return;
|
|
14786
14608
|
const users = JSON.parse(usersRaw);
|
|
14787
14609
|
const userId = users[0]?.userId;
|
|
@@ -14907,7 +14729,7 @@ if (bootAccountConfig?.whatsapp) {
|
|
|
14907
14729
|
}
|
|
14908
14730
|
init({
|
|
14909
14731
|
configDir: configDirForWhatsApp,
|
|
14910
|
-
platformRoot:
|
|
14732
|
+
platformRoot: resolve25(process.env.MAXY_PLATFORM_ROOT ?? join13(__dirname, "..")),
|
|
14911
14733
|
accountConfig: bootAccountConfig,
|
|
14912
14734
|
onMessage: async (msg) => {
|
|
14913
14735
|
try {
|