@rubytech/create-maxy-code 0.1.23 → 0.1.24

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 (90) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/admin/PLUGIN.md +4 -0
  3. package/payload/platform/plugins/admin/skills/admin-user-management/SKILL.md +47 -0
  4. package/payload/platform/plugins/admin/skills/commitment-followthrough/SKILL.md +60 -0
  5. package/payload/platform/plugins/admin/skills/file-presentation/SKILL.md +67 -0
  6. package/payload/platform/plugins/admin/skills/session-management/SKILL.md +62 -0
  7. package/payload/platform/plugins/deep-research/.claude-plugin/plugin.json +1 -1
  8. package/payload/platform/plugins/deep-research/PLUGIN.md +7 -1
  9. package/payload/platform/plugins/deep-research/recipes/README.md +36 -0
  10. package/payload/platform/plugins/deep-research/skills/academic-verify/SKILL.md +75 -0
  11. package/payload/platform/plugins/deep-research/skills/book-mirror/SKILL.md +68 -0
  12. package/payload/platform/plugins/deep-research/skills/data-research/SKILL.md +108 -0
  13. package/payload/platform/plugins/deep-research/skills/strategic-reading/SKILL.md +69 -0
  14. package/payload/platform/plugins/docs/references/deployment.md +3 -2
  15. package/payload/platform/plugins/email/mcp/dist/lib/imap.d.ts +1 -1
  16. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.d.ts +7 -2
  17. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.d.ts.map +1 -1
  18. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +7 -2
  19. package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +1 -1
  20. package/payload/platform/plugins/linkedin-import/skills/linkedin-import/SKILL.md +2 -0
  21. package/payload/platform/plugins/memory/PLUGIN.md +6 -0
  22. package/payload/platform/plugins/memory/skills/archive-crawler/SKILL.md +67 -0
  23. package/payload/platform/plugins/memory/skills/concept-synthesis/SKILL.md +80 -0
  24. package/payload/platform/plugins/memory/skills/conversation-archive/SKILL.md +2 -0
  25. package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +2 -0
  26. package/payload/platform/plugins/scheduling/PLUGIN.md +3 -0
  27. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.d.ts +7 -3
  28. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.d.ts.map +1 -1
  29. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +7 -3
  30. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
  31. package/payload/platform/plugins/scheduling/skills/briefing/SKILL.md +75 -0
  32. package/payload/platform/plugins/scheduling/skills/daily-prep/SKILL.md +61 -0
  33. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  34. package/payload/platform/services/claude-session-manager/dist/http-server.js +14 -1
  35. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  36. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +14 -0
  37. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  38. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +9 -2
  39. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  40. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts +25 -1
  41. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts.map +1 -1
  42. package/payload/platform/services/claude-session-manager/dist/system-prompt.js +54 -3
  43. package/payload/platform/services/claude-session-manager/dist/system-prompt.js.map +1 -1
  44. package/payload/platform/templates/agents/admin/IDENTITY.md +38 -284
  45. package/payload/platform/templates/agents/admin/SOUL.md +4 -4
  46. package/payload/platform/templates/specialists/agents/content-producer.md +24 -69
  47. package/payload/platform/templates/specialists/agents/database-operator.md +49 -155
  48. package/payload/platform/templates/specialists/agents/personal-assistant.md +27 -177
  49. package/payload/platform/templates/specialists/agents/project-manager.md +29 -96
  50. package/payload/platform/templates/specialists/agents/research-assistant.md +36 -78
  51. package/payload/premium-plugins/real-agency/agents/compliance.md +14 -0
  52. package/payload/premium-plugins/real-agency/agents/negotiator.md +22 -0
  53. package/payload/premium-plugins/real-agency/agents/valuer.md +16 -0
  54. package/payload/premium-plugins/real-agency/plugins/estate-business/.claude-plugin/plugin.json +1 -1
  55. package/payload/premium-plugins/real-agency/plugins/estate-business/PLUGIN.md +29 -13
  56. package/payload/premium-plugins/real-agency/plugins/estate-business/skills/commission-calculator/SKILL.md +40 -0
  57. package/payload/premium-plugins/real-agency/plugins/estate-business/skills/month-end-close/SKILL.md +69 -0
  58. package/payload/premium-plugins/real-agency/plugins/estate-business/skills/payment-batch-stager/SKILL.md +42 -0
  59. package/payload/premium-plugins/real-agency/plugins/estate-business/skills/period-reconciler/SKILL.md +42 -0
  60. package/payload/premium-plugins/real-agency/plugins/estate-sales/.claude-plugin/plugin.json +1 -1
  61. package/payload/premium-plugins/real-agency/plugins/estate-sales/PLUGIN.md +27 -13
  62. package/payload/premium-plugins/real-agency/plugins/estate-sales/skills/chase-progression/SKILL.md +107 -0
  63. package/payload/premium-plugins/real-agency/plugins/estate-sales/skills/risk-scorer/SKILL.md +42 -0
  64. package/payload/premium-plugins/real-agency/plugins/leads/.claude-plugin/plugin.json +1 -1
  65. package/payload/premium-plugins/real-agency/plugins/leads/PLUGIN.md +24 -10
  66. package/payload/premium-plugins/real-agency/plugins/leads/skills/chain-progression-tracker/SKILL.md +51 -0
  67. package/payload/premium-plugins/real-agency/plugins/leads/skills/diary-builder/SKILL.md +38 -0
  68. package/payload/premium-plugins/real-agency/plugins/leads/skills/enquiry-triage/SKILL.md +36 -0
  69. package/payload/premium-plugins/real-agency/plugins/leads/skills/morning-round/SKILL.md +72 -0
  70. package/payload/premium-plugins/real-agency/plugins/listings/.claude-plugin/plugin.json +1 -1
  71. package/payload/premium-plugins/real-agency/plugins/listings/PLUGIN.md +43 -12
  72. package/payload/premium-plugins/real-agency/plugins/listings/skills/comparable-finder/SKILL.md +52 -0
  73. package/payload/premium-plugins/real-agency/plugins/listings/skills/epc-checker/SKILL.md +38 -0
  74. package/payload/premium-plugins/real-agency/plugins/listings/skills/listing-copy-writer/SKILL.md +55 -0
  75. package/payload/premium-plugins/real-agency/plugins/listings/skills/local-market-stats/SKILL.md +33 -0
  76. package/payload/premium-plugins/real-agency/plugins/listings/skills/new-instruction/SKILL.md +78 -0
  77. package/payload/premium-plugins/real-agency/plugins/listings/skills/particulars-builder/SKILL.md +48 -0
  78. package/payload/premium-plugins/real-agency/plugins/listings/skills/portal-launch-scheduler/SKILL.md +49 -0
  79. package/payload/premium-plugins/real-agency/plugins/listings/skills/pricing-scenario-builder/SKILL.md +35 -0
  80. package/payload/premium-plugins/real-agency/plugins/listings/skills/supplier-booker/SKILL.md +39 -0
  81. package/payload/premium-plugins/real-agency/plugins/listings/skills/talk-track-composer/SKILL.md +36 -0
  82. package/payload/premium-plugins/real-agency/plugins/listings/skills/terms-of-business-drafter/SKILL.md +54 -0
  83. package/payload/premium-plugins/real-agency/plugins/listings/skills/valuation-prep/SKILL.md +69 -0
  84. package/payload/premium-plugins/real-agency/plugins/loop/PLUGIN.md +20 -0
  85. package/payload/premium-plugins/real-agency/plugins/loop/skills/compliance-flag-checker/SKILL.md +53 -0
  86. package/payload/premium-plugins/real-agency/plugins/loop/skills/priority-ranker/SKILL.md +40 -0
  87. package/payload/premium-plugins/real-agency/plugins/loop/skills/tone-matched-drafter/SKILL.md +53 -0
  88. package/payload/premium-plugins/real-agency/plugins/loop/skills/variance-narrator/SKILL.md +50 -0
  89. package/payload/premium-plugins/real-agency/plugins/loop/skills/vendor-research/SKILL.md +54 -0
  90. package/payload/server/server.js +73 -162
