@carlonicora/nestjs-neo4jsonapi 8.7.0 → 8.9.0
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/agents/graph/services/graph.search.service.d.ts +14 -1
- package/dist/agents/graph/services/graph.search.service.d.ts.map +1 -1
- package/dist/agents/graph/services/graph.search.service.js +15 -4
- package/dist/agents/graph/services/graph.search.service.js.map +1 -1
- package/dist/agents/graph/tools/read-entity.tool.d.ts.map +1 -1
- package/dist/agents/graph/tools/read-entity.tool.js +19 -7
- package/dist/agents/graph/tools/read-entity.tool.js.map +1 -1
- package/dist/agents/graph/tools/tool.factory.d.ts +7 -0
- package/dist/agents/graph/tools/tool.factory.d.ts.map +1 -1
- package/dist/agents/graph/tools/tool.factory.js +12 -0
- package/dist/agents/graph/tools/tool.factory.js.map +1 -1
- package/dist/common/interfaces/external.entity.source.interface.d.ts +28 -0
- package/dist/common/interfaces/external.entity.source.interface.d.ts.map +1 -1
- package/dist/common/interfaces/external.entity.source.interface.js +35 -0
- package/dist/common/interfaces/external.entity.source.interface.js.map +1 -1
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.d.ts +2 -2
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.d.ts.map +1 -1
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.js +5 -2
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.js.map +1 -1
- package/dist/foundations/assistant/services/assistant-mention.extractor.d.ts +6 -0
- package/dist/foundations/assistant/services/assistant-mention.extractor.d.ts.map +1 -1
- package/dist/foundations/assistant/services/assistant-mention.extractor.js +18 -1
- package/dist/foundations/assistant/services/assistant-mention.extractor.js.map +1 -1
- package/dist/foundations/company/entities/company.d.ts +1 -0
- package/dist/foundations/company/entities/company.d.ts.map +1 -1
- package/dist/foundations/company/entities/company.js +1 -0
- package/dist/foundations/company/entities/company.js.map +1 -1
- package/dist/foundations/company/repositories/company.repository.d.ts +16 -1
- package/dist/foundations/company/repositories/company.repository.d.ts.map +1 -1
- package/dist/foundations/company/repositories/company.repository.js +31 -1
- package/dist/foundations/company/repositories/company.repository.js.map +1 -1
- package/dist/foundations/referral/repositories/referral.repository.d.ts +20 -0
- package/dist/foundations/referral/repositories/referral.repository.d.ts.map +1 -1
- package/dist/foundations/referral/repositories/referral.repository.js +42 -0
- package/dist/foundations/referral/repositories/referral.repository.js.map +1 -1
- package/dist/foundations/referral/services/referral.service.d.ts +14 -0
- package/dist/foundations/referral/services/referral.service.d.ts.map +1 -1
- package/dist/foundations/referral/services/referral.service.js +19 -0
- package/dist/foundations/referral/services/referral.service.js.map +1 -1
- package/dist/foundations/stripe-trial/services/trial.service.d.ts +1 -0
- package/dist/foundations/stripe-trial/services/trial.service.d.ts.map +1 -1
- package/dist/foundations/stripe-trial/services/trial.service.js +7 -0
- package/dist/foundations/stripe-trial/services/trial.service.js.map +1 -1
- package/dist/mcp/services/mcp.entity.write.service.d.ts +11 -0
- package/dist/mcp/services/mcp.entity.write.service.d.ts.map +1 -1
- package/dist/mcp/services/mcp.entity.write.service.js +15 -0
- package/dist/mcp/services/mcp.entity.write.service.js.map +1 -1
- package/dist/mcp/services/mcp.errors.d.ts +6 -1
- package/dist/mcp/services/mcp.errors.d.ts.map +1 -1
- package/dist/mcp/services/mcp.errors.js +12 -3
- package/dist/mcp/services/mcp.errors.js.map +1 -1
- package/dist/mcp/services/mcp.generic.tools.service.d.ts +6 -2
- package/dist/mcp/services/mcp.generic.tools.service.d.ts.map +1 -1
- package/dist/mcp/services/mcp.generic.tools.service.js +18 -5
- package/dist/mcp/services/mcp.generic.tools.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,9 @@ export type McpErrorCode = "unknown_type" | "not_writable" | "forbidden" | "vali
|
|
|
13
13
|
* - `ZodError` → validation_failed with per-issue `issues` meta
|
|
14
14
|
* - an error named `TimeoutError` (the `DOMException` an `AbortSignal.timeout`
|
|
15
15
|
* fetch rejects with) → timeout with `retryable: true`
|
|
16
|
+
* - `ExternalSourceUnavailableError` → its own `code` (e.g. corpus_unavailable)
|
|
17
|
+
* with `retryable: true`: the source did not answer, so the record is
|
|
18
|
+
* unknown, never not_found
|
|
16
19
|
* - other `Error` → internal with the error message
|
|
17
20
|
*
|
|
18
21
|
* Never includes stack traces.
|
|
@@ -31,7 +34,9 @@ export declare function mcpFlatError(code: string, message: string, meta?: Recor
|
|
|
31
34
|
* The ToolFactory's unknown-type error maps to `unknown_type`, a missing record
|
|
32
35
|
* to `not_found`, an unregistered service to `internal`, every other tool-level
|
|
33
36
|
* error to `validation_failed`; the extras (e.g. `schema`, `suggestion`) stay
|
|
34
|
-
* on the payload.
|
|
37
|
+
* on the payload. A value that names its own `code` keeps it: an external
|
|
38
|
+
* source that did not answer reports e.g. `corpus_unavailable`
|
|
39
|
+
* (`ToolFactory.capture`), never `not_found`.
|
|
35
40
|
*/
|
|
36
41
|
export declare function mcpToolResult(result: unknown): McpToolResult;
|
|
37
42
|
//# sourceMappingURL=mcp.errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.errors.d.ts","sourceRoot":"","sources":["../../../src/mcp/services/mcp.errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp.errors.d.ts","sourceRoot":"","sources":["../../../src/mcp/services/mcp.errors.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACtB,cAAc,GAAG,cAAc,GAAG,WAAW,GAAG,mBAAmB,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAE7G;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,aAAa,CA8BlD;AAMD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,aAAa,CAE7G;AAmBD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,CAM5D"}
|
|
@@ -5,6 +5,7 @@ exports.mcpFlatError = mcpFlatError;
|
|
|
5
5
|
exports.mcpToolResult = mcpToolResult;
|
|
6
6
|
const common_1 = require("@nestjs/common");
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
|
+
const external_entity_source_interface_1 = require("../../common/interfaces/external.entity.source.interface");
|
|
8
9
|
/**
|
|
9
10
|
* Maps an unknown thrown value to a flat MCP error result.
|
|
10
11
|
*
|
|
@@ -13,6 +14,9 @@ const zod_1 = require("zod");
|
|
|
13
14
|
* - `ZodError` → validation_failed with per-issue `issues` meta
|
|
14
15
|
* - an error named `TimeoutError` (the `DOMException` an `AbortSignal.timeout`
|
|
15
16
|
* fetch rejects with) → timeout with `retryable: true`
|
|
17
|
+
* - `ExternalSourceUnavailableError` → its own `code` (e.g. corpus_unavailable)
|
|
18
|
+
* with `retryable: true`: the source did not answer, so the record is
|
|
19
|
+
* unknown, never not_found
|
|
16
20
|
* - other `Error` → internal with the error message
|
|
17
21
|
*
|
|
18
22
|
* Never includes stack traces.
|
|
@@ -21,6 +25,9 @@ function mcpError(e) {
|
|
|
21
25
|
let code = "internal";
|
|
22
26
|
let message = "Unexpected error";
|
|
23
27
|
let meta = {};
|
|
28
|
+
if ((0, external_entity_source_interface_1.isExternalSourceUnavailableError)(e)) {
|
|
29
|
+
return mcpFlatError(e.code, e.message, { retryable: true });
|
|
30
|
+
}
|
|
24
31
|
if (e instanceof common_1.HttpException) {
|
|
25
32
|
const status = e.getStatus();
|
|
26
33
|
code =
|
|
@@ -84,12 +91,14 @@ function toolErrorCode(error) {
|
|
|
84
91
|
* The ToolFactory's unknown-type error maps to `unknown_type`, a missing record
|
|
85
92
|
* to `not_found`, an unregistered service to `internal`, every other tool-level
|
|
86
93
|
* error to `validation_failed`; the extras (e.g. `schema`, `suggestion`) stay
|
|
87
|
-
* on the payload.
|
|
94
|
+
* on the payload. A value that names its own `code` keeps it: an external
|
|
95
|
+
* source that did not answer reports e.g. `corpus_unavailable`
|
|
96
|
+
* (`ToolFactory.capture`), never `not_found`.
|
|
88
97
|
*/
|
|
89
98
|
function mcpToolResult(result) {
|
|
90
99
|
if (typeof result === "object" && result !== null && typeof result.error === "string") {
|
|
91
|
-
const { error, ...extras } = result;
|
|
92
|
-
return mcpFlatError(toolErrorCode(error), error, extras);
|
|
100
|
+
const { error, code, ...extras } = result;
|
|
101
|
+
return mcpFlatError(typeof code === "string" ? code : toolErrorCode(error), error, extras);
|
|
93
102
|
}
|
|
94
103
|
return { content: [{ type: "text", text: typeof result === "string" ? result : JSON.stringify(result) }] };
|
|
95
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.errors.js","sourceRoot":"","sources":["../../../src/mcp/services/mcp.errors.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"mcp.errors.js","sourceRoot":"","sources":["../../../src/mcp/services/mcp.errors.ts"],"names":[],"mappings":";;AA4BA,4BA8BC;AAUD,oCAEC;AA+BD,sCAMC;AA3GD,2CAA+C;AAC/C,6BAA+B;AAC/B,+GAA4G;AAW5G;;;;;;;;;;;;;;GAcG;AACH,SAAgB,QAAQ,CAAC,CAAU;IACjC,IAAI,IAAI,GAAiB,UAAU,CAAC;IACpC,IAAI,OAAO,GAAG,kBAAkB,CAAC;IACjC,IAAI,IAAI,GAA4B,EAAE,CAAC;IACvC,IAAI,IAAA,mEAAgC,EAAC,CAAC,CAAC,EAAE,CAAC;QACxC,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,CAAC,YAAY,sBAAa,EAAE,CAAC;QAC/B,MAAM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MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7G,CAAC"}
|
|
@@ -11,7 +11,8 @@ import { McpEntityWriteService } from "./mcp.entity.write.service";
|
|
|
11
11
|
/**
|
|
12
12
|
* Builds the generic MCP tool set for one authenticated request:
|
|
13
13
|
* the five graph read tools, the document-retrieval tool, `ping`, and the four
|
|
14
|
-
* entity write tools contributed by McpEntityWriteService
|
|
14
|
+
* entity write tools contributed by McpEntityWriteService (only when the
|
|
15
|
+
* user's catalog has a `chat.writable` type).
|
|
15
16
|
*/
|
|
16
17
|
export declare class McpGenericToolsService {
|
|
17
18
|
private readonly resolveEntityTool;
|
|
@@ -30,7 +31,10 @@ export declare class McpGenericToolsService {
|
|
|
30
31
|
* catalog size, and every app status contribution merged at the top level.
|
|
31
32
|
*/
|
|
32
33
|
ping(ctx: McpUserContext): Promise<Record<string, unknown>>;
|
|
33
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Builds the per-request generic tool definitions: the read tools, plus the
|
|
36
|
+
* write tools when {@link McpEntityWriteService.hasWritableTypes} is true.
|
|
37
|
+
*/
|
|
34
38
|
build(ctx: McpUserContext): McpToolDefinition[];
|
|
35
39
|
}
|
|
36
40
|
//# sourceMappingURL=mcp.generic.tools.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.generic.tools.service.d.ts","sourceRoot":"","sources":["../../../src/mcp/services/mcp.generic.tools.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAA6B,MAAM,+CAA+C,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAyB,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB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OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IACE,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBATnD,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,qBAAqB,EACnC,OAAO,EAAE,mBAAmB,EAC5B,aAAa,EAAE,aAAa,EACI,mBAAmB,GAAE,qBAAqB,EAAO;IAGpG;;;OAGG;IACG,IAAI,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAYjE;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE,cAAc,GAAG,iBAAiB,EAAE;CA4GhD"}
|
|
@@ -32,8 +32,14 @@ const mcp_entity_write_service_1 = require("./mcp.entity.write.service");
|
|
|
32
32
|
// DynamicStructuredTool literal in the tool file; not exportable without
|
|
33
33
|
// restructuring those files beyond the schema-export-only change).
|
|
34
34
|
const DESCRIBE_DESCRIPTION = "Returns the described fields and relationships for an entity type.";
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
//
|
|
36
|
+
// Documented divergence (see docs/mcp-server.md): the MCP copies of
|
|
37
|
+
// resolve_entity and search_entities do NOT tell the client to call
|
|
38
|
+
// resolve_entity first. Over MCP the server instructions (MCP_INSTRUCTIONS)
|
|
39
|
+
// decide when resolve_entity is the right tool; the operator copies in
|
|
40
|
+
// resolve-entity.tool.ts and search-entities.tool.ts keep the original wording.
|
|
41
|
+
const RESOLVE_DESCRIPTION = "Resolve a user-named entity across every visible type. Returns ranked candidates from the highest-confidence tier that yielded any match anywhere. Pass types to restrict the search to the record kinds you mean.";
|
|
42
|
+
const SEARCH_DESCRIPTION = "Find records of a known type by filter and sort. Use this when you already have the type, or to look up a specific record of a known type by its label, number or other identifying field.";
|
|
37
43
|
const READ_DESCRIPTION = "Fetches one record by id, optionally pulling related records across described relationships.";
|
|
38
44
|
const TRAVERSE_DESCRIPTION = "Walks a relationship from a known record to related records, optionally filtered and sorted.";
|
|
39
45
|
const SEARCH_DOCS_DESCRIPTION = "Search the company's documents (GraphRAG) for information relevant to a question. Returns the retrieved passages, each prefixed by its chunkId.";
|
|
@@ -64,7 +70,8 @@ function withFilterSchemas(schema) {
|
|
|
64
70
|
/**
|
|
65
71
|
* Builds the generic MCP tool set for one authenticated request:
|
|
66
72
|
* the five graph read tools, the document-retrieval tool, `ping`, and the four
|
|
67
|
-
* entity write tools contributed by McpEntityWriteService
|
|
73
|
+
* entity write tools contributed by McpEntityWriteService (only when the
|
|
74
|
+
* user's catalog has a `chat.writable` type).
|
|
68
75
|
*/
|
|
69
76
|
let McpGenericToolsService = class McpGenericToolsService {
|
|
70
77
|
constructor(resolveEntityTool, describeEntityTool, searchEntitiesTool, readEntityTool, traverseTool, searchDocumentsTool, writeService, catalog, configService, statusContributions = []) {
|
|
@@ -94,7 +101,10 @@ let McpGenericToolsService = class McpGenericToolsService {
|
|
|
94
101
|
...Object.assign({}, ...contributed),
|
|
95
102
|
};
|
|
96
103
|
}
|
|
97
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Builds the per-request generic tool definitions: the read tools, plus the
|
|
106
|
+
* write tools when {@link McpEntityWriteService.hasWritableTypes} is true.
|
|
107
|
+
*/
|
|
98
108
|
build(ctx) {
|
|
99
109
|
const recorder = [];
|
|
100
110
|
// The graph tools enforce a describe-first contract via the recorder. That
|
|
@@ -168,7 +178,10 @@ let McpGenericToolsService = class McpGenericToolsService {
|
|
|
168
178
|
}
|
|
169
179
|
},
|
|
170
180
|
},
|
|
171
|
-
|
|
181
|
+
// The generic write tools are listed only when the user's catalog has a
|
|
182
|
+
// chat.writable type: without one every call would answer not_writable,
|
|
183
|
+
// and a server whose data is read-only must not advertise writes.
|
|
184
|
+
...(this.writeService.hasWritableTypes(ctx) ? this.writeService.buildTools(ctx) : []),
|
|
172
185
|
];
|
|
173
186
|
}
|
|
174
187
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.generic.tools.service.js","sourceRoot":"","sources":["../../../src/mcp/services/mcp.generic.tools.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,2CAA+C;AAC/C,2BAAkC;AAClC,+BAA4B;AAC5B,6BAAwB;AACxB,6FAAwF;AAExF,wFAA8G;AAC9G,gFAAkG;AAClG,sFAA2G;AAC3G,wFAA8G;AAE9G,0EAOgD;AAChD,6FAAoH;AACpH,yEAM0C;AAC1C,6CAAqE;AACrE,yEAAmE;AAEnE,8EAA8E;AAC9E,yEAAyE;AACzE,mEAAmE;AACnE,MAAM,oBAAoB,GAAG,oEAAoE,CAAC;AAClG,MAAM,mBAAmB,GACvB,
|
|
1
|
+
{"version":3,"file":"mcp.generic.tools.service.js","sourceRoot":"","sources":["../../../src/mcp/services/mcp.generic.tools.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,2CAA+C;AAC/C,2BAAkC;AAClC,+BAA4B;AAC5B,6BAAwB;AACxB,6FAAwF;AAExF,wFAA8G;AAC9G,gFAAkG;AAClG,sFAA2G;AAC3G,wFAA8G;AAE9G,0EAOgD;AAChD,6FAAoH;AACpH,yEAM0C;AAC1C,6CAAqE;AACrE,yEAAmE;AAEnE,8EAA8E;AAC9E,yEAAyE;AACzE,mEAAmE;AACnE,MAAM,oBAAoB,GAAG,oEAAoE,CAAC;AAClG,EAAE;AACF,oEAAoE;AACpE,oEAAoE;AACpE,4EAA4E;AAC5E,uEAAuE;AACvE,gFAAgF;AAChF,MAAM,mBAAmB,GACvB,oNAAoN,CAAC;AACvN,MAAM,kBAAkB,GACtB,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