@carlonicora/nestjs-neo4jsonapi 2.0.0 → 2.2.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.
Files changed (152) hide show
  1. package/dist/agents/graph/graph.module.d.ts.map +1 -1
  2. package/dist/agents/graph/graph.module.js +3 -0
  3. package/dist/agents/graph/graph.module.js.map +1 -1
  4. package/dist/agents/graph/interfaces/graph.catalog.interface.d.ts +24 -0
  5. package/dist/agents/graph/interfaces/graph.catalog.interface.d.ts.map +1 -1
  6. package/dist/agents/graph/services/graph.catalog.service.d.ts +9 -0
  7. package/dist/agents/graph/services/graph.catalog.service.d.ts.map +1 -1
  8. package/dist/agents/graph/services/graph.catalog.service.js +61 -1
  9. package/dist/agents/graph/services/graph.catalog.service.js.map +1 -1
  10. package/dist/agents/graph/services/graph.search.service.d.ts +16 -1
  11. package/dist/agents/graph/services/graph.search.service.d.ts.map +1 -1
  12. package/dist/agents/graph/services/graph.search.service.js +51 -4
  13. package/dist/agents/graph/services/graph.search.service.js.map +1 -1
  14. package/dist/agents/graph/services/humanize-tool.d.ts +17 -2
  15. package/dist/agents/graph/services/humanize-tool.d.ts.map +1 -1
  16. package/dist/agents/graph/services/humanize-tool.js +71 -6
  17. package/dist/agents/graph/services/humanize-tool.js.map +1 -1
  18. package/dist/agents/graph/services/materialise-bridge.d.ts +6 -0
  19. package/dist/agents/graph/services/materialise-bridge.d.ts.map +1 -1
  20. package/dist/agents/graph/services/materialise-bridge.js +17 -1
  21. package/dist/agents/graph/services/materialise-bridge.js.map +1 -1
  22. package/dist/agents/graph/services/scope.guard.d.ts +43 -0
  23. package/dist/agents/graph/services/scope.guard.d.ts.map +1 -0
  24. package/dist/agents/graph/services/scope.guard.js +91 -0
  25. package/dist/agents/graph/services/scope.guard.js.map +1 -0
  26. package/dist/agents/graph/tools/read-entity.tool.d.ts +9 -1
  27. package/dist/agents/graph/tools/read-entity.tool.d.ts.map +1 -1
  28. package/dist/agents/graph/tools/read-entity.tool.js +30 -5
  29. package/dist/agents/graph/tools/read-entity.tool.js.map +1 -1
  30. package/dist/agents/graph/tools/resolve-entity.tool.d.ts.map +1 -1
  31. package/dist/agents/graph/tools/resolve-entity.tool.js +8 -1
  32. package/dist/agents/graph/tools/resolve-entity.tool.js.map +1 -1
  33. package/dist/agents/graph/tools/search-entities.tool.d.ts +9 -1
  34. package/dist/agents/graph/tools/search-entities.tool.d.ts.map +1 -1
  35. package/dist/agents/graph/tools/search-entities.tool.js +37 -8
  36. package/dist/agents/graph/tools/search-entities.tool.js.map +1 -1
  37. package/dist/agents/graph/tools/tool.factory.d.ts +4 -0
  38. package/dist/agents/graph/tools/tool.factory.d.ts.map +1 -1
  39. package/dist/agents/graph/tools/tool.factory.js.map +1 -1
  40. package/dist/agents/graph/tools/traverse.tool.d.ts +9 -1
  41. package/dist/agents/graph/tools/traverse.tool.d.ts.map +1 -1
  42. package/dist/agents/graph/tools/traverse.tool.js +21 -5
  43. package/dist/agents/graph/tools/traverse.tool.js.map +1 -1
  44. package/dist/agents/operator/contexts/operator.context.d.ts +4 -0
  45. package/dist/agents/operator/contexts/operator.context.d.ts.map +1 -1
  46. package/dist/agents/operator/contexts/operator.context.js +4 -0
  47. package/dist/agents/operator/contexts/operator.context.js.map +1 -1
  48. package/dist/agents/operator/operator.module.d.ts.map +1 -1
  49. package/dist/agents/operator/operator.module.js +4 -0
  50. package/dist/agents/operator/operator.module.js.map +1 -1
  51. package/dist/agents/operator/services/operator.service.d.ts +8 -0
  52. package/dist/agents/operator/services/operator.service.d.ts.map +1 -1
  53. package/dist/agents/operator/services/operator.service.js +8 -0
  54. package/dist/agents/operator/services/operator.service.js.map +1 -1
  55. package/dist/agents/operator/tools/entity-write.tools.d.ts +124 -0
  56. package/dist/agents/operator/tools/entity-write.tools.d.ts.map +1 -0
  57. package/dist/agents/operator/tools/entity-write.tools.js +471 -0
  58. package/dist/agents/operator/tools/entity-write.tools.js.map +1 -0
  59. package/dist/agents/operator/tools/operator.tool.registry.d.ts +5 -1
  60. package/dist/agents/operator/tools/operator.tool.registry.d.ts.map +1 -1
  61. package/dist/agents/operator/tools/operator.tool.registry.js +19 -2
  62. package/dist/agents/operator/tools/operator.tool.registry.js.map +1 -1
  63. package/dist/agents/operator/tools/search-documents.tool.d.ts +16 -1
  64. package/dist/agents/operator/tools/search-documents.tool.d.ts.map +1 -1
  65. package/dist/agents/operator/tools/search-documents.tool.js +59 -3
  66. package/dist/agents/operator/tools/search-documents.tool.js.map +1 -1
  67. package/dist/agents/prompts/index.d.ts +1 -0
  68. package/dist/agents/prompts/index.d.ts.map +1 -1
  69. package/dist/agents/prompts/index.js +7 -1
  70. package/dist/agents/prompts/index.js.map +1 -1
  71. package/dist/agents/responder/contexts/responder.context.d.ts +12 -0
  72. package/dist/agents/responder/contexts/responder.context.d.ts.map +1 -1
  73. package/dist/agents/responder/contexts/responder.context.js +4 -0
  74. package/dist/agents/responder/contexts/responder.context.js.map +1 -1
  75. package/dist/agents/responder/factories/responder.context.factory.d.ts +4 -0
  76. package/dist/agents/responder/factories/responder.context.factory.d.ts.map +1 -1
  77. package/dist/agents/responder/factories/responder.context.factory.js +2 -0
  78. package/dist/agents/responder/factories/responder.context.factory.js.map +1 -1
  79. package/dist/agents/responder/nodes/graph.node.service.d.ts.map +1 -1
  80. package/dist/agents/responder/nodes/graph.node.service.js +18 -2
  81. package/dist/agents/responder/nodes/graph.node.service.js.map +1 -1
  82. package/dist/agents/responder/nodes/responder.answer.node.service.d.ts +32 -0
  83. package/dist/agents/responder/nodes/responder.answer.node.service.d.ts.map +1 -1
  84. package/dist/agents/responder/nodes/responder.answer.node.service.js +31 -19
  85. package/dist/agents/responder/nodes/responder.answer.node.service.js.map +1 -1
  86. package/dist/agents/responder/services/responder.service.d.ts +4 -0
  87. package/dist/agents/responder/services/responder.service.d.ts.map +1 -1
  88. package/dist/agents/responder/services/responder.service.js +2 -0
  89. package/dist/agents/responder/services/responder.service.js.map +1 -1
  90. package/dist/common/interfaces/entity.schema.interface.d.ts +16 -0
  91. package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
  92. package/dist/config/interfaces/config.prompts.interface.d.ts +12 -0
  93. package/dist/config/interfaces/config.prompts.interface.d.ts.map +1 -1
  94. package/dist/core/blocknote/services/blocknote.service.d.ts +23 -14
  95. package/dist/core/blocknote/services/blocknote.service.d.ts.map +1 -1
  96. package/dist/core/blocknote/services/blocknote.service.js +48 -32
  97. package/dist/core/blocknote/services/blocknote.service.js.map +1 -1
  98. package/dist/core/email/email.helpers.d.ts +18 -0
  99. package/dist/core/email/email.helpers.d.ts.map +1 -0
  100. package/dist/core/email/email.helpers.js +50 -0
  101. package/dist/core/email/email.helpers.js.map +1 -0
  102. package/dist/core/email/index.d.ts +1 -0
  103. package/dist/core/email/index.d.ts.map +1 -1
  104. package/dist/core/email/index.js +2 -0
  105. package/dist/core/email/index.js.map +1 -1
  106. package/dist/core/email/services/email.service.d.ts.map +1 -1
  107. package/dist/core/email/services/email.service.js +4 -4
  108. package/dist/core/email/services/email.service.js.map +1 -1
  109. package/dist/core/llm/services/llm.service.d.ts.map +1 -1
  110. package/dist/core/llm/services/llm.service.js +34 -2
  111. package/dist/core/llm/services/llm.service.js.map +1 -1
  112. package/dist/core/llm/services/tool-error-feedback.d.ts +40 -0
  113. package/dist/core/llm/services/tool-error-feedback.d.ts.map +1 -0
  114. package/dist/core/llm/services/tool-error-feedback.js +131 -0
  115. package/dist/core/llm/services/tool-error-feedback.js.map +1 -0
  116. package/dist/foundations/assistant/assistant.module.d.ts.map +1 -1
  117. package/dist/foundations/assistant/assistant.module.js +7 -1
  118. package/dist/foundations/assistant/assistant.module.js.map +1 -1
  119. package/dist/foundations/assistant/controllers/assistant.controller.d.ts +13 -1
  120. package/dist/foundations/assistant/controllers/assistant.controller.d.ts.map +1 -1
  121. package/dist/foundations/assistant/controllers/assistant.controller.js +37 -3
  122. package/dist/foundations/assistant/controllers/assistant.controller.js.map +1 -1
  123. package/dist/foundations/assistant/dtos/assistant-append.dto.d.ts +6 -0
  124. package/dist/foundations/assistant/dtos/assistant-append.dto.d.ts.map +1 -1
  125. package/dist/foundations/assistant/dtos/assistant-append.dto.js +1 -1
  126. package/dist/foundations/assistant/dtos/assistant-append.dto.js.map +1 -1
  127. package/dist/foundations/assistant/dtos/assistant-post.dto.d.ts +29 -0
  128. package/dist/foundations/assistant/dtos/assistant-post.dto.d.ts.map +1 -1
  129. package/dist/foundations/assistant/dtos/assistant-post.dto.js +47 -2
  130. package/dist/foundations/assistant/dtos/assistant-post.dto.js.map +1 -1
  131. package/dist/foundations/assistant/repositories/assistant.repository.d.ts +22 -0
  132. package/dist/foundations/assistant/repositories/assistant.repository.d.ts.map +1 -1
  133. package/dist/foundations/assistant/repositories/assistant.repository.js +28 -0
  134. package/dist/foundations/assistant/repositories/assistant.repository.js.map +1 -1
  135. package/dist/foundations/assistant/services/assistant-mention.extractor.d.ts +36 -0
  136. package/dist/foundations/assistant/services/assistant-mention.extractor.d.ts.map +1 -0
  137. package/dist/foundations/assistant/services/assistant-mention.extractor.js +99 -0
  138. package/dist/foundations/assistant/services/assistant-mention.extractor.js.map +1 -0
  139. package/dist/foundations/assistant/services/assistant.service.d.ts +84 -2
  140. package/dist/foundations/assistant/services/assistant.service.d.ts.map +1 -1
  141. package/dist/foundations/assistant/services/assistant.service.js +312 -60
  142. package/dist/foundations/assistant/services/assistant.service.js.map +1 -1
  143. package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
  144. package/dist/foundations/auth/services/auth.service.js +2 -0
  145. package/dist/foundations/auth/services/auth.service.js.map +1 -1
  146. package/dist/foundations/user/services/user.service.d.ts.map +1 -1
  147. package/dist/foundations/user/services/user.service.js +3 -0
  148. package/dist/foundations/user/services/user.service.js.map +1 -1
  149. package/dist/foundations/waitlist/services/waitlist.service.d.ts.map +1 -1
  150. package/dist/foundations/waitlist/services/waitlist.service.js +2 -0
  151. package/dist/foundations/waitlist/services/waitlist.service.js.map +1 -1
  152. package/package.json +1 -1
