@rubytech/create-maxy-code 0.1.540 → 0.1.542
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +3 -1
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +10 -0
- package/payload/platform/plugins/docs/references/internals.md +2 -0
- package/payload/platform/plugins/whatsapp/PLUGIN.md +1 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/config-forwards-every-declared-field.test.d.ts +2 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/config-forwards-every-declared-field.test.d.ts.map +1 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/config-forwards-every-declared-field.test.js +57 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/config-forwards-every-declared-field.test.js.map +1 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/deliverability-grounding.test.js +9 -2
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/deliverability-grounding.test.js.map +1 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/group-info-call-site.test.d.ts +2 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/group-info-call-site.test.d.ts.map +1 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/group-info-call-site.test.js +98 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/group-info-call-site.test.js.map +1 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js +18 -7
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +3 -3
- package/payload/platform/scripts/check-no-live-location-claims.mjs +73 -0
- package/payload/platform/services/claude-session-manager/dist/http-server.js +4 -4
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +41 -28
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/server/{chunk-TQTZXAK3.js → chunk-HZP7BKBF.js} +0 -91
- package/payload/server/{manager-F6NXSOJW.js → manager-CM55K4J2.js} +1 -1
- package/payload/server/server.js +154 -40
package/payload/server/server.js
CHANGED
|
@@ -199,7 +199,7 @@ import {
|
|
|
199
199
|
waitForConnection,
|
|
200
200
|
warnNonUuidAccount,
|
|
201
201
|
writeChatMetadataMerged
|
|
202
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-HZP7BKBF.js";
|
|
203
203
|
import {
|
|
204
204
|
ACCOUNTS_DIR,
|
|
205
205
|
BIN_DIR,
|
|
@@ -3399,6 +3399,33 @@ app.get("/", async (c) => {
|
|
|
3399
3399
|
});
|
|
3400
3400
|
var health_default = app;
|
|
3401
3401
|
|
|
3402
|
+
// app/lib/claude-agent/public-address.ts
|
|
3403
|
+
function resolvePublicAddress(slug, accounts, houseAccountId, isActive) {
|
|
3404
|
+
const claimants = accounts.filter((a) => isActive(a.accountDir, slug));
|
|
3405
|
+
if (claimants.length === 0) return { kind: "none" };
|
|
3406
|
+
if (claimants.length === 1) return { kind: "served", owner: claimants[0], refused: [] };
|
|
3407
|
+
const house = claimants.find((a) => a.accountId === houseAccountId);
|
|
3408
|
+
if (!house) return { kind: "ambiguous", claimants: claimants.map((a) => a.accountId) };
|
|
3409
|
+
return {
|
|
3410
|
+
kind: "served",
|
|
3411
|
+
owner: house,
|
|
3412
|
+
refused: claimants.filter((a) => a.accountId !== house.accountId).map((a) => a.accountId)
|
|
3413
|
+
};
|
|
3414
|
+
}
|
|
3415
|
+
function resolvePublicAddressFromDisk(slug) {
|
|
3416
|
+
const accounts = listValidAccounts().map((a) => ({ accountId: a.accountId, accountDir: a.accountDir }));
|
|
3417
|
+
return resolvePublicAddress(slug, accounts, resolveAccount()?.accountId ?? null, isActiveAgentSlug);
|
|
3418
|
+
}
|
|
3419
|
+
function logPublicAddress(slug, verdict) {
|
|
3420
|
+
if (verdict.kind === "served" && verdict.refused.length > 0) {
|
|
3421
|
+
console.error(
|
|
3422
|
+
`[webchat] op=address-collision slug=${slug} served=${verdict.owner.accountId} refused=${verdict.refused.join(",")}`
|
|
3423
|
+
);
|
|
3424
|
+
} else if (verdict.kind === "ambiguous") {
|
|
3425
|
+
console.error(`[webchat] op=address-collision slug=${slug} served=none refused=${verdict.claimants.join(",")}`);
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3402
3429
|
// app/lib/stt/voice-note.ts
|
|
3403
3430
|
import { writeFile, mkdtemp, rm } from "fs/promises";
|
|
3404
3431
|
import { tmpdir } from "os";
|
|
@@ -3593,15 +3620,43 @@ function isAdminKeyNamespace(key) {
|
|
|
3593
3620
|
function webchatTurnTimeoutMs() {
|
|
3594
3621
|
return Number(process.env.WEBCHAT_TURN_TIMEOUT_MS ?? String(2 * 6e4));
|
|
3595
3622
|
}
|
|
3623
|
+
function resolveServingAccount(requestedSlug) {
|
|
3624
|
+
if (requestedSlug) {
|
|
3625
|
+
if (!validateAgentSlug(requestedSlug)) {
|
|
3626
|
+
console.log(`[webchat] op=resolve slug=${requestedSlug} source=none agent=none account=none`);
|
|
3627
|
+
return { ok: false, status: 404, error: "no-agent-for-address" };
|
|
3628
|
+
}
|
|
3629
|
+
const verdict = resolvePublicAddressFromDisk(requestedSlug);
|
|
3630
|
+
logPublicAddress(requestedSlug, verdict);
|
|
3631
|
+
if (verdict.kind !== "served") {
|
|
3632
|
+
console.log(`[webchat] op=resolve slug=${requestedSlug} source=none agent=none account=none`);
|
|
3633
|
+
return { ok: false, status: 404, error: "no-agent-for-address" };
|
|
3634
|
+
}
|
|
3635
|
+
console.log(
|
|
3636
|
+
`[webchat] op=resolve slug=${requestedSlug} source=slug agent=${requestedSlug} account=${verdict.owner.accountId}`
|
|
3637
|
+
);
|
|
3638
|
+
return { ok: true, account: verdict.owner, agentSlug: requestedSlug };
|
|
3639
|
+
}
|
|
3640
|
+
const house = resolveAccount();
|
|
3641
|
+
if (!house) {
|
|
3642
|
+
console.log("[webchat] op=resolve slug=none source=none agent=none account=none");
|
|
3643
|
+
return { ok: false, status: 500, error: "No account configured" };
|
|
3644
|
+
}
|
|
3645
|
+
const agentSlug = resolveDefaultAgentSlug(house.accountDir);
|
|
3646
|
+
if (!agentSlug) {
|
|
3647
|
+
console.log(`[webchat] op=resolve slug=none source=none agent=none account=${house.accountId}`);
|
|
3648
|
+
return { ok: false, status: 404, error: "no-agent-for-address" };
|
|
3649
|
+
}
|
|
3650
|
+
console.log(
|
|
3651
|
+
`[webchat] op=resolve slug=none source=default-fallback agent=${agentSlug} account=${house.accountId}`
|
|
3652
|
+
);
|
|
3653
|
+
return { ok: true, account: { accountId: house.accountId, accountDir: house.accountDir }, agentSlug };
|
|
3654
|
+
}
|
|
3596
3655
|
function createChatRoutes(deps) {
|
|
3597
3656
|
const app77 = new Hono();
|
|
3598
3657
|
app77.post("/", async (c) => {
|
|
3599
3658
|
console.log(`[chat-route] entered route=public method=POST`);
|
|
3600
3659
|
const contentType = c.req.header("content-type") ?? "";
|
|
3601
|
-
const account = resolveAccount();
|
|
3602
|
-
if (!account) {
|
|
3603
|
-
return c.json({ error: "No account configured" }, 500);
|
|
3604
|
-
}
|
|
3605
3660
|
let message;
|
|
3606
3661
|
let session_key;
|
|
3607
3662
|
let userTimestamp;
|
|
@@ -3611,6 +3666,8 @@ function createChatRoutes(deps) {
|
|
|
3611
3666
|
let requestFormat;
|
|
3612
3667
|
let attachmentCount = 0;
|
|
3613
3668
|
let requestedSlug;
|
|
3669
|
+
let account;
|
|
3670
|
+
let agentSlug;
|
|
3614
3671
|
if (contentType.startsWith("multipart/form-data")) {
|
|
3615
3672
|
requestFormat = "multipart";
|
|
3616
3673
|
let formData;
|
|
@@ -3633,6 +3690,10 @@ function createChatRoutes(deps) {
|
|
|
3633
3690
|
if (!SESSION_KEY_RE.test(session_key)) {
|
|
3634
3691
|
return c.json({ error: "session_key has invalid shape" }, 400);
|
|
3635
3692
|
}
|
|
3693
|
+
const serving = resolveServingAccount(requestedSlug);
|
|
3694
|
+
if (!serving.ok) return c.json({ error: serving.error }, serving.status);
|
|
3695
|
+
account = serving.account;
|
|
3696
|
+
agentSlug = serving.agentSlug;
|
|
3636
3697
|
const files = formData.getAll("attachments");
|
|
3637
3698
|
if (files.length > MAX_FILES_PER_MESSAGE) {
|
|
3638
3699
|
return c.json({ error: `Maximum ${MAX_FILES_PER_MESSAGE} files per message.` }, 422);
|
|
@@ -3710,26 +3771,16 @@ ${result.result.text}` : result.result.text;
|
|
|
3710
3771
|
if (!message) {
|
|
3711
3772
|
return c.json({ error: "message required" }, 400);
|
|
3712
3773
|
}
|
|
3774
|
+
const serving = resolveServingAccount(requestedSlug);
|
|
3775
|
+
if (!serving.ok) return c.json({ error: serving.error }, serving.status);
|
|
3776
|
+
account = serving.account;
|
|
3777
|
+
agentSlug = serving.agentSlug;
|
|
3713
3778
|
}
|
|
3714
3779
|
console.log(
|
|
3715
3780
|
`[chat-route] session=${session_key.slice(0, 8)} format=${requestFormat} messageLen=${message.length} attachments=${attachmentCount} staleTopicFields=${hasStaleTopicFields}`
|
|
3716
3781
|
);
|
|
3717
3782
|
const fullMessage = message + uploadNote;
|
|
3718
3783
|
const encoder = new TextEncoder();
|
|
3719
|
-
let agentSlug;
|
|
3720
|
-
let resolveSource;
|
|
3721
|
-
if (requestedSlug) {
|
|
3722
|
-
const active = validateAgentSlug(requestedSlug) && isActiveAgentSlug(account.accountDir, requestedSlug);
|
|
3723
|
-
agentSlug = active ? requestedSlug : null;
|
|
3724
|
-
resolveSource = active ? "slug" : "none";
|
|
3725
|
-
} else {
|
|
3726
|
-
agentSlug = resolveDefaultAgentSlug(account.accountDir);
|
|
3727
|
-
resolveSource = agentSlug ? "default-fallback" : "none";
|
|
3728
|
-
}
|
|
3729
|
-
console.log(`[webchat] op=resolve slug=${requestedSlug ?? "none"} source=${resolveSource} agent=${agentSlug ?? "none"}`);
|
|
3730
|
-
if (!agentSlug) {
|
|
3731
|
-
return c.json({ error: "no-agent-for-address" }, 404);
|
|
3732
|
-
}
|
|
3733
3784
|
let accessMode = "open";
|
|
3734
3785
|
try {
|
|
3735
3786
|
const config = resolveAgentConfig(account.accountDir, agentSlug);
|
|
@@ -5029,7 +5080,7 @@ async function defaultHttpGet(url) {
|
|
|
5029
5080
|
}
|
|
5030
5081
|
}
|
|
5031
5082
|
async function defaultResolve(accountId) {
|
|
5032
|
-
const { resolveSocket: resolveSocket2 } = await import("./manager-
|
|
5083
|
+
const { resolveSocket: resolveSocket2 } = await import("./manager-CM55K4J2.js");
|
|
5033
5084
|
return resolveSocket2(accountId);
|
|
5034
5085
|
}
|
|
5035
5086
|
async function fetchAvatar(accountId, jid, deps = {}) {
|
|
@@ -8244,7 +8295,8 @@ app3.get("/conversation-graph-state", async (c) => {
|
|
|
8244
8295
|
});
|
|
8245
8296
|
app3.get("/group-info", async (c) => {
|
|
8246
8297
|
const { accountId, targetSource } = resolveLifecycleAccountId(c, c.req.query("accountId") ?? null);
|
|
8247
|
-
const callerAccountId = c
|
|
8298
|
+
const { denial, callerAccountId } = callerScopeDenial(c, accountId, targetSource);
|
|
8299
|
+
if (denial) return denial;
|
|
8248
8300
|
const scope = `account=${accountId} targetSource=${targetSource} caller=${callerAccountId ?? "none"}`;
|
|
8249
8301
|
const jid = c.req.query("jid");
|
|
8250
8302
|
try {
|
|
@@ -11883,7 +11935,8 @@ function enumeratePublicRows() {
|
|
|
11883
11935
|
senderId: meta.senderId,
|
|
11884
11936
|
startedAt: meta.startedAt,
|
|
11885
11937
|
visitorId: meta.visitorId,
|
|
11886
|
-
agentSlug: meta.agentSlug
|
|
11938
|
+
agentSlug: meta.agentSlug,
|
|
11939
|
+
accountId: meta.accountId
|
|
11887
11940
|
});
|
|
11888
11941
|
}
|
|
11889
11942
|
return rows;
|
|
@@ -11899,13 +11952,13 @@ app8.get("/session", (c) => {
|
|
|
11899
11952
|
if (visitor.kind === "person") {
|
|
11900
11953
|
found = resolveVisitorSession(rows, visitor.personId);
|
|
11901
11954
|
} else {
|
|
11902
|
-
const account = resolveAccount();
|
|
11903
11955
|
const agentParam = c.req.query("agent");
|
|
11904
11956
|
let effectiveSlug;
|
|
11905
11957
|
if (agentParam) {
|
|
11906
|
-
effectiveSlug =
|
|
11958
|
+
effectiveSlug = validateAgentSlug(agentParam) && resolvePublicAddressFromDisk(agentParam).kind === "served" ? agentParam : null;
|
|
11907
11959
|
} else {
|
|
11908
|
-
|
|
11960
|
+
const house = resolveAccount();
|
|
11961
|
+
effectiveSlug = house ? resolveDefaultAgentSlug(house.accountDir) : null;
|
|
11909
11962
|
}
|
|
11910
11963
|
found = effectiveSlug ? resolveOpenVisitorSession(rows, visitor.visitorId, effectiveSlug) : null;
|
|
11911
11964
|
}
|
|
@@ -11971,8 +12024,8 @@ app8.get("/stream", (c) => {
|
|
|
11971
12024
|
data: ${JSON.stringify(turn)}
|
|
11972
12025
|
|
|
11973
12026
|
`));
|
|
11974
|
-
const
|
|
11975
|
-
const uploadsDir =
|
|
12027
|
+
const uploadAccountId = meta.accountId ?? resolveAccount()?.accountId ?? null;
|
|
12028
|
+
const uploadsDir = uploadAccountId ? publicUploadsDir(uploadAccountId, sessionId) : null;
|
|
11976
12029
|
const attachmentCursor = { consumed: 0 };
|
|
11977
12030
|
const readable = new ReadableStream({
|
|
11978
12031
|
start(controller) {
|
|
@@ -12051,12 +12104,12 @@ app8.get("/attachment/:attachmentId", (c) => {
|
|
|
12051
12104
|
console.error(`${ATT_TAG} op=denied session=${ses} att=${at} reason=foreign-session`);
|
|
12052
12105
|
return new Response("Not found", { status: 404 });
|
|
12053
12106
|
}
|
|
12054
|
-
const
|
|
12055
|
-
if (!
|
|
12107
|
+
const uploadAccountId = row.accountId ?? resolveAccount()?.accountId ?? null;
|
|
12108
|
+
if (!uploadAccountId) {
|
|
12056
12109
|
console.error(`${ATT_TAG} op=denied session=${ses} att=${at} reason=not-found`);
|
|
12057
12110
|
return new Response("Not found", { status: 404 });
|
|
12058
12111
|
}
|
|
12059
|
-
const uploadsRoot = publicUploadsDir(
|
|
12112
|
+
const uploadsRoot = publicUploadsDir(uploadAccountId, sessionId);
|
|
12060
12113
|
const dir = resolve15(uploadsRoot, attachmentId);
|
|
12061
12114
|
if (!dir.startsWith(uploadsRoot + sep7)) {
|
|
12062
12115
|
console.error(`${ATT_TAG} op=denied session=${ses} att=${at} reason=bad-id`);
|
|
@@ -27170,30 +27223,34 @@ app73.post("/", async (c) => {
|
|
|
27170
27223
|
if (!body.session_id || typeof body.session_id !== "string") {
|
|
27171
27224
|
return c.json({ error: "session_id required" }, 400);
|
|
27172
27225
|
}
|
|
27173
|
-
const accountId = getDefaultAccountId();
|
|
27174
|
-
if (!accountId) {
|
|
27175
|
-
console.error("[session] getDefaultAccountId() returned null \u2014 no account configured");
|
|
27176
|
-
return c.json({ error: "No account configured" }, 503);
|
|
27177
|
-
}
|
|
27178
|
-
const account = resolveAccount();
|
|
27179
27226
|
const cookieHeader = c.req.header("cookie");
|
|
27180
27227
|
const visitorId = parseVisitorCookie2(cookieHeader);
|
|
27228
|
+
let account;
|
|
27181
27229
|
let agentSlug = null;
|
|
27182
27230
|
if (body.agent) {
|
|
27183
27231
|
if (!validateAgentSlug(body.agent)) {
|
|
27184
27232
|
return c.json({ error: "Invalid agent name" }, 400);
|
|
27185
27233
|
}
|
|
27186
|
-
|
|
27234
|
+
const verdict = resolvePublicAddressFromDisk(body.agent);
|
|
27235
|
+
logPublicAddress(body.agent, verdict);
|
|
27236
|
+
if (verdict.kind !== "served") {
|
|
27187
27237
|
console.error(`[session] op=reject agent=${body.agent} reason=not-active`);
|
|
27188
27238
|
return c.json({ error: "no-agent-for-address" }, 404);
|
|
27189
27239
|
}
|
|
27240
|
+
account = verdict.owner;
|
|
27190
27241
|
agentSlug = body.agent;
|
|
27191
27242
|
} else {
|
|
27243
|
+
account = resolveAccount();
|
|
27192
27244
|
agentSlug = account ? resolveDefaultAgentSlug(account.accountDir) : null;
|
|
27193
27245
|
if (agentSlug) {
|
|
27194
27246
|
console.log(`[session] using defaultAgent=${agentSlug} (no agent param)`);
|
|
27195
27247
|
}
|
|
27196
27248
|
}
|
|
27249
|
+
const accountId = account?.accountId ?? null;
|
|
27250
|
+
if (!accountId) {
|
|
27251
|
+
console.error("[session] no account resolved for this address");
|
|
27252
|
+
return c.json({ error: "No account configured" }, 503);
|
|
27253
|
+
}
|
|
27197
27254
|
if (!agentSlug) {
|
|
27198
27255
|
console.error("[session] no agent resolved");
|
|
27199
27256
|
return c.json({ error: "No agents configured" }, 404);
|
|
@@ -30664,6 +30721,7 @@ function buildPublicWebchatSpawnRequest(input) {
|
|
|
30664
30721
|
role: "public",
|
|
30665
30722
|
channel: "webchat",
|
|
30666
30723
|
accountId: input.accountId,
|
|
30724
|
+
agentAccountId: input.accountId,
|
|
30667
30725
|
agentSlug,
|
|
30668
30726
|
model: SONNET_MODEL,
|
|
30669
30727
|
// sliceToken/personId are present only for a gated visitor; open-mode
|
|
@@ -31559,6 +31617,37 @@ function warnOnChannelAdminBindingDrift() {
|
|
|
31559
31617
|
}
|
|
31560
31618
|
}
|
|
31561
31619
|
|
|
31620
|
+
// app/lib/webchat/public-address-collision-audit.ts
|
|
31621
|
+
function auditPublicAddressCollisions(deps) {
|
|
31622
|
+
const house = deps.houseAccountId();
|
|
31623
|
+
const byslug = /* @__PURE__ */ new Map();
|
|
31624
|
+
let checked2 = 0;
|
|
31625
|
+
for (const row of deps.activeSlugs()) {
|
|
31626
|
+
for (const slug of row.slugs) {
|
|
31627
|
+
checked2++;
|
|
31628
|
+
byslug.set(slug, [...byslug.get(slug) ?? [], row.accountId]);
|
|
31629
|
+
}
|
|
31630
|
+
}
|
|
31631
|
+
const collisions = [];
|
|
31632
|
+
for (const [slug, claimants] of byslug) {
|
|
31633
|
+
if (claimants.length < 2) continue;
|
|
31634
|
+
const served = house !== null && claimants.includes(house) ? house : null;
|
|
31635
|
+
collisions.push({ slug, served, refused: claimants.filter((id) => id !== served) });
|
|
31636
|
+
}
|
|
31637
|
+
return { checked: checked2, collisions };
|
|
31638
|
+
}
|
|
31639
|
+
function runPublicAddressCollisionAudit(deps) {
|
|
31640
|
+
const result = auditPublicAddressCollisions(deps);
|
|
31641
|
+
for (const row of result.collisions) {
|
|
31642
|
+
console.error(
|
|
31643
|
+
`[webchat:public-address] op=collision slug=${row.slug} served=${row.served ?? "none"} refused=${row.refused.join(",")}`
|
|
31644
|
+
);
|
|
31645
|
+
}
|
|
31646
|
+
console.error(
|
|
31647
|
+
`[webchat:public-address] op=collision-audit checked=${result.checked} collisions=${result.collisions.length}`
|
|
31648
|
+
);
|
|
31649
|
+
}
|
|
31650
|
+
|
|
31562
31651
|
// server/lib/booking-site-accounts.ts
|
|
31563
31652
|
import { existsSync as existsSync48, readFileSync as readFileSync45 } from "fs";
|
|
31564
31653
|
import { resolve as resolve43 } from "path";
|
|
@@ -32852,7 +32941,8 @@ ${clientErrorReporterScript}
|
|
|
32852
32941
|
function loadBrandingCache(agentSlug) {
|
|
32853
32942
|
const configDir = join53(homedir4(), BRAND.configDir);
|
|
32854
32943
|
try {
|
|
32855
|
-
const
|
|
32944
|
+
const verdict = resolvePublicAddressFromDisk(agentSlug);
|
|
32945
|
+
const accountId = verdict.kind === "served" ? verdict.owner.accountId : getDefaultAccountId();
|
|
32856
32946
|
if (!accountId) return null;
|
|
32857
32947
|
const cachePath = join53(configDir, "branding-cache", accountId, `${agentSlug}.json`);
|
|
32858
32948
|
if (!existsSync50(cachePath)) return null;
|
|
@@ -33068,8 +33158,9 @@ app76.get("/browser", (c) => {
|
|
|
33068
33158
|
app76.get("/:slug", async (c, next) => {
|
|
33069
33159
|
const slug = c.req.param("slug");
|
|
33070
33160
|
if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
|
|
33071
|
-
const
|
|
33072
|
-
|
|
33161
|
+
const verdict = validateAgentSlug(slug) ? resolvePublicAddressFromDisk(slug) : { kind: "none" };
|
|
33162
|
+
logPublicAddress(slug, verdict);
|
|
33163
|
+
if (verdict.kind !== "served") {
|
|
33073
33164
|
console.error(`[public-catchall] op=reject path=/${slug} slug=${slug} reason=not-reachable`);
|
|
33074
33165
|
return c.html(agentUnavailableHtml(), 404);
|
|
33075
33166
|
}
|
|
@@ -33662,6 +33753,29 @@ registerLoop({
|
|
|
33662
33753
|
firstRunDelayMs: 0,
|
|
33663
33754
|
run: runIngestAuditTick
|
|
33664
33755
|
});
|
|
33756
|
+
var WEBCHAT_ADDRESS_AUDIT_INTERVAL_MS = 60 * 60 * 1e3;
|
|
33757
|
+
registerLoop({
|
|
33758
|
+
name: "webchat-address-audit",
|
|
33759
|
+
intervalMs: WEBCHAT_ADDRESS_AUDIT_INTERVAL_MS,
|
|
33760
|
+
firstRunDelayMs: 0,
|
|
33761
|
+
run: () => {
|
|
33762
|
+
try {
|
|
33763
|
+
runPublicAddressCollisionAudit({
|
|
33764
|
+
houseAccountId: () => resolveAccount()?.accountId ?? null,
|
|
33765
|
+
activeSlugs: () => listValidAccounts().map((a) => {
|
|
33766
|
+
const agentsRoot = join53(a.accountDir, "agents");
|
|
33767
|
+
if (!existsSync50(agentsRoot)) return { accountId: a.accountId, slugs: [] };
|
|
33768
|
+
const slugs = readdirSync29(agentsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).filter((slug) => isActiveAgentSlug(a.accountDir, slug));
|
|
33769
|
+
return { accountId: a.accountId, slugs };
|
|
33770
|
+
})
|
|
33771
|
+
});
|
|
33772
|
+
} catch (err) {
|
|
33773
|
+
console.error(
|
|
33774
|
+
`[webchat:public-address] op=collision-audit-rejected detail=${err instanceof Error ? err.message : String(err)}`
|
|
33775
|
+
);
|
|
33776
|
+
}
|
|
33777
|
+
}
|
|
33778
|
+
});
|
|
33665
33779
|
var USERS_RECONCILE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
33666
33780
|
function countUsersRows() {
|
|
33667
33781
|
if (!existsSync50(USERS_FILE)) return 0;
|