@rubytech/create-realagent 1.0.806 → 1.0.808
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/neo4j/migrations/004-project-admin-agent.ts +247 -0
- package/payload/platform/neo4j/migrations/004-prune-alien-accounts.ts +134 -0
- package/payload/platform/plugins/admin/skills/onboarding/SKILL.md +2 -0
- package/payload/platform/plugins/docs/references/cloudflare.md +1 -0
- package/payload/platform/plugins/docs/references/graph.md +42 -0
- package/payload/platform/plugins/docs/references/internals.md +3 -1
- package/payload/platform/plugins/docs/references/memory-guide.md +4 -0
- package/payload/platform/plugins/docs/references/troubleshooting.md +19 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.js +19 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +4 -1
- package/payload/platform/templates/agents/admin/SOUL.md +2 -0
- package/payload/server/chunk-CRWLE6BZ.js +3511 -0
- package/payload/server/chunk-LSUMH6OF.js +9993 -0
- package/payload/server/chunk-V3VLAL7N.js +10009 -0
- package/payload/server/chunk-YULDSPAC.js +3484 -0
- package/payload/server/client-pool-LXE7RIRT.js +31 -0
- package/payload/server/client-pool-N2Y57223.js +31 -0
- package/payload/server/maxy-edge.js +5 -4
- package/payload/server/neo4j-migrations-HEECOAGK.js +128 -0
- package/payload/server/public/assets/admin-MxaCgGHZ.js +352 -0
- package/payload/server/public/assets/{graph-CBu0rtrP.js → graph-CDwy6Qw1.js} +1 -1
- package/payload/server/public/assets/page-DEyK-lSN.js +50 -0
- package/payload/server/public/graph.html +2 -2
- package/payload/server/public/index.html +2 -2
- package/payload/server/server.js +658 -278
- package/payload/server/public/assets/admin-BYsaXlDv.js +0 -352
- package/payload/server/public/assets/page-BNM63zsb.js +0 -50
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_evictAllForTest,
|
|
3
|
+
_poolSnapshotForTest,
|
|
4
|
+
acquireClient,
|
|
5
|
+
acquireOneShotClient,
|
|
6
|
+
evictClient,
|
|
7
|
+
getActiveClient,
|
|
8
|
+
interruptClient,
|
|
9
|
+
pushUserMessage,
|
|
10
|
+
recordCachedTokens,
|
|
11
|
+
recordCrash,
|
|
12
|
+
setInflight,
|
|
13
|
+
startIdleEvictTick,
|
|
14
|
+
stopIdleEvictTick
|
|
15
|
+
} from "./chunk-YULDSPAC.js";
|
|
16
|
+
import "./chunk-JSBRDJBE.js";
|
|
17
|
+
export {
|
|
18
|
+
_evictAllForTest,
|
|
19
|
+
_poolSnapshotForTest,
|
|
20
|
+
acquireClient,
|
|
21
|
+
acquireOneShotClient,
|
|
22
|
+
evictClient,
|
|
23
|
+
getActiveClient,
|
|
24
|
+
interruptClient,
|
|
25
|
+
pushUserMessage,
|
|
26
|
+
recordCachedTokens,
|
|
27
|
+
recordCrash,
|
|
28
|
+
setInflight,
|
|
29
|
+
startIdleEvictTick,
|
|
30
|
+
stopIdleEvictTick
|
|
31
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_evictAllForTest,
|
|
3
|
+
_poolSnapshotForTest,
|
|
4
|
+
acquireClient,
|
|
5
|
+
acquireOneShotClient,
|
|
6
|
+
evictClient,
|
|
7
|
+
getActiveClient,
|
|
8
|
+
interruptClient,
|
|
9
|
+
pushUserMessage,
|
|
10
|
+
recordCachedTokens,
|
|
11
|
+
recordCrash,
|
|
12
|
+
setInflight,
|
|
13
|
+
startIdleEvictTick,
|
|
14
|
+
stopIdleEvictTick
|
|
15
|
+
} from "./chunk-CRWLE6BZ.js";
|
|
16
|
+
import "./chunk-JSBRDJBE.js";
|
|
17
|
+
export {
|
|
18
|
+
_evictAllForTest,
|
|
19
|
+
_poolSnapshotForTest,
|
|
20
|
+
acquireClient,
|
|
21
|
+
acquireOneShotClient,
|
|
22
|
+
evictClient,
|
|
23
|
+
getActiveClient,
|
|
24
|
+
interruptClient,
|
|
25
|
+
pushUserMessage,
|
|
26
|
+
recordCachedTokens,
|
|
27
|
+
recordCrash,
|
|
28
|
+
setInflight,
|
|
29
|
+
startIdleEvictTick,
|
|
30
|
+
stopIdleEvictTick
|
|
31
|
+
};
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
sanitizeClientCorrId,
|
|
17
17
|
streamActionEvents,
|
|
18
18
|
vncLog
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-V3VLAL7N.js";
|
|
20
|
+
import "./chunk-CRWLE6BZ.js";
|
|
21
21
|
import "./chunk-JSBRDJBE.js";
|
|
22
22
|
|
|
23
23
|
// server/edge.ts
|
|
@@ -583,6 +583,7 @@ var VERSION_FILE = resolve(PLATFORM_ROOT, `config/.${brandHostname}-version`);
|
|
|
583
583
|
var NPM_PACKAGE = brandNpmPackage;
|
|
584
584
|
var REGISTRY_URL = `https://registry.npmjs.org/${NPM_PACKAGE}/latest`;
|
|
585
585
|
var FETCH_TIMEOUT_MS = 5e3;
|
|
586
|
+
var PROCESS_STARTED_AT = (/* @__PURE__ */ new Date()).toISOString();
|
|
586
587
|
function readInstalled() {
|
|
587
588
|
if (!existsSync3(VERSION_FILE)) return "unknown";
|
|
588
589
|
const content = readFileSync2(VERSION_FILE, "utf-8").trim();
|
|
@@ -631,9 +632,9 @@ app5.get("/", async (c) => {
|
|
|
631
632
|
const outcome = installed === "unknown" ? "stale-version-file" : latest === null ? "fetch-failed" : "ok";
|
|
632
633
|
const clientErrors24h = countClientErrors24h();
|
|
633
634
|
console.log(
|
|
634
|
-
`[admin/version] outcome=${outcome} installed=${installed} latest=${latest ?? "null"} updateAvailable=${updateAvailable} clientErrors24h=${clientErrors24h}`
|
|
635
|
+
`[admin/version] outcome=${outcome} installed=${installed} latest=${latest ?? "null"} updateAvailable=${updateAvailable} clientErrors24h=${clientErrors24h} processStartedAt=${PROCESS_STARTED_AT}`
|
|
635
636
|
);
|
|
636
|
-
return c.json({ installed, latest, updateAvailable, clientErrors24h });
|
|
637
|
+
return c.json({ installed, latest, updateAvailable, clientErrors24h, processStartedAt: PROCESS_STARTED_AT });
|
|
637
638
|
});
|
|
638
639
|
app5.post("/alert-surfaced", async (c) => {
|
|
639
640
|
let installed = "unknown";
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import "./chunk-JSBRDJBE.js";
|
|
2
|
+
|
|
3
|
+
// app/lib/neo4j-migrations.ts
|
|
4
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
5
|
+
import { resolve as resolve2 } from "path";
|
|
6
|
+
|
|
7
|
+
// ../neo4j/migrations/004-prune-alien-accounts.ts
|
|
8
|
+
import { readFileSync, readdirSync } from "fs";
|
|
9
|
+
import { resolve } from "path";
|
|
10
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
11
|
+
async function pruneAlienAccounts(driver, platformRoot) {
|
|
12
|
+
const accountsDir = resolve(platformRoot, "..", "data", "accounts");
|
|
13
|
+
const validIds = enumerateValidAccountIds(accountsDir);
|
|
14
|
+
if (validIds.size === 0) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
`refusing to prune: no valid accounts found under ${accountsDir} \u2014 corrupt install? not deleting anything to avoid wiping the entire graph.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
const valid = Array.from(validIds);
|
|
20
|
+
const session = driver.session();
|
|
21
|
+
try {
|
|
22
|
+
const peek = await session.run(
|
|
23
|
+
`MATCH (n)
|
|
24
|
+
WHERE n.accountId IS NOT NULL AND NOT n.accountId IN $valid
|
|
25
|
+
RETURN DISTINCT n.accountId AS aid`,
|
|
26
|
+
{ valid }
|
|
27
|
+
);
|
|
28
|
+
const alienIds = [];
|
|
29
|
+
for (const record of peek.records) {
|
|
30
|
+
const aid = record.get("aid");
|
|
31
|
+
if (typeof aid === "string") alienIds.push(aid);
|
|
32
|
+
}
|
|
33
|
+
if (alienIds.length === 0) return;
|
|
34
|
+
const result = await session.run(
|
|
35
|
+
`MATCH (n)
|
|
36
|
+
WHERE n.accountId IS NOT NULL AND NOT n.accountId IN $valid
|
|
37
|
+
DETACH DELETE n
|
|
38
|
+
RETURN count(n) AS pruned`,
|
|
39
|
+
{ valid }
|
|
40
|
+
);
|
|
41
|
+
const prunedRaw = result.records[0]?.get("pruned");
|
|
42
|
+
const pruned = typeof prunedRaw === "number" ? prunedRaw : prunedRaw?.toNumber?.() ?? 0;
|
|
43
|
+
console.error(
|
|
44
|
+
`[graph-invariant] alien-accounts pruned=${pruned} accountIds=${alienIds.join(",")}`
|
|
45
|
+
);
|
|
46
|
+
} finally {
|
|
47
|
+
await session.close();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function enumerateValidAccountIds(accountsDir) {
|
|
51
|
+
const valid = /* @__PURE__ */ new Set();
|
|
52
|
+
let names;
|
|
53
|
+
try {
|
|
54
|
+
names = readdirSync(accountsDir);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (err.code === "ENOENT") return valid;
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
for (const name of names) {
|
|
60
|
+
if (!UUID_RE.test(name)) continue;
|
|
61
|
+
const configPath = resolve(accountsDir, name, "account.json");
|
|
62
|
+
try {
|
|
63
|
+
JSON.parse(readFileSync(configPath, "utf-8"));
|
|
64
|
+
valid.add(name);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
const code = err.code ?? "parse-error";
|
|
67
|
+
if (code === "ENOENT") continue;
|
|
68
|
+
console.error(
|
|
69
|
+
`[graph-invariant] account-json-skip uuid=${name} reason=${code}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return valid;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// app/lib/neo4j-migrations.ts
|
|
77
|
+
var BOOT_MIGRATIONS = [
|
|
78
|
+
{ fileName: "003-person-name-eradicate.cypher", slug: "person-name-eradicate" }
|
|
79
|
+
];
|
|
80
|
+
async function applyBootMigrations(driver, platformRoot) {
|
|
81
|
+
for (const migration of BOOT_MIGRATIONS) {
|
|
82
|
+
await applyOne(driver, platformRoot, migration);
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
await pruneAlienAccounts(driver, platformRoot);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
88
|
+
console.error(`[migration] failed prune-alien-accounts error="${msg}"`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function applyOne(driver, platformRoot, migration) {
|
|
92
|
+
const path = resolve2(platformRoot, "neo4j/migrations", migration.fileName);
|
|
93
|
+
let cypher;
|
|
94
|
+
try {
|
|
95
|
+
cypher = readFileSync2(path, "utf-8");
|
|
96
|
+
} catch (err) {
|
|
97
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
98
|
+
console.error(
|
|
99
|
+
`[migration] failed ${migration.slug} error=cannot-read-file path=${path} msg=${msg}`
|
|
100
|
+
);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const session = driver.session();
|
|
104
|
+
try {
|
|
105
|
+
const result = await session.run(cypher);
|
|
106
|
+
const record = result.records[0];
|
|
107
|
+
const removedRaw = record?.get("removed");
|
|
108
|
+
const removed = toNumber(removedRaw);
|
|
109
|
+
console.error(
|
|
110
|
+
`[migration] applied ${migration.slug} removed=${removed}`
|
|
111
|
+
);
|
|
112
|
+
} catch (err) {
|
|
113
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
114
|
+
console.error(`[migration] failed ${migration.slug} error="${msg}"`);
|
|
115
|
+
} finally {
|
|
116
|
+
await session.close();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function toNumber(v) {
|
|
120
|
+
if (typeof v === "number") return v;
|
|
121
|
+
if (v && typeof v.toNumber === "function") {
|
|
122
|
+
return v.toNumber();
|
|
123
|
+
}
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
applyBootMigrations
|
|
128
|
+
};
|