@rubytech/create-maxy-code 0.1.351 → 0.1.353
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 +2 -2
- package/payload/platform/config/brand.json +1 -1
- package/payload/platform/package-lock.json +76 -1
- package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
- package/payload/platform/plugins/admin/hooks/lib/maxy-mcp-plugins.txt +1 -0
- package/payload/platform/plugins/admin/mcp/dist/__tests__/capabilities-here.test.js +27 -10
- package/payload/platform/plugins/admin/mcp/dist/__tests__/capabilities-here.test.js.map +1 -1
- package/payload/platform/plugins/admin/skills/agent-builder/references/agent-pattern.md +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +40 -2
- package/payload/platform/plugins/cloudflare/skills/calendar-site/SKILL.md +2 -2
- package/payload/platform/plugins/cloudflare/skills/calendar-site/template/public/booking.css +41 -0
- package/payload/platform/plugins/cloudflare/skills/calendar-site/template/public/booking.js +236 -47
- package/payload/platform/plugins/cloudflare/skills/calendar-site/template/public/index.html +6 -0
- package/payload/platform/plugins/connector/.claude-plugin/plugin.json +21 -0
- package/payload/platform/plugins/connector/PLUGIN.md +55 -0
- package/payload/platform/plugins/connector/lib/mcp-spawn-tee/index.js +193 -0
- package/payload/platform/plugins/connector/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/connector/mcp/dist/index.d.ts +2 -0
- package/payload/platform/plugins/connector/mcp/dist/index.d.ts.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/index.js +119 -0
- package/payload/platform/plugins/connector/mcp/dist/index.js.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/call.d.ts +54 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/call.d.ts.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/call.js +157 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/call.js.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/redact.d.ts +10 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/redact.d.ts.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/redact.js +29 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/redact.js.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/ssrf.d.ts +29 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/ssrf.d.ts.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/ssrf.js +112 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/ssrf.js.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/store.d.ts +25 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/store.d.ts.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/store.js +63 -0
- package/payload/platform/plugins/connector/mcp/dist/lib/store.js.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/scripts/audit-connectors.d.ts +9 -0
- package/payload/platform/plugins/connector/mcp/dist/scripts/audit-connectors.d.ts.map +1 -0
- package/payload/platform/plugins/connector/mcp/dist/scripts/audit-connectors.js +63 -0
- package/payload/platform/plugins/connector/mcp/dist/scripts/audit-connectors.js.map +1 -0
- package/payload/platform/plugins/connector/mcp/package.json +20 -0
- package/payload/platform/plugins/docs/references/connector.md +33 -0
- package/payload/platform/plugins/docs/references/getting-started.md +1 -1
- package/payload/platform/scripts/check-agent-contract.mjs +97 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +5 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +4 -0
- package/payload/platform/templates/specialists/agents/citation-auditor.md +5 -1
- package/payload/platform/templates/specialists/agents/coding-assistant.md +8 -0
- package/payload/platform/templates/specialists/agents/compiled-truth-rewriter.md +4 -0
- package/payload/platform/templates/specialists/agents/content-producer.md +8 -0
- package/payload/platform/templates/specialists/agents/data-manager.md +9 -1
- package/payload/platform/templates/specialists/agents/database-operator.md +12 -0
- package/payload/platform/templates/specialists/agents/librarian.md +9 -1
- package/payload/platform/templates/specialists/agents/personal-assistant.md +8 -0
- package/payload/platform/templates/specialists/agents/project-manager.md +8 -0
- package/payload/platform/templates/specialists/agents/public-session-reviewer.md +9 -1
- package/payload/platform/templates/specialists/agents/research-assistant.md +8 -0
- package/payload/platform/templates/specialists/agents/typed-edge-classifier.md +4 -2
- package/payload/premium-plugins/writer-craft/agents/writer-craft--manuscript-reviewer.md +12 -0
- package/payload/server/public/assets/{AdminLoginScreens-B1cvICYI.js → AdminLoginScreens-CzdOQKyO.js} +1 -1
- package/payload/server/public/assets/{AdminShell-B-GeoG3j.js → AdminShell-CC-CuN6Y.js} +1 -1
- package/payload/server/public/assets/{Checkbox-DoGMXVpF.js → Checkbox-sQBc9xSy.js} +1 -1
- package/payload/server/public/assets/{OperatorConversations-CfG1EYyP.js → OperatorConversations-CA_2c3sp.js} +1 -1
- package/payload/server/public/assets/OperatorConversations-DPVKGsRS.css +1 -0
- package/payload/server/public/assets/{admin-DF9JDP6a.js → admin-qW6jM6l0.js} +1 -1
- package/payload/server/public/assets/admin-types-DJoj6VJv.js +1 -0
- package/payload/server/public/assets/{browser-Cyi6v8BS.js → browser-BsW6KaxZ.js} +1 -1
- package/payload/server/public/assets/calendar-BPAiN1cL.js +1 -0
- package/payload/server/public/assets/chat-DVD9yoVL.js +1 -0
- package/payload/server/public/assets/{data-CrJZjlQ1.js → data-D_cR_NCZ.js} +1 -1
- package/payload/server/public/assets/{graph-CutaO0w1.js → graph-CmpAy2WP.js} +1 -1
- package/payload/server/public/assets/{graph-labels-CH0sWvcA.js → graph-labels-C0SLq_VP.js} +1 -1
- package/payload/server/public/assets/{operator-CqKk6Twn.js → operator-CrjtJcEY.js} +1 -1
- package/payload/server/public/assets/page-Cf3fVDSo.js +32 -0
- package/payload/server/public/assets/{public-D5lkOp3H.js → public-BkNtvSYp.js} +1 -1
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +4 -4
- package/payload/server/public/chat.html +6 -6
- package/payload/server/public/data.html +4 -4
- package/payload/server/public/graph.html +6 -6
- package/payload/server/public/index.html +7 -7
- package/payload/server/public/operator.html +8 -8
- package/payload/server/public/public.html +6 -6
- package/payload/server/server.js +153 -83
- package/payload/server/public/assets/OperatorConversations-C8G6Gfgu.css +0 -1
- package/payload/server/public/assets/admin-types-Dg11L4MQ.js +0 -1
- package/payload/server/public/assets/calendar-CA3_Dm8j.js +0 -1
- package/payload/server/public/assets/chat-C4hHkcTu.js +0 -1
- package/payload/server/public/assets/page-Bfm1FN4n.js +0 -30
package/payload/server/server.js
CHANGED
|
@@ -1301,9 +1301,9 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
1301
1301
|
};
|
|
1302
1302
|
|
|
1303
1303
|
// server/index.ts
|
|
1304
|
-
import { readFileSync as readFileSync33, existsSync as
|
|
1304
|
+
import { readFileSync as readFileSync33, existsSync as existsSync32, watchFile } from "fs";
|
|
1305
1305
|
import { spawn as spawn3 } from "child_process";
|
|
1306
|
-
import { resolve as resolve34, join as
|
|
1306
|
+
import { resolve as resolve34, join as join32, basename as basename10 } from "path";
|
|
1307
1307
|
import { homedir as homedir3 } from "os";
|
|
1308
1308
|
import { monitorEventLoopDelay } from "perf_hooks";
|
|
1309
1309
|
|
|
@@ -5173,14 +5173,17 @@ async function storeComponentArtefact(accountId, attachmentId, mimeType, content
|
|
|
5173
5173
|
import { writeFile as writeFile3, mkdtemp, rm } from "fs/promises";
|
|
5174
5174
|
import { tmpdir } from "os";
|
|
5175
5175
|
import { join as join5 } from "path";
|
|
5176
|
-
|
|
5176
|
+
|
|
5177
|
+
// app/lib/stt/audio-mime.ts
|
|
5177
5178
|
var AUDIO_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
5178
5179
|
"audio/ogg",
|
|
5179
5180
|
"audio/opus",
|
|
5180
5181
|
"audio/webm",
|
|
5181
5182
|
"audio/mp4",
|
|
5183
|
+
"audio/x-m4a",
|
|
5182
5184
|
"audio/mpeg",
|
|
5183
|
-
"audio/wav"
|
|
5185
|
+
"audio/wav",
|
|
5186
|
+
"video/mp4"
|
|
5184
5187
|
]);
|
|
5185
5188
|
function normalizeMime(mimeType) {
|
|
5186
5189
|
return mimeType.split(";")[0].trim().toLowerCase();
|
|
@@ -5198,14 +5201,21 @@ function audioExtension(mimeType) {
|
|
|
5198
5201
|
return ".webm";
|
|
5199
5202
|
case "audio/mp4":
|
|
5200
5203
|
return ".m4a";
|
|
5204
|
+
case "audio/x-m4a":
|
|
5205
|
+
return ".m4a";
|
|
5201
5206
|
case "audio/mpeg":
|
|
5202
5207
|
return ".mp3";
|
|
5203
5208
|
case "audio/wav":
|
|
5204
5209
|
return ".wav";
|
|
5210
|
+
case "video/mp4":
|
|
5211
|
+
return ".mp4";
|
|
5205
5212
|
default:
|
|
5206
5213
|
return ".audio";
|
|
5207
5214
|
}
|
|
5208
5215
|
}
|
|
5216
|
+
|
|
5217
|
+
// app/lib/stt/voice-note.ts
|
|
5218
|
+
var TAG14 = "[voice]";
|
|
5209
5219
|
async function transcribeVoiceNote(file, source) {
|
|
5210
5220
|
const startMs = Date.now();
|
|
5211
5221
|
const bytes = file.size;
|
|
@@ -17405,6 +17415,10 @@ app42.post("/launch", requireAdminSession, async (c) => {
|
|
|
17405
17415
|
});
|
|
17406
17416
|
var browser_default = app42;
|
|
17407
17417
|
|
|
17418
|
+
// server/routes/admin/calendar.ts
|
|
17419
|
+
import { existsSync as existsSync26 } from "fs";
|
|
17420
|
+
import { join as join28 } from "path";
|
|
17421
|
+
|
|
17408
17422
|
// server/lib/calendar-ics.ts
|
|
17409
17423
|
var CRLF = "\r\n";
|
|
17410
17424
|
var PRODID = "-//Maxy//Calendar//EN";
|
|
@@ -17501,6 +17515,49 @@ function countVEvents(ics) {
|
|
|
17501
17515
|
return count;
|
|
17502
17516
|
}
|
|
17503
17517
|
|
|
17518
|
+
// server/lib/calendar-availability.ts
|
|
17519
|
+
import { readFileSync as readFileSync28 } from "fs";
|
|
17520
|
+
import { join as join27 } from "path";
|
|
17521
|
+
var AVAILABILITY_FILENAME = "calendar-availability.json";
|
|
17522
|
+
var REQUIRED_KEYS = [
|
|
17523
|
+
"timezone",
|
|
17524
|
+
"durationMins",
|
|
17525
|
+
"bufferMins",
|
|
17526
|
+
"weekly"
|
|
17527
|
+
];
|
|
17528
|
+
function readAvailabilityConfig(accountDir) {
|
|
17529
|
+
const path2 = join27(accountDir, AVAILABILITY_FILENAME);
|
|
17530
|
+
let raw;
|
|
17531
|
+
try {
|
|
17532
|
+
raw = readFileSync28(path2, "utf-8");
|
|
17533
|
+
} catch {
|
|
17534
|
+
throw new Error(`availability not configured: ${path2} not found`);
|
|
17535
|
+
}
|
|
17536
|
+
let parsed;
|
|
17537
|
+
try {
|
|
17538
|
+
parsed = JSON.parse(raw);
|
|
17539
|
+
} catch (err) {
|
|
17540
|
+
throw new Error(`invalid JSON in ${path2}: ${err.message}`);
|
|
17541
|
+
}
|
|
17542
|
+
const cfg = parsed;
|
|
17543
|
+
for (const key of REQUIRED_KEYS) {
|
|
17544
|
+
if (cfg[key] === void 0 || cfg[key] === null) {
|
|
17545
|
+
throw new Error(`availability config ${path2} missing required key: ${key}`);
|
|
17546
|
+
}
|
|
17547
|
+
}
|
|
17548
|
+
if (cfg.daysAhead !== void 0 && cfg.daysAhead !== null) {
|
|
17549
|
+
if (typeof cfg.daysAhead !== "number" || !Number.isInteger(cfg.daysAhead) || cfg.daysAhead < 1) {
|
|
17550
|
+
throw new Error(`availability config ${path2} invalid daysAhead: must be a positive integer`);
|
|
17551
|
+
}
|
|
17552
|
+
}
|
|
17553
|
+
if (cfg.allowMultiSlot !== void 0 && cfg.allowMultiSlot !== null) {
|
|
17554
|
+
if (typeof cfg.allowMultiSlot !== "boolean") {
|
|
17555
|
+
throw new Error(`availability config ${path2} invalid allowMultiSlot: must be a boolean`);
|
|
17556
|
+
}
|
|
17557
|
+
}
|
|
17558
|
+
return cfg;
|
|
17559
|
+
}
|
|
17560
|
+
|
|
17504
17561
|
// server/routes/admin/calendar.ts
|
|
17505
17562
|
var app43 = new Hono();
|
|
17506
17563
|
function normalizeAttendees(raw) {
|
|
@@ -17824,6 +17881,29 @@ app43.delete("/meetings/:id", requireAdminSession, async (c) => {
|
|
|
17824
17881
|
await session.close();
|
|
17825
17882
|
}
|
|
17826
17883
|
});
|
|
17884
|
+
app43.get("/booking-link", requireAdminSession, (c) => {
|
|
17885
|
+
try {
|
|
17886
|
+
const account = resolveAccount();
|
|
17887
|
+
if (!account) {
|
|
17888
|
+
console.error('[calendar] op=booking-link-fail err="no account configured"');
|
|
17889
|
+
return c.json({ bookingDomain: null });
|
|
17890
|
+
}
|
|
17891
|
+
if (!existsSync26(join28(account.accountDir, AVAILABILITY_FILENAME))) {
|
|
17892
|
+
console.log("[calendar] op=booking-link bookingDomain=none source=availability-config");
|
|
17893
|
+
return c.json({ bookingDomain: null });
|
|
17894
|
+
}
|
|
17895
|
+
const config = readAvailabilityConfig(account.accountDir);
|
|
17896
|
+
const bookingDomain = typeof config.bookingDomain === "string" && config.bookingDomain.trim() ? config.bookingDomain.trim() : null;
|
|
17897
|
+
console.log(
|
|
17898
|
+
`[calendar] op=booking-link bookingDomain=${bookingDomain ?? "none"} source=availability-config`
|
|
17899
|
+
);
|
|
17900
|
+
return c.json({ bookingDomain });
|
|
17901
|
+
} catch (err) {
|
|
17902
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
17903
|
+
console.error(`[calendar] op=booking-link-fail err="${message}"`);
|
|
17904
|
+
return c.json({ bookingDomain: null });
|
|
17905
|
+
}
|
|
17906
|
+
});
|
|
17827
17907
|
var calendar_default = app43;
|
|
17828
17908
|
|
|
17829
17909
|
// server/routes/admin/index.ts
|
|
@@ -18099,7 +18179,7 @@ app47.route("/request-magic-link", request_magic_link_default);
|
|
|
18099
18179
|
var access_default = app47;
|
|
18100
18180
|
|
|
18101
18181
|
// server/routes/sites.ts
|
|
18102
|
-
import { existsSync as
|
|
18182
|
+
import { existsSync as existsSync27, readFileSync as readFileSync29, realpathSync as realpathSync7, statSync as statSync11 } from "fs";
|
|
18103
18183
|
import { resolve as resolve28 } from "path";
|
|
18104
18184
|
var SAFE_SEG_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
|
|
18105
18185
|
var MIME = {
|
|
@@ -18165,7 +18245,7 @@ app48.get("/:rel{.*}", (c) => {
|
|
|
18165
18245
|
}
|
|
18166
18246
|
let stat8;
|
|
18167
18247
|
try {
|
|
18168
|
-
stat8 =
|
|
18248
|
+
stat8 = existsSync27(filePath) ? statSync11(filePath) : null;
|
|
18169
18249
|
} catch {
|
|
18170
18250
|
stat8 = null;
|
|
18171
18251
|
}
|
|
@@ -18184,7 +18264,7 @@ app48.get("/:rel{.*}", (c) => {
|
|
|
18184
18264
|
console.error(`[sites] path-traversal-rejected path=${reqPath} reason=escape status=403`);
|
|
18185
18265
|
return c.text("Forbidden", 403);
|
|
18186
18266
|
}
|
|
18187
|
-
if (!
|
|
18267
|
+
if (!existsSync27(filePath)) {
|
|
18188
18268
|
console.error(`[sites] not-found path=${reqPath} status=404`);
|
|
18189
18269
|
return c.text("Not found", 404);
|
|
18190
18270
|
}
|
|
@@ -18203,7 +18283,7 @@ app48.get("/:rel{.*}", (c) => {
|
|
|
18203
18283
|
}
|
|
18204
18284
|
let body;
|
|
18205
18285
|
try {
|
|
18206
|
-
body =
|
|
18286
|
+
body = readFileSync29(realPath);
|
|
18207
18287
|
} catch (err) {
|
|
18208
18288
|
const code = err?.code;
|
|
18209
18289
|
if (code === "EISDIR") {
|
|
@@ -18239,7 +18319,7 @@ var sites_default = app48;
|
|
|
18239
18319
|
|
|
18240
18320
|
// app/lib/visitor-token.ts
|
|
18241
18321
|
import { createHmac, randomBytes, timingSafeEqual } from "crypto";
|
|
18242
|
-
import { mkdirSync as mkdirSync6, readFileSync as
|
|
18322
|
+
import { mkdirSync as mkdirSync6, readFileSync as readFileSync30, writeFileSync as writeFileSync11 } from "fs";
|
|
18243
18323
|
import { dirname as dirname7 } from "path";
|
|
18244
18324
|
var TOKEN_PREFIX = "v1.";
|
|
18245
18325
|
var SECRET_BYTES = 32;
|
|
@@ -18248,7 +18328,7 @@ var cachedSecret = null;
|
|
|
18248
18328
|
function getSecret() {
|
|
18249
18329
|
if (cachedSecret) return cachedSecret;
|
|
18250
18330
|
try {
|
|
18251
|
-
const hex2 =
|
|
18331
|
+
const hex2 = readFileSync30(VISITOR_TOKEN_SECRET_FILE, "utf-8").trim();
|
|
18252
18332
|
if (hex2.length === SECRET_BYTES * 2) {
|
|
18253
18333
|
cachedSecret = Buffer.from(hex2, "hex");
|
|
18254
18334
|
return cachedSecret;
|
|
@@ -18262,7 +18342,7 @@ function getSecret() {
|
|
|
18262
18342
|
console.log(`[visitor-token] secret minted path=${VISITOR_TOKEN_SECRET_FILE}`);
|
|
18263
18343
|
} catch {
|
|
18264
18344
|
}
|
|
18265
|
-
const hex =
|
|
18345
|
+
const hex = readFileSync30(VISITOR_TOKEN_SECRET_FILE, "utf-8").trim();
|
|
18266
18346
|
cachedSecret = Buffer.from(hex, "hex");
|
|
18267
18347
|
return cachedSecret;
|
|
18268
18348
|
}
|
|
@@ -18315,8 +18395,8 @@ var VISITOR_COOKIE_NAME = "mxy_v";
|
|
|
18315
18395
|
var VISITOR_COOKIE_MAX_AGE_SECONDS = Math.floor(DEFAULT_TTL_MS / 1e3);
|
|
18316
18396
|
|
|
18317
18397
|
// app/lib/brand-config.ts
|
|
18318
|
-
import { existsSync as
|
|
18319
|
-
import { join as
|
|
18398
|
+
import { existsSync as existsSync28, readFileSync as readFileSync31 } from "fs";
|
|
18399
|
+
import { join as join29 } from "path";
|
|
18320
18400
|
var cached2 = null;
|
|
18321
18401
|
var cachedAttempted = false;
|
|
18322
18402
|
function readBrandConfig() {
|
|
@@ -18324,10 +18404,10 @@ function readBrandConfig() {
|
|
|
18324
18404
|
cachedAttempted = true;
|
|
18325
18405
|
const platformRoot3 = process.env.MAXY_PLATFORM_ROOT;
|
|
18326
18406
|
if (!platformRoot3) return null;
|
|
18327
|
-
const brandPath =
|
|
18328
|
-
if (!
|
|
18407
|
+
const brandPath = join29(platformRoot3, "config", "brand.json");
|
|
18408
|
+
if (!existsSync28(brandPath)) return null;
|
|
18329
18409
|
try {
|
|
18330
|
-
cached2 = JSON.parse(
|
|
18410
|
+
cached2 = JSON.parse(readFileSync31(brandPath, "utf-8"));
|
|
18331
18411
|
return cached2;
|
|
18332
18412
|
} catch {
|
|
18333
18413
|
return null;
|
|
@@ -18816,7 +18896,7 @@ var visitor_event_default = app51;
|
|
|
18816
18896
|
|
|
18817
18897
|
// server/routes/session.ts
|
|
18818
18898
|
import { resolve as resolve29 } from "path";
|
|
18819
|
-
import { existsSync as
|
|
18899
|
+
import { existsSync as existsSync29, writeFileSync as writeFileSync12, mkdirSync as mkdirSync7 } from "fs";
|
|
18820
18900
|
var UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
18821
18901
|
function writeBrandingCache(accountId, agentSlug, branding) {
|
|
18822
18902
|
try {
|
|
@@ -18900,7 +18980,7 @@ app52.post("/", async (c) => {
|
|
|
18900
18980
|
let agentConfig = null;
|
|
18901
18981
|
if (account) {
|
|
18902
18982
|
const agentDir = resolve29(account.accountDir, "agents", agentSlug);
|
|
18903
|
-
if (!
|
|
18983
|
+
if (!existsSync29(agentDir) || !existsSync29(resolve29(agentDir, "config.json"))) {
|
|
18904
18984
|
return c.json({ error: "Agent not found" }, 404);
|
|
18905
18985
|
}
|
|
18906
18986
|
agentConfig = resolveAgentConfig(account.accountDir, agentSlug);
|
|
@@ -19008,39 +19088,6 @@ app52.post("/", async (c) => {
|
|
|
19008
19088
|
});
|
|
19009
19089
|
var session_default2 = app52;
|
|
19010
19090
|
|
|
19011
|
-
// server/lib/calendar-availability.ts
|
|
19012
|
-
import { readFileSync as readFileSync31 } from "fs";
|
|
19013
|
-
import { join as join28 } from "path";
|
|
19014
|
-
var AVAILABILITY_FILENAME = "calendar-availability.json";
|
|
19015
|
-
var REQUIRED_KEYS = [
|
|
19016
|
-
"timezone",
|
|
19017
|
-
"durationMins",
|
|
19018
|
-
"bufferMins",
|
|
19019
|
-
"weekly"
|
|
19020
|
-
];
|
|
19021
|
-
function readAvailabilityConfig(accountDir) {
|
|
19022
|
-
const path2 = join28(accountDir, AVAILABILITY_FILENAME);
|
|
19023
|
-
let raw;
|
|
19024
|
-
try {
|
|
19025
|
-
raw = readFileSync31(path2, "utf-8");
|
|
19026
|
-
} catch {
|
|
19027
|
-
throw new Error(`availability not configured: ${path2} not found`);
|
|
19028
|
-
}
|
|
19029
|
-
let parsed;
|
|
19030
|
-
try {
|
|
19031
|
-
parsed = JSON.parse(raw);
|
|
19032
|
-
} catch (err) {
|
|
19033
|
-
throw new Error(`invalid JSON in ${path2}: ${err.message}`);
|
|
19034
|
-
}
|
|
19035
|
-
const cfg = parsed;
|
|
19036
|
-
for (const key of REQUIRED_KEYS) {
|
|
19037
|
-
if (cfg[key] === void 0 || cfg[key] === null) {
|
|
19038
|
-
throw new Error(`availability config ${path2} missing required key: ${key}`);
|
|
19039
|
-
}
|
|
19040
|
-
}
|
|
19041
|
-
return cfg;
|
|
19042
|
-
}
|
|
19043
|
-
|
|
19044
19091
|
// server/lib/calendar-slots.ts
|
|
19045
19092
|
var WEEKDAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
19046
19093
|
function tzOffsetMs(instant, timeZone) {
|
|
@@ -19521,8 +19568,8 @@ async function migrateUploads(opts = {}) {
|
|
|
19521
19568
|
|
|
19522
19569
|
// app/lib/migrate-admin-webchat-sidecars.ts
|
|
19523
19570
|
import { readdir as readdir6, readFile as readFile7, rename as rename3, writeFile as writeFile4, unlink as unlink3 } from "fs/promises";
|
|
19524
|
-
import { existsSync as
|
|
19525
|
-
import { join as
|
|
19571
|
+
import { existsSync as existsSync30 } from "fs";
|
|
19572
|
+
import { join as join30 } from "path";
|
|
19526
19573
|
var ADMIN_ROLE2 = "admin";
|
|
19527
19574
|
var WEBCHAT_CHANNEL2 = "webchat";
|
|
19528
19575
|
var SESSION_META_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.meta\.json$/i;
|
|
@@ -19551,7 +19598,7 @@ async function writeRaw(path2, obj) {
|
|
|
19551
19598
|
await rename3(tmp, path2);
|
|
19552
19599
|
} catch (err) {
|
|
19553
19600
|
try {
|
|
19554
|
-
if (
|
|
19601
|
+
if (existsSync30(tmp)) await unlink3(tmp);
|
|
19555
19602
|
} catch {
|
|
19556
19603
|
}
|
|
19557
19604
|
throw err;
|
|
@@ -19567,7 +19614,7 @@ async function collectLiveSidecars(projectsRoot) {
|
|
|
19567
19614
|
}
|
|
19568
19615
|
for (const slug of slugs) {
|
|
19569
19616
|
if (!slug.isDirectory()) continue;
|
|
19570
|
-
const slugDir =
|
|
19617
|
+
const slugDir = join30(projectsRoot, slug.name);
|
|
19571
19618
|
let entries;
|
|
19572
19619
|
try {
|
|
19573
19620
|
entries = await readdir6(slugDir, { withFileTypes: true });
|
|
@@ -19576,9 +19623,9 @@ async function collectLiveSidecars(projectsRoot) {
|
|
|
19576
19623
|
}
|
|
19577
19624
|
for (const entry of entries) {
|
|
19578
19625
|
if (entry.isFile() && SESSION_META_RE.test(entry.name)) {
|
|
19579
|
-
out.push(
|
|
19626
|
+
out.push(join30(slugDir, entry.name));
|
|
19580
19627
|
} else if (entry.isDirectory() && entry.name === "subagents") {
|
|
19581
|
-
const subDir =
|
|
19628
|
+
const subDir = join30(slugDir, entry.name);
|
|
19582
19629
|
let subs;
|
|
19583
19630
|
try {
|
|
19584
19631
|
subs = await readdir6(subDir, { withFileTypes: true });
|
|
@@ -19586,7 +19633,7 @@ async function collectLiveSidecars(projectsRoot) {
|
|
|
19586
19633
|
continue;
|
|
19587
19634
|
}
|
|
19588
19635
|
for (const s of subs) {
|
|
19589
|
-
if (s.isFile() && SESSION_META_RE.test(s.name)) out.push(
|
|
19636
|
+
if (s.isFile() && SESSION_META_RE.test(s.name)) out.push(join30(subDir, s.name));
|
|
19590
19637
|
}
|
|
19591
19638
|
}
|
|
19592
19639
|
}
|
|
@@ -19598,7 +19645,7 @@ function shortId(path2) {
|
|
|
19598
19645
|
return base.slice(0, 8);
|
|
19599
19646
|
}
|
|
19600
19647
|
async function migrateAdminWebchatSidecars(opts = {}) {
|
|
19601
|
-
const projectsRoot = opts.projectsRoot ?? (process.env.CLAUDE_CONFIG_DIR ?
|
|
19648
|
+
const projectsRoot = opts.projectsRoot ?? (process.env.CLAUDE_CONFIG_DIR ? join30(process.env.CLAUDE_CONFIG_DIR, "projects") : null) ?? "";
|
|
19602
19649
|
const usersFile = opts.usersFile ?? USERS_FILE;
|
|
19603
19650
|
const accountId = opts.accountId ?? resolveAccount()?.accountId ?? null;
|
|
19604
19651
|
const resolveName = opts.resolveName ?? defaultResolveName;
|
|
@@ -21198,12 +21245,12 @@ function startTelegramNativeFileFollower(input) {
|
|
|
21198
21245
|
}
|
|
21199
21246
|
|
|
21200
21247
|
// server/telegram-descriptor.ts
|
|
21201
|
-
import { resolve as resolve32, join as
|
|
21248
|
+
import { resolve as resolve32, join as join31 } from "path";
|
|
21202
21249
|
function telegramGatewayUrl() {
|
|
21203
21250
|
return `http://127.0.0.1:${process.env.MAXY_UI_INTERNAL_PORT ?? ""}`;
|
|
21204
21251
|
}
|
|
21205
21252
|
function telegramServerPath() {
|
|
21206
|
-
return process.env.MAXY_TELEGRAM_CHANNEL_SERVER_PATH ?? resolve32(process.env.MAXY_PLATFORM_ROOT ??
|
|
21253
|
+
return process.env.MAXY_TELEGRAM_CHANNEL_SERVER_PATH ?? resolve32(process.env.MAXY_PLATFORM_ROOT ?? join31(__dirname, ".."), "services/telegram-channel/dist/server.js");
|
|
21207
21254
|
}
|
|
21208
21255
|
|
|
21209
21256
|
// app/lib/whatsapp/inbound/channel-admin-binding-drift.ts
|
|
@@ -21271,7 +21318,7 @@ function broadcastAdminShutdown(reason) {
|
|
|
21271
21318
|
|
|
21272
21319
|
// ../lib/entitlement/src/index.ts
|
|
21273
21320
|
import { createPublicKey, createHash as createHash5, verify as cryptoVerify } from "crypto";
|
|
21274
|
-
import { existsSync as
|
|
21321
|
+
import { existsSync as existsSync31, readFileSync as readFileSync32, statSync as statSync12 } from "fs";
|
|
21275
21322
|
import { resolve as resolve33 } from "path";
|
|
21276
21323
|
|
|
21277
21324
|
// ../lib/entitlement/src/canonicalize.ts
|
|
@@ -21320,7 +21367,7 @@ function resolveEntitlement(brand, account) {
|
|
|
21320
21367
|
return logResolved(implicitTrust(account), null);
|
|
21321
21368
|
}
|
|
21322
21369
|
const entitlementPath = resolve33(brand.configDir, "entitlement.json");
|
|
21323
|
-
if (!
|
|
21370
|
+
if (!existsSync31(entitlementPath)) {
|
|
21324
21371
|
return logResolved(anonymousFallback("missing"), { reason: "missing" });
|
|
21325
21372
|
}
|
|
21326
21373
|
const stat8 = statSync12(entitlementPath);
|
|
@@ -21510,12 +21557,12 @@ function clientFrom(c) {
|
|
|
21510
21557
|
);
|
|
21511
21558
|
}
|
|
21512
21559
|
var PLATFORM_ROOT8 = process.env.MAXY_PLATFORM_ROOT || "";
|
|
21513
|
-
var BRAND_JSON_PATH = PLATFORM_ROOT8 ?
|
|
21560
|
+
var BRAND_JSON_PATH = PLATFORM_ROOT8 ? join32(PLATFORM_ROOT8, "config", "brand.json") : "";
|
|
21514
21561
|
var BRAND = { productName: "Maxy", hostname: "maxy", configDir: ".maxy", marketingUrl: "https://getmaxy.com" };
|
|
21515
|
-
if (BRAND_JSON_PATH && !
|
|
21562
|
+
if (BRAND_JSON_PATH && !existsSync32(BRAND_JSON_PATH)) {
|
|
21516
21563
|
console.error(`[brand] WARNING: brand.json not found at ${BRAND_JSON_PATH} \u2014 using Maxy defaults`);
|
|
21517
21564
|
}
|
|
21518
|
-
if (BRAND_JSON_PATH &&
|
|
21565
|
+
if (BRAND_JSON_PATH && existsSync32(BRAND_JSON_PATH)) {
|
|
21519
21566
|
try {
|
|
21520
21567
|
const parsed = JSON.parse(readFileSync33(BRAND_JSON_PATH, "utf-8"));
|
|
21521
21568
|
BRAND = { ...BRAND, ...parsed };
|
|
@@ -21549,10 +21596,10 @@ var brandLoginOpts = {
|
|
|
21549
21596
|
appleTouchIconPath: brandAppIcon512Path,
|
|
21550
21597
|
themeColor: BRAND.defaultColors?.primary
|
|
21551
21598
|
};
|
|
21552
|
-
var ALIAS_DOMAINS_PATH =
|
|
21599
|
+
var ALIAS_DOMAINS_PATH = join32(homedir3(), BRAND.configDir, "alias-domains.json");
|
|
21553
21600
|
function loadAliasDomains() {
|
|
21554
21601
|
try {
|
|
21555
|
-
if (!
|
|
21602
|
+
if (!existsSync32(ALIAS_DOMAINS_PATH)) return null;
|
|
21556
21603
|
const parsed = JSON.parse(readFileSync33(ALIAS_DOMAINS_PATH, "utf-8"));
|
|
21557
21604
|
if (!Array.isArray(parsed)) {
|
|
21558
21605
|
console.error("[alias-domains] malformed alias-domains.json \u2014 expected array");
|
|
@@ -21581,7 +21628,7 @@ var app54 = new Hono();
|
|
|
21581
21628
|
var nativeFileFollowers = /* @__PURE__ */ new Map();
|
|
21582
21629
|
var waGateway = new WaGateway({
|
|
21583
21630
|
gatewayUrl: `http://127.0.0.1:${process.env.MAXY_UI_INTERNAL_PORT ?? ""}`,
|
|
21584
|
-
serverPath: process.env.MAXY_WA_CHANNEL_SERVER_PATH ?? resolve34(process.env.MAXY_PLATFORM_ROOT ??
|
|
21631
|
+
serverPath: process.env.MAXY_WA_CHANNEL_SERVER_PATH ?? resolve34(process.env.MAXY_PLATFORM_ROOT ?? join32(__dirname, ".."), "services/whatsapp-channel/dist/server.js"),
|
|
21585
21632
|
// Task 751 — file delivery on the native channel: resolve the platform
|
|
21586
21633
|
// account + path validation here and funnel through the shared send core.
|
|
21587
21634
|
sendDocument: async ({ senderId, accountId, filePath, caption }) => {
|
|
@@ -21597,7 +21644,7 @@ var waGateway = new WaGateway({
|
|
|
21597
21644
|
caption,
|
|
21598
21645
|
accountId,
|
|
21599
21646
|
maxyAccountId,
|
|
21600
|
-
platformRoot: resolve34(process.env.MAXY_PLATFORM_ROOT ??
|
|
21647
|
+
platformRoot: resolve34(process.env.MAXY_PLATFORM_ROOT ?? join32(__dirname, ".."))
|
|
21601
21648
|
});
|
|
21602
21649
|
return result.ok ? { ok: true, messageId: result.messageId } : { ok: false, error: result.error };
|
|
21603
21650
|
},
|
|
@@ -22109,7 +22156,7 @@ app54.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
22109
22156
|
console.error(`[agent-assets] path-traversal-rejected slug=${slug} file=${filename}`);
|
|
22110
22157
|
return c.text("Forbidden", 403);
|
|
22111
22158
|
}
|
|
22112
|
-
if (!
|
|
22159
|
+
if (!existsSync32(filePath)) {
|
|
22113
22160
|
console.error(`[agent-assets] serve slug=${slug} file=${filename} status=404`);
|
|
22114
22161
|
return c.text("Not found", 404);
|
|
22115
22162
|
}
|
|
@@ -22139,7 +22186,7 @@ app54.get("/generated/:filename", (c) => {
|
|
|
22139
22186
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
22140
22187
|
return c.text("Forbidden", 403);
|
|
22141
22188
|
}
|
|
22142
|
-
if (!
|
|
22189
|
+
if (!existsSync32(filePath)) {
|
|
22143
22190
|
console.error(`[generated] serve file=${filename} status=404`);
|
|
22144
22191
|
return c.text("Not found", 404);
|
|
22145
22192
|
}
|
|
@@ -22159,7 +22206,7 @@ app54.route("/v", visitor_consent_default);
|
|
|
22159
22206
|
var htmlCache = /* @__PURE__ */ new Map();
|
|
22160
22207
|
var brandLogoPath = "/brand/maxy-monochrome.png";
|
|
22161
22208
|
var brandIconPath = "/brand/maxy-monochrome.png";
|
|
22162
|
-
if (BRAND_JSON_PATH &&
|
|
22209
|
+
if (BRAND_JSON_PATH && existsSync32(BRAND_JSON_PATH)) {
|
|
22163
22210
|
try {
|
|
22164
22211
|
const fullBrand = JSON.parse(readFileSync33(BRAND_JSON_PATH, "utf-8"));
|
|
22165
22212
|
if (fullBrand.assets?.logo) brandLogoPath = `/brand/${fullBrand.assets.logo}`;
|
|
@@ -22188,7 +22235,7 @@ var brandScript = `<script>window.__BRAND__=${JSON.stringify({
|
|
|
22188
22235
|
var brandThemeColor = BRAND.defaultColors?.primary ?? "#000000";
|
|
22189
22236
|
var brandBackgroundColor = BRAND.defaultColors?.background ?? "#ffffff";
|
|
22190
22237
|
var brandAppIconsExist = [brandAppIcon192Path, brandAppIcon512Path, brandMaskableIconPath].every(
|
|
22191
|
-
(p) =>
|
|
22238
|
+
(p) => existsSync32(resolve34(process.cwd(), "public", p.replace(/^\//, "")))
|
|
22192
22239
|
);
|
|
22193
22240
|
var SW_SOURCE = (() => {
|
|
22194
22241
|
try {
|
|
@@ -22200,8 +22247,8 @@ var SW_SOURCE = (() => {
|
|
|
22200
22247
|
function readInstalledVersion() {
|
|
22201
22248
|
try {
|
|
22202
22249
|
if (!PLATFORM_ROOT8) return "unknown";
|
|
22203
|
-
const versionFile =
|
|
22204
|
-
if (!
|
|
22250
|
+
const versionFile = join32(PLATFORM_ROOT8, "config", `.${BRAND.hostname}-version`);
|
|
22251
|
+
if (!existsSync32(versionFile)) return "unknown";
|
|
22205
22252
|
const content = readFileSync33(versionFile, "utf-8").trim();
|
|
22206
22253
|
return content || "unknown";
|
|
22207
22254
|
} catch {
|
|
@@ -22260,12 +22307,12 @@ ${clientErrorReporterScript}
|
|
|
22260
22307
|
return html;
|
|
22261
22308
|
}
|
|
22262
22309
|
function loadBrandingCache(agentSlug) {
|
|
22263
|
-
const configDir2 =
|
|
22310
|
+
const configDir2 = join32(homedir3(), BRAND.configDir);
|
|
22264
22311
|
try {
|
|
22265
22312
|
const accountId = getDefaultAccountId();
|
|
22266
22313
|
if (!accountId) return null;
|
|
22267
|
-
const cachePath =
|
|
22268
|
-
if (!
|
|
22314
|
+
const cachePath = join32(configDir2, "branding-cache", accountId, `${agentSlug}.json`);
|
|
22315
|
+
if (!existsSync32(cachePath)) return null;
|
|
22269
22316
|
return JSON.parse(readFileSync33(cachePath, "utf-8"));
|
|
22270
22317
|
} catch {
|
|
22271
22318
|
return null;
|
|
@@ -22484,11 +22531,11 @@ var hostname = process.env.HOSTNAME ?? "127.0.0.1";
|
|
|
22484
22531
|
var httpServer = serve({ fetch: app54.fetch, port, hostname });
|
|
22485
22532
|
console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
22486
22533
|
{
|
|
22487
|
-
const reconcilePlatformRoot = process.env.MAXY_PLATFORM_ROOT ??
|
|
22534
|
+
const reconcilePlatformRoot = process.env.MAXY_PLATFORM_ROOT ?? join32(__dirname, "..");
|
|
22488
22535
|
const reconcileScript = resolve34(reconcilePlatformRoot, "plugins/scheduling/mcp/dist/scripts/reconcile-bookings.js");
|
|
22489
22536
|
const RECONCILE_INTERVAL_MS = 12e4;
|
|
22490
22537
|
const runReconcile = () => {
|
|
22491
|
-
if (!
|
|
22538
|
+
if (!existsSync32(reconcileScript)) return;
|
|
22492
22539
|
try {
|
|
22493
22540
|
const child = spawn3(process.execPath, [reconcileScript], {
|
|
22494
22541
|
env: { ...process.env, PLATFORM_ROOT: reconcilePlatformRoot },
|
|
@@ -22505,6 +22552,29 @@ console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
|
22505
22552
|
const loop = setInterval(runReconcile, RECONCILE_INTERVAL_MS);
|
|
22506
22553
|
loop.unref();
|
|
22507
22554
|
}
|
|
22555
|
+
{
|
|
22556
|
+
const auditPlatformRoot = process.env.MAXY_PLATFORM_ROOT ?? join32(__dirname, "..");
|
|
22557
|
+
const auditScript = resolve34(auditPlatformRoot, "plugins/connector/mcp/dist/scripts/audit-connectors.js");
|
|
22558
|
+
const auditLogDir = process.env.LOG_DIR ?? LOG_DIR;
|
|
22559
|
+
const CONNECTOR_AUDIT_INTERVAL_MS = 3e5;
|
|
22560
|
+
const runConnectorAudit = () => {
|
|
22561
|
+
if (!existsSync32(auditScript)) return;
|
|
22562
|
+
try {
|
|
22563
|
+
const child = spawn3(process.execPath, [auditScript], {
|
|
22564
|
+
env: { ...process.env, PLATFORM_ROOT: auditPlatformRoot, LOG_DIR: auditLogDir },
|
|
22565
|
+
stdio: "inherit"
|
|
22566
|
+
});
|
|
22567
|
+
child.unref();
|
|
22568
|
+
child.on("error", (err) => console.error(`[connector-audit] spawn-failed err="${err.message}"`));
|
|
22569
|
+
} catch (err) {
|
|
22570
|
+
console.error(`[connector-audit] spawn-failed err="${err.message}"`);
|
|
22571
|
+
}
|
|
22572
|
+
};
|
|
22573
|
+
const firstAudit = setTimeout(runConnectorAudit, 3e4);
|
|
22574
|
+
firstAudit.unref();
|
|
22575
|
+
const auditLoop = setInterval(runConnectorAudit, CONNECTOR_AUDIT_INTERVAL_MS);
|
|
22576
|
+
auditLoop.unref();
|
|
22577
|
+
}
|
|
22508
22578
|
{
|
|
22509
22579
|
const census = pwaCensus({
|
|
22510
22580
|
shellHtml: (file) => {
|
|
@@ -22598,7 +22668,7 @@ try {
|
|
|
22598
22668
|
var ADMINUSER_RECONCILE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
22599
22669
|
async function runAdminUserReconcileTick() {
|
|
22600
22670
|
try {
|
|
22601
|
-
if (!
|
|
22671
|
+
if (!existsSync32(USERS_FILE)) {
|
|
22602
22672
|
console.error("[adminuser-self-heal] skip reason=no-users-file");
|
|
22603
22673
|
return;
|
|
22604
22674
|
}
|
|
@@ -22716,7 +22786,7 @@ if (bootAccountConfig?.whatsapp) {
|
|
|
22716
22786
|
}
|
|
22717
22787
|
init({
|
|
22718
22788
|
configDir: configDirForWhatsApp,
|
|
22719
|
-
platformRoot: resolve34(process.env.MAXY_PLATFORM_ROOT ??
|
|
22789
|
+
platformRoot: resolve34(process.env.MAXY_PLATFORM_ROOT ?? join32(__dirname, "..")),
|
|
22720
22790
|
accountConfig: bootAccountConfig,
|
|
22721
22791
|
onMessage: async (msg) => {
|
|
22722
22792
|
if (msg.isOwnerMirror) {
|