@rubytech/create-maxy-code 0.1.60 → 0.1.62
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/PLUGIN.md +1 -1
- package/payload/platform/plugins/brochures/skills/property-brochure/SKILL.md +26 -3
- package/payload/platform/plugins/brochures/skills/property-brochure/references/registers.md +1 -1
- package/payload/platform/plugins/docs/references/admin-session.md +2 -2
- package/payload/platform/plugins/docs/references/internals.md +1 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +1 -1
- package/payload/platform/plugins/epc/.claude-plugin/plugin.json +17 -0
- package/payload/platform/plugins/epc/PLUGIN.md +85 -0
- package/payload/platform/plugins/epc/mcp/dist/index.d.ts +2 -0
- package/payload/platform/plugins/epc/mcp/dist/index.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/index.js +117 -0
- package/payload/platform/plugins/epc/mcp/dist/index.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/crypto.d.ts +3 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/crypto.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/crypto.js +72 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/crypto.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/epc-api.d.ts +60 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/epc-api.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/epc-api.js +181 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/epc-api.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/file-crypto.d.ts +3 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/file-crypto.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/file-crypto.js +49 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/file-crypto.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/key-store.d.ts +15 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/key-store.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/key-store.js +130 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/key-store.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/neo4j.d.ts +5 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/neo4j.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/neo4j.js +38 -0
- package/payload/platform/plugins/epc/mcp/dist/lib/neo4j.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-deregister.d.ts +4 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-deregister.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-deregister.js +9 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-deregister.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-list.d.ts +4 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-list.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-list.js +10 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-list.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-register.d.ts +5 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-register.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-register.js +36 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/key-register.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/lookup.d.ts +10 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/lookup.d.ts.map +1 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/lookup.js +30 -0
- package/payload/platform/plugins/epc/mcp/dist/tools/lookup.js.map +1 -0
- package/payload/platform/plugins/epc/mcp/package-lock.json +2566 -0
- package/payload/platform/plugins/epc/mcp/package.json +21 -0
- package/payload/platform/plugins/epc/mcp/src/__tests__/epc-api.test.ts +251 -0
- package/payload/platform/plugins/epc/mcp/src/__tests__/key-roundtrip.test.ts +113 -0
- package/payload/platform/plugins/epc/mcp/src/__tests__/lookup.test.ts +181 -0
- package/payload/platform/plugins/epc/mcp/src/__tests__/schema-parity.test.ts +54 -0
- package/payload/platform/plugins/epc/mcp/src/index.ts +156 -0
- package/payload/platform/plugins/epc/mcp/src/lib/crypto.ts +79 -0
- package/payload/platform/plugins/epc/mcp/src/lib/epc-api.ts +241 -0
- package/payload/platform/plugins/epc/mcp/src/lib/file-crypto.ts +55 -0
- package/payload/platform/plugins/epc/mcp/src/lib/key-store.ts +172 -0
- package/payload/platform/plugins/epc/mcp/src/lib/neo4j.ts +47 -0
- package/payload/platform/plugins/epc/mcp/src/tools/key-deregister.ts +9 -0
- package/payload/platform/plugins/epc/mcp/src/tools/key-list.ts +10 -0
- package/payload/platform/plugins/epc/mcp/src/tools/key-register.ts +44 -0
- package/payload/platform/plugins/epc/mcp/src/tools/lookup.ts +43 -0
- package/payload/platform/plugins/epc/mcp/tsconfig.json +20 -0
- package/payload/platform/plugins/epc/mcp/vitest.config.ts +8 -0
- package/payload/platform/plugins/preval/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/preval/PLUGIN.md +25 -17
- package/payload/platform/plugins/preval/skills/property-preval/SKILL.md +107 -39
- package/payload/platform/plugins/preval/skills/property-preval/references/render.py +449 -84
- package/payload/platform/plugins/preval/skills/property-preval/references/template-inputs.schema.json +126 -80
- package/payload/platform/plugins/preval/skills/property-preval/references/template.html +183 -124
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +6 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +7 -0
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +8 -0
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
- package/payload/platform/templates/agents/admin/SOUL.md +1 -1
- package/payload/premium-plugins/real-agent/BUNDLE.md +4 -2
- package/payload/premium-plugins/real-agent/agents/valuer.md +1 -1
- package/payload/premium-plugins/real-agent/plugins/.claude-plugin/marketplace.json +5 -0
- package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-brochure/SKILL.md +26 -3
- package/payload/premium-plugins/real-agent/plugins/brochures/skills/property-brochure/references/registers.md +1 -1
- package/payload/premium-plugins/real-agent/plugins/epc/.claude-plugin/plugin.json +17 -0
- package/payload/premium-plugins/real-agent/plugins/epc/PLUGIN.md +85 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/index.d.ts +2 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/index.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/index.js +117 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/index.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/crypto.d.ts +3 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/crypto.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/crypto.js +72 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/crypto.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/epc-api.d.ts +60 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/epc-api.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/epc-api.js +181 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/epc-api.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/file-crypto.d.ts +3 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/file-crypto.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/file-crypto.js +49 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/file-crypto.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/key-store.d.ts +15 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/key-store.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/key-store.js +130 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/key-store.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/neo4j.d.ts +5 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/neo4j.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/neo4j.js +38 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/lib/neo4j.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-deregister.d.ts +4 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-deregister.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-deregister.js +9 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-deregister.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-list.d.ts +4 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-list.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-list.js +10 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-list.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-register.d.ts +5 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-register.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-register.js +36 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/key-register.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/lookup.d.ts +10 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/lookup.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/lookup.js +30 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/dist/tools/lookup.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/package-lock.json +2566 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/package.json +21 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/__tests__/epc-api.test.ts +251 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/__tests__/key-roundtrip.test.ts +113 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/__tests__/lookup.test.ts +181 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/__tests__/schema-parity.test.ts +54 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/index.ts +156 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/lib/crypto.ts +79 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/lib/epc-api.ts +241 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/lib/file-crypto.ts +55 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/lib/key-store.ts +172 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/lib/neo4j.ts +47 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/tools/key-deregister.ts +9 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/tools/key-list.ts +10 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/tools/key-register.ts +44 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/src/tools/lookup.ts +43 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/tsconfig.json +20 -0
- package/payload/premium-plugins/real-agent/plugins/epc/mcp/vitest.config.ts +8 -0
- package/payload/premium-plugins/real-agent/plugins/preval/.claude-plugin/plugin.json +1 -1
- package/payload/premium-plugins/real-agent/plugins/preval/PLUGIN.md +25 -17
- package/payload/premium-plugins/real-agent/plugins/preval/skills/property-preval/SKILL.md +107 -39
- package/payload/premium-plugins/real-agent/plugins/preval/skills/property-preval/references/render.py +449 -84
- package/payload/premium-plugins/real-agent/plugins/preval/skills/property-preval/references/template-inputs.schema.json +126 -80
- package/payload/premium-plugins/real-agent/plugins/preval/skills/property-preval/references/template.html +183 -124
- package/payload/server/public/assets/{admin-Bp-BjBCX.js → admin-DhN3G8W7.js} +1 -1
- package/payload/server/public/assets/{data-BGUAGVkV.js → data-B2ZVXOcE.js} +1 -1
- package/payload/server/public/assets/{graph-MvYxZOBF.js → graph-BAMGPHrK.js} +1 -1
- package/payload/server/public/assets/{graph-labels-D865qb3K.js → graph-labels-D9eBbvxo.js} +1 -1
- package/payload/server/public/assets/{page-C2b1nlOc.js → page-CV27Al6Z.js} +1 -1
- package/payload/server/public/assets/{page--hOVRrgN.js → page-DjdVMWCz.js} +1 -1
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/graph.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/server.js +3 -16
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { resolve, dirname } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { getSession } from "./neo4j.js";
|
|
5
|
+
import { encrypt, decrypt } from "./crypto.js";
|
|
6
|
+
import { encryptWith, decryptWith } from "./file-crypto.js";
|
|
7
|
+
class Neo4jKeyStore {
|
|
8
|
+
backendName = "neo4j";
|
|
9
|
+
backendPath = process.env.NEO4J_URI ?? "<unset>";
|
|
10
|
+
async load(accountId) {
|
|
11
|
+
const session = getSession();
|
|
12
|
+
try {
|
|
13
|
+
const result = await session.run(`MATCH (k:EpcApiKey {accountId: $accountId})
|
|
14
|
+
RETURN k.encryptedKey AS encryptedKey,
|
|
15
|
+
k.createdAt AS createdAt,
|
|
16
|
+
k.updatedAt AS updatedAt`, { accountId });
|
|
17
|
+
if (result.records.length === 0)
|
|
18
|
+
return null;
|
|
19
|
+
const r = result.records[0];
|
|
20
|
+
return {
|
|
21
|
+
apiKey: decrypt(r.get("encryptedKey")),
|
|
22
|
+
createdAt: r.get("createdAt") ?? "",
|
|
23
|
+
updatedAt: r.get("updatedAt") ?? "",
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
await session.close();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async save(accountId, apiKey) {
|
|
31
|
+
const encryptedKey = encrypt(apiKey);
|
|
32
|
+
const now = new Date().toISOString();
|
|
33
|
+
const session = getSession();
|
|
34
|
+
try {
|
|
35
|
+
await session.run(`CREATE INDEX epc_api_key_account IF NOT EXISTS
|
|
36
|
+
FOR (k:EpcApiKey) ON (k.accountId)`, {});
|
|
37
|
+
await session.run(`MERGE (k:EpcApiKey {accountId: $accountId})
|
|
38
|
+
ON CREATE SET k.encryptedKey = $encryptedKey, k.createdAt = $now, k.updatedAt = $now
|
|
39
|
+
ON MATCH SET k.encryptedKey = $encryptedKey, k.updatedAt = $now`, { accountId, encryptedKey, now });
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
await session.close();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async delete(accountId) {
|
|
46
|
+
const session = getSession();
|
|
47
|
+
try {
|
|
48
|
+
const result = await session.run(`MATCH (k:EpcApiKey {accountId: $accountId})
|
|
49
|
+
DELETE k
|
|
50
|
+
RETURN count(k) AS deleted`, { accountId });
|
|
51
|
+
const deleted = result.records[0]?.get("deleted")?.toNumber?.() ?? 0;
|
|
52
|
+
return deleted > 0;
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
await session.close();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const LABEL = "epc";
|
|
60
|
+
class FileKeyStore {
|
|
61
|
+
backendName = "file";
|
|
62
|
+
backendPath;
|
|
63
|
+
storePath;
|
|
64
|
+
keyFilePath;
|
|
65
|
+
constructor() {
|
|
66
|
+
const home = homedir();
|
|
67
|
+
this.storePath = resolve(home, ".claude/.realagent-epc-key.enc");
|
|
68
|
+
this.keyFilePath = resolve(home, ".claude/.realagent-epc-encryption-key");
|
|
69
|
+
this.backendPath = this.storePath;
|
|
70
|
+
}
|
|
71
|
+
ensureDir() {
|
|
72
|
+
mkdirSync(dirname(this.storePath), { recursive: true });
|
|
73
|
+
}
|
|
74
|
+
readAll() {
|
|
75
|
+
if (!existsSync(this.storePath))
|
|
76
|
+
return {};
|
|
77
|
+
const blob = readFileSync(this.storePath, "utf-8").trim();
|
|
78
|
+
if (!blob)
|
|
79
|
+
return {};
|
|
80
|
+
const json = decryptWith(blob, this.keyFilePath, LABEL);
|
|
81
|
+
return JSON.parse(json);
|
|
82
|
+
}
|
|
83
|
+
writeAll(env) {
|
|
84
|
+
this.ensureDir();
|
|
85
|
+
const blob = encryptWith(JSON.stringify(env), this.keyFilePath, LABEL);
|
|
86
|
+
writeFileSync(this.storePath, blob, { mode: 0o600 });
|
|
87
|
+
}
|
|
88
|
+
async load(accountId) {
|
|
89
|
+
const env = this.readAll();
|
|
90
|
+
const entry = env[accountId];
|
|
91
|
+
if (!entry)
|
|
92
|
+
return null;
|
|
93
|
+
return {
|
|
94
|
+
apiKey: decryptWith(entry.encryptedKey, this.keyFilePath, LABEL),
|
|
95
|
+
createdAt: entry.createdAt,
|
|
96
|
+
updatedAt: entry.updatedAt,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async save(accountId, apiKey) {
|
|
100
|
+
const env = this.readAll();
|
|
101
|
+
const now = new Date().toISOString();
|
|
102
|
+
const encryptedKey = encryptWith(apiKey, this.keyFilePath, LABEL);
|
|
103
|
+
const prev = env[accountId];
|
|
104
|
+
env[accountId] = {
|
|
105
|
+
encryptedKey,
|
|
106
|
+
createdAt: prev?.createdAt ?? now,
|
|
107
|
+
updatedAt: now,
|
|
108
|
+
};
|
|
109
|
+
this.writeAll(env);
|
|
110
|
+
}
|
|
111
|
+
async delete(accountId) {
|
|
112
|
+
const env = this.readAll();
|
|
113
|
+
if (!(accountId in env))
|
|
114
|
+
return false;
|
|
115
|
+
delete env[accountId];
|
|
116
|
+
this.writeAll(env);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
let cached = null;
|
|
121
|
+
export function selectKeyStore() {
|
|
122
|
+
if (cached)
|
|
123
|
+
return cached;
|
|
124
|
+
cached = process.env.EPC_STANDALONE === "1" ? new FileKeyStore() : new Neo4jKeyStore();
|
|
125
|
+
return cached;
|
|
126
|
+
}
|
|
127
|
+
export function _resetKeyStoreForTests() {
|
|
128
|
+
cached = null;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=key-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-store.js","sourceRoot":"","sources":["../../src/lib/key-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAsB5D,MAAM,aAAa;IACR,WAAW,GAAG,OAAO,CAAC;IACtB,WAAW,GAAG,OAAO,C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GAAG;SACf,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QACtC,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,IAAI,MAAM,GAAoB,IAAI,CAAC;AAEnC,MAAM,UAAU,cAAc;IAC5B,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,aAAa,EAAE,CAAC;IACvF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j.d.ts","sourceRoot":"","sources":["../../src/lib/neo4j.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAqBtD,wBAAgB,SAAS,IAAI,MAAM,CAclC;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAKjD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import neo4j from "neo4j-driver";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
let driver = null;
|
|
5
|
+
function readPassword() {
|
|
6
|
+
if (process.env.NEO4J_PASSWORD)
|
|
7
|
+
return process.env.NEO4J_PASSWORD;
|
|
8
|
+
const passwordFile = resolve(process.env.PLATFORM_ROOT ?? resolve(import.meta.dirname, "../../../.."), "config/.neo4j-password");
|
|
9
|
+
try {
|
|
10
|
+
return readFileSync(passwordFile, "utf-8").trim();
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
throw new Error(`Neo4j password not found. Expected at ${passwordFile} or in NEO4J_PASSWORD env var.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function getDriver() {
|
|
17
|
+
if (!driver) {
|
|
18
|
+
const uri = process.env.NEO4J_URI;
|
|
19
|
+
if (!uri) {
|
|
20
|
+
throw new Error("[epc] NEO4J_URI unset — refusing to default to bolt://localhost:7687");
|
|
21
|
+
}
|
|
22
|
+
const user = process.env.NEO4J_USER ?? "neo4j";
|
|
23
|
+
const password = readPassword();
|
|
24
|
+
console.error(`[epc] resolved neo4j_uri=${uri}`);
|
|
25
|
+
driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
|
|
26
|
+
}
|
|
27
|
+
return driver;
|
|
28
|
+
}
|
|
29
|
+
export function getSession() {
|
|
30
|
+
return getDriver().session();
|
|
31
|
+
}
|
|
32
|
+
export async function closeDriver() {
|
|
33
|
+
if (driver) {
|
|
34
|
+
await driver.close();
|
|
35
|
+
driver = null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=neo4j.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neo4j.js","sourceRoot":"","sources":["../../src/lib/neo4j.ts"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC,SAAS,YAAY;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OA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 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-deregister.d.ts","sourceRoot":"","sources":["../../src/tools/key-deregister.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { selectKeyStore } from "../lib/key-store.js";
|
|
2
|
+
export async function keyDeregister(params) {
|
|
3
|
+
const deleted = await selectKeyStore().delete(params.accountId);
|
|
4
|
+
if (!deleted) {
|
|
5
|
+
throw new Error("No EPC API key is registered for this account.");
|
|
6
|
+
}
|
|
7
|
+
console.error(`[epc] key-op op=deregister account=${params.accountId}`);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=key-deregister.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-deregister.js","sourceRoot":"","sources":["../../src/tools/key-deregister.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAA6B;IAC/D,MAAM,OAAO,GAAG,MAAM,cAAc,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,sCAAsC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-list.d.ts","sourceRoot":"","sources":["../../src/tools/key-list.ts"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { loadAccountKey } from "../lib/epc-api.js";
|
|
2
|
+
export async function keyList(params) {
|
|
3
|
+
const key = await loadAccountKey(params.accountId);
|
|
4
|
+
console.error(`[epc] key-op op=list account=${params.accountId}`);
|
|
5
|
+
if (!key) {
|
|
6
|
+
return "No EPC API key registered. Use epc-key-register to add one.";
|
|
7
|
+
}
|
|
8
|
+
return `EPC API key registered (created: ${key.createdAt}, updated: ${key.updatedAt}). Key value is encrypted and cannot be retrieved.`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=key-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-list.js","sourceRoot":"","sources":["../../src/tools/key-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,MAA6B;IACzD,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnD,OAAO,CAAC,KAAK,CAAC,gCAAgC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,6DAA6D,CAAC;IACvE,CAAC;IACD,OAAO,oCAAoC,GAAG,CAAC,SAAS,cAAc,GAAG,CAAC,SAAS,oDAAoD,CAAC;AAC1I,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-register.d.ts","sourceRoot":"","sources":["../../src/tools/key-register.ts"],"names":[],"mappings":"AA8BA,wBAAsB,WAAW,CAAC,MAAM,EAAE;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { selectKeyStore } from "../lib/key-store.js";
|
|
2
|
+
import { BASE_URL, REQUEST_TIMEOUT_MS, EpcError } from "../lib/epc-api.js";
|
|
3
|
+
// Probe the EPC register with the supplied credential against
|
|
4
|
+
// /domestic/search constrained to a tiny page so we do not pull a real
|
|
5
|
+
// payload. A valid credential returns HTTP 200 (rows may be empty for a
|
|
6
|
+
// nonsense postcode, which is fine — authentication is what we test).
|
|
7
|
+
// An invalid credential returns HTTP 401 Unauthorized.
|
|
8
|
+
async function validateApiKey(credential) {
|
|
9
|
+
const url = `${BASE_URL}/domestic/search?postcode=SW1A1AA&size=1`;
|
|
10
|
+
const response = await fetch(url, {
|
|
11
|
+
headers: {
|
|
12
|
+
Accept: "application/json",
|
|
13
|
+
Authorization: `Basic ${Buffer.from(credential, "utf-8").toString("base64")}`,
|
|
14
|
+
},
|
|
15
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
16
|
+
});
|
|
17
|
+
if (response.status === 401 || response.status === 403) {
|
|
18
|
+
throw new Error(`EPC register rejected the credential (HTTP ${response.status}). Expected format is email:api-key.`);
|
|
19
|
+
}
|
|
20
|
+
// 200, 404 (no rows for that postcode), and 200-with-rows all prove the
|
|
21
|
+
// credential was accepted. Anything else surfaces as the upstream code.
|
|
22
|
+
if (response.status === 200 || response.status === 404)
|
|
23
|
+
return;
|
|
24
|
+
const body = await response.text().catch(() => "");
|
|
25
|
+
throw new EpcError(response.status, "domestic/search", body.slice(0, 200));
|
|
26
|
+
}
|
|
27
|
+
export async function keyRegister(params) {
|
|
28
|
+
const { apiKey, accountId } = params;
|
|
29
|
+
if (!apiKey.includes(":")) {
|
|
30
|
+
throw new Error("EPC credential must be in the form email:api-key (email of the account that generated the key, then a colon, then the API key).");
|
|
31
|
+
}
|
|
32
|
+
await validateApiKey(apiKey);
|
|
33
|
+
await selectKeyStore().save(accountId, apiKey);
|
|
34
|
+
console.error(`[epc] key-op op=register account=${accountId}`);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=key-register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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KAAK,UAAU,WAAW,CAAC,MAGjC;IACC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,iIAAiI,CAClI,CAAC;IACJ,CAAC;IACD,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,cAAc,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,CAAC,KAAK,CAAC,oCAAoC,SAAS,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function epcLookupByAddress(args: {
|
|
2
|
+
accountId: string;
|
|
3
|
+
address: string;
|
|
4
|
+
postcode?: string;
|
|
5
|
+
}): Promise<string>;
|
|
6
|
+
export declare function epcLookupByUprn(args: {
|
|
7
|
+
accountId: string;
|
|
8
|
+
uprn: string;
|
|
9
|
+
}): Promise<string>;
|
|
10
|
+
//# sourceMappingURL=lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/tools/lookup.ts"],"names":[],"mappings":"AAOA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAalB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAalB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { epcSearch, groupAndPickMostRecent } from "../lib/epc-api.js";
|
|
2
|
+
export async function epcLookupByAddress(args) {
|
|
3
|
+
const { accountId, address, postcode } = args;
|
|
4
|
+
const { rows } = await epcSearch({
|
|
5
|
+
toolName: "epc-lookup-by-address",
|
|
6
|
+
accountId,
|
|
7
|
+
identifier: address,
|
|
8
|
+
params: { address, postcode, size: 25 },
|
|
9
|
+
});
|
|
10
|
+
const result = {
|
|
11
|
+
status: "ok",
|
|
12
|
+
matches: groupAndPickMostRecent(rows),
|
|
13
|
+
};
|
|
14
|
+
return JSON.stringify(result, null, 2);
|
|
15
|
+
}
|
|
16
|
+
export async function epcLookupByUprn(args) {
|
|
17
|
+
const { accountId, uprn } = args;
|
|
18
|
+
const { rows } = await epcSearch({
|
|
19
|
+
toolName: "epc-lookup-by-uprn",
|
|
20
|
+
accountId,
|
|
21
|
+
identifier: uprn,
|
|
22
|
+
params: { uprn, size: 25 },
|
|
23
|
+
});
|
|
24
|
+
const result = {
|
|
25
|
+
status: "ok",
|
|
26
|
+
matches: groupAndPickMostRecent(rows),
|
|
27
|
+
};
|
|
28
|
+
return JSON.stringify(result, null, 2);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=lookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../src/tools/lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAY,MAAM,mBAAmB,CAAC;AAOhF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAIxC;IACC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,SAAS,CAAC;QAC/B,QAAQ,EAAE,uBAAuB;QACjC,SAAS;QACT,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE;KACxC,CAAC,CAAC;IACH,MAAM,MAAM,GAAiB;QAC3B,MAA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