@rubytech/create-maxy-code 0.1.108 → 0.1.110
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/dist/index.js +11 -125
- package/dist/snap-chromium.js +1 -2
- package/dist/uninstall.js +10 -9
- package/package.json +1 -1
- package/payload/platform/plugins/admin/PLUGIN.md +1 -0
- package/payload/platform/plugins/admin/mcp/dist/index.js +1 -1
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/skills/upgrade/SKILL.md +34 -0
- package/payload/platform/plugins/cloudflare/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/cloudflare/PLUGIN.md +9 -16
- package/payload/platform/plugins/cloudflare/mcp/dist/index.js +7 -12
- package/payload/platform/plugins/cloudflare/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/cloudflare/references/dashboard-guide.md +3 -3
- package/payload/platform/plugins/cloudflare/references/manual-setup.md +16 -51
- package/payload/platform/plugins/cloudflare/references/reset-guide.md +24 -25
- package/payload/platform/plugins/cloudflare/skills/setup-tunnel/SKILL.md +29 -144
- package/payload/platform/plugins/docs/references/admin-session.md +1 -1
- package/payload/platform/plugins/docs/references/admin-ui.md +1 -1
- package/payload/platform/plugins/docs/references/cloudflare.md +20 -29
- package/payload/platform/plugins/docs/references/platform.md +4 -22
- package/payload/platform/plugins/docs/references/plugins-guide.md +1 -1
- package/payload/platform/plugins/docs/references/troubleshooting.md +4 -316
- package/payload/platform/plugins/venture-studio/PLUGIN.md +35 -4
- package/payload/platform/plugins/venture-studio/bin/scaffold.sh +104 -0
- package/payload/platform/plugins/venture-studio/skills/investor-data-room/SKILL.md +3 -1
- package/payload/platform/plugins/work/mcp/dist/cli/project-create-cli.d.ts +2 -0
- package/payload/platform/plugins/work/mcp/dist/cli/project-create-cli.d.ts.map +1 -0
- package/payload/platform/plugins/work/mcp/dist/cli/project-create-cli.js +78 -0
- package/payload/platform/plugins/work/mcp/dist/cli/project-create-cli.js.map +1 -0
- package/payload/platform/scripts/check-no-task-id-leaks.mjs +1 -1
- package/payload/platform/scripts/vnc.sh +4 -3
- package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
- package/payload/premium-plugins/venture-studio/PLUGIN.md +35 -4
- package/payload/premium-plugins/venture-studio/bin/scaffold.sh +104 -0
- package/payload/premium-plugins/venture-studio/skills/investor-data-room/SKILL.md +3 -1
- package/payload/server/{chunk-AGFS3TVN.js → chunk-FSPPVVWM.js} +1303 -496
- package/payload/server/maxy-edge.js +21 -259
- package/payload/server/public/assets/{ChatInput-DJsqm_Gf.js → ChatInput-CsnIedhS.js} +1 -5
- package/payload/server/public/assets/{Checkbox-DGZG9BKc.js → Checkbox-CWugFyFT.js} +1 -1
- package/payload/server/public/assets/admin-D3gZuyUn.js +217 -0
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-Dw16BhiX.js → architectureDiagram-Q4EWVU46-CeTRKWDb.js} +1 -1
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-DIOpmf5Y.js → blockDiagram-DXYQGD6D-DeeIX5U3.js} +1 -1
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-Tdb_HZeX.js → c4Diagram-AHTNJAMY-CFsqZuil.js} +1 -1
- package/payload/server/public/assets/channel-CrSx5mnG.js +1 -0
- package/payload/server/public/assets/{chunk-336JU56O-CebpwDDe.js → chunk-336JU56O-DpIXuFM0.js} +2 -2
- package/payload/server/public/assets/{chunk-426QAEUC-BtRCmfDU.js → chunk-426QAEUC-Qk8qqrvA.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-BZ3GEWs3.js → chunk-4TB4RGXK-DtM8-CUn.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-iDI6Xu0U.js → chunk-5FUZZQ4R-CrSQ4ySU.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-SQD_EpYa.js → chunk-5PVQY5BW-Bn2nQwdj.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-CtCcA7_e.js → chunk-EDXVE4YY-CzCPnR0P.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-pXVGVCbb.js → chunk-ENJZ2VHE-CgZj9RoG.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-Dkzg9o2N.js → chunk-ICPOFSXX-wy-eNjwW.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-1ZZWzf9F.js → chunk-OYMX7WX6-CMmJtL8S.js} +1 -1
- package/payload/server/public/assets/{chunk-U2HBQHQK-CpQ3kzO0.js → chunk-U2HBQHQK-CFCW7OaT.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-C2LkxroC.js → chunk-X2U36JSP-Bgh-CJSN.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-Bl5jBOt5.js → chunk-YZCP3GAM-BXKwZ4vN.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-CHtnptPS.js → chunk-ZZ45TVLE-BiOuK5NP.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-C3IDJsqN.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-BOIrJ5Zb.js +1 -0
- package/payload/server/public/assets/clone-P8Fkz7JD.js +1 -0
- package/payload/server/public/assets/{dagre-BziN0Nkh.js → dagre-DyCxa9Q2.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-B7OG1g1Y.js → dagre-KV5264BT-Cffo_hmf.js} +1 -1
- package/payload/server/public/assets/data-DRfwJPja.js +1 -0
- package/payload/server/public/assets/{diagram-5BDNPKRD-Bf31nIDs.js → diagram-5BDNPKRD-Bt93Du3V.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-DQu85hhH.js → diagram-G4DWMVQ6-v4r-tBsC.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-5tstbs4y.js → diagram-MMDJMWI5-DKrVPOP-.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635--MOV1U4o.js → diagram-TYMM5635-B1PzWQb9.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-BtAnOJmd.js → erDiagram-SMLLAGMA-ClQzsQAs.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-CybiCIih.js → flowDiagram-DWJPFMVM-h3IbpN_7.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-B44jN7Cy.js → ganttDiagram-T4ZO3ILL-ClaxOJi8.js} +1 -1
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-CT7iYcwg.js → gitGraphDiagram-UUTBAWPF-pM-U4ClD.js} +1 -1
- package/payload/server/public/assets/graph-B4FFYwus.js +1 -0
- package/payload/server/public/assets/graph-labels-Cpk9Ktt0.js +1 -0
- package/payload/server/public/assets/{graphlib-DP4o0pYL.js → graphlib-CwimOv_M.js} +1 -1
- package/payload/server/public/assets/{infoDiagram-42DDH7IO-CvxFpFHN.js → infoDiagram-42DDH7IO-DcO3Giwe.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-CUwWLPeR.js → ishikawaDiagram-UXIWVN3A-BcdSL5VS.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-y-OnGgLi.js → journeyDiagram-VCZTEJTY-CYahHYzf.js} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-BhrSe8R4.js → kanban-definition-6JOO6SKY-Cl5KhoS4.js} +1 -1
- package/payload/server/public/assets/lib--yuBd0Xi.js +33 -0
- package/payload/server/public/assets/{line-C9uS7z4J.js → line-d_2oTxLp.js} +1 -1
- package/payload/server/public/assets/{mermaid-parser.core-Cg4ZdKp-.js → mermaid-parser.core-CMMDGv3x.js} +1 -1
- package/payload/server/public/assets/{mermaid.core-BHdKOsex.js → mermaid.core-DK9ENGbr.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-NBYiXHo7.js → mindmap-definition-QFDTVHPH-mA3x3MFG.js} +1 -1
- package/payload/server/public/assets/page-CgDmg_fX.js +1 -0
- package/payload/server/public/assets/{page-D9YpwhIu.js → page-D9lluVl7.js} +2 -2
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-CbojC64C.js → pieDiagram-DEJITSTG-CW1nGFlY.js} +1 -1
- package/payload/server/public/assets/public-DdLMkNdS.js +7 -0
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-CnnoZXcL.js → quadrantDiagram-34T5L4WZ-DI5igJhR.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-DFRFRtyJ.js → requirementDiagram-MS252O5E-DyVeI4e_.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-DU5gcpzO.js → sankeyDiagram-XADWPNL6-CCTTBYKY.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-BN7HZ6Hq.js → sequenceDiagram-FGHM5R23-hVVf35ly.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-DG6cCjvg.js → stateDiagram-FHFEXIEX-CSLuQDUX.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-C5JejhQU.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-qmV-8SEV.js → timeline-definition-GMOUNBTQ-sxC3W8Q4.js} +1 -1
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-BMXQ1s3n.js → vennDiagram-DHZGUBPP-Ro-ton6Z.js} +1 -1
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-CoAdP1Gw.js → wardleyDiagram-NUSXRM2D-T-dKD0Zx.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-CZlfGTEn.js → xychartDiagram-5P7HB3ND-CfProPts.js} +1 -1
- package/payload/server/public/data.html +4 -4
- package/payload/server/public/graph.html +5 -5
- package/payload/server/public/index.html +7 -7
- package/payload/server/public/public.html +4 -4
- package/payload/server/server.js +299 -1392
- package/payload/platform/plugins/cloudflare/scripts/__tests__/tunnel-ingress.test.ts +0 -241
- package/payload/platform/plugins/cloudflare/scripts/_stream-log.sh +0 -154
- package/payload/platform/plugins/cloudflare/scripts/list-cf-domains.sh +0 -98
- package/payload/platform/plugins/cloudflare/scripts/list-cf-domains.ts +0 -749
- package/payload/platform/plugins/cloudflare/scripts/reset-tunnel.sh +0 -107
- package/payload/platform/plugins/cloudflare/scripts/setup-tunnel.sh +0 -854
- package/payload/platform/plugins/cloudflare/scripts/tunnel-ingress.ts +0 -291
- package/payload/server/chunk-BDFOTLPW.js +0 -759
- package/payload/server/chunk-JRBCOVA4.js +0 -1305
- package/payload/server/cloudflare-task-tracker-M5ONAGUT.js +0 -22
- package/payload/server/public/assets/admin-BvzMvMGo.js +0 -217
- package/payload/server/public/assets/channel-DThrH4QF.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-BC6oGTNX.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-COwC5Umh.js +0 -1
- package/payload/server/public/assets/clone-Chp7hvnA.js +0 -1
- package/payload/server/public/assets/data-BAgaPs4j.js +0 -1
- package/payload/server/public/assets/graph-Cma7EArf.js +0 -1
- package/payload/server/public/assets/graph-labels-DyKk6Sxf.js +0 -1
- package/payload/server/public/assets/lib-CpkYtEDz.js +0 -29
- package/payload/server/public/assets/page-B4IWl3aZ.js +0 -1
- package/payload/server/public/assets/public-BtOXjy3A.js +0 -8
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CvVd1Q_q.js +0 -1
|
@@ -2,31 +2,24 @@ import {
|
|
|
2
2
|
Hono,
|
|
3
3
|
LOG_DIR,
|
|
4
4
|
WEBSOCKIFY_PORT,
|
|
5
|
-
actionLogPath,
|
|
6
5
|
canAccessAdmin,
|
|
7
6
|
clientIpMiddleware,
|
|
8
7
|
describeRemoteSession,
|
|
9
8
|
getRequestListener,
|
|
10
|
-
isActionActive,
|
|
11
|
-
isKnownAction,
|
|
12
|
-
launchAction,
|
|
13
9
|
newCorrId,
|
|
14
10
|
parseCookieValue,
|
|
15
|
-
primeSudo,
|
|
16
11
|
requireAdminCookie,
|
|
17
12
|
requirePortEnv,
|
|
18
13
|
sanitizeClientCorrId,
|
|
19
|
-
streamActionEvents,
|
|
20
14
|
vncLog,
|
|
21
15
|
websockifyLog
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-JRBCOVA4.js";
|
|
16
|
+
} from "./chunk-FSPPVVWM.js";
|
|
24
17
|
import "./chunk-JSBRDJBE.js";
|
|
25
18
|
|
|
26
19
|
// server/edge.ts
|
|
27
20
|
import { createServer, request as httpRequest } from "http";
|
|
28
21
|
import { createConnection as createConnection2 } from "net";
|
|
29
|
-
import { readFileSync as readFileSync4, existsSync as
|
|
22
|
+
import { readFileSync as readFileSync4, existsSync as existsSync4, watchFile } from "fs";
|
|
30
23
|
import { homedir } from "os";
|
|
31
24
|
import { join as join4 } from "path";
|
|
32
25
|
|
|
@@ -317,248 +310,18 @@ Content-Length: 0\r
|
|
|
317
310
|
socket.destroy();
|
|
318
311
|
}
|
|
319
312
|
|
|
320
|
-
// server/routes/admin/actions/run.ts
|
|
321
|
-
var app = new Hono();
|
|
322
|
-
app.post("/:name", async (c) => {
|
|
323
|
-
const name = c.req.param("name");
|
|
324
|
-
if (!isKnownAction(name)) {
|
|
325
|
-
return c.json({ error: `unknown action: ${name}` }, 400);
|
|
326
|
-
}
|
|
327
|
-
const actionName = name;
|
|
328
|
-
if (await isActionActive(actionName)) {
|
|
329
|
-
return c.json({ error: `action ${actionName} is already running`, code: "already-active" }, 409);
|
|
330
|
-
}
|
|
331
|
-
let body = {};
|
|
332
|
-
try {
|
|
333
|
-
body = await c.req.json();
|
|
334
|
-
} catch {
|
|
335
|
-
}
|
|
336
|
-
const launchArgs = {};
|
|
337
|
-
if (Array.isArray(body.positional)) {
|
|
338
|
-
if (!body.positional.every((x) => typeof x === "string")) {
|
|
339
|
-
return c.json({ error: "positional args must be strings" }, 400);
|
|
340
|
-
}
|
|
341
|
-
launchArgs.positional = body.positional;
|
|
342
|
-
}
|
|
343
|
-
if (typeof body.sudoPassword === "string" && body.sudoPassword) {
|
|
344
|
-
launchArgs.sudoPassword = body.sudoPassword;
|
|
345
|
-
}
|
|
346
|
-
try {
|
|
347
|
-
const result = await launchAction(actionName, launchArgs);
|
|
348
|
-
return c.json({ ok: true, actionId: result.actionId, unit: result.unit, logPath: result.logPath });
|
|
349
|
-
} catch (err) {
|
|
350
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
351
|
-
console.error(`[admin/actions/run] launch failed action=${actionName}: ${message}`);
|
|
352
|
-
return c.json({ error: `launch failed: ${message}` }, 500);
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
var run_default = app;
|
|
356
|
-
|
|
357
|
-
// node_modules/hono/dist/utils/stream.js
|
|
358
|
-
var StreamingApi = class {
|
|
359
|
-
writer;
|
|
360
|
-
encoder;
|
|
361
|
-
writable;
|
|
362
|
-
abortSubscribers = [];
|
|
363
|
-
responseReadable;
|
|
364
|
-
/**
|
|
365
|
-
* Whether the stream has been aborted.
|
|
366
|
-
*/
|
|
367
|
-
aborted = false;
|
|
368
|
-
/**
|
|
369
|
-
* Whether the stream has been closed normally.
|
|
370
|
-
*/
|
|
371
|
-
closed = false;
|
|
372
|
-
constructor(writable, _readable) {
|
|
373
|
-
this.writable = writable;
|
|
374
|
-
this.writer = writable.getWriter();
|
|
375
|
-
this.encoder = new TextEncoder();
|
|
376
|
-
const reader = _readable.getReader();
|
|
377
|
-
this.abortSubscribers.push(async () => {
|
|
378
|
-
await reader.cancel();
|
|
379
|
-
});
|
|
380
|
-
this.responseReadable = new ReadableStream({
|
|
381
|
-
async pull(controller) {
|
|
382
|
-
const { done, value } = await reader.read();
|
|
383
|
-
done ? controller.close() : controller.enqueue(value);
|
|
384
|
-
},
|
|
385
|
-
cancel: () => {
|
|
386
|
-
this.abort();
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
async write(input) {
|
|
391
|
-
try {
|
|
392
|
-
if (typeof input === "string") {
|
|
393
|
-
input = this.encoder.encode(input);
|
|
394
|
-
}
|
|
395
|
-
await this.writer.write(input);
|
|
396
|
-
} catch {
|
|
397
|
-
}
|
|
398
|
-
return this;
|
|
399
|
-
}
|
|
400
|
-
async writeln(input) {
|
|
401
|
-
await this.write(input + "\n");
|
|
402
|
-
return this;
|
|
403
|
-
}
|
|
404
|
-
sleep(ms) {
|
|
405
|
-
return new Promise((res) => setTimeout(res, ms));
|
|
406
|
-
}
|
|
407
|
-
async close() {
|
|
408
|
-
try {
|
|
409
|
-
await this.writer.close();
|
|
410
|
-
} catch {
|
|
411
|
-
}
|
|
412
|
-
this.closed = true;
|
|
413
|
-
}
|
|
414
|
-
async pipe(body) {
|
|
415
|
-
this.writer.releaseLock();
|
|
416
|
-
await body.pipeTo(this.writable, { preventClose: true });
|
|
417
|
-
this.writer = this.writable.getWriter();
|
|
418
|
-
}
|
|
419
|
-
onAbort(listener) {
|
|
420
|
-
this.abortSubscribers.push(listener);
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Abort the stream.
|
|
424
|
-
* You can call this method when stream is aborted by external event.
|
|
425
|
-
*/
|
|
426
|
-
abort() {
|
|
427
|
-
if (!this.aborted) {
|
|
428
|
-
this.aborted = true;
|
|
429
|
-
this.abortSubscribers.forEach((subscriber) => subscriber());
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
// node_modules/hono/dist/helper/streaming/utils.js
|
|
435
|
-
var isOldBunVersion = () => {
|
|
436
|
-
const version = typeof Bun !== "undefined" ? Bun.version : void 0;
|
|
437
|
-
if (version === void 0) {
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
|
-
const result = version.startsWith("1.1") || version.startsWith("1.0") || version.startsWith("0.");
|
|
441
|
-
isOldBunVersion = () => result;
|
|
442
|
-
return result;
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
// node_modules/hono/dist/helper/streaming/stream.js
|
|
446
|
-
var contextStash = /* @__PURE__ */ new WeakMap();
|
|
447
|
-
var stream = (c, cb, onError) => {
|
|
448
|
-
const { readable, writable } = new TransformStream();
|
|
449
|
-
const stream2 = new StreamingApi(writable, readable);
|
|
450
|
-
if (isOldBunVersion()) {
|
|
451
|
-
c.req.raw.signal.addEventListener("abort", () => {
|
|
452
|
-
if (!stream2.closed) {
|
|
453
|
-
stream2.abort();
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
contextStash.set(stream2.responseReadable, c);
|
|
458
|
-
(async () => {
|
|
459
|
-
try {
|
|
460
|
-
await cb(stream2);
|
|
461
|
-
} catch (e) {
|
|
462
|
-
if (e === void 0) {
|
|
463
|
-
} else if (e instanceof Error && onError) {
|
|
464
|
-
await onError(e, stream2);
|
|
465
|
-
} else {
|
|
466
|
-
console.error(e);
|
|
467
|
-
}
|
|
468
|
-
} finally {
|
|
469
|
-
stream2.close();
|
|
470
|
-
}
|
|
471
|
-
})();
|
|
472
|
-
return c.newResponse(stream2.responseReadable);
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
// server/routes/admin/actions/stream.ts
|
|
476
|
-
import { existsSync } from "fs";
|
|
477
|
-
var app2 = new Hono();
|
|
478
|
-
var ACTION_ID_RE = /^[a-z0-9-]+-[a-z0-9]+-[a-f0-9]{8}$/;
|
|
479
|
-
app2.get("/:id/stream", async (c) => {
|
|
480
|
-
const id = c.req.param("id");
|
|
481
|
-
if (!ACTION_ID_RE.test(id)) {
|
|
482
|
-
return c.json({ error: "invalid action id" }, 400);
|
|
483
|
-
}
|
|
484
|
-
const logPath = actionLogPath(id);
|
|
485
|
-
if (!existsSync(logPath)) {
|
|
486
|
-
return c.json({ error: "action not found (log missing)" }, 404);
|
|
487
|
-
}
|
|
488
|
-
const lastEventId = c.req.header("Last-Event-ID") ?? c.req.query("from") ?? "";
|
|
489
|
-
const fromByteOffset = lastEventId ? Math.max(0, Number(lastEventId) || 0) : 0;
|
|
490
|
-
const unit = `maxy-action-${id}`;
|
|
491
|
-
const abort = new AbortController();
|
|
492
|
-
c.req.raw.signal.addEventListener("abort", () => abort.abort());
|
|
493
|
-
return stream(c, async (s) => {
|
|
494
|
-
s.onAbort(() => abort.abort());
|
|
495
|
-
c.header("Content-Type", "text/event-stream");
|
|
496
|
-
c.header("Cache-Control", "no-cache, no-transform");
|
|
497
|
-
c.header("Connection", "keep-alive");
|
|
498
|
-
await s.write(": ok\n\n");
|
|
499
|
-
try {
|
|
500
|
-
for await (const ev of streamActionEvents({ actionId: id, unit, fromByteOffset, signal: abort.signal })) {
|
|
501
|
-
const id_ = ev.type === "line" ? String(ev.byteOffset) : "";
|
|
502
|
-
const payload = JSON.stringify(ev);
|
|
503
|
-
const frame = `${id_ ? `id: ${id_}
|
|
504
|
-
` : ""}event: ${ev.type}
|
|
505
|
-
data: ${payload}
|
|
506
|
-
|
|
507
|
-
`;
|
|
508
|
-
await s.write(frame);
|
|
509
|
-
}
|
|
510
|
-
} catch (err) {
|
|
511
|
-
console.error(`[admin/actions/stream] action=${id} error: ${err instanceof Error ? err.message : err}`);
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
});
|
|
515
|
-
var stream_default = app2;
|
|
516
|
-
|
|
517
|
-
// server/routes/admin/actions/sudo-prime.ts
|
|
518
|
-
var app3 = new Hono();
|
|
519
|
-
app3.post("/", async (c) => {
|
|
520
|
-
let body = {};
|
|
521
|
-
try {
|
|
522
|
-
body = await c.req.json();
|
|
523
|
-
} catch {
|
|
524
|
-
}
|
|
525
|
-
if (typeof body.password !== "string" || !body.password) {
|
|
526
|
-
return c.json({ error: "password required" }, 400);
|
|
527
|
-
}
|
|
528
|
-
const clientIp = c.var.clientIp ?? "unknown";
|
|
529
|
-
const result = await primeSudo(body.password, clientIp);
|
|
530
|
-
switch (result) {
|
|
531
|
-
case "ok":
|
|
532
|
-
return c.body(null, 204);
|
|
533
|
-
case "invalid":
|
|
534
|
-
return c.json({ error: "invalid password" }, 401);
|
|
535
|
-
case "limited":
|
|
536
|
-
return c.json({ error: "too many attempts; wait a minute" }, 429);
|
|
537
|
-
case "error":
|
|
538
|
-
return c.json({ error: "sudo prime failed \u2014 check server logs" }, 500);
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
var sudo_prime_default = app3;
|
|
542
|
-
|
|
543
|
-
// server/routes/admin/actions/index.ts
|
|
544
|
-
var app4 = new Hono();
|
|
545
|
-
app4.route("/sudo-prime", sudo_prime_default);
|
|
546
|
-
app4.route("/", stream_default);
|
|
547
|
-
app4.route("/", run_default);
|
|
548
|
-
var actions_default = app4;
|
|
549
|
-
|
|
550
313
|
// server/routes/admin/version.ts
|
|
551
|
-
import { existsSync as
|
|
314
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
552
315
|
import { resolve, join as join2 } from "path";
|
|
553
316
|
|
|
554
317
|
// server/lib/client-error-count.ts
|
|
555
|
-
import { existsSync
|
|
318
|
+
import { existsSync, readFileSync, statSync, openSync, readSync, closeSync } from "fs";
|
|
556
319
|
import { join } from "path";
|
|
557
320
|
var CLIENT_ERRORS_LOG = join(LOG_DIR, "client-errors.log");
|
|
558
321
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
559
322
|
var TAIL_BYTES = 256 * 1024;
|
|
560
323
|
function countClientErrors24h() {
|
|
561
|
-
if (!
|
|
324
|
+
if (!existsSync(CLIENT_ERRORS_LOG)) return 0;
|
|
562
325
|
let tail;
|
|
563
326
|
try {
|
|
564
327
|
const size = statSync(CLIENT_ERRORS_LOG).size;
|
|
@@ -609,7 +372,7 @@ function logFallbackOnce(reason, field, usingDefault) {
|
|
|
609
372
|
}
|
|
610
373
|
function resolveBrandConfig() {
|
|
611
374
|
const brandJsonPath = join2(PLATFORM_ROOT, "config", "brand.json");
|
|
612
|
-
if (!
|
|
375
|
+
if (!existsSync2(brandJsonPath)) {
|
|
613
376
|
logFallbackOnce("file-missing", "hostname", DEFAULT_HOSTNAME);
|
|
614
377
|
logFallbackOnce("file-missing", "npm.packageName", DEFAULT_NPM_PACKAGE);
|
|
615
378
|
return { hostname: DEFAULT_HOSTNAME, npmPackage: DEFAULT_NPM_PACKAGE };
|
|
@@ -638,7 +401,7 @@ function resolveBrandConfig() {
|
|
|
638
401
|
}
|
|
639
402
|
var PROCESS_STARTED_AT = (/* @__PURE__ */ new Date()).toISOString();
|
|
640
403
|
function readInstalled(versionFile) {
|
|
641
|
-
if (!
|
|
404
|
+
if (!existsSync2(versionFile)) return "unknown";
|
|
642
405
|
const content = readFileSync2(versionFile, "utf-8").trim();
|
|
643
406
|
return content || "unknown";
|
|
644
407
|
}
|
|
@@ -678,8 +441,8 @@ function isNewer(latest, installed) {
|
|
|
678
441
|
}
|
|
679
442
|
return false;
|
|
680
443
|
}
|
|
681
|
-
var
|
|
682
|
-
|
|
444
|
+
var app = new Hono();
|
|
445
|
+
app.get("/", async (c) => {
|
|
683
446
|
const { hostname, npmPackage } = resolveBrandConfig();
|
|
684
447
|
const versionFile = resolve(PLATFORM_ROOT, `config/.${hostname}-version`);
|
|
685
448
|
const installed = readInstalled(versionFile);
|
|
@@ -692,7 +455,7 @@ app5.get("/", async (c) => {
|
|
|
692
455
|
);
|
|
693
456
|
return c.json({ installed, latest, updateAvailable, clientErrors24h, processStartedAt: PROCESS_STARTED_AT });
|
|
694
457
|
});
|
|
695
|
-
|
|
458
|
+
app.post("/alert-surfaced", async (c) => {
|
|
696
459
|
let installed = "unknown";
|
|
697
460
|
let latest = null;
|
|
698
461
|
try {
|
|
@@ -705,13 +468,13 @@ app5.post("/alert-surfaced", async (c) => {
|
|
|
705
468
|
console.log(`[admin/version] alert-surfaced installed=${installed} latest=${latest ?? "null"}`);
|
|
706
469
|
return c.json({ ok: true });
|
|
707
470
|
});
|
|
708
|
-
var version_default =
|
|
471
|
+
var version_default = app;
|
|
709
472
|
|
|
710
473
|
// server/edge-admin.ts
|
|
711
474
|
function createEdgeAdminApp(opts) {
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
|
|
475
|
+
const app2 = new Hono();
|
|
476
|
+
app2.use("*", clientIpMiddleware);
|
|
477
|
+
app2.use("*", async (c, next) => {
|
|
715
478
|
const start = Date.now();
|
|
716
479
|
console.log(
|
|
717
480
|
`[edge-admin] inbound method=${c.req.method} path=${c.req.path} allowlist-branch=edge-admin`
|
|
@@ -721,14 +484,13 @@ function createEdgeAdminApp(opts) {
|
|
|
721
484
|
`[edge-admin] outcome method=${c.req.method} path=${c.req.path} status=${c.res.status} duration_ms=${Date.now() - start}`
|
|
722
485
|
);
|
|
723
486
|
});
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
return app6;
|
|
487
|
+
app2.use("*", requireAdminCookie(opts.isPublicHost));
|
|
488
|
+
app2.route("/api/admin/version", version_default);
|
|
489
|
+
return app2;
|
|
728
490
|
}
|
|
729
491
|
|
|
730
492
|
// server/edge-fallback.ts
|
|
731
|
-
import { existsSync as
|
|
493
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
732
494
|
import { extname, join as join3 } from "path";
|
|
733
495
|
var BRAND_DEFAULTS = {
|
|
734
496
|
configDir: ".maxy",
|
|
@@ -749,7 +511,7 @@ var MIME_BY_EXT = {
|
|
|
749
511
|
".gif": "image/gif"
|
|
750
512
|
};
|
|
751
513
|
function inlineAsset(filePath) {
|
|
752
|
-
if (!
|
|
514
|
+
if (!existsSync3(filePath)) return null;
|
|
753
515
|
const mime = MIME_BY_EXT[extname(filePath).toLowerCase()];
|
|
754
516
|
if (!mime) return null;
|
|
755
517
|
const bytes = readFileSync3(filePath);
|
|
@@ -759,7 +521,7 @@ function readString(value, fallback) {
|
|
|
759
521
|
return typeof value === "string" && value.length > 0 ? value : fallback;
|
|
760
522
|
}
|
|
761
523
|
function loadBrand(brandJsonPath, assetsDir = "") {
|
|
762
|
-
if (!brandJsonPath || !
|
|
524
|
+
if (!brandJsonPath || !existsSync3(brandJsonPath)) return { ...BRAND_DEFAULTS };
|
|
763
525
|
try {
|
|
764
526
|
const parsed = JSON.parse(readFileSync3(brandJsonPath, "utf-8"));
|
|
765
527
|
const logoFile = typeof parsed.assets?.logo === "string" ? parsed.assets.logo : null;
|
|
@@ -865,7 +627,7 @@ var BRAND = loadBrand(BRAND_JSON_PATH, BRAND_ASSETS_DIR);
|
|
|
865
627
|
var ALIAS_DOMAINS_PATH = join4(homedir(), BRAND.configDir, "alias-domains.json");
|
|
866
628
|
function loadAliasDomains() {
|
|
867
629
|
try {
|
|
868
|
-
if (!
|
|
630
|
+
if (!existsSync4(ALIAS_DOMAINS_PATH)) return /* @__PURE__ */ new Set();
|
|
869
631
|
const parsed = JSON.parse(readFileSync4(ALIAS_DOMAINS_PATH, "utf-8"));
|
|
870
632
|
if (!Array.isArray(parsed)) return /* @__PURE__ */ new Set();
|
|
871
633
|
return new Set(parsed.filter((h) => typeof h === "string"));
|