@@ -0,0 +1,471 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var EntityWriteTools_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.EntityWriteTools = void 0;
14
+ const tools_1 = require("@langchain/core/tools");
15
+ const common_1 = require("@nestjs/common");
16
+ const node_crypto_1 = require("node:crypto");
17
+ const zod_1 = require("zod");
18
+ const entity_service_registry_1 = require("../../../common/registries/entity.service.registry");
19
+ const graph_catalog_service_1 = require("../../graph/services/graph.catalog.service");
20
+ const scope_guard_1 = require("../../graph/services/scope.guard");
21
+ const tool_factory_1 = require("../../graph/tools/tool.factory");
22
+ const isError = (value) => typeof value === "object" && value !== null && "error" in value;
23
+ /**
24
+ * Generic, catalog-driven create/update/delete/link/unlink tools for the operator.
25
+ *
26
+ * Three invariants make these safe enough to expose to an LLM:
27
+ *
28
+ * 1. **Opt-in.** Only descriptors that declare `chat.writable` are touchable, and
29
+ * only when the caller's modules grant access. When nothing is writable the
30
+ * tools are not built at all, so a host application that never opts in sees
31
+ * exactly the tool set it had before.
32
+ * 2. **Scoped.** Every id in every payload is checked through `ScopeGuard`, and
33
+ * `create` overwrites the scope relationship with the run's OWN scope id — the
34
+ * model cannot name a different one. The scope relationship itself can never be
35
+ * re-pointed, so a record cannot be moved between scope roots.
36
+ * 3. **Service-only.** Writes go through `EntityServiceRegistry.get(type)`, i.e. the
37
+ * AbstractService, never the repository — so the host application's side effects
38
+ * (audit log, knowledge-graph chunking, cache invalidation) all fire. No Cypher
39
+ * is written here.
40
+ */
41
+ let EntityWriteTools = EntityWriteTools_1 = class EntityWriteTools {
42
+ constructor(catalog, registry, scopeGuard,
43
+ /**
44
+ * Optional in the TYPE signature only, so unit tests can construct the three
45
+ * collaborators they exercise. Nest has no notion of `?` and still resolves it
46
+ * from GraphModule — a missing provider fails loudly at boot rather than
47
+ * silently dropping the per-turn tool-call audit trail.
48
+ */
49
+ factory) {
50
+ this.catalog = catalog;
51
+ this.registry = registry;
52
+ this.scopeGuard = scopeGuard;
53
+ this.factory = factory;
54
+ this.logger = new common_1.Logger(EntityWriteTools_1.name);
55
+ }
56
+ /**
57
+ * Builds the five write tools for one operator turn.
58
+ *
59
+ * Returns `[]` when the caller can write nothing. This is what keeps hosts that
60
+ * declare no `chat.writable` descriptor on exactly the behaviour they had before
61
+ * these tools existed.
62
+ */
63
+ buildDefinitions(ctx, recorder) {
64
+ const writableTypes = this.writableTypes(ctx);
65
+ if (!writableTypes.length)
66
+ return [];
67
+ const types = writableTypes.join(", ");
68
+ const typeField = zod_1.z.string().describe(`The entity type to write. Only these types may be written: ${types}.`);
69
+ const createSchema = zod_1.z.object({
70
+ type: typeField,
71
+ fields: zod_1.z
72
+ .record(zod_1.z.string(), zod_1.z.any())
73
+ .describe("Field values keyed by field name. Call describe_entity first to learn the valid field names."),
74
+ relationships: zod_1.z
75
+ .record(zod_1.z.string(), zod_1.z.string())
76
+ .optional()
77
+ .describe("Related record ids keyed by relationship name, for relationships declared on this type."),
78
+ });
79
+ const updateSchema = zod_1.z.object({
80
+ type: typeField,
81
+ id: zod_1.z.string().describe("Id of the record to update."),
82
+ fields: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).describe("Only the field values that change. Others are left untouched."),
83
+ });
84
+ const deleteSchema = zod_1.z.object({
85
+ type: typeField,
86
+ id: zod_1.z.string().describe("Id of the record to delete."),
87
+ });
88
+ const linkSchema = zod_1.z.object({
89
+ type: typeField,
90
+ id: zod_1.z.string().describe("Id of the record whose relationship changes."),
91
+ relationship: zod_1.z.string().describe("Relationship name as reported by describe_entity."),
92
+ targetIds: zod_1.z.array(zod_1.z.string()).describe("Ids of the related records."),
93
+ });
94
+ return [
95
+ {
96
+ tool: new tools_1.DynamicStructuredTool({
97
+ name: "create_entity",
98
+ description: `Creates one new record. Writable types: ${types}. This action requires user approval before it runs.`,
99
+ schema: createSchema,
100
+ func: async (input) => JSON.stringify(await this.createEntity(input, ctx, recorder)),
101
+ }),
102
+ destructive: true,
103
+ summarise: (args) => this.summariseCreate(args),
104
+ },
105
+ {
106
+ tool: new tools_1.DynamicStructuredTool({
107
+ name: "update_entity",
108
+ description: `Updates the given fields of one existing record, leaving every other field untouched. Writable types: ${types}. This action requires user approval before it runs.`,
109
+ schema: updateSchema,
110
+ func: async (input) => JSON.stringify(await this.updateEntity(input, ctx, recorder)),
111
+ }),
112
+ destructive: true,
113
+ summarise: (args) => this.summariseUpdate(args),
114
+ },
115
+ {
116
+ tool: new tools_1.DynamicStructuredTool({
117
+ name: "delete_entity",
118
+ description: `Permanently deletes one existing record. Writable types: ${types}. This action requires user approval before it runs.`,
119
+ schema: deleteSchema,
120
+ func: async (input) => JSON.stringify(await this.deleteEntity(input, ctx, recorder)),
121
+ }),
122
+ destructive: true,
123
+ summarise: (args) => this.summariseDelete(args),
124
+ },
125
+ {
126
+ tool: new tools_1.DynamicStructuredTool({
127
+ name: "link_entities",
128
+ description: `Adds related records to one relationship of an existing record. Writable types: ${types}. This action requires user approval before it runs.`,
129
+ schema: linkSchema,
130
+ func: async (input) => JSON.stringify(await this.linkEntities(input, ctx, recorder)),
131
+ }),
132
+ destructive: true,
133
+ summarise: (args) => this.summariseLink(args, "Link"),
134
+ },
135
+ {
136
+ tool: new tools_1.DynamicStructuredTool({
137
+ name: "unlink_entities",
138
+ description: `Removes related records from one relationship of an existing record. Writable types: ${types}. This action requires user approval before it runs.`,
139
+ schema: linkSchema,
140
+ func: async (input) => JSON.stringify(await this.unlinkEntities(input, ctx, recorder)),
141
+ }),
142
+ destructive: true,
143
+ summarise: (args) => this.summariseLink(args, "Unlink"),
144
+ },
145
+ ];
146
+ }
147
+ async createEntity(input, ctx, recorder) {
148
+ return this.capture("create_entity", input, recorder, async () => {
149
+ const entity = this.resolveWritable(input.type, ctx);
150
+ if (isError(entity))
151
+ return entity;
152
+ const fields = input.fields ?? {};
153
+ const fieldError = this.validateFields(entity, fields);
154
+ if (fieldError)
155
+ return { error: fieldError };
156
+ // The run's scope is authoritative: whatever the model supplied for the
157
+ // scope relationship is discarded before validation and replaced below.
158
+ const scopeKey = this.scopeKeyOf(entity);
159
+ const relationships = { ...(input.relationships ?? {}) };
160
+ if (scopeKey)
161
+ delete relationships[scopeKey];
162
+ const relationshipError = await this.validateRelationships(entity, relationships, ctx);
163
+ if (relationshipError)
164
+ return { error: relationshipError };
165
+ const service = this.registry.get(entity.type);
166
+ if (!service)
167
+ return { error: `Service not available for "${entity.type}".` };
168
+ const id = (0, node_crypto_1.randomUUID)();
169
+ return this.dispatch(async () => {
170
+ await service.create({
171
+ id,
172
+ ...fields,
173
+ ...relationships,
174
+ ...(scopeKey && ctx.scopeId ? { [scopeKey]: ctx.scopeId } : {}),
175
+ });
176
+ return { id, type: entity.type, created: true };
177
+ });
178
+ });
179
+ }
180
+ async updateEntity(input, ctx, recorder) {
181
+ return this.capture("update_entity", input, recorder, async () => {
182
+ const entity = this.resolveWritable(input.type, ctx);
183
+ if (isError(entity))
184
+ return entity;
185
+ const outOfScope = await this.requireInScope(entity.type, [input.id], ctx);
186
+ if (outOfScope)
187
+ return outOfScope;
188
+ const fields = input.fields ?? {};
189
+ const fieldError = this.validateFields(entity, fields);
190
+ if (fieldError)
191
+ return { error: fieldError };
192
+ const service = this.registry.get(entity.type);
193
+ if (!service)
194
+ return { error: `Service not available for "${entity.type}".` };
195
+ return this.dispatch(async () => {
196
+ // patch, not put: only the named fields change. put would map every
197
+ // descriptor relationship and treat the ones absent from the payload as
198
+ // "delete all edges", silently stripping the record's relationships.
199
+ await service.patch({ id: input.id, ...fields });
200
+ return { id: input.id, type: entity.type, updated: true };
201
+ });
202
+ });
203
+ }
204
+ async deleteEntity(input, ctx, recorder) {
205
+ return this.capture("delete_entity", input, recorder, async () => {
206
+ const entity = this.resolveWritable(input.type, ctx);
207
+ if (isError(entity))
208
+ return entity;
209
+ const outOfScope = await this.requireInScope(entity.type, [input.id], ctx);
210
+ if (outOfScope)
211
+ return outOfScope;
212
+ const service = this.registry.get(entity.type);
213
+ if (!service)
214
+ return { error: `Service not available for "${entity.type}".` };
215
+ return this.dispatch(async () => {
216
+ await service.delete({ id: input.id });
217
+ return { id: input.id, type: entity.type, deleted: true };
218
+ });
219
+ });
220
+ }
221
+ async linkEntities(input, ctx, recorder) {
222
+ return this.capture("link_entities", input, recorder, () => this.applyLink(input, ctx, "link"));
223
+ }
224
+ async unlinkEntities(input, ctx, recorder) {
225
+ return this.capture("unlink_entities", input, recorder, () => this.applyLink(input, ctx, "unlink"));
226
+ }
227
+ // ---------------------------------------------------------------------------
228
+ // Guards
229
+ // ---------------------------------------------------------------------------
230
+ resolveWritable(type, ctx) {
231
+ const entity = this.catalog.getEntityDetail(type, ctx.userModuleIds);
232
+ if (!entity)
233
+ return { error: `Entity type "${type}" is not available.` };
234
+ if (!entity.writable) {
235
+ return { error: `Entity type "${type}" is read-only. Writable types: ${this.writableTypes(ctx).join(", ")}.` };
236
+ }
237
+ return entity;
238
+ }
239
+ /** Reject any field the catalog does not declare, and any type mismatch. */
240
+ validateFields(entity, fields) {
241
+ const byName = new Map(entity.fields.map((field) => [field.name, field]));
242
+ for (const [name, value] of Object.entries(fields)) {
243
+ const definition = byName.get(name);
244
+ if (!definition) {
245
+ return `Field "${name}" is not available on ${entity.type}. Valid fields: [${entity.fields
246
+ .map((field) => field.name)
247
+ .join(", ")}].`;
248
+ }
249
+ if (!this.matchesType(definition.type, value)) {
250
+ return `Field "${name}" on ${entity.type} expects ${definition.type}.`;
251
+ }
252
+ }
253
+ return null;
254
+ }
255
+ /**
256
+ * Reject unknown or reverse-only relationship keys, and any target id that is
257
+ * outside the run's scope. The scope relationship never reaches this method —
258
+ * callers strip it first.
259
+ */
260
+ async validateRelationships(entity, relationships, ctx) {
261
+ const byName = new Map(entity.relationships.map((relationship) => [relationship.name, relationship]));
262
+ for (const [name, value] of Object.entries(relationships)) {
263
+ const relationship = byName.get(name);
264
+ if (!relationship) {
265
+ return `Relationship "${name}" is not available on ${entity.type}. Valid relationships: [${entity.relationships
266
+ .map((candidate) => candidate.name)
267
+ .join(", ")}].`;
268
+ }
269
+ const rejection = this.rejectUnwritableRelationship(entity, relationship);
270
+ if (rejection)
271
+ return rejection;
272
+ const ids = (Array.isArray(value) ? value : [value]).map((id) => String(id));
273
+ const outOfScope = await this.requireInScope(relationship.targetType, ids, ctx);
274
+ if (outOfScope)
275
+ return outOfScope.error;
276
+ }
277
+ return null;
278
+ }
279
+ /**
280
+ * A relationship the generic write path must never touch:
281
+ * - reverse relationships are serialisation-only, with no edge on this side;
282
+ * - the scope relationship is what confines the record to the run's root, so
283
+ * re-pointing it would move the record into another scope.
284
+ */
285
+ rejectUnwritableRelationship(entity, relationship) {
286
+ if (relationship.isReverse) {
287
+ return `Relationship "${relationship.name}" on ${entity.type} is read-only and cannot be written.`;
288
+ }
289
+ if (relationship.name === this.scopeKeyOf(entity)) {
290
+ return `Relationship "${relationship.name}" on ${entity.type} cannot be changed.`;
291
+ }
292
+ return null;
293
+ }
294
+ /** `null` when every id is inside the run's scope, otherwise the error to return. */
295
+ async requireInScope(type, ids, ctx) {
296
+ for (const id of ids) {
297
+ const inScope = await this.scopeGuard.isInScope({ type, id, ctx });
298
+ if (!inScope) {
299
+ this.logger.warn(`entity-write: ${type} record "${id}" is not found in the current scope.`);
300
+ return { error: `A ${type} record with id "${id}" was not found.` };
301
+ }
302
+ }
303
+ return null;
304
+ }
305
+ // ---------------------------------------------------------------------------
306
+ // Internals
307
+ // ---------------------------------------------------------------------------
308
+ /**
309
+ * The scope chain is guaranteed to be exactly one hop for writable types — the
310
+ * catalog rejects deeper writables at boot — so the first hop's key is the
311
+ * relationship that pins a new record to the run's scope root.
312
+ */
313
+ scopeKeyOf(entity) {
314
+ return entity.scope?.path[0]?.key;
315
+ }
316
+ writableTypes(ctx) {
317
+ return this.catalog
318
+ .getAllChatEnabledEntities()
319
+ .filter((entity) => entity.writable && ctx.userModuleIds.includes(entity.moduleId))
320
+ .map((entity) => entity.type);
321
+ }
322
+ matchesType(type, value) {
323
+ // An explicit null clears a field; the repository handles it per type.
324
+ if (value === null || value === undefined)
325
+ return true;
326
+ if (type.endsWith("[]")) {
327
+ const base = type.slice(0, -2);
328
+ return Array.isArray(value) && value.every((item) => this.matchesType(base, item));
329
+ }
330
+ switch (type) {
331
+ case "string":
332
+ case "date":
333
+ case "datetime":
334
+ return typeof value === "string";
335
+ case "number":
336
+ return typeof value === "number" && Number.isFinite(value);
337
+ case "boolean":
338
+ return typeof value === "boolean";
339
+ default:
340
+ // "json" and any future scalar: the descriptor imposes no shape.
341
+ return true;
342
+ }
343
+ }
344
+ async applyLink(input, ctx, mode) {
345
+ const entity = this.resolveWritable(input.type, ctx);
346
+ if (isError(entity))
347
+ return entity;
348
+ const relationship = entity.relationships.find((candidate) => candidate.name === input.relationship);
349
+ if (!relationship) {
350
+ return {
351
+ error: `Relationship "${input.relationship}" is not available on ${entity.type}. Valid relationships: [${entity.relationships
352
+ .map((candidate) => candidate.name)
353
+ .join(", ")}].`,
354
+ };
355
+ }
356
+ const rejection = this.rejectUnwritableRelationship(entity, relationship);
357
+ if (rejection)
358
+ return { error: rejection };
359
+ const targetIds = (input.targetIds ?? []).map((id) => String(id));
360
+ if (!targetIds.length)
361
+ return { error: "targetIds must contain at least one id." };
362
+ if (relationship.cardinality === "one") {
363
+ if (mode === "unlink") {
364
+ // A to-one edge cannot be removed through the generic patch path: the
365
+ // repository maps an empty list to "no change", so the edge would survive
366
+ // while the tool reported success.
367
+ return {
368
+ error: `Relationship "${relationship.name}" on ${entity.type} holds a single record and cannot be cleared. Link a different record instead.`,
369
+ };
370
+ }
371
+ if (targetIds.length !== 1) {
372
+ return { error: `Relationship "${relationship.name}" on ${entity.type} accepts exactly one record.` };
373
+ }
374
+ }
375
+ const outOfScope = (await this.requireInScope(entity.type, [input.id], ctx)) ??
376
+ (await this.requireInScope(relationship.targetType, targetIds, ctx));
377
+ if (outOfScope)
378
+ return outOfScope;
379
+ const service = this.registry.get(entity.type);
380
+ if (!service)
381
+ return { error: `Service not available for "${entity.type}".` };
382
+ return this.dispatch(async () => {
383
+ if (relationship.cardinality === "one") {
384
+ // The framework's add/remove relationship helpers are to-many only, so a
385
+ // to-one edge is repointed with patch, which replaces the single edge.
386
+ await service.patch({ id: input.id, [relationship.name]: targetIds });
387
+ }
388
+ else if (mode === "link") {
389
+ await service.addToRelationshipFromDTO({
390
+ id: input.id,
391
+ relationship: relationship.name,
392
+ data: targetIds.map((id) => ({ id, type: relationship.targetType })),
393
+ });
394
+ }
395
+ else {
396
+ await service.removeFromRelationshipFromDTO({
397
+ id: input.id,
398
+ relationship: relationship.name,
399
+ data: targetIds.map((id) => ({ id, type: relationship.targetType })),
400
+ });
401
+ }
402
+ return { id: input.id, type: entity.type, relationship: relationship.name, targetIds, [mode + "ed"]: true };
403
+ });
404
+ }
405
+ /**
406
+ * Runs a write and converts a thrown framework error into the `{ error }` shape
407
+ * every tool method returns, matching the read tools' contract: the operator
408
+ * turns a returned error into a ToolMessage the model can recover from, whereas
409
+ * a thrown one aborts the tool node.
410
+ */
411
+ async dispatch(fn) {
412
+ try {
413
+ return await fn();
414
+ }
415
+ catch (err) {
416
+ const message = err instanceof Error ? err.message : String(err);
417
+ this.logger.warn(`entity-write: write rejected: ${message}`);
418
+ return { error: message };
419
+ }
420
+ }
421
+ capture(tool, input, recorder, fn) {
422
+ return this.factory ? this.factory.capture({ tool, input }, fn, recorder) : fn();
423
+ }
424
+ // ---------------------------------------------------------------------------
425
+ // Approval-card summaries
426
+ //
427
+ // These are rendered to the user before the action runs. They stay generic:
428
+ // nothing beyond the tool's own arguments is named.
429
+ // ---------------------------------------------------------------------------
430
+ summariseCreate(args) {
431
+ const type = this.summariseType(args);
432
+ const label = this.summariseLabel(args.fields);
433
+ return label ? `Create a new ${type} record named "${label}".` : `Create a new ${type} record.`;
434
+ }
435
+ summariseUpdate(args) {
436
+ const type = this.summariseType(args);
437
+ const fields = args.fields && typeof args.fields === "object" ? Object.keys(args.fields) : [];
438
+ const changed = fields.length ? ` (${fields.join(", ")})` : "";
439
+ return `Update the ${type} record ${this.summariseId(args)}${changed}.`;
440
+ }
441
+ summariseDelete(args) {
442
+ return `Delete the ${this.summariseType(args)} record ${this.summariseId(args)}.`;
443
+ }
444
+ summariseLink(args, verb) {
445
+ const count = Array.isArray(args.targetIds) ? args.targetIds.length : 0;
446
+ const relationship = typeof args.relationship === "string" ? args.relationship : "related";
447
+ const preposition = verb === "Link" ? "to" : "from";
448
+ return `${verb} ${count} record(s) ${preposition} the "${relationship}" relationship of the ${this.summariseType(args)} record ${this.summariseId(args)}.`;
449
+ }
450
+ summariseType(args) {
451
+ return typeof args.type === "string" && args.type ? args.type : "record";
452
+ }
453
+ summariseId(args) {
454
+ return typeof args.id === "string" && args.id ? args.id : "(unknown id)";
455
+ }
456
+ summariseLabel(fields) {
457
+ if (!fields || typeof fields !== "object")
458
+ return undefined;
459
+ const candidate = fields.name ?? fields.title;
460
+ return typeof candidate === "string" && candidate ? candidate : undefined;
461
+ }
462
+ };
463
+ exports.EntityWriteTools = EntityWriteTools;
464
+ exports.EntityWriteTools = EntityWriteTools = EntityWriteTools_1 = __decorate([
465
+ (0, common_1.Injectable)(),
466
+ __metadata("design:paramtypes", [graph_catalog_service_1.GraphCatalogService,
467
+ entity_service_registry_1.EntityServiceRegistry,
468
+ scope_guard_1.ScopeGuard,
469
+ tool_factory_1.ToolFactory])
470
+ ], EntityWriteTools);
471
+ //# sourceMappingURL=entity-write.tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-write.tools.js","sourceRoot":"","sources":["../../../../src/agents/operator/tools/entity-write.tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iDAA8D;AAC9D,2CAAoD;AACpD,6CAAyC;AACzC,6BAAwB;AACxB,gGAA2F;AAE3F,sFAAiF;AACjF,kEAA8D;AAC9D,iEAA0F;AAkC1F,MAAM,OAAO,GAAG,CAAC,KAAc,EAAuB,EAAE,CACtD,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAG3B,YACmB,OAA4B,EAC5B,QAA+B,EAC/B,UAAsB;IACvC;;;;;OAKG;IACc,OAAqB;QATrB,YAAO,GAAP,OAAO,CAAqB;QAC5B,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,eAAU,GAAV,UAAU,CAAY;QAOtB,YAAO,GAAP,OAAO,CAAc;QAZvB,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;IAazD,CAAC;IAEJ;;;;;;OAMG;IACH,gBAAgB,CAAC,GAA6B,EAAE,QAA0B;QACxE,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,CAAC,aAAa,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAErC,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8DAA8D,KAAK,GAAG,CAAC,CAAC;QAE9G,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;YAC5B,IAAI,EAAE,SAAS;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AK,CAAC;QACxG,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC;CACF,CAAA;AArdY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAKiB,2CAAmB;QAClB,+CAAqB;QACnB,wBAAU;QAOZ,0BAAW;GAb7B,gBAAgB,CAqd5B"}
@@ -5,6 +5,7 @@ import { SearchEntitiesTool } from "../../graph/tools/search-entities.tool";
5
5
  import { ToolCallRecord } from "../../graph/tools/tool.factory";
