@rubytech/create-realagent 1.0.635 → 1.0.637

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Real Agent</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/admin-BTjragNx.js"></script>
8
+ <script type="module" crossorigin src="/assets/admin-E3EIZIw0.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Be6NvmcD.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-rov5CBGT.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useVoiceRecorder-D4y_EM_A.js">
@@ -1,32 +1,9 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
1
+ import {
2
+ __commonJS,
3
+ __export,
4
+ __toESM,
5
+ readProgressLog
6
+ } from "./chunk-LM5BMENF.js";
30
7
 
31
8
  // ../lib/models/dist/index.js
32
9
  var require_dist = __commonJS({
@@ -2660,8 +2637,8 @@ var createAdaptorServer = (options) => {
2660
2637
  overrideGlobalObjects: options.overrideGlobalObjects,
2661
2638
  autoCleanupIncoming: options.autoCleanupIncoming
2662
2639
  });
2663
- const createServer = options.createServer || createServerHTTP;
2664
- const server = createServer(options.serverOptions || {}, requestListener);
2640
+ const createServer2 = options.createServer || createServerHTTP;
2641
+ const server = createServer2(options.serverOptions || {}, requestListener);
2665
2642
  return server;
2666
2643
  };
2667
2644
  var serve = (options, listeningListener) => {
@@ -7896,12 +7873,15 @@ var ADMIN_CORE_TOOLS = [
7896
7873
  "Glob",
7897
7874
  "Grep",
7898
7875
  "Agent",
7899
- // Task 557 — upstream mcp-neo4j-cypher (namespaced maxy-graph, read-only).
7900
- // maxy-graph_write_neo4j_cypher is intentionally absent: writes go through
7876
+ // Upstream mcp-neo4j-cypher (namespaced maxy-graph, read-only).
7877
+ // FastMCP joins NEO4J_NAMESPACE to each upstream tool name with a hyphen,
7878
+ // and allowedTools matching is string-exact under --permission-mode dontAsk —
7879
+ // these names must equal the init-message tool list byte-for-byte.
7880
+ // maxy-graph-write_neo4j_cypher is intentionally absent: writes go through
7901
7881
  // the schema-aware memory-write tool, which validates labels, properties,
7902
7882
  // and embeddings. Admin-only by virtue of not being in the public allow list.
7903
- "mcp__graph__maxy-graph_read_neo4j_cypher",
7904
- "mcp__graph__maxy-graph_get_neo4j_schema",
7883
+ "mcp__graph__maxy-graph-read_neo4j_cypher",
7884
+ "mcp__graph__maxy-graph-get_neo4j_schema",
7905
7885
  "mcp__memory__memory-search",
7906
7886
  "mcp__memory__memory-rank",
7907
7887
  "mcp__memory__memory-write",
@@ -11032,6 +11012,26 @@ function defaultRules() {
11032
11012
  thresholdCount: 0,
11033
11013
  thresholdWindowMinutes: 0,
11034
11014
  suggestedAction: "The stored Anthropic API key was rejected by console.anthropic.com (invalid, revoked, or expired) and `anthropic-setup` auto-deleted it. On the next operator interaction, explain that the key was cleared and walk them through sign-in again via the onboarding skill \u2014 the tool already returned `awaiting_signin` with the correct `browser_evaluate` action on the same call."
11015
+ },
11016
+ {
11017
+ // Task 561: fires when an admin-agent Bash tool call installs
11018
+ // `bind9-dnsutils` at runtime. Post-Task-561 the Maxy installer
11019
+ // (platform/scripts/setup.sh) provisions the package on every fresh
11020
+ // and upgrade install, so `dig` is always in PATH before
11021
+ // setup-tunnel.sh runs. An admin apt-install of bind9-dnsutils is
11022
+ // therefore evidence the installer regressed (or the host is on a
11023
+ // pre-Task-561 image); in either case the fix is to re-run the
11024
+ // installer, not to patch apt-state from chat. Session scope so a
11025
+ // single offending turn fires exactly once.
11026
+ id: "admin-agent-apt-bind9-install",
11027
+ name: "Admin agent installed bind9-dnsutils at runtime (installer regression)",
11028
+ type: "repeated-error",
11029
+ logSource: "any",
11030
+ pattern: "\\[tool-use\\][^\\n]*name=Bash[^\\n]*apt-get install[^\\n]*bind9-dnsutils",
11031
+ thresholdCount: 1,
11032
+ thresholdWindowMinutes: 60,
11033
+ scope: "session",
11034
+ suggestedAction: "[Task 561 regression] The admin agent ran `apt-get install bind9-dnsutils` \u2014 the exact workaround Task 561 eliminated. The Maxy installer provisions `bind9-dnsutils` in `platform/scripts/setup.sh` so `dig` is always in PATH before `setup-tunnel.sh` runs. Do not patch apt-state from chat \u2014 re-run the installer (`npx -y @rubytech/create-maxy`) and verify the installer's apt-get line still includes `bind9-dnsutils`. If the package is present in setup.sh but missing on the device, the installer did not re-run step 1 on the current image."
11035
11035
  }
11036
11036
  ];
11037
11037
  }
