@x12i/memorix-service 3.7.6 → 3.7.8
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/activity-ring.d.ts +16 -0
- package/dist/activity-ring.d.ts.map +1 -1
- package/dist/activity-ring.js +15 -0
- package/dist/activity-ring.js.map +1 -1
- package/dist/activity-routes.d.ts.map +1 -1
- package/dist/activity-routes.js +6 -0
- package/dist/activity-routes.js.map +1 -1
- package/dist/activity-ui.d.ts +1 -1
- package/dist/activity-ui.d.ts.map +1 -1
- package/dist/activity-ui.js +383 -177
- package/dist/activity-ui.js.map +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +8 -1
- package/dist/app.js.map +1 -1
- package/dist/catalog-bridge.d.ts.map +1 -1
- package/dist/catalog-bridge.js +6 -0
- package/dist/catalog-bridge.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +9 -1
- package/dist/cli.js.map +1 -1
- package/dist/data-changes-ui.js +1 -1
- package/dist/graph-ui.d.ts +3 -0
- package/dist/graph-ui.d.ts.map +1 -0
- package/dist/graph-ui.js +676 -0
- package/dist/graph-ui.js.map +1 -0
- package/dist/knowledge-upstream.d.ts +13 -0
- package/dist/knowledge-upstream.d.ts.map +1 -0
- package/dist/knowledge-upstream.js +38 -0
- package/dist/knowledge-upstream.js.map +1 -0
- package/dist/live-ops-nav.d.ts +2 -0
- package/dist/live-ops-nav.d.ts.map +1 -0
- package/dist/live-ops-nav.js +53 -0
- package/dist/live-ops-nav.js.map +1 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/mcp/nexum-tools.d.ts +28 -0
- package/dist/mcp/nexum-tools.d.ts.map +1 -0
- package/dist/mcp/nexum-tools.js +257 -0
- package/dist/mcp/nexum-tools.js.map +1 -0
- package/dist/mcp/service-public-url.d.ts +7 -0
- package/dist/mcp/service-public-url.d.ts.map +1 -0
- package/dist/mcp/service-public-url.js +19 -0
- package/dist/mcp/service-public-url.js.map +1 -0
- package/dist/openapi/openapi.json +449 -4
- package/dist/routes/data.d.ts.map +1 -1
- package/dist/routes/data.js +242 -16
- package/dist/routes/data.js.map +1 -1
- package/dist/routes/knowledge.d.ts.map +1 -1
- package/dist/routes/knowledge.js +9 -37
- package/dist/routes/knowledge.js.map +1 -1
- package/dist/routes/nexum-mcp.d.ts +9 -0
- package/dist/routes/nexum-mcp.d.ts.map +1 -0
- package/dist/routes/nexum-mcp.js +95 -0
- package/dist/routes/nexum-mcp.js.map +1 -0
- package/dist/safe-query.d.ts +31 -0
- package/dist/safe-query.d.ts.map +1 -0
- package/dist/safe-query.js +125 -0
- package/dist/safe-query.js.map +1 -0
- package/openapi/openapi.json +449 -4
- package/package.json +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function knowledgeUpstreamUrl(env?: NodeJS.ProcessEnv): string;
|
|
2
|
+
export declare function proxyJson(method: string, url: string, opts?: {
|
|
3
|
+
body?: unknown;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
status: number;
|
|
7
|
+
body: unknown;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function throwIfKnowledgeUpstreamError(upstream: {
|
|
10
|
+
status: number;
|
|
11
|
+
body: unknown;
|
|
12
|
+
}): void;
|
|
13
|
+
//# sourceMappingURL=knowledge-upstream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-upstream.d.ts","sourceRoot":"","sources":["../src/knowledge-upstream.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAClC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAMR;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC1D,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAoB5C;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1C,IAAI,CASN"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Nexum explore REST (canvas) upstream helpers.
|
|
3
|
+
* Subjects stay on /api/data/content — this is the Mongo graphified-* store.
|
|
4
|
+
*/
|
|
5
|
+
import { ServiceError } from "./errors.js";
|
|
6
|
+
export function knowledgeUpstreamUrl(env = process.env) {
|
|
7
|
+
return (env.MEMORIX_NEXUM_EXPLORE_URL?.trim() ||
|
|
8
|
+
env.NEXUM_API_URL?.trim() ||
|
|
9
|
+
"http://127.0.0.1:8080").replace(/\/+$/, "");
|
|
10
|
+
}
|
|
11
|
+
export async function proxyJson(method, url, opts) {
|
|
12
|
+
const res = await fetch(url, {
|
|
13
|
+
method,
|
|
14
|
+
headers: {
|
|
15
|
+
...(opts?.body !== undefined
|
|
16
|
+
? { "content-type": "application/json" }
|
|
17
|
+
: {}),
|
|
18
|
+
...(opts?.headers ?? {}),
|
|
19
|
+
},
|
|
20
|
+
...(opts?.body !== undefined ? { body: JSON.stringify(opts.body) } : {}),
|
|
21
|
+
signal: AbortSignal.timeout(30_000),
|
|
22
|
+
});
|
|
23
|
+
const text = await res.text();
|
|
24
|
+
let parsed = text;
|
|
25
|
+
try {
|
|
26
|
+
parsed = text ? JSON.parse(text) : null;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
/* keep text */
|
|
30
|
+
}
|
|
31
|
+
return { status: res.status, body: parsed };
|
|
32
|
+
}
|
|
33
|
+
export function throwIfKnowledgeUpstreamError(upstream) {
|
|
34
|
+
if (upstream.status >= 400) {
|
|
35
|
+
throw new ServiceError("KNOWLEDGE_UPSTREAM_ERROR", `knowledge upstream HTTP ${upstream.status}`, upstream.status >= 500 ? 502 : upstream.status, { upstream: upstream.body });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=knowledge-upstream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-upstream.js","sourceRoot":"","sources":["../src/knowledge-upstream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAClC,MAAyB,OAAO,CAAC,GAAG;IAEpC,OAAO,CACL,GAAG,CAAC,yBAAyB,EAAE,IAAI,EAAE;QACrC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE;QACzB,uBAAuB,CACxB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAc,EACd,GAAW,EACX,IAA2D;IAE3D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,MAAM;QACN,OAAO,EAAE;YACP,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,SAAS;gBAC1B,CAAC,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBACxC,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC;SACzB;QACD,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;KACpC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,MAAM,GAAY,IAAI,CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,QAA2C;IAE3C,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QAC3B,MAAM,IAAI,YAAY,CACpB,0BAA0B,EAC1B,2BAA2B,QAAQ,CAAC,MAAM,EAAE,EAC5C,QAAQ,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAC9C,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,CAC5B,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-ops-nav.d.ts","sourceRoot":"","sources":["../src/live-ops-nav.ts"],"names":[],"mappings":"AA8CA,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inject Memorix operator pages into the shared `/_live` HTML
|
|
3
|
+
* (activity / graph / changes are memorix-service routes, not api-live-view).
|
|
4
|
+
*/
|
|
5
|
+
const NAV_MARK = 'id="memorix-ops-nav"';
|
|
6
|
+
const NAV_HTML = `
|
|
7
|
+
<style>
|
|
8
|
+
#memorix-ops-nav {
|
|
9
|
+
display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch;
|
|
10
|
+
margin: 0 0 18px; padding: 12px 14px;
|
|
11
|
+
background: #10141b; border: 1px solid #242b38;
|
|
12
|
+
}
|
|
13
|
+
#memorix-ops-nav a {
|
|
14
|
+
display: flex; flex-direction: column; gap: 4px;
|
|
15
|
+
flex: 1 1 180px; min-width: 160px;
|
|
16
|
+
padding: 12px 14px; text-decoration: none;
|
|
17
|
+
border: 1px solid #242b38; background: #141922; color: #e8ebe6;
|
|
18
|
+
border-radius: 2px;
|
|
19
|
+
}
|
|
20
|
+
#memorix-ops-nav a:hover { border-color: #c8f082; }
|
|
21
|
+
#memorix-ops-nav a strong {
|
|
22
|
+
font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase;
|
|
23
|
+
color: #c8f082; font-weight: 600;
|
|
24
|
+
}
|
|
25
|
+
#memorix-ops-nav a span {
|
|
26
|
+
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
|
27
|
+
font-size: 11px; color: #8a9288; line-height: 1.35;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
30
|
+
<nav id="memorix-ops-nav" aria-label="Memorix operator pages">
|
|
31
|
+
<a href="/_live/activity">
|
|
32
|
+
<strong>Activity</strong>
|
|
33
|
+
<span>Pushed · Processed · Fetched</span>
|
|
34
|
+
</a>
|
|
35
|
+
<a href="/_live/graph">
|
|
36
|
+
<strong>Stored graph</strong>
|
|
37
|
+
<span>Browse knowledge-graph snapshots</span>
|
|
38
|
+
</a>
|
|
39
|
+
<a href="/_live/changes">
|
|
40
|
+
<strong>Data changes</strong>
|
|
41
|
+
<span>OT × CT change matrix</span>
|
|
42
|
+
</a>
|
|
43
|
+
</nav>
|
|
44
|
+
`;
|
|
45
|
+
export function withMemorixLiveOpsNav(html) {
|
|
46
|
+
if (!html || html.includes(NAV_MARK))
|
|
47
|
+
return html;
|
|
48
|
+
if (html.includes("</header>")) {
|
|
49
|
+
return html.replace("</header>", `</header>\n${NAV_HTML}`);
|
|
50
|
+
}
|
|
51
|
+
return html;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=live-ops-nav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-ops-nav.js","sourceRoot":"","sources":["../src/live-ops-nav.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AAExC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsChB,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAClD,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,QAAQ,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/live.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;AA4BnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,oBAAoB,GAAG,CAC1B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,iBAAiB,KACxB,OAAO,CAAC,IAAI,CAAC,CAAC;AAKnB,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,GACpC,IAAI,CAEN;AAwBD,eAAO,MAAM,eAAe;;;;
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;AA4BnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,oBAAoB,GAAG,CAC1B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,iBAAiB,KACxB,OAAO,CAAC,IAAI,CAAC,CAAC;AAKnB,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,GACpC,IAAI,CAEN;AAwBD,eAAO,MAAM,eAAe;;;;UA5C5B,CADA;;;UAKc,CAAC;;iEAKP,CAAC;;;;;;CAmCyC,CAAC;AAEnD,mEAAmE;AACnE,eAAO,MAAM,eAAe,cAE1B,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,cAE9B,CAAC;AAuQH,iGAAiG;AACjG,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BzB;AAslBD,iFAAiF;AACjF,eAAO,MAAM,kBAAkB;;wBAEH,oBAAoB,KAAG,OAAO,CAAC,mBAAmB,CAAC;CAsC9E,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only memorix-nexum MCP tools: knowledge-graph subjects + canvas proxy.
|
|
3
|
+
*/
|
|
4
|
+
import type { MemorixPlatform } from "../platform.js";
|
|
5
|
+
import type { MemorixScope } from "../scope.js";
|
|
6
|
+
export declare const NEXUM_MCP_TOOL_NAMES: readonly ["nexum_list_snapshots", "nexum_get_snapshot", "nexum_knowledge_status", "nexum_list_entities", "nexum_get_entity", "nexum_query"];
|
|
7
|
+
export type NexumMcpToolName = (typeof NEXUM_MCP_TOOL_NAMES)[number];
|
|
8
|
+
type JsonSchema = Record<string, unknown>;
|
|
9
|
+
type ToolDef = {
|
|
10
|
+
name: NexumMcpToolName;
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: JsonSchema;
|
|
13
|
+
};
|
|
14
|
+
export declare const NEXUM_MCP_TOOLS: ToolDef[];
|
|
15
|
+
export declare function callNexumMcpTool(opts: {
|
|
16
|
+
platform: MemorixPlatform;
|
|
17
|
+
scope: MemorixScope;
|
|
18
|
+
name: string;
|
|
19
|
+
args: unknown;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
content: Array<{
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
}>;
|
|
25
|
+
isError?: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=nexum-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nexum-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/nexum-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAShD,eAAO,MAAM,oBAAoB,6IAOvB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAAO,EA0EpC,CAAC;AAuDF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CA6ID"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { ServiceError } from "../errors.js";
|
|
2
|
+
import { knowledgeUpstreamUrl, proxyJson, throwIfKnowledgeUpstreamError, } from "../knowledge-upstream.js";
|
|
3
|
+
import { recordLooksLikeKnowledgeGraph } from "../activity-ring.js";
|
|
4
|
+
export const NEXUM_MCP_TOOL_NAMES = [
|
|
5
|
+
"nexum_list_snapshots",
|
|
6
|
+
"nexum_get_snapshot",
|
|
7
|
+
"nexum_knowledge_status",
|
|
8
|
+
"nexum_list_entities",
|
|
9
|
+
"nexum_get_entity",
|
|
10
|
+
"nexum_query",
|
|
11
|
+
];
|
|
12
|
+
export const NEXUM_MCP_TOOLS = [
|
|
13
|
+
{
|
|
14
|
+
name: "nexum_list_snapshots",
|
|
15
|
+
description: "List Memorix knowledge-graph snapshot subjects (objectType=content, contentType=snapshots). Optional filter to data.kind=knowledge-graph.",
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
limit: { type: "number", description: "Max records (default 50, max 200)" },
|
|
20
|
+
cursor: { type: "string" },
|
|
21
|
+
knowledgeGraphOnly: {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
description: "When true, keep only records with data.kind=knowledge-graph",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "nexum_get_snapshot",
|
|
30
|
+
description: "Get one Memorix content/snapshots subject by recordId (knowledge-graph snapshot when indexed).",
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: "object",
|
|
33
|
+
properties: {
|
|
34
|
+
recordId: { type: "string" },
|
|
35
|
+
},
|
|
36
|
+
required: ["recordId"],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "nexum_knowledge_status",
|
|
41
|
+
description: "Probe Nexum explore REST (canvas Mongo store) health. Separate from Memorix subjects.",
|
|
42
|
+
inputSchema: { type: "object", properties: {} },
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "nexum_list_entities",
|
|
46
|
+
description: "List or search canvas graph entities via Nexum explore REST (graphified-* Mongo).",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
graphId: { type: "string" },
|
|
51
|
+
q: { type: "string", description: "Search query; omit for visualization slice" },
|
|
52
|
+
limit: { type: "string" },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "nexum_get_entity",
|
|
58
|
+
description: "Get one canvas entity/node by id from Nexum explore REST.",
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: "object",
|
|
61
|
+
properties: {
|
|
62
|
+
entityId: { type: "string" },
|
|
63
|
+
graphId: { type: "string" },
|
|
64
|
+
},
|
|
65
|
+
required: ["entityId"],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "nexum_query",
|
|
70
|
+
description: "Neighbor query on the canvas graph (Nexum explore REST). Requires nodeId seed.",
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
nodeId: { type: "string" },
|
|
75
|
+
graphId: { type: "string" },
|
|
76
|
+
depth: { type: "number" },
|
|
77
|
+
},
|
|
78
|
+
required: ["nodeId"],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
function asRecord(args) {
|
|
83
|
+
return args && typeof args === "object" && !Array.isArray(args)
|
|
84
|
+
? args
|
|
85
|
+
: {};
|
|
86
|
+
}
|
|
87
|
+
function textResult(payload) {
|
|
88
|
+
return {
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: "text",
|
|
92
|
+
text: typeof payload === "string"
|
|
93
|
+
? payload
|
|
94
|
+
: JSON.stringify(payload, null, 2),
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function errorResult(err) {
|
|
100
|
+
if (err instanceof ServiceError) {
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: "text",
|
|
105
|
+
text: JSON.stringify({ code: err.code, message: err.message, details: err.details }, null, 2),
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
isError: true,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: "text",
|
|
115
|
+
text: err instanceof Error ? err.message : String(err),
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
isError: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export async function callNexumMcpTool(opts) {
|
|
122
|
+
const { platform, scope, name } = opts;
|
|
123
|
+
const args = asRecord(opts.args);
|
|
124
|
+
try {
|
|
125
|
+
switch (name) {
|
|
126
|
+
case "nexum_list_snapshots": {
|
|
127
|
+
const ports = platform.portsFor(scope);
|
|
128
|
+
const limit = Math.min(Number(args.limit ?? 50) || 50, 200);
|
|
129
|
+
const listed = await ports.reader.listContent(scope, {
|
|
130
|
+
objectType: "content",
|
|
131
|
+
contentType: "snapshots",
|
|
132
|
+
limit,
|
|
133
|
+
cursor: typeof args.cursor === "string" ? args.cursor : undefined,
|
|
134
|
+
});
|
|
135
|
+
let items = listed.items ?? [];
|
|
136
|
+
if (args.knowledgeGraphOnly === true) {
|
|
137
|
+
items = items.filter((r) => recordLooksLikeKnowledgeGraph(r));
|
|
138
|
+
}
|
|
139
|
+
return textResult({
|
|
140
|
+
scope,
|
|
141
|
+
addressing: {
|
|
142
|
+
objectType: "content",
|
|
143
|
+
contentType: "snapshots",
|
|
144
|
+
},
|
|
145
|
+
records: items,
|
|
146
|
+
pageInfo: { nextCursor: listed.nextCursor ?? null },
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
case "nexum_get_snapshot": {
|
|
150
|
+
const recordId = String(args.recordId ?? "").trim();
|
|
151
|
+
if (!recordId) {
|
|
152
|
+
throw new ServiceError("VALIDATION", "recordId required", 400);
|
|
153
|
+
}
|
|
154
|
+
const ports = platform.portsFor(scope);
|
|
155
|
+
const record = await ports.reader.getContent(scope, {
|
|
156
|
+
objectType: "content",
|
|
157
|
+
contentType: "snapshots",
|
|
158
|
+
recordId,
|
|
159
|
+
});
|
|
160
|
+
return textResult({
|
|
161
|
+
scope,
|
|
162
|
+
addressing: {
|
|
163
|
+
objectType: "content",
|
|
164
|
+
contentType: "snapshots",
|
|
165
|
+
recordId,
|
|
166
|
+
},
|
|
167
|
+
record,
|
|
168
|
+
knowledgeGraph: recordLooksLikeKnowledgeGraph(record),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
case "nexum_knowledge_status": {
|
|
172
|
+
const baseUrl = knowledgeUpstreamUrl();
|
|
173
|
+
let upstream = {
|
|
174
|
+
ok: false,
|
|
175
|
+
};
|
|
176
|
+
try {
|
|
177
|
+
const health = await proxyJson("GET", `${baseUrl}/health`);
|
|
178
|
+
upstream = {
|
|
179
|
+
ok: health.status >= 200 && health.status < 300,
|
|
180
|
+
status: health.status,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
upstream = {
|
|
185
|
+
ok: false,
|
|
186
|
+
error: err instanceof Error ? err.message : String(err),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return textResult({
|
|
190
|
+
scope,
|
|
191
|
+
upstreamOk: upstream.ok,
|
|
192
|
+
upstream,
|
|
193
|
+
exploreBaseUrl: baseUrl,
|
|
194
|
+
note: "Canvas store (Nexum explore REST). Subjects use nexum_list_snapshots / nexum_get_snapshot.",
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
case "nexum_list_entities": {
|
|
198
|
+
const graphId = String(args.graphId ?? "default").trim() || "default";
|
|
199
|
+
const q = typeof args.q === "string" ? args.q.trim() : "";
|
|
200
|
+
const limit = String(args.limit ?? (q ? "50" : "500"));
|
|
201
|
+
const baseUrl = knowledgeUpstreamUrl();
|
|
202
|
+
const path = q
|
|
203
|
+
? `/v1/orgs/${encodeURIComponent(scope.orgId)}/graphs/${encodeURIComponent(graphId)}/search?q=${encodeURIComponent(q)}&limit=${encodeURIComponent(limit)}`
|
|
204
|
+
: `/v1/orgs/${encodeURIComponent(scope.orgId)}/graphs/${encodeURIComponent(graphId)}/visualization?maximumNodes=${encodeURIComponent(limit)}`;
|
|
205
|
+
const upstream = await proxyJson("GET", `${baseUrl}${path}`);
|
|
206
|
+
throwIfKnowledgeUpstreamError(upstream);
|
|
207
|
+
return textResult({
|
|
208
|
+
scope,
|
|
209
|
+
graphId,
|
|
210
|
+
result: upstream.body,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
case "nexum_get_entity": {
|
|
214
|
+
const entityId = String(args.entityId ?? "").trim();
|
|
215
|
+
if (!entityId) {
|
|
216
|
+
throw new ServiceError("VALIDATION", "entityId required", 400);
|
|
217
|
+
}
|
|
218
|
+
const graphId = String(args.graphId ?? "default").trim() || "default";
|
|
219
|
+
const baseUrl = knowledgeUpstreamUrl();
|
|
220
|
+
const path = `/v1/orgs/${encodeURIComponent(scope.orgId)}/graphs/${encodeURIComponent(graphId)}/nodes/${encodeURIComponent(entityId)}`;
|
|
221
|
+
const upstream = await proxyJson("GET", `${baseUrl}${path}`);
|
|
222
|
+
throwIfKnowledgeUpstreamError(upstream);
|
|
223
|
+
return textResult({
|
|
224
|
+
scope,
|
|
225
|
+
graphId,
|
|
226
|
+
entityId,
|
|
227
|
+
result: upstream.body,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
case "nexum_query": {
|
|
231
|
+
const nodeId = String(args.nodeId ?? "").trim();
|
|
232
|
+
if (!nodeId) {
|
|
233
|
+
throw new ServiceError("VALIDATION", "nodeId required", 400);
|
|
234
|
+
}
|
|
235
|
+
const graphId = String(args.graphId ?? "default").trim() || "default";
|
|
236
|
+
const depth = Number(args.depth ?? 1);
|
|
237
|
+
const baseUrl = knowledgeUpstreamUrl();
|
|
238
|
+
const path = `/v1/orgs/${encodeURIComponent(scope.orgId)}/graphs/${encodeURIComponent(graphId)}/nodes/${encodeURIComponent(nodeId)}/neighbors?depth=${encodeURIComponent(String(depth))}`;
|
|
239
|
+
const upstream = await proxyJson("GET", `${baseUrl}${path}`);
|
|
240
|
+
throwIfKnowledgeUpstreamError(upstream);
|
|
241
|
+
return textResult({
|
|
242
|
+
scope,
|
|
243
|
+
graphId,
|
|
244
|
+
seed: nodeId,
|
|
245
|
+
depth,
|
|
246
|
+
result: upstream.body,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
default:
|
|
250
|
+
throw new ServiceError("VALIDATION", `Unknown tool: ${name}`, 400);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch (err) {
|
|
254
|
+
return errorResult(err);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=nexum-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nexum-tools.js","sourceRoot":"","sources":["../../src/mcp/nexum-tools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,6BAA6B,EAA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G,CACJ,CAAC;QACN,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute base URL for agent-facing links (MCP copy snippets, OpenAPI).
|
|
3
|
+
* Prefer public advertise URL, then MEMORIX_SERVICE_URL; never advertise 0.0.0.0.
|
|
4
|
+
*/
|
|
5
|
+
export declare function memorixServicePublicUrl(env?: NodeJS.ProcessEnv): string;
|
|
6
|
+
export declare function nexumMcpPublicUrl(env?: NodeJS.ProcessEnv): string;
|
|
7
|
+
//# sourceMappingURL=service-public-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-public-url.d.ts","sourceRoot":"","sources":["../../src/mcp/service-public-url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAWR;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAER"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute base URL for agent-facing links (MCP copy snippets, OpenAPI).
|
|
3
|
+
* Prefer public advertise URL, then MEMORIX_SERVICE_URL; never advertise 0.0.0.0.
|
|
4
|
+
*/
|
|
5
|
+
export function memorixServicePublicUrl(env = process.env) {
|
|
6
|
+
const fromEnv = env.MEMORIX_PUBLIC_URL?.trim() ||
|
|
7
|
+
env.MEMORIX_SERVICE_PUBLIC_URL?.trim() ||
|
|
8
|
+
env.MEMORIX_SERVICE_URL?.trim();
|
|
9
|
+
if (fromEnv)
|
|
10
|
+
return fromEnv.replace(/\/+$/, "");
|
|
11
|
+
const port = Number(env.MEMORIX_SERVICE_PORT ?? 5100);
|
|
12
|
+
const rawHost = env.MEMORIX_SERVICE_HOST?.trim() || "127.0.0.1";
|
|
13
|
+
const host = rawHost === "0.0.0.0" || rawHost === "::" ? "127.0.0.1" : rawHost;
|
|
14
|
+
return `http://${host}:${Number.isFinite(port) ? port : 5100}`;
|
|
15
|
+
}
|
|
16
|
+
export function nexumMcpPublicUrl(env = process.env) {
|
|
17
|
+
return `${memorixServicePublicUrl(env)}/mcp/nexum`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=service-public-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-public-url.js","sourceRoot":"","sources":["../../src/mcp/service-public-url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,OAAO,GACX,GAAG,CAAC,kBAAkB,EAAE,IAAI,EAAE;QAC9B,GAAG,CAAC,0BAA0B,EAAE,IAAI,EAAE;QACtC,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,CAAC;IAClC,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,IAAI,IAAI,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,GAAG,CAAC,oBAAoB,EAAE,IAAI,EAAE,IAAI,WAAW,CAAC;IAChE,MAAM,IAAI,GACR,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;IACpE,OAAO,UAAU,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,MAAyB,OAAO,CAAC,GAAG;IAEpC,OAAO,GAAG,uBAAuB,CAAC,GAAG,CAAC,YAAY,CAAC;AACrD,CAAC"}
|