6
6
  import { TraverseTool } from "../../graph/tools/traverse.tool";
7
7
  import { OperatorRetrievalContext, OperatorToolContribution, OperatorToolDefinition } from "../interfaces/operator.tool.interface";
8
+ import { EntityWriteTools } from "./entity-write.tools";
8
9
  import { OperatorTestActionTool } from "./operator-test-action.tool";
9
10
  import { SearchCommunitiesTool } from "./search-communities.tool";
10
11
  import { SearchDocumentsTool } from "./search-documents.tool";
@@ -12,6 +13,8 @@ import { SearchDocumentsTool } from "./search-documents.tool";
12
13
  * Composes the operator's tool set for a single turn:
13
14
  * - the five graph tools (read-only, built per request with ctx + recorder)
14
15
  * - the two retrieval tools (search_documents, search_communities)
16
+ * - the generic entity write tools, but only when a catalogued type the caller
17
+ * can reach declares `chat.writable` — otherwise none are built
15
18
  * - the test-only destructive tool (non-production environments only)
16
19
  * - any app-contributed factories registered under the OPERATOR_TOOLS token,
17
20
  * built per turn with the same ctx + recorder as the built-ins
@@ -26,7 +29,8 @@ export declare class OperatorToolRegistry {
26
29
  private readonly searchCommunitiesTool;
27
30
  private readonly operatorTestActionTool;
28
31
  private readonly contributed?;
29
- constructor(resolveEntityTool: ResolveEntityTool, describeEntityTool: DescribeEntityTool, searchEntitiesTool: SearchEntitiesTool, readEntityTool: ReadEntityTool, traverseTool: TraverseTool, searchDocumentsTool: SearchDocumentsTool, searchCommunitiesTool: SearchCommunitiesTool, operatorTestActionTool: OperatorTestActionTool, contributed?: OperatorToolContribution[]);
32
+ private readonly entityWriteTools?;
33
+ constructor(resolveEntityTool: ResolveEntityTool, describeEntityTool: DescribeEntityTool, searchEntitiesTool: SearchEntitiesTool, readEntityTool: ReadEntityTool, traverseTool: TraverseTool, searchDocumentsTool: SearchDocumentsTool, searchCommunitiesTool: SearchCommunitiesTool, operatorTestActionTool: OperatorTestActionTool, contributed?: OperatorToolContribution[], entityWriteTools?: EntityWriteTools);
30
34
  build(ctx: OperatorRetrievalContext, recorder: ToolCallRecord[]): OperatorToolDefinition[];
31
35
  }