@@ -32315,7 +32315,9 @@ async function GET13() {
32315
32315
  // app/api/admin/version/upgrade/route.ts
32316
32316
  import { spawn as spawn4 } from "child_process";
32317
32317
  import { existsSync as existsSync24, statSync as statSync9, writeFileSync as writeFileSync16, readFileSync as readFileSync24, openSync as openSync5, closeSync as closeSync5 } from "fs";
32318
- import { resolve as resolve26, join as join11 } from "path";
32318
+ import { createServer } from "net";
32319
+ import { resolve as resolve26, join as join11, dirname as dirname8 } from "path";
32320
+ import { fileURLToPath } from "url";
32319
32321
  var PLATFORM_ROOT10 = process.env.MAXY_PLATFORM_ROOT ?? resolve26(process.cwd(), "..");
32320
32322
  var upgradePkg = "@rubytech/create-maxy";
32321
32323
  var upgradeHostname = "maxy";
@@ -32348,6 +32350,27 @@ function isLockFresh() {
32348
32350
  return false;
32349
32351
  }
32350
32352
  }
32353
+ function probePortFree(port2) {
32354
+ return new Promise((resolve29) => {
32355
+ const probe = createServer();
32356
+ probe.once("error", (err) => {
32357
+ resolve29({ error: `${err.code ?? "EADDRINUSE"} on port ${port2}` });
32358
+ });
32359
+ probe.once("listening", () => {
32360
+ probe.close(() => resolve29(true));
32361
+ });
32362
+ probe.listen(port2, "0.0.0.0");
32363
+ });
32364
+ }
32365
+ function resolveSidecarPath() {
32366
+ try {
32367
+ const here = dirname8(fileURLToPath(import.meta.url));
32368
+ const candidate = join11(here, "upgrade-progress-server.js");
32369
+ return existsSync24(candidate) ? candidate : null;
32370
+ } catch {
32371
+ return null;
32372
+ }
32373
+ }
32351
32374
  async function POST23(req) {
32352
32375
  let body;
32353
32376
  try {
@@ -32365,17 +32388,65 @@ async function POST23(req) {
32365
32388
  if (isLockFresh()) {
32366
32389
  return Response.json({ ok: false, error: "upgrade already in progress" }, { status: 409 });
32367
32390
  }
32391
+ const mainPort = parseInt(process.env.PORT ?? "19200", 10);
32392
+ const sidecarPort = mainPort + 99;
32393
+ const portProbe = await probePortFree(sidecarPort);
32394
+ if (portProbe !== true) {
32395
+ console.error(`[admin/version/upgrade] sidecar port probe failed: ${portProbe.error}`);
32396
+ return Response.json(
32397
+ { ok: false, error: `upgrade progress port ${sidecarPort} is already in use (${portProbe.error})` },
32398
+ { status: 500 }
32399
+ );
32400
+ }
32401
+ const sidecarPath = resolveSidecarPath();
32402
+ const installerScope = `upgrade-${upgradeHostname}`;
32403
+ const sidecarScope = `upgrade-progress-${upgradeHostname}`;
32368
32404
  try {
32369
32405
  writeFileSync16(LOCK_FILE, String(Date.now()));
32370
32406
  } catch (err) {
32371
32407
  console.error("[admin/version/upgrade] failed to write lock file:", err);
32372
32408
  }
32409
+ if (!sidecarPath) {
32410
+ console.error("[admin/version/upgrade] progress sidecar binary not found in dist/");
32411
+ return Response.json(
32412
+ { ok: false, error: "progress sidecar binary missing \u2014 rebuild required" },
32413
+ { status: 500 }
32414
+ );
32415
+ }
32416
+ let sidecarPid;
32417
+ try {
32418
+ const sidecarLogFd = openSync5(LOG_FILE, "a");
32419
+ const sidecar = spawn4("systemd-run", [
32420
+ "--user",
32421
+ "--scope",
32422
+ `--unit=${sidecarScope}`,
32423
+ "--",
32424
+ "node",
32425
+ sidecarPath,
32426
+ `--port=${sidecarPort}`,
32427
+ `--log=${LOG_FILE}`,
32428
+ `--scope=${installerScope}`
32429
+ ], {
32430
+ detached: true,
32431
+ stdio: ["ignore", sidecarLogFd, sidecarLogFd]
32432
+ });
32433
+ sidecar.unref();
32434
+ closeSync5(sidecarLogFd);
32435
+ sidecarPid = sidecar.pid;
32436
+ console.log(`[admin/version/upgrade] spawned progress sidecar (pid ${sidecarPid} port ${sidecarPort})`);
32437
+ } catch (err) {
32438
+ console.error("[admin/version/upgrade] failed to spawn progress sidecar:", err);
32439
+ return Response.json(
32440
+ { ok: false, error: err instanceof Error ? err.message : "failed to spawn progress sidecar" },
32441
+ { status: 500 }
32442
+ );
32443
+ }
32373
32444
  try {
32374
32445
  const logFd = openSync5(LOG_FILE, "w");
32375
32446
  const child = spawn4("systemd-run", [
32376
32447
  "--user",
32377
32448
  "--scope",
32378
- `--unit=upgrade-${upgradeHostname}`,
32449
+ `--unit=${installerScope}`,
32379
32450
  "--",
32380
32451
  "npx",
32381
32452
  "-y",
@@ -32389,7 +32460,9 @@ async function POST23(req) {
32389
32460
  child.unref();
32390
32461
  closeSync5(logFd);
32391
32462
  console.log(`[admin/version/upgrade] spawned upgrade process (pid ${child.pid})`);
32392
- return Response.json({ ok: true, started: true });
32463
+ const host = new URL(req.url).hostname;
32464
+ const progressUrl = `http://${host}:${sidecarPort}/progress`;
32465
+ return Response.json({ ok: true, started: true, progressUrl });
32393
32466
  } catch (err) {
32394
32467
  console.error("[admin/version/upgrade] failed to spawn upgrade process:", err);
32395
32468
  return Response.json(
@@ -32413,40 +32486,8 @@ if (existsSync25(brandPath2)) {
32413
32486
  }
32414
32487
  }
32415
32488
  var LOG_FILE2 = `/tmp/${upgradeHostname2}-upgrade.log`;
32416
- var STEP_RE = /\[(\d+)\/(\d+)\]\s+(.+)/;
32417
- var ANSI_RE = /\x1b\[[0-9;?]*[a-zA-Z]/g;
32418
- var stripAnsi = (s) => s.replace(ANSI_RE, "").replace(/\r/g, "").trimEnd();
32419
- var MAX_SUBSTEPS = 20;
32420
32489
  async function GET14() {
32421
- if (!existsSync25(LOG_FILE2)) {
32422
- return Response.json({ step: 0, total: 0, label: "", started: false, subSteps: [] });
32423
- }
32424
- let content;
32425
- try {
32426
- content = readFileSync25(LOG_FILE2, "utf-8");
32427
- } catch {
32428
- return Response.json({ step: 0, total: 0, label: "", started: false, subSteps: [] });
32429
- }
32430
- const rawLines = content.split("\n");
32431
- let step = 0;
32432
- let total = 0;
32433
- let label = "";
32434
- let markerIdx = -1;
32435
- for (let i = rawLines.length - 1; i >= 0; i--) {
32436
- const match2 = rawLines[i].match(STEP_RE);
32437
- if (match2) {
32438
- step = parseInt(match2[1], 10);
32439
- total = parseInt(match2[2], 10);
32440
- label = match2[3].replace(/\.{3}$/, "").trim();
32441
- markerIdx = i;
32442
- break;
32443
- }
32444
- }
32445
- const subSteps = markerIdx >= 0 ? rawLines.slice(markerIdx + 1).map(stripAnsi).filter((l) => l.length > 0).slice(-MAX_SUBSTEPS) : [];
32446
- const tail = rawLines.slice(-20).join("\n");
32447
- const finished = tail.includes("Open in your browser:");
32448
- const failed = tail.includes("Setup failed:");
32449
- return Response.json({ step, total, label, started: true, finished, failed, subSteps });
32490
+ return Response.json(readProgressLog(LOG_FILE2));
32450
32491
  }
32451
32492
 
32452
32493
  // app/api/admin/sessions/route.ts
@@ -0,0 +1,83 @@
1
+ import {
2
+ readProgressLog
3
+ } from "./chunk-LM5BMENF.js";
4
+
5
+ // server/upgrade-progress-server.ts
6
+ import { createServer } from "http";
7
+ import { spawnSync } from "child_process";
8
+ import { appendFileSync } from "fs";
9
+ function arg(name) {
10
+ const prefix = `--${name}=`;
11
+ const hit = process.argv.find((a) => a.startsWith(prefix));
12
+ return hit?.slice(prefix.length);
13
+ }
14
+ var port = parseInt(arg("port") ?? "0", 10);
15
+ var logPath = arg("log") ?? "";
16
+ var scopeUnit = arg("scope") ?? "";
17
+ if (!port || !logPath || !scopeUnit) {
18
+ console.error(`[progress-server] missing required args: --port=${port} --log=${logPath} --scope=${scopeUnit}`);
19
+ process.exit(2);
20
+ }
21
+ function banner(line) {
22
+ try {
23
+ appendFileSync(logPath, `${line}
24
+ `);
25
+ } catch {
26
+ }
27
+ }
28
+ var server = createServer((req, res) => {
29
+ res.setHeader("Access-Control-Allow-Origin", "*");
30
+ res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
31
+ if (req.method === "OPTIONS") {
32
+ res.statusCode = 204;
33
+ res.end();
34
+ return;
35
+ }
36
+ if (req.url !== "/progress") {
37
+ res.statusCode = 404;
38
+ res.end();
39
+ return;
40
+ }
41
+ const payload = readProgressLog(logPath);
42
+ res.setHeader("Content-Type", "application/json");
43
+ res.statusCode = 200;
44
+ res.end(JSON.stringify(payload));
45
+ });
46
+ server.on("error", (err) => {
47
+ console.error(`[progress-server] listen error: ${err.code ?? ""} ${err.message}`);
48
+ banner(`[progress-server] exiting reason=error code=${err.code ?? "unknown"}`);
49
+ process.exit(1);
50
+ });
51
+ server.listen(port, "0.0.0.0", () => {
52
+ banner(`[progress-server] listening port=${port} log=${logPath} scope=${scopeUnit}`);
53
+ });
54
+ var installerSeenActive = false;
55
+ var WATCHDOG_INTERVAL_MS = 2e3;
56
+ var GRACE_UNTIL = Date.now() + 5e3;
57
+ function shutdown(reason) {
58
+ banner(`[progress-server] exiting reason=${reason}`);
59
+ server.close(() => process.exit(0));
60
+ setTimeout(() => process.exit(0), 500).unref();
61
+ }
62
+ var watchdog = setInterval(() => {
63
+ const result = spawnSync("systemctl", ["--user", "is-active", scopeUnit], { stdio: "pipe" });
64
+ const status = result.stdout?.toString().trim();
65
+ if (status === "active") {
66
+ installerSeenActive = true;
67
+ return;
68
+ }
69
+ if (!installerSeenActive && Date.now() < GRACE_UNTIL) return;
70
+ if (!installerSeenActive) {
71
+ banner(`[progress-server] exiting reason=scope-inactive (installer never reached active)`);
72
+ }
73
+ clearInterval(watchdog);
74
+ shutdown("scope-inactive");
75
+ }, WATCHDOG_INTERVAL_MS);
76
+ process.on("SIGTERM", () => {
77
+ clearInterval(watchdog);
78
+ shutdown("sigterm");
79
+ });
80
+ process.on("SIGINT", () => {
81
+ clearInterval(watchdog);
82
+ shutdown("sigint");
83
+ });