@rubytech/create-maxy-code 0.1.379 → 0.1.382

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.
Files changed (44) hide show
  1. package/dist/__tests__/plugin-install.test.js +18 -1
  2. package/dist/index.js +22 -8
  3. package/dist/lib/plugin-install.js +22 -0
  4. package/package.json +1 -1
  5. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +9 -1
  6. package/payload/platform/plugins/docs/references/admin-ui.md +2 -0
  7. package/payload/platform/plugins/docs/references/internals.md +4 -0
  8. package/payload/platform/plugins/docs/references/plugins-guide.md +2 -0
  9. package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +1 -1
  10. package/payload/platform/services/claude-session-manager/dist/index.js +32 -0
  11. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  12. package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.d.ts +51 -0
  13. package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.d.ts.map +1 -0
  14. package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.js +163 -0
  15. package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.js.map +1 -0
  16. package/payload/server/public/assets/{AdminLoginScreens-BHo8w_9J.js → AdminLoginScreens-C_Qn0UPy.js} +1 -1
  17. package/payload/server/public/assets/{AdminShell-DbTijFVA.js → AdminShell-iHdYhspw.js} +1 -1
  18. package/payload/server/public/assets/{Checkbox-LmjNFccS.js → Checkbox-B76SHnPC.js} +1 -1
  19. package/payload/server/public/assets/{admin-BBWILfl8.js → admin-RTEhnrPk.js} +1 -1
  20. package/payload/server/public/assets/{browser-DtLvD_ES.js → browser-Chmp3Xfv.js} +1 -1
  21. package/payload/server/public/assets/{calendar-D3i4IqOV.js → calendar-CjE7hiqV.js} +1 -1
  22. package/payload/server/public/assets/chat-DiKmCMO1.js +1 -0
  23. package/payload/server/public/assets/data-5PpEsUR3.js +1 -0
  24. package/payload/server/public/assets/{graph-ClQeGEH4.js → graph-DEHmvpNl.js} +1 -1
  25. package/payload/server/public/assets/{graph-labels-OaIKHgMg.js → graph-labels-CYAjU3rz.js} +1 -1
  26. package/payload/server/public/assets/{operator-Dxqfta5U.js → operator-BDTnuQhB.js} +1 -1
  27. package/payload/server/public/assets/{page-Dv_YEOUW.js → page-D8FFXoI9.js} +1 -1
  28. package/payload/server/public/assets/page-HeiBebPq.js +32 -0
  29. package/payload/server/public/assets/{public-C_mM8sSZ.js → public-BIOxrxZK.js} +1 -1
  30. package/payload/server/public/assets/{rotate-ccw-VF0b6NTt.js → rotate-ccw-K1xZvf3B.js} +1 -1
  31. package/payload/server/public/assets/{useSubAccountSwitcher-VzvzZC7h.css → useSubAccountSwitcher-B44qYovc.css} +1 -1
  32. package/payload/server/public/browser.html +4 -4
  33. package/payload/server/public/calendar.html +4 -4
  34. package/payload/server/public/chat.html +6 -6
  35. package/payload/server/public/data.html +5 -5
  36. package/payload/server/public/graph.html +7 -7
  37. package/payload/server/public/index.html +8 -8
  38. package/payload/server/public/operator.html +8 -8
  39. package/payload/server/public/public.html +6 -6
  40. package/payload/server/server.js +151 -61
  41. package/payload/server/public/assets/chat-DU-T6blN.js +0 -1
  42. package/payload/server/public/assets/data-B_vDxQrO.js +0 -1
  43. package/payload/server/public/assets/page-BkIb7CHh.js +0 -32
  44. /package/payload/server/public/assets/{useSubAccountSwitcher-CQbgG-FH.js → useSubAccountSwitcher-DPEkYkYd.js} +0 -0
@@ -1886,6 +1886,14 @@ function credsCensus(authDir) {
1886
1886
  return { credsPresent: true, registered: false, hasAccountSignature: false, e164: null };
1887
1887
  }
1888
1888
  }