32
36
  //# sourceMappingURL=operator.tool.registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operator.tool.registry.d.ts","sourceRoot":"","sources":["../../../../src/agents/operator/tools/operator.tool.registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAe,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAEL,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;;GAOG;AACH,qBACa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OA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M,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;;;;GASG;AACH,qBACa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAIjE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAZjB,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,sBAAsB,EACV,WAAW,CAAC,EAAE,wBAAwB,EAAE,EAI5E,gBAAgB,CAAC,EAAE,gBAAgB;IAGtD,KAAK,CAAC,GAAG,EAAE,wBAAwB,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,sBAAsB,EAAE;CAmD3F"}
@@ -20,6 +20,7 @@ const resolve_entity_tool_1 = require("../../graph/tools/resolve-entity.tool");
20
20
  const search_entities_tool_1 = require("../../graph/tools/search-entities.tool");
21
21
  const traverse_tool_1 = require("../../graph/tools/traverse.tool");
22
22
  const operator_tool_interface_1 = require("../interfaces/operator.tool.interface");
23
+ const entity_write_tools_1 = require("./entity-write.tools");
23
24
  const operator_test_action_tool_1 = require("./operator-test-action.tool");
24
25
  const search_communities_tool_1 = require("./search-communities.tool");
25
26
  const search_documents_tool_1 = require("./search-documents.tool");
