@carlonicora/nestjs-neo4jsonapi 2.1.0 → 2.3.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/graph.module.d.ts.map +1 -1
- package/dist/agents/graph/graph.module.js +3 -0
- package/dist/agents/graph/graph.module.js.map +1 -1
- package/dist/agents/graph/interfaces/graph.catalog.interface.d.ts +24 -0
- package/dist/agents/graph/interfaces/graph.catalog.interface.d.ts.map +1 -1
- package/dist/agents/graph/services/graph.catalog.service.d.ts +9 -0
- package/dist/agents/graph/services/graph.catalog.service.d.ts.map +1 -1
- package/dist/agents/graph/services/graph.catalog.service.js +61 -1
- package/dist/agents/graph/services/graph.catalog.service.js.map +1 -1
- package/dist/agents/graph/services/graph.search.service.d.ts +16 -1
- package/dist/agents/graph/services/graph.search.service.d.ts.map +1 -1
- package/dist/agents/graph/services/graph.search.service.js +51 -4
- package/dist/agents/graph/services/graph.search.service.js.map +1 -1
- package/dist/agents/graph/services/humanize-tool.d.ts +17 -2
- package/dist/agents/graph/services/humanize-tool.d.ts.map +1 -1
- package/dist/agents/graph/services/humanize-tool.js +71 -6
- package/dist/agents/graph/services/humanize-tool.js.map +1 -1
- package/dist/agents/graph/services/materialise-bridge.d.ts +6 -0
- package/dist/agents/graph/services/materialise-bridge.d.ts.map +1 -1
- package/dist/agents/graph/services/materialise-bridge.js +17 -1
- package/dist/agents/graph/services/materialise-bridge.js.map +1 -1
- package/dist/agents/graph/services/scope.guard.d.ts +43 -0
- package/dist/agents/graph/services/scope.guard.d.ts.map +1 -0
- package/dist/agents/graph/services/scope.guard.js +91 -0
- package/dist/agents/graph/services/scope.guard.js.map +1 -0
- package/dist/agents/graph/tools/read-entity.tool.d.ts +9 -1
- package/dist/agents/graph/tools/read-entity.tool.d.ts.map +1 -1
- package/dist/agents/graph/tools/read-entity.tool.js +30 -5
- package/dist/agents/graph/tools/read-entity.tool.js.map +1 -1
- package/dist/agents/graph/tools/resolve-entity.tool.d.ts.map +1 -1
- package/dist/agents/graph/tools/resolve-entity.tool.js +8 -1
- package/dist/agents/graph/tools/resolve-entity.tool.js.map +1 -1
- package/dist/agents/graph/tools/search-entities.tool.d.ts +9 -1
- package/dist/agents/graph/tools/search-entities.tool.d.ts.map +1 -1
- package/dist/agents/graph/tools/search-entities.tool.js +37 -8
- package/dist/agents/graph/tools/search-entities.tool.js.map +1 -1
- package/dist/agents/graph/tools/tool.factory.d.ts +4 -0
- package/dist/agents/graph/tools/tool.factory.d.ts.map +1 -1
- package/dist/agents/graph/tools/tool.factory.js.map +1 -1
- package/dist/agents/graph/tools/traverse.tool.d.ts +9 -1
- package/dist/agents/graph/tools/traverse.tool.d.ts.map +1 -1
- package/dist/agents/graph/tools/traverse.tool.js +21 -5
- package/dist/agents/graph/tools/traverse.tool.js.map +1 -1
- package/dist/agents/operator/contexts/operator.context.d.ts +4 -0
- package/dist/agents/operator/contexts/operator.context.d.ts.map +1 -1
- package/dist/agents/operator/contexts/operator.context.js +4 -0
- package/dist/agents/operator/contexts/operator.context.js.map +1 -1
- package/dist/agents/operator/operator.module.d.ts.map +1 -1
- package/dist/agents/operator/operator.module.js +4 -0
- package/dist/agents/operator/operator.module.js.map +1 -1
- package/dist/agents/operator/services/operator.service.d.ts +15 -0
- package/dist/agents/operator/services/operator.service.d.ts.map +1 -1
- package/dist/agents/operator/services/operator.service.js +23 -5
- package/dist/agents/operator/services/operator.service.js.map +1 -1
- package/dist/agents/operator/tools/entity-write.tools.d.ts +124 -0
- package/dist/agents/operator/tools/entity-write.tools.d.ts.map +1 -0
- package/dist/agents/operator/tools/entity-write.tools.js +471 -0
- package/dist/agents/operator/tools/entity-write.tools.js.map +1 -0
- package/dist/agents/operator/tools/operator.tool.registry.d.ts +5 -1
- package/dist/agents/operator/tools/operator.tool.registry.d.ts.map +1 -1
- package/dist/agents/operator/tools/operator.tool.registry.js +19 -2
- package/dist/agents/operator/tools/operator.tool.registry.js.map +1 -1
- package/dist/agents/operator/tools/search-documents.tool.d.ts +16 -1
- package/dist/agents/operator/tools/search-documents.tool.d.ts.map +1 -1
- package/dist/agents/operator/tools/search-documents.tool.js +59 -3
- package/dist/agents/operator/tools/search-documents.tool.js.map +1 -1
- package/dist/agents/prompts/index.d.ts +1 -0
- package/dist/agents/prompts/index.d.ts.map +1 -1
- package/dist/agents/prompts/index.js +7 -1
- package/dist/agents/prompts/index.js.map +1 -1
- package/dist/agents/responder/contexts/responder.context.d.ts +19 -0
- package/dist/agents/responder/contexts/responder.context.d.ts.map +1 -1
- package/dist/agents/responder/contexts/responder.context.js +6 -0
- package/dist/agents/responder/contexts/responder.context.js.map +1 -1
- package/dist/agents/responder/factories/responder.context.factory.d.ts +4 -0
- package/dist/agents/responder/factories/responder.context.factory.d.ts.map +1 -1
- package/dist/agents/responder/factories/responder.context.factory.js +2 -0
- package/dist/agents/responder/factories/responder.context.factory.js.map +1 -1
- package/dist/agents/responder/nodes/graph.node.service.d.ts.map +1 -1
- package/dist/agents/responder/nodes/graph.node.service.js +18 -2
- package/dist/agents/responder/nodes/graph.node.service.js.map +1 -1
- package/dist/agents/responder/nodes/planner.node.service.d.ts +1 -1
- package/dist/agents/responder/nodes/planner.node.service.d.ts.map +1 -1
- package/dist/agents/responder/nodes/planner.node.service.js +5 -0
- package/dist/agents/responder/nodes/planner.node.service.js.map +1 -1
- package/dist/agents/responder/nodes/responder.answer.node.service.d.ts +33 -1
- package/dist/agents/responder/nodes/responder.answer.node.service.d.ts.map +1 -1
- package/dist/agents/responder/nodes/responder.answer.node.service.js +69 -27
- package/dist/agents/responder/nodes/responder.answer.node.service.js.map +1 -1
- package/dist/agents/responder/services/responder.service.d.ts +7 -0
- package/dist/agents/responder/services/responder.service.d.ts.map +1 -1
- package/dist/agents/responder/services/responder.service.js +3 -0
- package/dist/agents/responder/services/responder.service.js.map +1 -1
- package/dist/common/interfaces/entity.schema.interface.d.ts +16 -0
- package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
- package/dist/common/interfaces/index.d.ts +1 -0
- package/dist/common/interfaces/index.d.ts.map +1 -1
- package/dist/common/interfaces/index.js +1 -0
- package/dist/common/interfaces/index.js.map +1 -1
- package/dist/common/interfaces/seed.context.interface.d.ts +62 -0
- package/dist/common/interfaces/seed.context.interface.d.ts.map +1 -0
- package/dist/common/interfaces/seed.context.interface.js +20 -0
- package/dist/common/interfaces/seed.context.interface.js.map +1 -0
- package/dist/config/interfaces/config.prompts.interface.d.ts +12 -0
- package/dist/config/interfaces/config.prompts.interface.d.ts.map +1 -1
- package/dist/core/blocknote/services/blocknote.service.d.ts +23 -14
- package/dist/core/blocknote/services/blocknote.service.d.ts.map +1 -1
- package/dist/core/blocknote/services/blocknote.service.js +48 -32
- package/dist/core/blocknote/services/blocknote.service.js.map +1 -1
- package/dist/core/llm/services/llm.service.d.ts.map +1 -1
- package/dist/core/llm/services/llm.service.js +34 -2
- package/dist/core/llm/services/llm.service.js.map +1 -1
- package/dist/core/llm/services/tool-error-feedback.d.ts +40 -0
- package/dist/core/llm/services/tool-error-feedback.d.ts.map +1 -0
- package/dist/core/llm/services/tool-error-feedback.js +131 -0
- package/dist/core/llm/services/tool-error-feedback.js.map +1 -0
- package/dist/foundations/assistant/assistant.module.d.ts.map +1 -1
- package/dist/foundations/assistant/assistant.module.js +7 -1
- package/dist/foundations/assistant/assistant.module.js.map +1 -1
- package/dist/foundations/assistant/controllers/assistant.controller.d.ts +13 -1
- package/dist/foundations/assistant/controllers/assistant.controller.d.ts.map +1 -1
- package/dist/foundations/assistant/controllers/assistant.controller.js +37 -3
- package/dist/foundations/assistant/controllers/assistant.controller.js.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-append.dto.d.ts +6 -0
- package/dist/foundations/assistant/dtos/assistant-append.dto.d.ts.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-append.dto.js +1 -1
- package/dist/foundations/assistant/dtos/assistant-append.dto.js.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-post.dto.d.ts +29 -0
- package/dist/foundations/assistant/dtos/assistant-post.dto.d.ts.map +1 -1
- package/dist/foundations/assistant/dtos/assistant-post.dto.js +47 -2
- package/dist/foundations/assistant/dtos/assistant-post.dto.js.map +1 -1
- package/dist/foundations/assistant/repositories/assistant.repository.d.ts +22 -0
- package/dist/foundations/assistant/repositories/assistant.repository.d.ts.map +1 -1
- package/dist/foundations/assistant/repositories/assistant.repository.js +28 -0
- package/dist/foundations/assistant/repositories/assistant.repository.js.map +1 -1
- package/dist/foundations/assistant/services/assistant-mention.extractor.d.ts +36 -0
- package/dist/foundations/assistant/services/assistant-mention.extractor.d.ts.map +1 -0
- package/dist/foundations/assistant/services/assistant-mention.extractor.js +99 -0
- package/dist/foundations/assistant/services/assistant-mention.extractor.js.map +1 -0
- package/dist/foundations/assistant/services/assistant.service.d.ts +93 -2
- package/dist/foundations/assistant/services/assistant.service.d.ts.map +1 -1
- package/dist/foundations/assistant/services/assistant.service.js +388 -60
- package/dist/foundations/assistant/services/assistant.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Feedback for tool calls the model gets wrong.
|
|
4
|
+
*
|
|
5
|
+
* A tool whose arguments fail schema validation is rejected by LangChain BEFORE
|
|
6
|
+
* the tool's own code runs, so the model receives the generic
|
|
7
|
+
* "Received tool input did not match expected schema" and has nothing to act
|
|
8
|
+
* on. Small models respond by re-emitting the identical call until the
|
|
9
|
+
* iteration budget is gone — one observed run burned 14 of 15 iterations and
|
|
10
|
+
* 108k input tokens repeating a `read_entity` call that was missing `type`.
|
|
11
|
+
*
|
|
12
|
+
* These helpers replace that dead end with the same imperative phrasing the
|
|
13
|
+
* graph tools already use for their own errors, and give the caller a way to
|
|
14
|
+
* detect a call that is looping.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.REPEATED_TOOL_FAILURE_LIMIT = void 0;
|
|
18
|
+
exports.toolCallSignature = toolCallSignature;
|
|
19
|
+
exports.describeToolInputRejection = describeToolInputRejection;
|
|
20
|
+
exports.repeatedToolFailureMessage = repeatedToolFailureMessage;
|
|
21
|
+
/** Identical failing calls tolerated before the tool loop is abandoned. */
|
|
22
|
+
exports.REPEATED_TOOL_FAILURE_LIMIT = 3;
|
|
23
|
+
/** Recursively sort object keys so key order cannot disguise an identical call. */
|
|
24
|
+
function canonicalise(value) {
|
|
25
|
+
if (Array.isArray(value))
|
|
26
|
+
return value.map(canonicalise);
|
|
27
|
+
if (value === null || typeof value !== "object")
|
|
28
|
+
return value;
|
|
29
|
+
const source = value;
|
|
30
|
+
const sorted = {};
|
|
31
|
+
for (const key of Object.keys(source).sort())
|
|
32
|
+
sorted[key] = canonicalise(source[key]);
|
|
33
|
+
return sorted;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Stable identity for a tool call. Models re-emit the same arguments with the
|
|
37
|
+
* keys in a different order — `{id, include}` one iteration, `{include, id}`
|
|
38
|
+
* the next — so the signature must be key-order independent or a loop reads as
|
|
39
|
+
* a series of distinct calls.
|
|
40
|
+
*/
|
|
41
|
+
function toolCallSignature(name, args) {
|
|
42
|
+
try {
|
|
43
|
+
return `${name}:${JSON.stringify(canonicalise(args))}`;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return `${name}:${String(args)}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** The zod object shape, across the several places zod versions keep it. */
|
|
50
|
+
function shapeOf(schema) {
|
|
51
|
+
const candidate = schema;
|
|
52
|
+
const raw = candidate?.shape ?? candidate?._def?.shape ?? candidate?.def?.shape;
|
|
53
|
+
const resolved = typeof raw === "function" ? raw() : raw;
|
|
54
|
+
return resolved && typeof resolved === "object" ? resolved : null;
|
|
55
|
+
}
|
|
56
|
+
function requiredArgumentNames(schema) {
|
|
57
|
+
const shape = shapeOf(schema);
|
|
58
|
+
if (!shape)
|
|
59
|
+
return [];
|
|
60
|
+
return Object.entries(shape)
|
|
61
|
+
.filter(([, field]) => {
|
|
62
|
+
const parse = field?.safeParse;
|
|
63
|
+
// A field that rejects `undefined` is required.
|
|
64
|
+
return typeof parse === "function" ? !parse.call(field, undefined).success : false;
|
|
65
|
+
})
|
|
66
|
+
.map(([name]) => name);
|
|
67
|
+
}
|
|
68
|
+
function valueAtPath(args, path) {
|
|
69
|
+
let cursor = args;
|
|
70
|
+
for (const key of path) {
|
|
71
|
+
if (cursor === null || typeof cursor !== "object")
|
|
72
|
+
return undefined;
|
|
73
|
+
cursor = cursor[key];
|
|
74
|
+
}
|
|
75
|
+
return cursor;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Explain, in the tool's own terms, why its arguments were rejected. Returns
|
|
79
|
+
* null when the schema cannot be introspected or the arguments actually
|
|
80
|
+
* validate — in both cases the caller should fall back to the raw error, since
|
|
81
|
+
* the rejection came from somewhere else.
|
|
82
|
+
*/
|
|
83
|
+
function describeToolInputRejection(params) {
|
|
84
|
+
const schema = params.schema;
|
|
85
|
+
if (!schema || typeof schema.safeParse !== "function")
|
|
86
|
+
return null;
|
|
87
|
+
const result = schema.safeParse(params.args);
|
|
88
|
+
if (result?.success !== false)
|
|
89
|
+
return null;
|
|
90
|
+
const missing = [];
|
|
91
|
+
const invalid = [];
|
|
92
|
+
const unexpected = [];
|
|
93
|
+
for (const issue of result.error?.issues ?? []) {
|
|
94
|
+
if (issue.code === "unrecognized_keys") {
|
|
95
|
+
unexpected.push(...(issue.keys ?? []).map((k) => `"${k}"`));
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const path = (issue.path ?? []);
|
|
99
|
+
const name = path.length ? path.join(".") : "(whole argument object)";
|
|
100
|
+
if (valueAtPath(params.args, path) === undefined) {
|
|
101
|
+
missing.push(issue.expected ? `"${name}" (expected ${issue.expected})` : `"${name}"`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
invalid.push(`"${name}" — ${issue.message}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const required = requiredArgumentNames(schema);
|
|
108
|
+
const lines = [
|
|
109
|
+
`Tool error: the call to "${params.toolName}" was rejected before it ran — its arguments did not match the tool's schema.`,
|
|
110
|
+
];
|
|
111
|
+
if (missing.length)
|
|
112
|
+
lines.push(`Missing required argument ${missing.join(", ")}.`);
|
|
113
|
+
if (invalid.length)
|
|
114
|
+
lines.push(`Invalid argument ${invalid.join(", ")}.`);
|
|
115
|
+
if (unexpected.length)
|
|
116
|
+
lines.push(`Unexpected argument ${unexpected.join(", ")} — remove it.`);
|
|
117
|
+
if (required.length)
|
|
118
|
+
lines.push(`Required arguments for ${params.toolName}: ${required.join(", ")}.`);
|
|
119
|
+
// Imperative, never question-shaped: a small model relays a question to the
|
|
120
|
+
// user instead of retrying, which is exactly the failure this message exists
|
|
121
|
+
// to prevent.
|
|
122
|
+
lines.push(`Reissue ${params.toolName} now with every required argument present. Do not resend the same arguments.`);
|
|
123
|
+
return lines.join(" ");
|
|
124
|
+
}
|
|
125
|
+
/** Final word to the model when the same rejected call keeps coming back. */
|
|
126
|
+
function repeatedToolFailureMessage(params) {
|
|
127
|
+
return (`Tool error: "${params.toolName}" has now been called ${params.attempts} times with the same invalid arguments ` +
|
|
128
|
+
`and was rejected every time. Stop calling "${params.toolName}" with those arguments. ` +
|
|
129
|
+
`Answer from the data already gathered, or call a different tool with corrected arguments.`);
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=tool-error-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-error-feedback.js","sourceRoot":"","sources":["../../../../src/core/llm/services/tool-error-feedback.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAqBH,8CAMC;AAqCD,gEA2CC;AAGD,gEAMC;AAlHD,2EAA2E;AAC9D,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAE7C,mFAAmF;AACnF,SAAS,YAAY,CAAC,KAA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AAO,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1E,IAAI,UAAU,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,uBAAuB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/F,IAAI,QAAQ,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,0BAA0B,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtG,4EAA4E;IAC5E,6EAA6E;IAC7E,cAAc;IACd,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,QAAQ,8EAA8E,CAAC,CAAC;IAErH,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,6EAA6E;AAC7E,SAAgB,0BAA0B,CAAC,MAA8C;IACvF,OAAO,CACL,gBAAgB,MAAM,CAAC,QAAQ,yBAAyB,MAAM,CAAC,QAAQ,yCAAyC;QAChH,8CAA8C,MAAM,CAAC,QAAQ,0BAA0B;QACvF,2FAA2F,CAC5F,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/assistant/assistant.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"assistant.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/assistant/assistant.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAclE,qBAqBa,eAAgB,YAAW,YAAY;IAClD,YAAY;CAGb"}
|
|
@@ -12,11 +12,13 @@ const graph_module_1 = require("../../agents/graph/graph.module");
|
|
|
12
12
|
const operator_module_1 = require("../../agents/operator/operator.module");
|
|
13
13
|
const responder_module_1 = require("../../agents/responder/responder.module");
|
|
14
14
|
const registry_1 = require("../../common/registries/registry");
|
|
15
|
+
const blocknote_module_1 = require("../../core/blocknote/blocknote.module");
|
|
15
16
|
const assistant_action_module_1 = require("../assistant-action/assistant-action.module");
|
|
16
17
|
const assistant_message_module_1 = require("../assistant-message/assistant-message.module");
|
|
17
18
|
const assistant_controller_1 = require("./controllers/assistant.controller");
|
|
18
19
|
const assistant_1 = require("./entities/assistant");
|
|
19
20
|
const assistant_repository_1 = require("./repositories/assistant.repository");
|
|
21
|
+
const assistant_mention_extractor_1 = require("./services/assistant-mention.extractor");
|
|
20
22
|
const assistant_service_1 = require("./services/assistant.service");
|
|
21
23
|
let AssistantModule = class AssistantModule {
|
|
22
24
|
onModuleInit() {
|
|
@@ -31,15 +33,19 @@ exports.AssistantModule = AssistantModule = __decorate([
|
|
|
31
33
|
// service/repository to create and resolve pending actions.
|
|
32
34
|
// forwardRef on OperatorModule: its standalone OperatorController needs
|
|
33
35
|
// AssistantService while AssistantService needs OperatorService.
|
|
36
|
+
// GraphModule supplies GraphCatalogService and ScopeGuard (mention
|
|
37
|
+
// validation + hydration scope filtering); BlockNoteModule supplies the
|
|
38
|
+
// markdown conversion used to persist a rich composer payload.
|
|
34
39
|
imports: [
|
|
35
40
|
graph_module_1.GraphModule,
|
|
41
|
+
blocknote_module_1.BlockNoteModule,
|
|
36
42
|
responder_module_1.ResponderModule,
|
|
37
43
|
(0, common_1.forwardRef)(() => operator_module_1.OperatorModule),
|
|
38
44
|
assistant_message_module_1.AssistantMessageModule,
|
|
39
45
|
(0, common_1.forwardRef)(() => assistant_action_module_1.AssistantActionModule),
|
|
40
46
|
],
|
|
41
47
|
controllers: [assistant_controller_1.AssistantController],
|
|
42
|
-
providers: [assistant_1.AssistantDescriptor.model.serialiser, assistant_repository_1.AssistantRepository, assistant_service_1.AssistantService],
|
|
48
|
+
providers: [assistant_1.AssistantDescriptor.model.serialiser, assistant_repository_1.AssistantRepository, assistant_mention_extractor_1.AssistantMentionExtractor, assistant_service_1.AssistantService],
|
|
43
49
|
exports: [assistant_service_1.AssistantService, assistant_message_module_1.AssistantMessageModule],
|
|
44
50
|
})
|
|
45
51
|
], AssistantModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.module.js","sourceRoot":"","sources":["../../../src/foundations/assistant/assistant.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAkE;AAClE,kEAA8D;AAC9D,2EAAuE;AACvE,8EAA0E;AAC1E,+DAAiE;AACjE,yFAAoF;AACpF,4FAAuF;AACvF,6EAAyE;AACzE,oDAA2D;AAC3D,8EAA0E;AAC1E,oEAAgE;
|
|
1
|
+
{"version":3,"file":"assistant.module.js","sourceRoot":"","sources":["../../../src/foundations/assistant/assistant.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAkE;AAClE,kEAA8D;AAC9D,2EAAuE;AACvE,8EAA0E;AAC1E,+DAAiE;AACjE,4EAAwE;AACxE,yFAAoF;AACpF,4FAAuF;AACvF,6EAAyE;AACzE,oDAA2D;AAC3D,8EAA0E;AAC1E,wFAAmF;AACnF,oEAAgE;AAuBzD,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAAY;QACV,wBAAa,CAAC,QAAQ,CAAC,+BAAmB,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;CACF,CAAA;AAJY,0CAAe;0BAAf,eAAe;IArB3B,IAAA,eAAM,EAAC;QACN,wEAAwE;QACxE,wEAAwE;QACxE,4DAA4D;QAC5D,wEAAwE;QACxE,iEAAiE;QACjE,mEAAmE;QACnE,wEAAwE;QACxE,+DAA+D;QAC/D,OAAO,EAAE;YACP,0BAAW;YACX,kCAAe;YACf,kCAAe;YACf,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,CAAC;YAChC,iDAAsB;YACtB,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,+CAAqB,CAAC;SACxC;QACD,WAAW,EAAE,CAAC,0CAAmB,CAAC;QAClC,SAAS,EAAE,CAAC,+BAAmB,CAAC,KAAK,CAAC,UAAU,EAAE,0CAAmB,EAAE,uDAAyB,EAAE,oCAAgB,CAAC;QACnH,OAAO,EAAE,CAAC,oCAAgB,EAAE,iDAAsB,CAAC;KACpD,CAAC;GACW,eAAe,CAI3B"}
|
|
@@ -49,8 +49,20 @@ export declare class AssistantController {
|
|
|
49
49
|
/**
|
|
50
50
|
* GET /assistants — list the current user's assistant threads.
|
|
51
51
|
* RBAC (company + owner) is enforced by the repository's `buildUserHasAccess` override.
|
|
52
|
+
*
|
|
53
|
+
* `boundType` + `boundId` narrow the list to the threads bound to one
|
|
54
|
+
* resource (e.g. a campaign). Both are required together: a bound id with no
|
|
55
|
+
* type is ambiguous, and a type with no id names no resource. Supplying them
|
|
56
|
+
* is a custom filter, so it bypasses the CRUD handler and calls the service.
|
|
57
|
+
*/
|
|
58
|
+
findAll(reply: FastifyReply, query: any, search?: string, fetchAll?: boolean, orderBy?: string, boundType?: string, boundId?: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Validate the polymorphic `content` relationship reference against the model
|
|
61
|
+
* registry. The DTO can only assert that `type` is a non-empty string —
|
|
62
|
+
* BOUND_TO accepts any registered model, and the registry is the only place
|
|
63
|
+
* that knows the full set.
|
|
52
64
|
*/
|
|
53
|
-
|
|
65
|
+
private resolveBoundContent;
|
|
54
66
|
/**
|
|
55
67
|
* GET /assistants/:assistantId — read a single assistant thread.
|
|
56
68
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/controllers/assistant.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assistant.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/controllers/assistant.controller.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,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AC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM;IAapC;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAS3B;;OAEG;IAEG,QAAQ,CAAQ,KAAK,EAAE,YAAY,EAAwB,WAAW,EAAE,MAAM;IAIpF;;OAEG;IAEG,KAAK,CAAQ,KAAK,EAAE,YAAY,EAAU,IAAI,EAAE,iBAAiB;IAIvE;;OAEG;IAGG,MAAM,CAAQ,KAAK,EAAE,YAAY,EAAwB,WAAW,EAAE,MAAM;CAGnF"}
|
|
@@ -18,6 +18,7 @@ exports.mergeIncluded = mergeIncluded;
|
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
19
|
const jwt_auth_guard_1 = require("../../../common/guards/jwt.auth.guard");
|
|
20
20
|
const crud_handlers_1 = require("../../../common/handlers/crud.handlers");
|
|
21
|
+
const registry_1 = require("../../../common/registries/registry");
|
|
21
22
|
const jsonapi_service_1 = require("../../../core/jsonapi/services/jsonapi.service");
|
|
22
23
|
const assistant_append_dto_1 = require("../dtos/assistant-append.dto");
|
|
23
24
|
const assistant_patch_dto_1 = require("../dtos/assistant-patch.dto");
|
|
@@ -87,7 +88,9 @@ let AssistantController = AssistantController_1 = class AssistantController {
|
|
|
87
88
|
*/
|
|
88
89
|
async create(body, req) {
|
|
89
90
|
const { content, title, howToMode, limitToHowToId } = body.data.attributes;
|
|
90
|
-
this.
|
|
91
|
+
const boundContent = this.resolveBoundContent(body.data.relationships?.content?.data);
|
|
92
|
+
this.logger.log(`create: userId=${req.user.userId} companyId=${req.user.companyId} firstMessageLen=${content.length}` +
|
|
93
|
+
(boundContent ? ` boundTo=${boundContent.type}/${boundContent.id}` : ""));
|
|
91
94
|
const { assistant, userMessage, assistantMessage, toolCalls } = await this.assistants.createWithFirstMessage({
|
|
92
95
|
companyId: req.user.companyId,
|
|
93
96
|
userId: req.user.userId,
|
|
@@ -95,6 +98,7 @@ let AssistantController = AssistantController_1 = class AssistantController {
|
|
|
95
98
|
title,
|
|
96
99
|
howToMode,
|
|
97
100
|
limitToHowToId,
|
|
101
|
+
boundContent,
|
|
98
102
|
});
|
|
99
103
|
const document = (await this.jsonApi.buildSingle(assistant_1.AssistantDescriptor.model, assistant));
|
|
100
104
|
const messagesDoc = (await this.jsonApi.buildList(assistant_message_1.AssistantMessageDescriptor.model, [
|
|
@@ -145,10 +149,38 @@ let AssistantController = AssistantController_1 = class AssistantController {
|
|
|
145
149
|
/**
|
|
146
150
|
* GET /assistants — list the current user's assistant threads.
|
|
147
151
|
* RBAC (company + owner) is enforced by the repository's `buildUserHasAccess` override.
|
|
152
|
+
*
|
|
153
|
+
* `boundType` + `boundId` narrow the list to the threads bound to one
|
|
154
|
+
* resource (e.g. a campaign). Both are required together: a bound id with no
|
|
155
|
+
* type is ambiguous, and a type with no id names no resource. Supplying them
|
|
156
|
+
* is a custom filter, so it bypasses the CRUD handler and calls the service.
|
|
148
157
|
*/
|
|
149
|
-
async findAll(reply, query, search, fetchAll, orderBy) {
|
|
158
|
+
async findAll(reply, query, search, fetchAll, orderBy, boundType, boundId) {
|
|
159
|
+
if (boundType && boundId) {
|
|
160
|
+
if (!registry_1.modelRegistry.getByType(boundType)) {
|
|
161
|
+
throw new common_1.BadRequestException(`Unknown resource type "${boundType}" for boundType.`);
|
|
162
|
+
}
|
|
163
|
+
const response = await this.assistants.findByBoundContent({ boundType, boundId, query });
|
|
164
|
+
reply.send(response);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
150
167
|
return this.crud.findAll(reply, { query, search, fetchAll, orderBy });
|
|
151
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Validate the polymorphic `content` relationship reference against the model
|
|
171
|
+
* registry. The DTO can only assert that `type` is a non-empty string —
|
|
172
|
+
* BOUND_TO accepts any registered model, and the registry is the only place
|
|
173
|
+
* that knows the full set.
|
|
174
|
+
*/
|
|
175
|
+
resolveBoundContent(reference) {
|
|
176
|
+
if (!reference)
|
|
177
|
+
return undefined;
|
|
178
|
+
const model = registry_1.modelRegistry.getByType(reference.type);
|
|
179
|
+
if (!model) {
|
|
180
|
+
throw new common_1.BadRequestException(`Unknown resource type "${reference.type}" for the assistant's bound content.`);
|
|
181
|
+
}
|
|
182
|
+
return { type: model.type, id: reference.id };
|
|
183
|
+
}
|
|
152
184
|
/**
|
|
153
185
|
* GET /assistants/:assistantId — read a single assistant thread.
|
|
154
186
|
*/
|
|
@@ -193,8 +225,10 @@ __decorate([
|
|
|
193
225
|
__param(2, (0, common_1.Query)("search")),
|
|
194
226
|
__param(3, (0, common_1.Query)("fetchAll")),
|
|
195
227
|
__param(4, (0, common_1.Query)("orderBy")),
|
|
228
|
+
__param(5, (0, common_1.Query)("boundType")),
|
|
229
|
+
__param(6, (0, common_1.Query)("boundId")),
|
|
196
230
|
__metadata("design:type", Function),
|
|
197
|
-
__metadata("design:paramtypes", [Object, Object, String, Boolean, String]),
|
|
231
|
+
__metadata("design:paramtypes", [Object, Object, String, Boolean, String, String, String]),
|
|
198
232
|
__metadata("design:returntype", Promise)
|
|
199
233
|
], AssistantController.prototype, "findAll", null);
|
|
200
234
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.controller.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/controllers/assistant.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"assistant.controller.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/controllers/assistant.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA+CA,sCA8BC;AA7ED,2CAgBwB;AAExB,0EAAqE;AACrE,0EAA4E;AAE5E,kEAAoE;AACpE,oFAAgF;AAChF,uEAAkE;AAClE,qEAAgE;AAChE,mEAA8D;AAC9D,qDAA4D;AAC5D,+DAA2D;AAC3D,0FAAgG;AAChG,oGAA+F;AAC/F,qEAAiE;AAEjE;;;;;;;;;;;;;;GAcG;AACH,SAAgB,aAAa,CAC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ADQ,yCAAkB;;iDAoBjC;AAYK;IADL,IAAA,YAAG,EAAC,8BAAa,CAAC,QAAQ,CAAC;IAEzB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,GAAE,CAAA;IACP,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;IACf,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;;;;kDAWlB;AAqBK;IADL,IAAA,YAAG,EAAC,GAAG,8BAAa,CAAC,QAAQ,eAAe,CAAC;IAC9B,WAAA,IAAA,YAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,cAAK,EAAC,aAAa,CAAC,CAAA;;;;mDAE/D;AAMK;IADL,IAAA,cAAK,EAAC,GAAG,8BAAa,CAAC,QAAQ,eAAe,CAAC;IACnC,WAAA,IAAA,YAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,uCAAiB;;gDAEtE;AAOK;IAFL,IAAA,eAAM,EAAC,GAAG,8BAAa,CAAC,QAAQ,eAAe,CAAC;IAChD,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;IAClB,WAAA,IAAA,YAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,cAAK,EAAC,aAAa,CAAC,CAAA;;;;iDAE7D;8BA5JU,mBAAmB;IAF/B,IAAA,kBAAS,EAAC,6BAAY,CAAC;IACvB,IAAA,mBAAU,GAAE;qCAMoB,oCAAgB;QACnB,gCAAc;GAN/B,mBAAmB,CA6J/B"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export declare class AssistantAppendAttributesDto {
|
|
2
|
+
/**
|
|
3
|
+
* This user message. Either plain text, or — following the host app's
|
|
4
|
+
* BlockNote convention — a JSON-serialised BlockNote document, which the
|
|
5
|
+
* server detects and converts. An append carries no binding; it inherits
|
|
6
|
+
* the thread's.
|
|
7
|
+
*/
|
|
2
8
|
content: string;
|
|
3
9
|
howToMode?: boolean;
|
|
4
10
|
limitToHowToId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-append.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-append.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,4BAA4B;
|
|
1
|
+
{"version":3,"file":"assistant-append.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-append.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,4BAA4B;IACvC;;;;;OAKG;IAIH,OAAO,EAAG,MAAM,CAAC;IAIjB,SAAS,CAAC,EAAE,OAAO,CAAC;IAIpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,sBAAsB;IAEjC,IAAI,EAAG,MAAM,CAAC;IAId,UAAU,EAAG,4BAA4B,CAAC;CAC3C;AAED,qBAAa,kBAAkB;IAG7B,IAAI,EAAG,sBAAsB,CAAC;CAC/B"}
|
|
@@ -18,7 +18,7 @@ exports.AssistantAppendAttributesDto = AssistantAppendAttributesDto;
|
|
|
18
18
|
__decorate([
|
|
19
19
|
(0, class_validator_1.IsString)(),
|
|
20
20
|
(0, class_validator_1.IsNotEmpty)(),
|
|
21
|
-
(0, class_validator_1.MaxLength)(
|
|
21
|
+
(0, class_validator_1.MaxLength)(200_000),
|
|
22
22
|
__metadata("design:type", String)
|
|
23
23
|
], AssistantAppendAttributesDto.prototype, "content", void 0);
|
|
24
24
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-append.dto.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-append.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAiH;AAEjH,MAAa,4BAA4B;
|
|
1
|
+
{"version":3,"file":"assistant-append.dto.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-append.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAiH;AAEjH,MAAa,4BAA4B;CAmBxC;AAnBD,oEAmBC;AATC;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,OAAO,CAAC;;6DACF;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;+DACQ;AAIpB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;oEACa;AAG1B,MAAa,sBAAsB;CAOlC;AAPD,wDAOC;AALC;IADC,IAAA,wBAAM,EAAC,oBAAoB,CAAC;;oDACf;AAId;IAFC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC;8BAC5B,4BAA4B;0DAAC;AAG5C,MAAa,kBAAkB;CAI9B;AAJD,gDAIC;AADC;IAFC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;8BAC5B,sBAAsB;gDAAC"}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference to the resource a thread is bound to (the `content` relationship,
|
|
3
|
+
* materialised as `(Assistant)-[:BOUND_TO]->(target)`).
|
|
4
|
+
*
|
|
5
|
+
* `type` is a plain `@IsString()` — NOT `@Equals(...)` — because the
|
|
6
|
+
* relationship is polymorphic: any registered model may be the target. The
|
|
7
|
+
* controller resolves the string against the model registry and rejects
|
|
8
|
+
* unknown types there, which is the only place that knows the full set.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AssistantContentReferenceDto {
|
|
11
|
+
type: string;
|
|
12
|
+
id: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class AssistantContentRelationshipDto {
|
|
15
|
+
data: AssistantContentReferenceDto;
|
|
16
|
+
}
|
|
17
|
+
export declare class AssistantPostRelationshipsDto {
|
|
18
|
+
content?: AssistantContentRelationshipDto;
|
|
19
|
+
}
|
|
1
20
|
export declare class AssistantPostAttributesDto {
|
|
21
|
+
/**
|
|
22
|
+
* The first user message. Either plain text, or — following the host app's
|
|
23
|
+
* BlockNote convention — a JSON-serialised BlockNote document. The server
|
|
24
|
+
* detects the latter and derives the persisted markdown (and the pinned
|
|
25
|
+
* entity mentions) from it; see AssistantService.resolveUserTurnInput.
|
|
26
|
+
*
|
|
27
|
+
* The cap is generous because a serialised document carries block structure
|
|
28
|
+
* as well as prose.
|
|
29
|
+
*/
|
|
2
30
|
content: string;
|
|
3
31
|
title?: string;
|
|
4
32
|
howToMode?: boolean;
|
|
@@ -7,6 +35,7 @@ export declare class AssistantPostAttributesDto {
|
|
|
7
35
|
export declare class AssistantPostDataDto {
|
|
8
36
|
type: string;
|
|
9
37
|
attributes: AssistantPostAttributesDto;
|
|
38
|
+
relationships?: AssistantPostRelationshipsDto;
|
|
10
39
|
}
|
|
11
40
|
export declare class AssistantPostDto {
|
|
12
41
|
data: AssistantPostDataDto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-post.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-post.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assistant-post.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-post.dto.ts"],"names":[],"mappings":"AAcA;;;;;;;;GAQG;AACH,qBAAa,4BAA4B;IAGvC,IAAI,EAAG,MAAM,CAAC;IAGd,EAAE,EAAG,MAAM,CAAC;CACb;AAED,qBAAa,+BAA+B;IAI1C,IAAI,EAAG,4BAA4B,CAAC;CACrC;AAED,qBAAa,6BAA6B;IAIxC,OAAO,CAAC,EAAE,+BAA+B,CAAC;CAC3C;AAED,qBAAa,0BAA0B;IACrC;;;;;;;;OAQG;IAIH,OAAO,EAAG,MAAM,CAAC;IAKjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,SAAS,CAAC,EAAE,OAAO,CAAC;IAIpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,oBAAoB;IAE/B,IAAI,EAAG,MAAM,CAAC;IAId,UAAU,EAAG,0BAA0B,CAAC;IAKxC,aAAa,CAAC,EAAE,6BAA6B,CAAC;CAC/C;AAED,qBAAa,gBAAgB;IAG3B,IAAI,EAAG,oBAAoB,CAAC;CAC7B"}
|
|
@@ -9,17 +9,56 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AssistantPostDto = exports.AssistantPostDataDto = exports.AssistantPostAttributesDto = void 0;
|
|
12
|
+
exports.AssistantPostDto = exports.AssistantPostDataDto = exports.AssistantPostAttributesDto = exports.AssistantPostRelationshipsDto = exports.AssistantContentRelationshipDto = exports.AssistantContentReferenceDto = void 0;
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const assistant_meta_1 = require("../entities/assistant.meta");
|
|
16
|
+
/**
|
|
17
|
+
* Reference to the resource a thread is bound to (the `content` relationship,
|
|
18
|
+
* materialised as `(Assistant)-[:BOUND_TO]->(target)`).
|
|
19
|
+
*
|
|
20
|
+
* `type` is a plain `@IsString()` — NOT `@Equals(...)` — because the
|
|
21
|
+
* relationship is polymorphic: any registered model may be the target. The
|
|
22
|
+
* controller resolves the string against the model registry and rejects
|
|
23
|
+
* unknown types there, which is the only place that knows the full set.
|
|
24
|
+
*/
|
|
25
|
+
class AssistantContentReferenceDto {
|
|
26
|
+
}
|
|
27
|
+
exports.AssistantContentReferenceDto = AssistantContentReferenceDto;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], AssistantContentReferenceDto.prototype, "type", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsUUID)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AssistantContentReferenceDto.prototype, "id", void 0);
|
|
37
|
+
class AssistantContentRelationshipDto {
|
|
38
|
+
}
|
|
39
|
+
exports.AssistantContentRelationshipDto = AssistantContentRelationshipDto;
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.ValidateNested)(),
|
|
42
|
+
(0, class_validator_1.IsDefined)(),
|
|
43
|
+
(0, class_transformer_1.Type)(() => AssistantContentReferenceDto),
|
|
44
|
+
__metadata("design:type", AssistantContentReferenceDto)
|
|
45
|
+
], AssistantContentRelationshipDto.prototype, "data", void 0);
|
|
46
|
+
class AssistantPostRelationshipsDto {
|
|
47
|
+
}
|
|
48
|
+
exports.AssistantPostRelationshipsDto = AssistantPostRelationshipsDto;
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.ValidateNested)(),
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
(0, class_transformer_1.Type)(() => AssistantContentRelationshipDto),
|
|
53
|
+
__metadata("design:type", AssistantContentRelationshipDto)
|
|
54
|
+
], AssistantPostRelationshipsDto.prototype, "content", void 0);
|
|
16
55
|
class AssistantPostAttributesDto {
|
|
17
56
|
}
|
|
18
57
|
exports.AssistantPostAttributesDto = AssistantPostAttributesDto;
|
|
19
58
|
__decorate([
|
|
20
59
|
(0, class_validator_1.IsString)(),
|
|
21
60
|
(0, class_validator_1.IsNotEmpty)(),
|
|
22
|
-
(0, class_validator_1.MaxLength)(
|
|
61
|
+
(0, class_validator_1.MaxLength)(200_000),
|
|
23
62
|
__metadata("design:type", String)
|
|
24
63
|
], AssistantPostAttributesDto.prototype, "content", void 0);
|
|
25
64
|
__decorate([
|
|
@@ -50,6 +89,12 @@ __decorate([
|
|
|
50
89
|
(0, class_transformer_1.Type)(() => AssistantPostAttributesDto),
|
|
51
90
|
__metadata("design:type", AssistantPostAttributesDto)
|
|
52
91
|
], AssistantPostDataDto.prototype, "attributes", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, class_validator_1.ValidateNested)(),
|
|
94
|
+
(0, class_validator_1.IsOptional)(),
|
|
95
|
+
(0, class_transformer_1.Type)(() => AssistantPostRelationshipsDto),
|
|
96
|
+
__metadata("design:type", AssistantPostRelationshipsDto)
|
|
97
|
+
], AssistantPostDataDto.prototype, "relationships", void 0);
|
|
53
98
|
class AssistantPostDto {
|
|
54
99
|
}
|
|
55
100
|
exports.AssistantPostDto = AssistantPostDto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-post.dto.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-post.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"assistant-post.dto.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/dtos/assistant-post.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAUyB;AACzB,+DAA2D;AAE3D;;;;;;;;GAQG;AACH,MAAa,4BAA4B;CAOxC;AAPD,oEAOC;AAJC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0DACC;AAGd;IADC,IAAA,wBAAM,GAAE;;wDACG;AAGd,MAAa,+BAA+B;CAK3C;AALD,0EAKC;AADC;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,2BAAS,GAAE;IACX,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC;8BAClC,4BAA4B;6DAAC;AAGtC,MAAa,6BAA6B;CAKzC;AALD,sEAKC;AADC;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+BAA+B,CAAC;8BAClC,+BAA+B;8DAAC;AAG5C,MAAa,0BAA0B;CA2BtC;AA3BD,gEA2BC;AAdC;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,OAAO,CAAC;;2DACF;AAKjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,GAAG,CAAC;;yDACA;AAIf;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;6DACQ;AAIpB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kEACa;AAG1B,MAAa,oBAAoB;CAYhC;AAZD,oDAYC;AAVC;IADC,IAAA,wBAAM,EAAC,8BAAa,CAAC,QAAQ,CAAC;;kDACjB;AAId;IAFC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC;8BAC1B,0BAA0B;wDAAC;AAKxC;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;8BAC1B,6BAA6B;2DAAC;AAGhD,MAAa,gBAAgB;CAI5B;AAJD,4CAIC;AADC;IAFC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC;8BAC1B,oBAAoB;8CAAC"}
|
|
@@ -49,6 +49,28 @@ export declare class AssistantRepository extends AbstractRepository<Assistant, t
|
|
|
49
49
|
}>;
|
|
50
50
|
constructor(neo4j: Neo4jService, securityService: SecurityService, clsService: ClsService);
|
|
51
51
|
protected buildUserHasAccess(): string;
|
|
52
|
+
/**
|
|
53
|
+
* Attach the thread to the resource it is scoped to:
|
|
54
|
+
* `(Assistant)-[:BOUND_TO]->(target)`.
|
|
55
|
+
*
|
|
56
|
+
* This cannot go through the generic create path. `BOUND_TO` is declared
|
|
57
|
+
* polymorphic on the descriptor (any registered model may be the target), so
|
|
58
|
+
* `relationships.content.model` is only a placeholder — `assistantMeta`.
|
|
59
|
+
* `AbstractRepository.create` reads `rel.model.labelName` both to validate the
|
|
60
|
+
* target exists (abstract.repository.ts:713) and to build the edge MATCH
|
|
61
|
+
* (:822), so routing a Campaign id through it looks for
|
|
62
|
+
* `(:Assistant { id: <campaign-uuid> })` and fails with "One or more related
|
|
63
|
+
* nodes do not exist."
|
|
64
|
+
*
|
|
65
|
+
* The caller resolves the real label from the model registry, so the label
|
|
66
|
+
* interpolated here is always a registered one and never user input. The id
|
|
67
|
+
* stays parameterised.
|
|
68
|
+
*/
|
|
69
|
+
bindContent(params: {
|
|
70
|
+
assistantId: string;
|
|
71
|
+
targetLabel: string;
|
|
72
|
+
targetId: string;
|
|
73
|
+
}): Promise<void>;
|
|
52
74
|
/**
|
|
53
75
|
* Override delete to cascade through HAS_MESSAGE children so that
|
|
54
76
|
* `AssistantMessage` nodes (and their REFERENCES edges) are removed with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/repositories/assistant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;;;;;;;;GASG;AACH,qBACa,mBAAoB,SAAQ,kBAAkB,CAAC,SAAS,EAAE,OAAO,mBAAmB,CAAC,aAAa,CAAC;IAC9G,SAAS,CAAC,QAAQ,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAuB;gBAExC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU;IAIzF,SAAS,CAAC,kBAAkB,IAAI,MAAM;IAStC;;;;;;OAMG;IACG,MAAM,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAUpD"}
|
|
1
|
+
{"version":3,"file":"assistant.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/repositories/assistant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;;;;;;;;GASG;AACH,qBACa,mBAAoB,SAAQ,kBAAkB,CAAC,SAAS,EAAE,OAAO,mBAAmB,CAAC,aAAa,CAAC;IAC9G,SAAS,CAAC,QAAQ,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAuB;gBAExC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU;IAIzF,SAAS,CAAC,kBAAkB,IAAI,MAAM;IAStC;;;;;;;;;;;;;;;;OAgBG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAYxG;;;;;;OAMG;IACG,MAAM,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAUpD"}
|
|
@@ -39,6 +39,34 @@ let AssistantRepository = class AssistantRepository extends abstract_repository_
|
|
|
39
39
|
}
|
|
40
40
|
WITH ${nodeName}`;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Attach the thread to the resource it is scoped to:
|
|
44
|
+
* `(Assistant)-[:BOUND_TO]->(target)`.
|
|
45
|
+
*
|
|
46
|
+
* This cannot go through the generic create path. `BOUND_TO` is declared
|
|
47
|
+
* polymorphic on the descriptor (any registered model may be the target), so
|
|
48
|
+
* `relationships.content.model` is only a placeholder — `assistantMeta`.
|
|
49
|
+
* `AbstractRepository.create` reads `rel.model.labelName` both to validate the
|
|
50
|
+
* target exists (abstract.repository.ts:713) and to build the edge MATCH
|
|
51
|
+
* (:822), so routing a Campaign id through it looks for
|
|
52
|
+
* `(:Assistant { id: <campaign-uuid> })` and fails with "One or more related
|
|
53
|
+
* nodes do not exist."
|
|
54
|
+
*
|
|
55
|
+
* The caller resolves the real label from the model registry, so the label
|
|
56
|
+
* interpolated here is always a registered one and never user input. The id
|
|
57
|
+
* stays parameterised.
|
|
58
|
+
*/
|
|
59
|
+
async bindContent(params) {
|
|
60
|
+
await this.neo4j.writeOne({
|
|
61
|
+
query: `
|
|
62
|
+
MATCH (assistant:Assistant {id: $assistantId})
|
|
63
|
+
MATCH (target:${params.targetLabel} {id: $targetId})
|
|
64
|
+
MERGE (assistant)-[rel:BOUND_TO]->(target)
|
|
65
|
+
SET rel.updatedAt = datetime()
|
|
66
|
+
`,
|
|
67
|
+
queryParams: { assistantId: params.assistantId, targetId: params.targetId },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
42
70
|
/**
|
|
43
71
|
* Override delete to cascade through HAS_MESSAGE children so that
|
|
44
72
|
* `AssistantMessage` nodes (and their REFERENCES edges) are removed with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.repository.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/repositories/assistant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAwC;AACxC,2FAAuF;AACvF,8EAA0E;AAC1E,uFAAmF;AACnF,qDAAuE;AAEvE;;;;;;;;;GASG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,wCAAuE;IAG9G,YAAY,KAAmB,EAAE,eAAgC,EAAE,UAAsB;QACvF,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QAHzB,eAAU,GAAG,+BAAmB,CAAC;IAIpD,CAAC;IAES,kBAAkB;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAC3C,OAAO,QAAQ,QAAQ;;uBAEJ,QAAQ;;mBAEZ,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,MAAsB;QACjC,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxB,KAAK,EAAE;;;;OAIN;YACD,WAAW,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE;SAC/B,CAAC,CAAC;IACL,CAAC;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"assistant.repository.js","sourceRoot":"","sources":["../../../../src/foundations/assistant/repositories/assistant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAwC;AACxC,2FAAuF;AACvF,8EAA0E;AAC1E,uFAAmF;AACnF,qDAAuE;AAEvE;;;;;;;;;GASG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,wCAAuE;IAG9G,YAAY,KAAmB,EAAE,eAAgC,EAAE,UAAsB;QACvF,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QAHzB,eAAU,GAAG,+BAAmB,CAAC;IAIpD,CAAC;IAES,kBAAkB;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAC3C,OAAO,QAAQ,QAAQ;;uBAEJ,QAAQ;;mBAEZ,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,WAAW,CAAC,MAAsE;QACtF,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxB,KAAK,EAAE;;wBAEW,MAAM,CAAC,WAAW;;;OAGnC;YACD,WAAW,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;SAC5E,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,MAAsB;QACjC,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxB,KAAK,EAAE;;;;OAIN;YACD,WAAW,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE;SAC/B,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA9DY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAIQ,4BAAY,EAAmB,kCAAe,EAAc,uBAAU;GAH9E,mBAAmB,CA8D/B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GraphCatalogService } from "../../../agents/graph/services/graph.catalog.service";
|
|
2
|
+
import { ScopeGuard } from "../../../agents/graph/services/scope.guard";
|
|
3
|
+
import { UserContext } from "../../../agents/graph/tools/tool.factory";
|
|
4
|
+
import { EntityServiceRegistry } from "../../../common/registries/entity.service.registry";
|
|
5
|
+
export interface ExtractedMention {
|
|
6
|
+
/** JSON:API type, e.g. "npcs". */
|
|
7
|
+
type: string;
|
|
8
|
+
id: string;
|
|
9
|
+
/** Display text the user saw. */
|
|
10
|
+
alias: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Turns a BlockNote document into the entity references a user message pins.
|
|
14
|
+
*
|
|
15
|
+
* A mention arrives from the browser, so it is INPUT, not a trusted pointer:
|
|
16
|
+
* validate() re-checks catalog membership, scope and existence before any of
|
|
17
|
+
* it reaches the LLM or becomes a REFERENCES edge.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AssistantMentionExtractor {
|
|
20
|
+
private readonly catalog;
|
|
21
|
+
private readonly scopeGuard;
|
|
22
|
+
private readonly entityServices;
|
|
23
|
+
private readonly logger;
|
|
24
|
+
constructor(catalog: GraphCatalogService, scopeGuard: ScopeGuard, entityServices: EntityServiceRegistry);
|
|
25
|
+
/** Walks a BlockNote document for inline nodes of type "mention". Never throws. */
|
|
26
|
+
extract(blocks: unknown[]): ExtractedMention[];
|
|
27
|
+
/**
|
|
28
|
+
* Drops mentions that are not in the catalog for these modules, are outside
|
|
29
|
+
* the run's scope, or no longer resolve to a record.
|
|
30
|
+
*/
|
|
31
|
+
validate(params: {
|
|
32
|
+
mentions: ExtractedMention[];
|
|
33
|
+
ctx: UserContext;
|
|
34
|
+
}): Promise<ExtractedMention[]>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=assistant-mention.extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-mention.extractor.d.ts","sourceRoot":"","sources":["../../../../src/foundations/assistant/services/assistant-mention.extractor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAE3F,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,qBACa,yBAAyB;IAIlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,cAAc;IALjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8C;gBAGlD,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,qBAAqB;IAGxD,mFAAmF;IACnF,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE;IAmC9C;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;QAAC,GAAG,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAoBxG"}
|