@@ -650,8 +650,8 @@ var serveStatic = (options = { root: "" }) => {
650
650
  };
651
651
 
652
652
  // server/index.ts
653
- import { readFileSync as readFileSync22, existsSync as existsSync26, watchFile } from "fs";
654
- import { resolve as resolve25, join as join14, basename as basename5 } from "path";
653
+ import { readFileSync as readFileSync22, existsSync as existsSync25, watchFile } from "fs";
654
+ import { resolve as resolve25, join as join13, basename as basename5 } from "path";
655
655
  import { homedir as homedir5 } from "os";
656
656
 
657
657
  // app/lib/agent-slug-pattern.ts
@@ -9465,83 +9465,20 @@ app21.put("/:id/label", requireAdminSession, async (c) => {
9465
9465
  var sessions_default = app21;
9466
9466
 
9467
9467
  // app/lib/claude-agent/onboarding-prompt.ts
9468
- import { mkdirSync as mkdirSync7, rmSync as rmSync2, existsSync as existsSync18, writeFileSync as writeFileSync11 } from "fs";
9469
- import { join as join11 } from "path";
9470
- var TAG19 = "[onboarding-inject]";
9471
- function eligibilityDir() {
9472
- const override = process.env.MAXY_ONBOARDING_ELIGIBILITY_DIR;
9473
- if (override && override.length > 0) return override;
9474
- return join11(MAXY_DIR, "state", "onboarding-injection");
9475
- }
9476
- function markerPath(managerSessionId) {
9477
- if (managerSessionId.includes("/") || managerSessionId.includes("\\")) {
9478
- throw new Error(`onboarding-prompt: invalid sessionId ${managerSessionId}`);
9479
- }
9480
- return join11(eligibilityDir(), managerSessionId);
9481
- }
9482
- function markEligibleForInjection(managerSessionId) {
9483
- const dir = eligibilityDir();
9484
- try {
9485
- mkdirSync7(dir, { recursive: true });
9486
- writeFileSync11(markerPath(managerSessionId), "", { flag: "w" });
9487
- console.log(`${TAG19} mark sessionId=${managerSessionId.slice(0, 8)}`);
9488
- } catch (err) {
9489
- const msg = err instanceof Error ? err.message : String(err);
9490
- console.error(`${TAG19} mark-failed sessionId=${managerSessionId.slice(0, 8)} reason=${msg}`);
9491
- throw err;
9492
- }
9493
- }
9494
- function consumeInjectionSlot(managerSessionId) {
9495
- const path2 = markerPath(managerSessionId);
9496
- if (!existsSync18(path2)) return false;
9497
- try {
9498
- rmSync2(path2, { force: true });
9499
- console.log(`${TAG19} consume sessionId=${managerSessionId.slice(0, 8)}`);
9500
- return true;
9501
- } catch (err) {
9502
- const msg = err instanceof Error ? err.message : String(err);
9503
- console.error(`${TAG19} consume-rm-failed sessionId=${managerSessionId.slice(0, 8)} reason=${msg}`);
9504
- return true;
9505
- }
9506
- }
9468
+ var TAG19 = "[onboarding-prompt]";
9507
9469
  async function buildOnboardingPromptBlock(accountId) {
9508
9470
  const step = await loadOnboardingStep(accountId);
9509
9471
  const accountIdShort = accountId.slice(0, 8);
9510
9472
  if (step === null) {
9511
- const block2 = renderUnreachableBlock();
9512
9473
  console.log(`${TAG19} graph-unreachable accountId=${accountIdShort}`);
9513
- return { injected: true, block: block2, step: "graph-unreachable" };
9514
- }
9515
- if (step === 9) {
9516
- console.log(`${TAG19} agent=admin accountId=${accountIdShort} step=9 injected=false`);
9517
- return { injected: false, reason: "complete" };
9518
- }
9519
- if (step === -1) {
9520
- const block2 = renderIncompleteBlock(-1);
9521
- console.log(`${TAG19} agent=admin accountId=${accountIdShort} step=missing injected=true`);
9522
- return { injected: true, block: block2, step: "missing" };
9523
- }
9524
- const block = renderIncompleteBlock(step);
9525
- console.log(`${TAG19} agent=admin accountId=${accountIdShort} step=${step} injected=true`);
9526
- return { injected: true, block, step };
9527
- }
9528
- function renderIncompleteBlock(currentStep) {
9529
- const stepAttr = currentStep < 0 ? "missing" : String(currentStep);
9530
- const resumeStep = currentStep < 0 ? 0 : currentStep + 1;
9531
- return [
9532
- `<onboarding-state currentStep="${stepAttr}" resumeStep="${resumeStep}">`,
9533
- `Onboarding is incomplete. Your first tool call this turn is \`skill-load\` with \`skillName=onboarding\`. Your second tool call is \`render-component\` for step ${resumeStep}, exactly as the skill body directs. Do not greet, do not summarise, do not write a preamble (\`let me check\`, \`let me figure out\`, \`let me list\` and similar phrasings are forbidden). The skill body is the only authority for what the operator sees next.`,
9534
- `</onboarding-state>`,
9535
- ""
9536
- ].join("\n");
9537
- }
9538
- function renderUnreachableBlock() {
9539
- return [
9540
- `<onboarding-state currentStep="unknown" graphUnreachable="true">`,
9541
- `Neo4j is unreachable, so onboarding state cannot be read. Do not assume onboarding is complete. Tell the operator the graph is unreachable, name the symptom in one line, and stop \u2014 do not improvise an onboarding flow without state, and do not silently skip the step the operator was on.`,
9542
- `</onboarding-state>`,
9543
- ""
9544
- ].join("\n");
9474
+ } else if (step === 9) {
9475
+ console.log(`${TAG19} agent=admin accountId=${accountIdShort} step=9 complete`);
9476
+ } else if (step === -1) {
9477
+ console.log(`${TAG19} agent=admin accountId=${accountIdShort} step=missing`);
9478
+ } else {
9479
+ console.log(`${TAG19} agent=admin accountId=${accountIdShort} step=${step}`);
9480
+ }
9481
+ return { step };
9545
9482
  }
9546
9483
 
9547
9484
  // server/routes/admin/claude-sessions.ts
@@ -9566,39 +9503,34 @@ app22.post("/", async (c) => {
9566
9503
  }
9567
9504
  const channel = typeof body.channel === "string" ? body.channel : "browser";
9568
9505
  const initialMessage = typeof body.initialMessage === "string" && body.initialMessage.trim() ? body.initialMessage : null;
9506
+ let onboarding;
9507
+ try {
9508
+ const outcome = await buildOnboardingPromptBlock(senderId);
9509
+ onboarding = { step: outcome.step };
9510
+ } catch (err) {
9511
+ console.error(`${TAG20} onboarding-resolve failed: ${err instanceof Error ? err.message : String(err)}`);
9512
+ }
9569
9513
  const upstream = await fetch(`${managerBase()}/spawn`, {
9570
9514
  method: "POST",
9571
9515
  headers: { "content-type": "application/json" },
9572
- body: JSON.stringify({ senderId, role: "admin", channel })
9516
+ body: JSON.stringify({ senderId, role: "admin", channel, accountId: senderId, onboarding })
9573
9517
  }).catch((err) => {
9574
9518
  console.error(`${TAG20} fetch-failed op=spawn message=${err instanceof Error ? err.message : String(err)}`);
9575
9519
  return null;
9576
9520
  });
9577
9521
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
9578
9522
  let spawnedSessionId = null;
9579
- if (upstream.ok) {
9523
+ if (upstream.ok && initialMessage) {
9580
9524
  const buffered = await upstream.clone().json().catch(() => null);
9581
9525
  if (buffered && typeof buffered.sessionId === "string" && buffered.sessionId) {
9582
9526
  spawnedSessionId = buffered.sessionId;
9583
- markEligibleForInjection(spawnedSessionId);
9584
9527
  }
9585
9528
  }
9586
9529
  if (initialMessage && spawnedSessionId) {
9587
- const accountId = senderId;
9588
- let outboundBody = JSON.stringify({ text: initialMessage });
9589
- try {
9590
- const outcome = await buildOnboardingPromptBlock(accountId);
9591
- if (outcome.injected) {
9592
- outboundBody = JSON.stringify({ text: outcome.block + initialMessage });
9593
- consumeInjectionSlot(spawnedSessionId);
9594
- }
9595
- } catch (err) {
9596
- console.error(`${TAG20} initial-message-inject failed: ${err instanceof Error ? err.message : String(err)}`);
9597
- }
9598
9530
  fetch(`${managerBase()}/${encodeURIComponent(spawnedSessionId)}/input`, {
9599
9531
  method: "POST",
9600
9532
  headers: { "content-type": "application/json" },
9601
- body: outboundBody
9533
+ body: JSON.stringify({ text: initialMessage })
9602
9534
  }).catch((err) => {
9603
9535
  console.error(`${TAG20} fetch-failed op=initial-input message=${err instanceof Error ? err.message : String(err)}`);
9604
9536
  });
@@ -9709,33 +9641,12 @@ app22.patch("/:sessionId", async (c) => {
9709
9641
  app22.post("/:sessionId/input", async (c) => {
9710
9642
  const sessionId = c.req.param("sessionId");
9711
9643
  const rawBody = await c.req.text();
9712
- let outboundBody = rawBody;
9713
- const cacheKey = c.get("cacheKey") ?? "";
9714
- const accountId = getAccountIdForSession(cacheKey);
9715
- if (accountId && consumeInjectionSlot(sessionId)) {
9716
- let parsed = null;
9717
- try {
9718
- parsed = JSON.parse(rawBody);
9719
- } catch {
9720
- parsed = null;
9721
- }
9722
- if (parsed && typeof parsed.text === "string") {
9723
- try {
9724
- const outcome = await buildOnboardingPromptBlock(accountId);
9725
- if (outcome.injected) {
9726
- outboundBody = JSON.stringify({ ...parsed, text: outcome.block + parsed.text });
9727
- }
9728
- } catch (err) {
9729
- console.error(`${TAG20} onboarding-inject failed: ${err instanceof Error ? err.message : String(err)}`);
9730
- }
9731
- }
9732
- }
9733
9644
  const upstream = await fetch(
9734
9645
  `${managerBase()}/${encodeURIComponent(sessionId)}/input`,
9735
9646
  {
9736
9647
  method: "POST",
9737
9648
  headers: { "content-type": "application/json" },
9738
- body: outboundBody
9649
+ body: rawBody
9739
9650
  }
9740
9651
  ).catch((err) => {
9741
9652
  console.error(`${TAG20} fetch-failed op=input message=${err instanceof Error ? err.message : String(err)}`);
@@ -10014,12 +9925,12 @@ function isValidDomain(value) {
10014
9925
  }
10015
9926
 
10016
9927
  // app/lib/alias-domains.ts
10017
- import { existsSync as existsSync19, mkdirSync as mkdirSync8, readFileSync as readFileSync17, writeFileSync as writeFileSync12 } from "fs";
9928
+ import { existsSync as existsSync18, mkdirSync as mkdirSync7, readFileSync as readFileSync17, writeFileSync as writeFileSync11 } from "fs";
10018
9929
  import { dirname as dirname5 } from "path";
10019
9930
  import { resolve as resolve15 } from "path";
10020
9931
  var ALIAS_DOMAINS_PATH = resolve15(MAXY_DIR, "alias-domains.json");
10021
9932
  function readExisting() {
10022
- if (!existsSync19(ALIAS_DOMAINS_PATH)) return /* @__PURE__ */ new Set();
9933
+ if (!existsSync18(ALIAS_DOMAINS_PATH)) return /* @__PURE__ */ new Set();
10023
9934
  try {
10024
9935
  const parsed = JSON.parse(readFileSync17(ALIAS_DOMAINS_PATH, "utf-8"));
10025
9936
  if (!Array.isArray(parsed)) return /* @__PURE__ */ new Set();
@@ -10032,13 +9943,13 @@ function addAliasDomain(hostname2) {
10032
9943
  const existing = readExisting();
10033
9944
  if (existing.has(hostname2)) return;
10034
9945
  existing.add(hostname2);
10035
- mkdirSync8(dirname5(ALIAS_DOMAINS_PATH), { recursive: true });
10036
- writeFileSync12(ALIAS_DOMAINS_PATH, JSON.stringify([...existing], null, 2) + "\n", "utf-8");
9946
+ mkdirSync7(dirname5(ALIAS_DOMAINS_PATH), { recursive: true });
9947
+ writeFileSync11(ALIAS_DOMAINS_PATH, JSON.stringify([...existing], null, 2) + "\n", "utf-8");
10037
9948
  }
10038
9949
 
10039
9950
  // app/lib/script-stream-tailer.ts
10040
9951
  import * as childProcess from "child_process";
10041
- import { appendFileSync as appendFileSync3, createReadStream as createReadStream2, mkdirSync as mkdirSync9, statSync as statSync6 } from "fs";
9952
+ import { appendFileSync as appendFileSync3, createReadStream as createReadStream2, mkdirSync as mkdirSync8, statSync as statSync6 } from "fs";
10042
9953
  import { dirname as dirname6 } from "path";
10043
9954
  import { StringDecoder } from "string_decoder";
10044
9955
  var SCRIPT_STREAM_RE = /^\[([^\]]+)\] \[script:([a-z][a-z0-9-]*)((?::[a-z0-9:_-]+)?)\] (.*)$/;
@@ -10148,7 +10059,7 @@ function writeRouteMilestone(streamLogPath, scope, line) {
10148
10059
  }
10149
10060
  const ts = (/* @__PURE__ */ new Date()).toISOString();
10150
10061
  try {
10151
- mkdirSync9(dirname6(streamLogPath), { recursive: true });
10062
+ mkdirSync8(dirname6(streamLogPath), { recursive: true });
10152
10063
  appendFileSync3(streamLogPath, `[${ts}] [script:${scope}] ${line}
10153
10064
  `);
10154
10065
  } catch (err) {
@@ -10538,8 +10449,8 @@ app27.get("/tunnels", requireAdminSession, async (c) => {
10538
10449
  if (!correlationId) return err("session", "No active conversation for session \u2014 refresh chat.");
10539
10450
  streamLogPath = streamLogPathFor(accountId, correlationId).streamLogPath;
10540
10451
  const certPath = resolve16(homedir4(), brand.configDir, "cloudflared", "cert.pem");
10541
- const { existsSync: existsSync27 } = await import("fs");
10542
- if (!existsSync27(certPath)) {
10452
+ const { existsSync: existsSync26 } = await import("fs");
10453
+ if (!existsSync26(certPath)) {
10543
10454
  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.`);
10544
10455
  }
10545
10456
  const result = await runFormSpawn({
@@ -10863,7 +10774,7 @@ var cloudflare_default = app27;
10863
10774
  import { createReadStream as createReadStream3 } from "fs";
10864
10775
  import { readdir as readdir2, readFile as readFile4, stat as stat4, mkdir as mkdir3, writeFile as writeFile4, unlink as unlink2 } from "fs/promises";
10865
10776
  import { realpathSync as realpathSync4 } from "fs";
10866
- import { basename as basename4, dirname as dirname7, join as join12, resolve as resolve18, sep as sep3 } from "path";
10777
+ import { basename as basename4, dirname as dirname7, join as join11, resolve as resolve18, sep as sep3 } from "path";
10867
10778
  import { Readable as Readable2 } from "stream";
10868
10779
 
10869
10780
  // app/lib/data-path.ts
@@ -11221,7 +11132,7 @@ async function cascadeDeleteDocument(params) {
11221
11132
  var UUID_RE7 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
11222
11133
  async function readMeta(absDir, baseName) {
11223
11134
  try {
11224
- const raw = await readFile4(join12(absDir, `${baseName}.meta.json`), "utf8");
11135
+ const raw = await readFile4(join11(absDir, `${baseName}.meta.json`), "utf8");
11225
11136
  const parsed = JSON.parse(raw);
11226
11137
  if (typeof parsed?.filename === "string") {
11227
11138
  return { filename: parsed.filename, mimeType: typeof parsed.mimeType === "string" ? parsed.mimeType : void 0 };
@@ -11259,7 +11170,7 @@ async function readAccountNames() {
11259
11170
  }
11260
11171
  async function enrich(absolute, entry, accountNames) {
11261
11172
  if (entry.kind === "directory" && UUID_RE7.test(entry.name)) {
11262
- const meta = await readMeta(join12(absolute, entry.name), entry.name);
11173
+ const meta = await readMeta(join11(absolute, entry.name), entry.name);
11263
11174
  if (meta?.filename) {
11264
11175
  entry.displayName = meta.filename;
11265
11176
  entry.mimeType = meta.mimeType;
@@ -11318,7 +11229,7 @@ app28.get("/", requireAdminSession, async (c) => {
11318
11229
  continue;
11319
11230
  }
11320
11231
  try {
11321
- const entryPath = join12(absolute, name);
11232
+ const entryPath = join11(absolute, name);
11322
11233
  const s = await stat4(entryPath);
11323
11234
  entries.push({
11324
11235
  name,
@@ -11491,7 +11402,7 @@ app28.delete("/", requireAdminSession, async (c) => {
11491
11402
  }
11492
11403
  const dot = base.lastIndexOf(".");
11493
11404
  const stem = dot === -1 ? base : base.slice(0, dot);
11494
- const sidecarPath = UUID_RE7.test(stem) && base !== `${stem}.meta.json` ? join12(dirname7(absolute), `${stem}.meta.json`) : null;
11405
+ const sidecarPath = UUID_RE7.test(stem) && base !== `${stem}.meta.json` ? join11(dirname7(absolute), `${stem}.meta.json`) : null;
11495
11406
  await unlink2(absolute);
11496
11407
  if (sidecarPath) {
11497
11408
  try {
@@ -13157,7 +13068,7 @@ var file_attach_default = app35;
13157
13068
  import neo4j3 from "neo4j-driver";
13158
13069
  import { readFile as readFile5, readdir as readdir3, stat as stat5 } from "fs/promises";
13159
13070
  import { resolve as resolve19, relative as relative2, isAbsolute } from "path";
13160
- import { existsSync as existsSync20 } from "fs";
13071
+ import { existsSync as existsSync19 } from "fs";
13161
13072
  var LIMIT = 50;
13162
13073
  var TEXT_MIME_PREFIXES = ["text/", "application/json", "application/markdown"];
13163
13074
  var ADMIN_AGENT_FILES = ["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"];
@@ -13305,7 +13216,7 @@ async function fetchAgentTemplateRows(accountDir) {
13305
13216
  async function unionSpecialistFilenames(overrideDir, bundledDir) {
13306
13217
  const names = /* @__PURE__ */ new Set();
13307
13218
  for (const dir of [overrideDir, bundledDir]) {
13308
- if (!existsSync20(dir)) continue;
13219
+ if (!existsSync19(dir)) continue;
13309
13220
  try {
13310
13221
  const entries = await readdir3(dir);
13311
13222
  for (const entry of entries) {
@@ -13320,7 +13231,7 @@ async function unionSpecialistFilenames(overrideDir, bundledDir) {
13320
13231
  }
13321
13232
  async function readAgentTemplateRow(inp) {
13322
13233
  let chosenPath = null;
13323
- if (existsSync20(inp.overridePath)) {
13234
+ if (existsSync19(inp.overridePath)) {
13324
13235
  try {
13325
13236
  validateFilePathInAccount(inp.overridePath, inp.overrideRoot);
13326
13237
  chosenPath = inp.overridePath;
@@ -13331,7 +13242,7 @@ async function readAgentTemplateRow(inp) {
13331
13242
  );
13332
13243
  return null;
13333
13244
  }
13334
- } else if (existsSync20(inp.bundledPath)) {
13245
+ } else if (existsSync19(inp.bundledPath)) {
13335
13246
  if (!isWithin(inp.bundledPath, inp.bundledRoot)) {
13336
13247
  console.error(
13337
13248
  `[admin/sidebar-artefacts] agent-template-read-failed agent=${inp.displayName} kind=${inp.logName} error="bundled path outside PLATFORM_ROOT"`
@@ -13373,7 +13284,7 @@ var sidebar_artefacts_default = app36;
13373
13284
  // server/routes/admin/sidebar-artefact-save.ts
13374
13285
  import { mkdir as mkdir4, readdir as readdir4, stat as stat6, writeFile as writeFile5 } from "fs/promises";
13375
13286
  import { resolve as resolve20 } from "path";
13376
- import { existsSync as existsSync21 } from "fs";
13287
+ import { existsSync as existsSync20 } from "fs";
13377
13288
  var ADMIN_AGENT_FILES2 = /* @__PURE__ */ new Set(["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"]);
13378
13289
  var UUID_RE8 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
13379
13290
  var app37 = new Hono();
@@ -13441,7 +13352,7 @@ async function resolveSavePath(id, accountId, accountDir) {
13441
13352
  }
13442
13353
  if (UUID_RE8.test(id)) {
13443
13354
  const dir = resolve20(ATTACHMENTS_ROOT, accountId, id);
13444
- if (!existsSync21(dir)) {
13355
+ if (!existsSync20(dir)) {
13445
13356
  const attShort = id.slice(0, 8);
13446
13357
  if (isHealPending(accountId, id)) {
13447
13358
  console.error(`[admin/sidebar-artefact-save] heal-race attachmentId=${attShort} outcome=503-retry source=heal-pending`);
@@ -13493,7 +13404,7 @@ var sidebar_artefact_save_default = app37;
13493
13404
 
13494
13405
  // server/routes/admin/sidebar-artefact-content.ts
13495
13406
  import { readFile as readFile6, readdir as readdir5 } from "fs/promises";
13496
- import { existsSync as existsSync22 } from "fs";
13407
+ import { existsSync as existsSync21 } from "fs";
13497
13408
  import { resolve as resolve21 } from "path";
13498
13409
  var UUID_RE9 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
13499
13410
  var app38 = new Hono();
@@ -13507,7 +13418,7 @@ app38.get("/", requireAdminSession, async (c) => {
13507
13418
  return new Response("Not found", { status: 404 });
13508
13419
  }
13509
13420
  const dir = resolve21(ATTACHMENTS_ROOT, accountId, id);
13510
- if (!existsSync22(dir)) {
13421
+ if (!existsSync21(dir)) {
13511
13422
  console.error(`[admin/sidebar-artefact-content] not-found id=${id.slice(0, 8)}`);
13512
13423
  return new Response("Not found", { status: 404 });
13513
13424
  }
@@ -13541,12 +13452,12 @@ app38.get("/", requireAdminSession, async (c) => {
13541
13452
  var sidebar_artefact_content_default = app38;
13542
13453
 
13543
13454
  // server/routes/admin/health.ts
13544
- import { existsSync as existsSync23, readFileSync as readFileSync19 } from "fs";
13545
- import { resolve as resolve22, join as join13 } from "path";
13455
+ import { existsSync as existsSync22, readFileSync as readFileSync19 } from "fs";
13456
+ import { resolve as resolve22, join as join12 } from "path";
13546
13457
  var PLATFORM_ROOT8 = process.env.MAXY_PLATFORM_ROOT ?? resolve22(process.cwd(), "..");
13547
13458
  var brandHostname = "maxy";
13548
- var brandJsonPath = join13(PLATFORM_ROOT8, "config", "brand.json");
13549
- if (existsSync23(brandJsonPath)) {
13459
+ var brandJsonPath = join12(PLATFORM_ROOT8, "config", "brand.json");
13460
+ if (existsSync22(brandJsonPath)) {
13550
13461
  try {
13551
13462
  const brand = JSON.parse(readFileSync19(brandJsonPath, "utf-8"));
13552
13463
  if (brand.hostname) brandHostname = brand.hostname;
@@ -13557,7 +13468,7 @@ var VERSION_FILE = resolve22(PLATFORM_ROOT8, `config/.${brandHostname}-version`)
13557
13468
  var PROCESS_STARTED_AT = (/* @__PURE__ */ new Date()).toISOString();
13558
13469
  var PROBE_TIMEOUT_MS = 1e3;
13559
13470
  function readVersion() {
13560
- if (!existsSync23(VERSION_FILE)) return "unknown";
13471
+ if (!existsSync22(VERSION_FILE)) return "unknown";
13561
13472
  return readFileSync19(VERSION_FILE, "utf-8").trim() || "unknown";
13562
13473
  }
13563
13474
  async function probeConversationDb() {
@@ -13643,7 +13554,7 @@ app40.route("/health-brand", health_default2);
13643
13554
  var admin_default = app40;
13644
13555
 
13645
13556
  // server/routes/sites.ts
13646
- import { existsSync as existsSync24, readFileSync as readFileSync20, realpathSync as realpathSync5, statSync as statSync7 } from "fs";
13557
+ import { existsSync as existsSync23, readFileSync as readFileSync20, realpathSync as realpathSync5, statSync as statSync7 } from "fs";
13647
13558
  import { resolve as resolve23 } from "path";
13648
13559
  var SAFE_SEG_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
13649
13560
  var MIME = {
@@ -13709,7 +13620,7 @@ app41.get("/:rel{.*}", (c) => {
13709
13620
  }
13710
13621
  let stat7;
13711
13622
  try {
13712
- stat7 = existsSync24(filePath) ? statSync7(filePath) : null;
13623
+ stat7 = existsSync23(filePath) ? statSync7(filePath) : null;
13713
13624
  } catch {
13714
13625
  stat7 = null;
13715
13626
  }
@@ -13728,7 +13639,7 @@ app41.get("/:rel{.*}", (c) => {
13728
13639
  console.error(`[sites] path-traversal-rejected path=${reqPath} reason=escape status=403`);
13729
13640
  return c.text("Forbidden", 403);
13730
13641
  }
13731
- if (!existsSync24(filePath)) {
13642
+ if (!existsSync23(filePath)) {
13732
13643
  console.error(`[sites] not-found path=${reqPath} status=404`);
13733
13644
  return c.text("Not found", 404);
13734
13645
  }
@@ -13864,7 +13775,7 @@ function startGraphHealthTimer() {
13864
13775
 
13865
13776
  // ../lib/entitlement/src/index.ts
13866
13777
  import { createPublicKey, createHash as createHash3, verify as cryptoVerify } from "crypto";
13867
- import { existsSync as existsSync25, readFileSync as readFileSync21, statSync as statSync8 } from "fs";
13778
+ import { existsSync as existsSync24, readFileSync as readFileSync21, statSync as statSync8 } from "fs";
13868
13779
  import { resolve as resolve24 } from "path";
13869
13780
 
13870
13781
  // ../lib/entitlement/src/canonicalize.ts
@@ -13913,7 +13824,7 @@ function resolveEntitlement(brand, account) {
13913
13824
  return logResolved(implicitTrust(account), null);
13914
13825
  }
13915
13826
  const entitlementPath = resolve24(brand.configDir, "entitlement.json");
13916
- if (!existsSync25(entitlementPath)) {
13827
+ if (!existsSync24(entitlementPath)) {
13917
13828
  return logResolved(anonymousFallback("missing"), { reason: "missing" });
13918
13829
  }
13919
13830
  const stat7 = statSync8(entitlementPath);
@@ -14103,12 +14014,12 @@ function clientFrom(c) {
14103
14014
  );
14104
14015
  }
14105
14016
  var PLATFORM_ROOT9 = process.env.MAXY_PLATFORM_ROOT || "";
14106
- var BRAND_JSON_PATH = PLATFORM_ROOT9 ? join14(PLATFORM_ROOT9, "config", "brand.json") : "";
14017
+ var BRAND_JSON_PATH = PLATFORM_ROOT9 ? join13(PLATFORM_ROOT9, "config", "brand.json") : "";
14107
14018
  var BRAND = { productName: "Maxy", hostname: "maxy", configDir: ".maxy", domain: "getmaxy.com" };
14108
- if (BRAND_JSON_PATH && !existsSync26(BRAND_JSON_PATH)) {
14019
+ if (BRAND_JSON_PATH && !existsSync25(BRAND_JSON_PATH)) {
14109
14020
  console.error(`[brand] WARNING: brand.json not found at ${BRAND_JSON_PATH} \u2014 using Maxy defaults`);
14110
14021
  }
14111
- if (BRAND_JSON_PATH && existsSync26(BRAND_JSON_PATH)) {
14022
+ if (BRAND_JSON_PATH && existsSync25(BRAND_JSON_PATH)) {
14112
14023
  try {
14113
14024
  const parsed = JSON.parse(readFileSync22(BRAND_JSON_PATH, "utf-8"));
14114
14025
  BRAND = { ...BRAND, ...parsed };
@@ -14129,10 +14040,10 @@ var brandLoginOpts = {
14129
14040
  bodyFont: BRAND.defaultFonts?.body,
14130
14041
  logoContainsName: !!BRAND.logoContainsName
14131
14042
  };
14132
- var ALIAS_DOMAINS_PATH2 = join14(homedir5(), BRAND.configDir, "alias-domains.json");
14043
+ var ALIAS_DOMAINS_PATH2 = join13(homedir5(), BRAND.configDir, "alias-domains.json");
14133
14044
  function loadAliasDomains() {
14134
14045
  try {
14135
- if (!existsSync26(ALIAS_DOMAINS_PATH2)) return null;
14046
+ if (!existsSync25(ALIAS_DOMAINS_PATH2)) return null;
14136
14047
  const parsed = JSON.parse(readFileSync22(ALIAS_DOMAINS_PATH2, "utf-8"));
14137
14048
  if (!Array.isArray(parsed)) {
14138
14049
  console.error("[alias-domains] malformed alias-domains.json \u2014 expected array");
@@ -14513,7 +14424,7 @@ app42.get("/agent-assets/:slug/:filename", (c) => {
14513
14424
  console.error(`[agent-assets] path-traversal-rejected slug=${slug} file=${filename}`);
14514
14425
  return c.text("Forbidden", 403);
14515
14426
  }
14516
- if (!existsSync26(filePath)) {
14427
+ if (!existsSync25(filePath)) {
14517
14428
  console.error(`[agent-assets] serve slug=${slug} file=${filename} status=404`);
14518
14429
  return c.text("Not found", 404);
14519
14430
  }
@@ -14543,7 +14454,7 @@ app42.get("/generated/:filename", (c) => {
14543
14454
  console.error(`[generated] serve file=${filename} status=403`);
14544
14455
  return c.text("Forbidden", 403);
14545
14456
  }
14546
- if (!existsSync26(filePath)) {
14457
+ if (!existsSync25(filePath)) {
14547
14458
  console.error(`[generated] serve file=${filename} status=404`);
14548
14459
  return c.text("Not found", 404);
14549
14460
  }
@@ -14560,7 +14471,7 @@ app42.route("/sites", sites_default);
14560
14471
  var htmlCache = /* @__PURE__ */ new Map();
14561
14472
  var brandLogoPath = "/brand/maxy-monochrome.png";
14562
14473
  var brandIconPath = "/brand/maxy-monochrome.png";
14563
- if (BRAND_JSON_PATH && existsSync26(BRAND_JSON_PATH)) {
14474
+ if (BRAND_JSON_PATH && existsSync25(BRAND_JSON_PATH)) {
14564
14475
  try {
14565
14476
  const fullBrand = JSON.parse(readFileSync22(BRAND_JSON_PATH, "utf-8"));
14566
14477
  if (fullBrand.assets?.logo) brandLogoPath = `/brand/${fullBrand.assets.logo}`;
@@ -14579,8 +14490,8 @@ var brandScript = `<script>window.__BRAND__=${JSON.stringify({
14579
14490
  function readInstalledVersion() {
14580
14491
  try {
14581
14492
  if (!PLATFORM_ROOT9) return "unknown";
14582
- const versionFile = join14(PLATFORM_ROOT9, "config", `.${BRAND.hostname}-version`);
14583
- if (!existsSync26(versionFile)) return "unknown";
14493
+ const versionFile = join13(PLATFORM_ROOT9, "config", `.${BRAND.hostname}-version`);
14494
+ if (!existsSync25(versionFile)) return "unknown";
14584
14495
  const content = readFileSync22(versionFile, "utf-8").trim();
14585
14496
  return content || "unknown";
14586
14497
  } catch {
@@ -14638,15 +14549,15 @@ ${clientErrorReporterScript}
14638
14549
  }
14639
14550
  var brandedHtmlCache = /* @__PURE__ */ new Map();
14640
14551
  function loadBrandingCache(agentSlug) {
14641
- const configDir2 = join14(homedir5(), BRAND.configDir);
14552
+ const configDir2 = join13(homedir5(), BRAND.configDir);
14642
14553
  try {
14643
- const accountJsonPath = join14(configDir2, "account.json");
14644
- if (!existsSync26(accountJsonPath)) return null;
14554
+ const accountJsonPath = join13(configDir2, "account.json");
14555
+ if (!existsSync25(accountJsonPath)) return null;
14645
14556
  const account = JSON.parse(readFileSync22(accountJsonPath, "utf-8"));
14646
14557
  const accountId = account.accountId;
14647
14558
  if (!accountId) return null;
14648
- const cachePath = join14(configDir2, "branding-cache", accountId, `${agentSlug}.json`);
14649
- if (!existsSync26(cachePath)) return null;
14559
+ const cachePath = join13(configDir2, "branding-cache", accountId, `${agentSlug}.json`);
14560
+ if (!existsSync25(cachePath)) return null;
14650
14561
  return JSON.parse(readFileSync22(cachePath, "utf-8"));
14651
14562
  } catch {
14652
14563
  return null;
@@ -14654,9 +14565,9 @@ function loadBrandingCache(agentSlug) {
14654
14565
  }
14655
14566
  function resolveDefaultSlug() {
14656
14567
  try {
14657
- const configDir2 = join14(homedir5(), BRAND.configDir);
14658
- const accountJsonPath = join14(configDir2, "account.json");
14659
- if (!existsSync26(accountJsonPath)) return null;
14568
+ const configDir2 = join13(homedir5(), BRAND.configDir);
14569
+ const accountJsonPath = join13(configDir2, "account.json");
14570
+ if (!existsSync25(accountJsonPath)) return null;
14660
14571
  const account = JSON.parse(readFileSync22(accountJsonPath, "utf-8"));
14661
14572
  return account.defaultAgent || null;
14662
14573
  } catch {
@@ -14840,7 +14751,7 @@ try {
14840
14751
  }
14841
14752
  (async () => {
14842
14753
  try {
14843
- if (!existsSync26(USERS_FILE)) return;
14754
+ if (!existsSync25(USERS_FILE)) return;
14844
14755
  const usersRaw = readFileSync22(USERS_FILE, "utf-8").trim();
14845
14756
  if (!usersRaw) return;
14846
14757
  const users = JSON.parse(usersRaw);
@@ -14967,7 +14878,7 @@ if (bootAccountConfig?.whatsapp) {
14967
14878
  }
14968
14879
  init({
14969
14880
  configDir: configDirForWhatsApp,
14970
- platformRoot: resolve25(process.env.MAXY_PLATFORM_ROOT ?? join14(__dirname, "..")),
14881
+ platformRoot: resolve25(process.env.MAXY_PLATFORM_ROOT ?? join13(__dirname, "..")),
14971
14882
  accountConfig: bootAccountConfig,
14972
14883
  onMessage: async (msg) => {
14973
14884
  try {