@@ -27,12 +28,18 @@ const search_documents_tool_1 = require("./search-documents.tool");
27
28
  * Composes the operator's tool set for a single turn:
28
29
  * - the five graph tools (read-only, built per request with ctx + recorder)
29
30
  * - the two retrieval tools (search_documents, search_communities)
31
+ * - the generic entity write tools, but only when a catalogued type the caller
32
+ * can reach declares `chat.writable` — otherwise none are built
30
33
  * - the test-only destructive tool (non-production environments only)
31
34
  * - any app-contributed factories registered under the OPERATOR_TOOLS token,
32
35
  * built per turn with the same ctx + recorder as the built-ins
33
36
  */
34
37
  let OperatorToolRegistry = class OperatorToolRegistry {
35
- constructor(resolveEntityTool, describeEntityTool, searchEntitiesTool, readEntityTool, traverseTool, searchDocumentsTool, searchCommunitiesTool, operatorTestActionTool, contributed) {
38
+ constructor(resolveEntityTool, describeEntityTool, searchEntitiesTool, readEntityTool, traverseTool, searchDocumentsTool, searchCommunitiesTool, operatorTestActionTool, contributed,
39
+ // Declared last, and optional in the type signature only, so the registry
40
+ // stays constructible without the write-tool provider. Nest resolves it from
41
+ // OperatorModule like every other built-in.
42
+ entityWriteTools) {
36
43
  this.resolveEntityTool = resolveEntityTool;
37
44
  this.describeEntityTool = describeEntityTool;
38
45
  this.searchEntitiesTool = searchEntitiesTool;
@@ -42,12 +49,17 @@ let OperatorToolRegistry = class OperatorToolRegistry {
42
49
  this.searchCommunitiesTool = searchCommunitiesTool;
43
50
  this.operatorTestActionTool = operatorTestActionTool;
44
51
  this.contributed = contributed;
52
+ this.entityWriteTools = entityWriteTools;
45
53
  }
46
54
  build(ctx, recorder) {
47
55
  const userCtx = {
48
56
  companyId: ctx.companyId,
49
57
  userId: ctx.userId,
50
58
  userModuleIds: ctx.userModuleIds,
59
+ // Carry the run's scope through to the graph tools, which is the only way
60
+ // their ScopeGuard checks can see which root this turn is confined to.
61
+ scopeId: ctx.scopeId,
62
+ scopeType: ctx.scopeType,
51
63
  };
52
64
  const definitions = [
53
65
  { tool: this.resolveEntityTool.build(userCtx, recorder), destructive: false },
@@ -58,6 +70,11 @@ let OperatorToolRegistry = class OperatorToolRegistry {
58
70
  { tool: this.searchDocumentsTool.build(ctx, recorder), destructive: false },
59
71
  { tool: this.searchCommunitiesTool.build(recorder), destructive: false },
60
72
  ];
73
+ // Generic write tools. buildDefinitions() returns [] unless a catalogued
74
+ // type the caller can reach is chat.writable, so hosts that opt none in keep
75
+ // exactly the read-only tool set they had before. Spliced in before the
76
+ // contributed spread so the duplicate-name guard below covers them too.
77
+ definitions.push(...(this.entityWriteTools?.buildDefinitions(ctx, recorder) ?? []));
61
78
  if (process.env.NODE_ENV !== "production") {
62
79
  definitions.push(this.operatorTestActionTool.buildDefinition(recorder));
63
80
  }
@@ -90,6 +107,6 @@ exports.OperatorToolRegistry = OperatorToolRegistry = __decorate([
90
107
  traverse_tool_1.TraverseTool,
91
108
  search_documents_tool_1.SearchDocumentsTool,
92
109
  search_communities_tool_1.SearchCommunitiesTool,
93
- operator_test_action_tool_1.OperatorTestActionTool, Array])
110
+ operator_test_action_tool_1.OperatorTestActionTool, Array, entity_write_tools_1.EntityWriteTools])
94
111
  ], OperatorToolRegistry);
95
112
  //# sourceMappingURL=operator.tool.registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operator.tool.registry.js","sourceRoot":"","sources":["../../../../src/agents/operator/tools/operator.tool.registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,iFAA4E;AAC5E,yEAAoE;AACpE,+EAA0E;AAC1E,iFAA4E;AAE5E,mEAA+D;AAC/D,mFAK+C;AAC/C,2EAAqE;AACrE,uEAAkE;AAClE,mEAA8D;AAE9D;;;;;;;GAOG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YACmB,iBAAoC,EACpC,kBAAsC,EACtC,kBAAsC,EACtC,cAA8B,EAC9B,YAA0B,EAC1B,mBAAwC,EACxC,qBAA4C,EAC5C,sBAA8C,EACV,WAAwC;QAR5E,sBAAiB,GAAjB,iBAA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;GATtD,oBAAoB,CAsDhC"}
1
+ {"version":3,"file":"operator.tool.registry.js","sourceRoot":"","sources":["../../../../src/agents/operator/tools/operator.tool.registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,iFAA4E;AAC5E,yEAAoE;AACpE,+EAA0E;AAC1E,iFAA4E;AAE5E,mEAA+D;AAC/D,mFAK+C;AAC/C,6DAAwD;AACxD,2EAAqE;AACrE,uEAAkE;AAClE,mEAA8D;AAE9D;;;;;;;;;GASG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YACmB,iBAAoC,EACpC,kBAAsC,EACtC,kBAAsC,EACtC,cAA8B,EAC9B,YAA0B,EAC1B,mBAAwC,EACxC,qBAA4C,EAC5C,sBAA8C,EACV,WAAwC;IAC7F,0EAA0E;IAC1E,6EAA6E;IAC7E,4CAA4C;IAC3B,gBAAmC;QAZnC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,2BAAsB,GAAtB,sBAAsB,CAAwB;QACV,gBAAW,GAAX,WAAW,CAA6B;QAI5E,qBAAgB,GAAhB,gBAAgB,CAAmB;IACnD,CAAC;IAEJ,KAAK,CAAC,GAA6B,EAAE,QAA0B;QAC7D,MAAM,OAAO,GAAgB;YAC3B,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,0EAA0E;YAC1E,uEAAuE;YACvE,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC;QAE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