1889
+ function getAuthAgeMs(authDir) {
1890
+ try {
1891
+ const stats = fsSync.statSync(resolveCredsPath(authDir));
1892
+ return Date.now() - stats.mtimeMs;
1893
+ } catch {
1894
+ return null;
1895
+ }
1896
+ }
1889
1897
  async function clearAuth(authDir) {
1890
1898
  try {
1891
1899
  await fs.access(authDir);
@@ -1897,6 +1905,17 @@ async function clearAuth(authDir) {
1897
1905
  console.error(`${TAG} cleared credentials at ${authDir}`);
1898
1906
  return true;
1899
1907
  }
1908
+ function discardAuthDirSync(authDir) {
1909
+ try {
1910
+ if (!fsSync.existsSync(authDir)) return false;
1911
+ fsSync.rmSync(authDir, { recursive: true, force: true });
1912
+ console.error(`${TAG} discarded credential dir ${authDir}`);
1913
+ return true;
1914
+ } catch (err) {
1915
+ console.warn(`${TAG} discardAuthDirSync failed authDir=${authDir}: ${String(err)}`);
1916
+ return false;
1917
+ }
1918
+ }
1900
1919
  function listCredentialAccountIds(configDir2) {
1901
1920
  const credsRoot = path.join(os.homedir(), configDir2, "credentials", "whatsapp");
1902
1921
  try {
@@ -3154,7 +3173,7 @@ async function sendMediaMessage(sock, to, media, opts) {
3154
3173
  }
3155
3174
 
3156
3175
  // app/lib/whatsapp/message-store.ts
3157
- import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync4, appendFileSync, readdirSync } from "fs";
3176
+ import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync4, appendFileSync, readdirSync, statSync as statSync2 } from "fs";
3158
3177
  import { dirname, join as join3 } from "path";
3159
3178
  var STORE_ROOT = () => join3(process.env.MAXY_DIR_OVERRIDE ?? MAXY_DIR, "data", "whatsapp-messages");
3160
3179
  function conversationFile(platformAccountId, remoteJid) {
@@ -3175,6 +3194,7 @@ function parseLines(raw) {
3175
3194
  }
3176
3195
  return out;
3177
3196
  }
3197
+ var byDateSentAsc = (a, b) => a.dateSent.localeCompare(b.dateSent);
3178
3198
  function appendMessage(platformAccountId, record) {
3179
3199
  const file = conversationFile(platformAccountId, record.remoteJid);
3180
3200
  try {
@@ -3209,13 +3229,79 @@ function readConversation(platformAccountId, remoteJid) {
3209
3229
  const file = conversationFile(platformAccountId, remoteJid);
3210
3230
  try {
3211
3231
  if (!existsSync3(file)) return [];
3212
- return parseLines(readFileSync4(file, "utf8")).sort((a, b) => a.dateSent.localeCompare(b.dateSent));
3232
+ return parseLines(readFileSync4(file, "utf8")).sort(byDateSentAsc);
3213
3233
  } catch (err) {
3214
3234
  const reason = err instanceof Error ? err.message : String(err);
3215
3235
  console.error(`[whatsapp-message-store] FAIL op=read reason=${reason.slice(0, 100)} remoteJid=${remoteJid}`);
3216
3236
  return [];
3217
3237
  }
3218
3238
  }
3239
+ var summaryCache = /* @__PURE__ */ new Map();
3240
+ function summariseRecords(records) {
3241
+ if (records.length === 0) return null;
3242
+ const sorted = records.slice().sort(byDateSentAsc);
3243
+ return {
3244
+ first: sorted[0],
3245
+ last: sorted[sorted.length - 1],
3246
+ firstNamedSender: sorted.find((r) => r.senderName)?.senderName ?? null
3247
+ };
3248
+ }
3249
+ function readConversationSummaries(platformAccountId) {
3250
+ const dir = join3(STORE_ROOT(), platformAccountId);
3251
+ const out = /* @__PURE__ */ new Map();
3252
+ const seen = /* @__PURE__ */ new Set();
3253
+ let fullReads = 0;
3254
+ let cacheHits = 0;
3255
+ let bytesRead = 0;
3256
+ try {
3257
+ if (!existsSync3(dir)) return out;
3258
+ for (const entry of readdirSync(dir)) {
3259
+ if (!entry.endsWith(".jsonl")) continue;
3260
+ const remoteJid = entry.slice(0, -".jsonl".length);
3261
+ const file = join3(dir, entry);
3262
+ seen.add(file);
3263
+ let size;
3264
+ let mtimeMs;
3265
+ try {
3266
+ const st = statSync2(file);
3267
+ size = st.size;
3268
+ mtimeMs = st.mtimeMs;
3269
+ } catch {
3270
+ continue;
3271
+ }
3272
+ const cached2 = summaryCache.get(file);
3273
+ if (cached2 && cached2.size === size && cached2.mtimeMs === mtimeMs) {
3274
+ cacheHits++;
3275
+ out.set(remoteJid, cached2.summary);
3276
+ continue;
3277
+ }
3278
+ let summary;
3279
+ try {
3280
+ const raw = readFileSync4(file, "utf8");
3281
+ bytesRead += Buffer.byteLength(raw);
3282
+ fullReads++;
3283
+ summary = summariseRecords(parseLines(raw));
3284
+ } catch (err) {
3285
+ const reason = err instanceof Error ? err.message : String(err);
3286
+ console.error(`[whatsapp-message-store] FAIL op=summarise reason=${reason.slice(0, 100)} remoteJid=${remoteJid}`);
3287
+ continue;
3288
+ }
3289
+ if (!summary) continue;
3290
+ summaryCache.set(file, { size, mtimeMs, summary });
3291
+ out.set(remoteJid, summary);
3292
+ }
3293
+ for (const key of summaryCache.keys()) {
3294
+ if (dirname(key) === dir && !seen.has(key)) summaryCache.delete(key);
3295
+ }
3296
+ } catch (err) {
3297
+ const reason = err instanceof Error ? err.message : String(err);
3298
+ console.error(`[whatsapp-message-store] FAIL op=summaries reason=${reason.slice(0, 100)} platformAccountId=${platformAccountId}`);
3299
+ }
3300
+ console.log(
3301
+ `[whatsapp-message-store] op=summaries accountId=${platformAccountId} conversations=${out.size} fullReads=${fullReads} cacheHits=${cacheHits} bytesRead=${bytesRead}`
3302
+ );
3303
+ return out;
3304
+ }
3219
3305
  function readAllConversations(platformAccountId) {
3220
3306
  const dir = join3(STORE_ROOT(), platformAccountId);
3221
3307
  const out = /* @__PURE__ */ new Map();
@@ -6349,6 +6435,13 @@ async function waitForLogin(opts) {
6349
6435
  console.error(`${TAG17} waitForLogin poll timeout account=${accountId} elapsed=${elapsed}s \u2014 login kept alive (pairing code still valid)`);
6350
6436
  return { connected: false, message: "Still waiting for you to enter the pairing code. The code is still valid \u2014 ask me to keep waiting, or request a new code.", configPersisted: false };
6351
6437
  }
6438
+ function listActiveLoginAccountIds() {
6439
+ const ids = [];
6440
+ for (const [accountId, login] of activeLogins) {
6441
+ if (isLoginFresh(login)) ids.push(accountId);
6442
+ }
6443
+ return ids;
6444
+ }
6352
6445
 
6353
6446
  // app/lib/whatsapp/outbound/send-document.ts
6354
6447
  import { realpathSync as realpathSync3 } from "fs";
@@ -6545,6 +6638,7 @@ function serializeWhatsAppSchema() {
6545
6638
  import { readdirSync as readdirSync3 } from "fs";
6546
6639
  import { join as join9 } from "path";
6547
6640
  var TAG19 = "[whatsapp:reconcile]";
6641
+ var HALF_REGISTERED_MIN_AGE_MS = 5 * 6e4;
6548
6642
  function listCredsAccountIds(credsRoot) {
6549
6643
  try {
6550
6644
  return readdirSync3(credsRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && hasCredsSync(join9(credsRoot, e.name))).map((e) => e.name);
@@ -6558,14 +6652,28 @@ function isAccountConfigured(accountDir, accountId) {
6558
6652
  return !!accounts && Object.prototype.hasOwnProperty.call(accounts, accountId);
6559
6653
  }
6560
6654
  function reconcileCredsOnDisk(opts) {
6561
- const { credsRoot, accountDir, liveAccountIds } = opts;
6655
+ const { credsRoot, accountDir, liveAccountIds, activeLoginAccountIds } = opts;
6562
6656
  const entries = [];
6563
6657
  for (const accountId of listCredsAccountIds(credsRoot)) {
6564
6658
  if (liveAccountIds.has(accountId)) continue;
6565
6659
  const authDir = join9(credsRoot, accountId);
6566
6660
  const census = credsCensus(authDir);
6567
6661
  if (census.registered && !census.hasAccountSignature) {
6568
- console.error(`${TAG19} op=half-registered account=${accountId} registered=true hasAccount=false`);
6662
+ const inFlight = activeLoginAccountIds.has(accountId);
6663
+ const ageMs = getAuthAgeMs(authDir);
6664
+ const abandoned = !inFlight && ageMs !== null && ageMs >= HALF_REGISTERED_MIN_AGE_MS;
6665
+ if (!abandoned) {
6666
+ console.error(`${TAG19} op=half-registered account=${accountId} registered=true hasAccount=false inFlight=${inFlight} ageMs=${ageMs ?? "null"}`);
6667
+ entries.push({ accountId, connected: false, linkedUnconfigured: true });
6668
+ continue;
6669
+ }
6670
+ console.error(`${TAG19} op=discard-half-registered account=${accountId} registered=true hasAccount=false ageMs=${ageMs}`);
6671
+ const removed = discardAuthDirSync(authDir);
6672
+ if (!removed) {
6673
+ console.error(`${TAG19} op=discard-half-registered-failed account=${accountId} \u2014 residue persists`);
6674
+ entries.push({ accountId, connected: false, linkedUnconfigured: true });
6675
+ }
6676
+ continue;
6569
6677
  }
6570
6678
  const selfPhone = readSelfId(authDir).e164 ?? void 0;
6571
6679
  const configured = accountDir ? isAccountConfigured(accountDir, accountId) : false;
@@ -6593,9 +6701,10 @@ app2.get("/status", (c) => {
6593
6701
  try {
6594
6702
  const live = getStatus();
6595
6703
  const liveIds = new Set(live.map((a) => a.accountId));
6704
+ const activeLoginIds = new Set(listActiveLoginAccountIds());
6596
6705
  const credsRoot = join10(MAXY_DIR, "credentials", "whatsapp");
6597
6706
  const accountDir = resolveAccount()?.accountDir ?? null;
6598
- const reconciled = reconcileCredsOnDisk({ credsRoot, accountDir, liveAccountIds: liveIds });
6707
+ const reconciled = reconcileCredsOnDisk({ credsRoot, accountDir, liveAccountIds: liveIds, activeLoginAccountIds: activeLoginIds });
6599
6708
  const accounts = [...live, ...reconciled];
6600
6709
  const summary = accounts.map((a) => `${a.accountId}:${a.connected ? "up" : a.linkedUnconfigured ? "linked-unconfigured" : "down"}`).join(", ");
6601
6710
  console.error(`${TAG20} status accounts=${accounts.length} [${summary}]`);
@@ -7015,11 +7124,11 @@ app2.get("/group-info", async (c) => {
7015
7124
  var whatsapp_default = app2;
7016
7125
 
7017
7126
  // server/routes/whatsapp-reader.ts
7018
- import { readFileSync as readFileSync15, watch, statSync as statSync4, openSync, readSync, closeSync, existsSync as existsSync8, readdirSync as readdirSync8, realpathSync as realpathSync4 } from "fs";
7127
+ import { readFileSync as readFileSync15, watch, statSync as statSync5, openSync, readSync, closeSync, existsSync as existsSync8, readdirSync as readdirSync8, realpathSync as realpathSync4 } from "fs";
7019
7128
  import { basename as basename4, dirname as dirname3, isAbsolute, join as join14, relative as relative2, resolve as resolve12, sep as sep3 } from "path";
7020
7129
 
7021
7130
  // server/routes/admin/sidebar-sessions.ts
7022
- import { readdirSync as readdirSync5, readFileSync as readFileSync12, statSync as statSync2 } from "fs";
7131
+ import { readdirSync as readdirSync5, readFileSync as readFileSync12, statSync as statSync3 } from "fs";
7023
7132
  import { basename as basename3, dirname as dirname2, join as join11, resolve as resolve11 } from "path";
7024
7133
 
7025
7134
  // app/lib/whatsapp-reader/select-sessions.ts
@@ -7043,25 +7152,22 @@ function selectReaderChannelSessions(rows) {
7043
7152
  source: "session"
7044
7153
  }));
7045
7154
  }
7046
- function buildStoreConversationRows(accountId, convos) {
7155
+ function buildStoreConversationRows(accountId, summaries) {
7047
7156
  const rows = [];
7048
- for (const [remoteJid, messages] of convos) {
7049
- if (messages.length === 0) continue;
7050
- const last = messages[messages.length - 1];
7157
+ for (const [remoteJid, { first, last, firstNamedSender }] of summaries) {
7051
7158
  const scope = last.scope;
7052
7159
  const isGroup = remoteJid.endsWith("@g.us");
7053
- const senderTelephone = isGroup ? null : messages[0].senderTelephone;
7054
- const senderName = messages.find((m) => m.senderName)?.senderName ?? null;
7160
+ const senderTelephone = isGroup ? null : first.senderTelephone;
7055
7161
  rows.push({
7056
7162
  sessionId: "",
7057
7163
  projectDir: "",
7058
7164
  title: remoteJid,
7059
7165
  senderId: senderTelephone,
7060
- startedAt: messages[0].dateSent,
7166
+ startedAt: first.dateSent,
7061
7167
  channel: "whatsapp",
7062
7168
  role: scope === "admin" ? "admin" : "public",
7063
7169
  operatorName: null,
7064
- whatsappName: senderName,
7170
+ whatsappName: firstNamedSender,
7065
7171
  lastMessageAt: last.dateSent,
7066
7172
  modelGated: false,
7067
7173
  model: null,
@@ -7312,26 +7418,10 @@ app3.get("/", requireAdminSession, async (c) => {
7312
7418
  const scopeAccountId = getAccountIdForSession(cacheKey) ?? null;
7313
7419
  const validAccounts = listValidAccounts();
7314
7420
  const multiAccount = validAccounts.length > 1;
7315
- const accounts = [];
7316
- for (const a of validAccounts) {
7317
- let businessName = null;
7318
- try {
7319
- const branding = await fetchBranding(a.accountId);
7320
- businessName = branding?.name || null;
7321
- } catch {
7322
- }
7323
- accounts.push({
7324
- accountId: a.accountId,
7325
- role: a.config.role ?? "",
7326
- businessName,
7327
- isHouse: a.config.role === "house"
7328
- });
7329
- }
7330
- console.log(`[admin-sessions-list] accounts=${accounts.length}`);
7331
7421
  const configDir2 = claudeConfigDir();
7332
7422
  if (!configDir2) {
7333
7423
  console.error("[admin-sessions-list] CLAUDE_CONFIG_DIR not set; returning empty list");
7334
- return c.json({ sessions: [], accountId: scopeAccountId, accounts });
7424
+ return c.json({ sessions: [], accountId: scopeAccountId });
7335
7425
  }
7336
7426
  const projectsRoot = join11(configDir2, "projects");
7337
7427
  const jsonls = enumerateJsonls(projectsRoot);
@@ -7362,7 +7452,7 @@ app3.get("/", requireAdminSession, async (c) => {
7362
7452
  let mtimeMs;
7363
7453
  try {
7364
7454
  body = readFileSync12(path2, "utf8");
7365
- mtimeMs = statSync2(path2).mtimeMs;
7455
+ mtimeMs = statSync3(path2).mtimeMs;
7366
7456
  } catch {
7367
7457
  continue;
7368
7458
  }
@@ -7440,13 +7530,13 @@ app3.get("/", requireAdminSession, async (c) => {
7440
7530
  if (multiAccount) {
7441
7531
  console.log(`[admin-sessions-list] untagged-accountId-rows=${untaggedCount}`);
7442
7532
  }
7443
- return c.json({ sessions: rows, accountId: scopeAccountId, accounts });
7533
+ return c.json({ sessions: rows, accountId: scopeAccountId });
7444
7534
  });
7445
7535
  var sidebar_sessions_default = app3;
7446
7536
 
7447
7537
  // app/lib/admin-identity/pin-validator.ts
7448
7538
  import { createHash } from "crypto";
7449
- import { existsSync as existsSync7, readFileSync as readFileSync13, readdirSync as readdirSync6, statSync as statSync3 } from "fs";
7539
+ import { existsSync as existsSync7, readFileSync as readFileSync13, readdirSync as readdirSync6, statSync as statSync4 } from "fs";
7450
7540
  import { join as join12 } from "path";
7451
7541
  function hashPin(pin) {
7452
7542
  return createHash("sha256").update(pin).digest("hex");
@@ -7898,7 +7988,7 @@ app4.get("/conversations", requireAdminSession, async (c) => {
7898
7988
  ...r,
7899
7989
  operatorName: r.senderId ? nameBySender.get(r.senderId) ?? null : null
7900
7990
  }));
7901
- const storeRows = account ? buildStoreConversationRows(account.accountId, readAllConversations(account.accountId)) : [];
7991
+ const storeRows = account ? buildStoreConversationRows(account.accountId, readConversationSummaries(account.accountId)) : [];
7902
7992
  const adminScope = storeRows.filter((r) => r.scope === "admin").length;
7903
7993
  const publicScope = storeRows.length - adminScope;
7904
7994
  console.log(
@@ -7907,7 +7997,7 @@ app4.get("/conversations", requireAdminSession, async (c) => {
7907
7997
  return c.json({ conversations: [...sessionConversations, ...storeRows] });
7908
7998
  });
7909
7999
  function readFrom(path2, from) {
7910
- const end = statSync4(path2).size;
8000
+ const end = statSync5(path2).size;
7911
8001
  if (end <= from) return { buf: Buffer.alloc(0), end: from };
7912
8002
  const fd = openSync(path2, "r");
7913
8003
  try {
@@ -8024,7 +8114,7 @@ function runActivityTick(c) {
8024
8114
  let size = 0;
8025
8115
  let mtimeMs = 0;
8026
8116
  try {
8027
- const st = statSync4(join14(c.subagentsDir, name));
8117
+ const st = statSync5(join14(c.subagentsDir, name));
8028
8118
  size = st.size;
8029
8119
  mtimeMs = st.mtimeMs;
8030
8120
  } catch {
@@ -8090,7 +8180,7 @@ data: ${JSON.stringify(turn)}
8090
8180
  start(controller) {
8091
8181
  const fileEnd0 = (() => {
8092
8182
  try {
8093
- return statSync4(jsonlPath).size;
8183
+ return statSync5(jsonlPath).size;
8094
8184
  } catch {
8095
8185
  return 0;
8096
8186
  }
@@ -8219,7 +8309,7 @@ app4.get("/directives", requireAdminSession, (c) => {
8219
8309
  const pid = Number(pidPart);
8220
8310
  let len = 0;
8221
8311
  try {
8222
- len = statSync4(join14(dir, name)).size;
8312
+ len = statSync5(join14(dir, name)).size;
8223
8313
  } catch {
8224
8314
  }
8225
8315
  return { name, secs, pid, ts: Number.isFinite(secs) ? new Date(secs * 1e3).toISOString() : null, len };
@@ -8284,7 +8374,7 @@ data: ${JSON.stringify(turn)}
8284
8374
  };
8285
8375
  const fileEnd0 = (() => {
8286
8376
  try {
8287
- return statSync4(file).size;
8377
+ return statSync5(file).size;
8288
8378
  } catch {
8289
8379
  return 0;
8290
8380
  }
@@ -8365,7 +8455,7 @@ data: ${JSON.stringify(turn)}
8365
8455
  var whatsapp_reader_default = app4;
8366
8456
 
8367
8457
  // server/routes/public-reader.ts
8368
- import { statSync as statSync5, openSync as openSync2, readSync as readSync2, closeSync as closeSync2, watch as watch2, readFileSync as readFileSync16, readdirSync as readdirSync9 } from "fs";
8458
+ import { statSync as statSync6, openSync as openSync2, readSync as readSync2, closeSync as closeSync2, watch as watch2, readFileSync as readFileSync16, readdirSync as readdirSync9 } from "fs";
8369
8459
  import { basename as basename5, dirname as dirname4, join as join15, resolve as resolve13, sep as sep4 } from "path";
8370
8460
 
8371
8461
  // app/lib/whatsapp-reader/delivered-kinds.ts
@@ -8499,7 +8589,7 @@ function enrichPublicAttachments(turns, sessionAttachments, cursor) {
8499
8589
  }
8500
8590
  }
8501
8591
  function readFrom2(path2, from) {
8502
- const end = statSync5(path2).size;
8592
+ const end = statSync6(path2).size;
8503
8593
  if (end <= from) return { buf: Buffer.alloc(0), end: from };
8504
8594
  const fd = openSync2(path2, "r");
8505
8595
  try {
@@ -8662,7 +8752,7 @@ var public_reader_default = app5;
8662
8752
  // server/routes/webchat.ts
8663
8753
  import { basename as basename6, dirname as dirname5 } from "path";
8664
8754
  import { join as join18 } from "path";
8665
- import { existsSync as existsSync10, readdirSync as readdirSync11, readFileSync as readFileSync19, renameSync as renameSync3, statSync as statSync6, writeFileSync as writeFileSync7 } from "fs";
8755
+ import { existsSync as existsSync10, readdirSync as readdirSync11, readFileSync as readFileSync19, renameSync as renameSync3, statSync as statSync7, writeFileSync as writeFileSync7 } from "fs";
8666
8756
 
8667
8757
  // server/canonical-webchat-override.ts
8668
8758
  import { readFileSync as readFileSync17, writeFileSync as writeFileSync5, renameSync } from "fs";
@@ -8932,7 +9022,7 @@ function sessionSidecarExists(sessionId) {
8932
9022
  function jsonlSizeBytes(projectDir, sessionId) {
8933
9023
  if (projectDir === null) return null;
8934
9024
  try {
8935
- return statSync6(join18(projectDir, `${sessionId}.jsonl`)).size;
9025
+ return statSync7(join18(projectDir, `${sessionId}.jsonl`)).size;
8936
9026
  } catch {
8937
9027
  return null;
8938
9028
  }
@@ -9076,7 +9166,7 @@ function latestAdminWebchatSessionId(requesterUserId, primaryUserId, scopeAccoun
9076
9166
  if (multiAccount && meta.accountId !== scopeAccountId) continue;
9077
9167
  let mtimeMs;
9078
9168
  try {
9079
- mtimeMs = statSync6(path2).mtimeMs;
9169
+ mtimeMs = statSync7(path2).mtimeMs;
9080
9170
  } catch {
9081
9171
  continue;
9082
9172
  }
@@ -9908,7 +9998,7 @@ import { openSync as openSync3, closeSync as closeSync3, writeFileSync as writeF
9908
9998
  import { createHash as createHash3, randomUUID as randomUUID7 } from "crypto";
9909
9999
 
9910
10000
  // ../lib/admins-write/src/index.ts
9911
- import { existsSync as existsSync14, readFileSync as readFileSync23, writeFileSync as writeFileSync9, renameSync as renameSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync13, statSync as statSync7, appendFileSync as appendFileSync2 } from "fs";
10001
+ import { existsSync as existsSync14, readFileSync as readFileSync23, writeFileSync as writeFileSync9, renameSync as renameSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync13, statSync as statSync8, appendFileSync as appendFileSync2 } from "fs";
9912
10002
  import { dirname as dirname6, join as join22 } from "path";
9913
10003
  function id8(value) {
9914
10004
  return value.slice(0, 8);
@@ -10031,7 +10121,7 @@ function computeAdminStoreDivergence(input) {
10031
10121
  if (entry.startsWith(".")) continue;
10032
10122
  const accountDir = join22(input.accountsDir, entry);
10033
10123
  try {
10034
- if (!statSync7(accountDir).isDirectory()) continue;
10124
+ if (!statSync8(accountDir).isDirectory()) continue;
10035
10125
  } catch {
10036
10126
  continue;
10037
10127
  }
@@ -10431,7 +10521,7 @@ ${body.newPin}
10431
10521
  var onboarding_default = app9;
10432
10522
 
10433
10523
  // server/routes/client-error.ts
10434
- import { appendFileSync as appendFileSync3, existsSync as existsSync16, renameSync as renameSync6, statSync as statSync8 } from "fs";
10524
+ import { appendFileSync as appendFileSync3, existsSync as existsSync16, renameSync as renameSync6, statSync as statSync9 } from "fs";
10435
10525
  import { join as join23 } from "path";
10436
10526
  var CLIENT_ERRORS_LOG = join23(LOG_DIR, "client-errors.log");
10437
10527
  var MAX_LOG_SIZE = 10 * 1024 * 1024;
@@ -10482,7 +10572,7 @@ function stackHead(stack) {
10482
10572
  function rotateIfNeeded() {
10483
10573
  try {
10484
10574
  if (!existsSync16(CLIENT_ERRORS_LOG)) return;
10485
- const stats = statSync8(CLIENT_ERRORS_LOG);
10575
+ const stats = statSync9(CLIENT_ERRORS_LOG);
10486
10576
  if (stats.size < MAX_LOG_SIZE) return;
10487
10577
  renameSync6(CLIENT_ERRORS_LOG, CLIENT_ERRORS_LOG + ".1");
10488
10578
  } catch (err) {
@@ -10788,7 +10878,7 @@ app12.get("/", requireAdminSession, async (c) => {
10788
10878
  var accounts_default = app12;
10789
10879
 
10790
10880
  // server/routes/admin/logs.ts
10791
- import { existsSync as existsSync18, readdirSync as readdirSync14, readFileSync as readFileSync25, statSync as statSync9 } from "fs";
10881
+ import { existsSync as existsSync18, readdirSync as readdirSync14, readFileSync as readFileSync25, statSync as statSync10 } from "fs";
10792
10882
  import { resolve as resolve16, basename as basename7 } from "path";
10793
10883
 
10794
10884
  // app/lib/logs-read-resolve.ts
@@ -10828,7 +10918,7 @@ app13.get("/", async (c) => {
10828
10918
  searched.push(filePath);
10829
10919
  try {
10830
10920
  const buffer = readFileSync25(filePath);
10831
- const onDiskBytes = statSync9(filePath).size;
10921
+ const onDiskBytes = statSync10(filePath).size;
10832
10922
  const headers = {
10833
10923
  "Content-Type": "text/plain; charset=utf-8",
10834
10924
  "Content-Length": String(buffer.byteLength)
@@ -10893,7 +10983,7 @@ app13.get("/", async (c) => {
10893
10983
  try {
10894
10984
  const filename = basename7(hit.path);
10895
10985
  const buffer = readFileSync25(hit.path);
10896
- const onDiskBytes = statSync9(hit.path).size;
10986
+ const onDiskBytes = statSync10(hit.path).size;
10897
10987
  const headers = {
10898
10988
  "Content-Type": "text/plain; charset=utf-8",
10899
10989
  "Content-Length": String(buffer.byteLength)
@@ -10936,7 +11026,7 @@ app13.get("/", async (c) => {
10936
11026
  console.warn(`[admin/logs] readdir-fail dir=${dir} reason=${reason}`);
10937
11027
  continue;
10938
11028
  }
10939
- files.filter((f) => !seen.has(f)).map((f) => ({ name: f, mtime: statSync9(resolve16(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime).forEach(({ name }) => {
11029
+ files.filter((f) => !seen.has(f)).map((f) => ({ name: f, mtime: statSync10(resolve16(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime).forEach(({ name }) => {
10940
11030
  seen.add(name);
10941
11031
  try {
10942
11032
  const content = readFileSync25(resolve16(dir, name));
@@ -11821,7 +11911,7 @@ app17.put("/:id/label", requireAdminSession, async (c) => {
11821
11911
  var sessions_default = app17;
11822
11912
 
11823
11913
  // app/lib/claude-agent/spawn-context.ts
11824
- import { existsSync as existsSync22, readFileSync as readFileSync27, readdirSync as readdirSync16, statSync as statSync10 } from "fs";
11914
+ import { existsSync as existsSync22, readFileSync as readFileSync27, readdirSync as readdirSync16, statSync as statSync11 } from "fs";
11825
11915
  import { dirname as dirname7, resolve as resolve19, join as join25 } from "path";
11826
11916
  async function resolveOwnerProfileBlock(accountId, userId) {
11827
11917
  if (!userId) return { ok: false, reason: "missing-user-id" };
@@ -11924,7 +12014,7 @@ function listPluginDirs() {
11924
12014
  for (const name of readdirSync16(platformPlugins)) {
11925
12015
  const dir = join25(platformPlugins, name);
11926
12016
  try {
11927
- if (statSync10(dir).isDirectory()) out.set(name, dir);
12017
+ if (statSync11(dir).isDirectory()) out.set(name, dir);
11928
12018
  } catch {
11929
12019
  }
11930
12020
  }
@@ -11938,7 +12028,7 @@ function listPluginDirs() {
11938
12028
  for (const name of readdirSync16(bundlePlugins)) {
11939
12029
  const dir = join25(bundlePlugins, name);
11940
12030
  try {
11941
- if (statSync10(dir).isDirectory()) out.set(name, dir);
12031
+ if (statSync11(dir).isDirectory()) out.set(name, dir);
11942
12032
  } catch {
11943
12033
  }
11944
12034
  }
@@ -18525,7 +18615,7 @@ app48.route("/request-magic-link", request_magic_link_default);
18525
18615
  var access_default = app48;
18526
18616
 
18527
18617
  // server/routes/sites.ts
18528
- import { existsSync as existsSync28, readFileSync as readFileSync31, realpathSync as realpathSync6, statSync as statSync11 } from "fs";
18618
+ import { existsSync as existsSync28, readFileSync as readFileSync31, realpathSync as realpathSync6, statSync as statSync12 } from "fs";
18529
18619
  import { resolve as resolve26 } from "path";
18530
18620
  var SAFE_SEG_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
18531
18621
  var MIME = {
@@ -18591,7 +18681,7 @@ app49.get("/:rel{.*}", (c) => {
18591
18681
  }
18592
18682
  let stat8;
18593
18683
  try {
18594
- stat8 = existsSync28(filePath) ? statSync11(filePath) : null;
18684
+ stat8 = existsSync28(filePath) ? statSync12(filePath) : null;
18595
18685
  } catch {
18596
18686
  stat8 = null;
18597
18687
  }
@@ -22287,7 +22377,7 @@ function broadcastAdminShutdown(reason) {
22287
22377
 
22288
22378
  // ../lib/entitlement/src/index.ts
22289
22379
  import { createPublicKey, createHash as createHash5, verify as cryptoVerify } from "crypto";
22290
- import { existsSync as existsSync32, readFileSync as readFileSync34, statSync as statSync12 } from "fs";
22380
+ import { existsSync as existsSync32, readFileSync as readFileSync34, statSync as statSync13 } from "fs";
22291
22381
  import { resolve as resolve32 } from "path";
22292
22382
 
22293
22383
  // ../lib/entitlement/src/canonicalize.ts
@@ -22339,7 +22429,7 @@ function resolveEntitlement(brand, account) {
22339
22429
  if (!existsSync32(entitlementPath)) {
22340
22430
  return logResolved(anonymousFallback("missing"), { reason: "missing" });
22341
22431
  }
22342
- const stat8 = statSync12(entitlementPath);
22432
+ const stat8 = statSync13(entitlementPath);
22343
22433
  const key = memoKey(stat8.mtimeMs, account);
22344
22434
  if (memo && memo.key === key) {
22345
22435
  return memo.result;
@@ -1 +0,0 @@
1
- import{W as e,q as t}from"./useSubAccountSwitcher-CQbgG-FH.js";import"./admin-types-DJoj6VJv.js";import"./AdminShell-DbTijFVA.js";import{n}from"./page-BkIb7CHh.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -1 +0,0 @@
1
- import{W as e,q as t}from"./useSubAccountSwitcher-CQbgG-FH.js";import{t as n}from"./page-Dv_YEOUW.js";import"./graph-labels-OaIKHgMg.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));