@hashgraphonline/conversational-agent 0.2.213 → 0.2.214
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/esm/index10.js +2 -2
- package/dist/esm/index21.js +1 -1
- package/dist/esm/index23.js +1 -1
- package/dist/esm/index33.js +4 -4
- package/dist/esm/index42.js +4 -26
- package/dist/esm/index42.js.map +1 -1
- package/dist/esm/index43.js +11 -4
- package/dist/esm/index43.js.map +1 -1
- package/dist/esm/index44.js +322 -12
- package/dist/esm/index44.js.map +1 -1
- package/dist/esm/index45.js +142 -280
- package/dist/esm/index45.js.map +1 -1
- package/dist/esm/index46.js +7 -184
- package/dist/esm/index46.js.map +1 -1
- package/dist/esm/index47.js +26 -6
- package/dist/esm/index47.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index10.js
CHANGED
|
@@ -3,8 +3,8 @@ import { extractRenderConfigs, generateFieldOrdering } from "@hashgraphonline/st
|
|
|
3
3
|
import { Logger } from "@hashgraphonline/standards-sdk";
|
|
4
4
|
import { fieldTypeRegistry } from "./index12.js";
|
|
5
5
|
import { fieldGuidanceRegistry } from "./index13.js";
|
|
6
|
-
import "./
|
|
7
|
-
import { FIELD_PRIORITIES } from "./
|
|
6
|
+
import "./index43.js";
|
|
7
|
+
import { FIELD_PRIORITIES } from "./index46.js";
|
|
8
8
|
function isZodObjectSchema(schema) {
|
|
9
9
|
return typeof schema === "object" && schema !== null && "shape" in schema;
|
|
10
10
|
}
|
package/dist/esm/index21.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReferenceIdGenerator } from "./index22.js";
|
|
2
|
-
import { DEFAULT_CONTENT_REFERENCE_CONFIG, ContentReferenceError } from "./
|
|
2
|
+
import { DEFAULT_CONTENT_REFERENCE_CONFIG, ContentReferenceError } from "./index47.js";
|
|
3
3
|
const _ContentStorage = class _ContentStorage {
|
|
4
4
|
constructor(maxStorage = _ContentStorage.DEFAULT_MAX_STORAGE, referenceConfig) {
|
|
5
5
|
this.messages = [];
|
package/dist/esm/index23.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChatOpenAI } from "@langchain/openai";
|
|
2
2
|
import { Logger } from "@hashgraphonline/standards-sdk";
|
|
3
|
-
import { ENTITY_PATTERNS } from "./
|
|
3
|
+
import { ENTITY_PATTERNS } from "./index43.js";
|
|
4
4
|
import "hedera-agent-kit";
|
|
5
5
|
import "@hashgraphonline/standards-agent-kit";
|
|
6
6
|
import "./index13.js";
|
package/dist/esm/index33.js
CHANGED
|
@@ -8,11 +8,11 @@ import { MCPClientManager } from "./index15.js";
|
|
|
8
8
|
import { convertMCPToolToLangChain } from "./index17.js";
|
|
9
9
|
import { SmartMemoryManager } from "./index18.js";
|
|
10
10
|
import { ResponseFormatter } from "./index35.js";
|
|
11
|
-
import { ERROR_MESSAGES } from "./
|
|
12
|
-
import "./
|
|
11
|
+
import { ERROR_MESSAGES } from "./index42.js";
|
|
12
|
+
import "./index43.js";
|
|
13
13
|
import { SystemMessage, AIMessage, HumanMessage } from "@langchain/core/messages";
|
|
14
|
-
import { ToolRegistry } from "./
|
|
15
|
-
import { ExecutionPipeline } from "./
|
|
14
|
+
import { ToolRegistry } from "./index44.js";
|
|
15
|
+
import { ExecutionPipeline } from "./index45.js";
|
|
16
16
|
import { FormEngine } from "./index11.js";
|
|
17
17
|
function hasHashLinkBlock(metadata) {
|
|
18
18
|
if (!metadata || typeof metadata !== "object") {
|
package/dist/esm/index42.js
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
maxReferences: 100,
|
|
5
|
-
maxTotalStorageBytes: 100 * 1024 * 1024,
|
|
6
|
-
enableAutoCleanup: true,
|
|
7
|
-
cleanupIntervalMs: 5 * 60 * 1e3,
|
|
8
|
-
enablePersistence: false,
|
|
9
|
-
storageBackend: "memory",
|
|
10
|
-
cleanupPolicies: {
|
|
11
|
-
recent: { maxAgeMs: 30 * 60 * 1e3, priority: 1 },
|
|
12
|
-
userContent: { maxAgeMs: 2 * 60 * 60 * 1e3, priority: 2 },
|
|
13
|
-
agentGenerated: { maxAgeMs: 60 * 60 * 1e3, priority: 3 },
|
|
14
|
-
default: { maxAgeMs: 60 * 60 * 1e3, priority: 4 }
|
|
15
|
-
}
|
|
1
|
+
const ERROR_MESSAGES = {
|
|
2
|
+
TOO_MANY_REQUESTS: "Too many requests. Please wait a moment and try again.",
|
|
3
|
+
RATE_LIMITED: "I'm receiving too many requests right now. Please wait a moment and try again."
|
|
16
4
|
};
|
|
17
|
-
class ContentReferenceError extends Error {
|
|
18
|
-
constructor(message, type, referenceId, suggestedActions) {
|
|
19
|
-
super(message);
|
|
20
|
-
this.type = type;
|
|
21
|
-
this.referenceId = referenceId;
|
|
22
|
-
this.suggestedActions = suggestedActions;
|
|
23
|
-
this.name = "ContentReferenceError";
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
5
|
export {
|
|
27
|
-
|
|
28
|
-
DEFAULT_CONTENT_REFERENCE_CONFIG
|
|
6
|
+
ERROR_MESSAGES
|
|
29
7
|
};
|
|
30
8
|
//# sourceMappingURL=index42.js.map
|
package/dist/esm/index42.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index42.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index42.js","sources":["../../src/constants/messages.ts"],"sourcesContent":["/**\n * Common error messages and user feedback strings\n */\nexport const ERROR_MESSAGES = {\n TOO_MANY_REQUESTS: 'Too many requests. Please wait a moment and try again.',\n RATE_LIMITED: \"I'm receiving too many requests right now. Please wait a moment and try again.\",\n SYSTEM_ERROR: 'System error occurred',\n INVALID_INPUT: 'Invalid input provided',\n NETWORK_ERROR: 'Network error occurred',\n} as const;\n\n/**\n * Common success and status messages\n */\nexport const STATUS_MESSAGES = {\n OPERATION_SUCCESSFUL: 'Operation completed successfully',\n PROCESSING: 'Processing your request...',\n READY: 'Ready to process requests',\n INITIALIZING: 'Initializing...',\n} as const;"],"names":[],"mappings":"AAGO,MAAM,iBAAiB;AAAA,EAC5B,mBAAmB;AAAA,EACnB,cAAc;AAIhB;"}
|
package/dist/esm/index43.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { EntityFormat } from "./index26.js";
|
|
2
|
+
const ENTITY_PATTERNS = {
|
|
3
|
+
TOPIC_REFERENCE: "the topic",
|
|
4
|
+
TOKEN_REFERENCE: "the token"
|
|
4
5
|
};
|
|
6
|
+
({
|
|
7
|
+
TOPIC: EntityFormat.TOPIC_ID,
|
|
8
|
+
TOKEN: EntityFormat.TOKEN_ID,
|
|
9
|
+
ACCOUNT: EntityFormat.ACCOUNT_ID,
|
|
10
|
+
CONTRACT: EntityFormat.CONTRACT_ID
|
|
11
|
+
});
|
|
5
12
|
export {
|
|
6
|
-
|
|
13
|
+
ENTITY_PATTERNS
|
|
7
14
|
};
|
|
8
15
|
//# sourceMappingURL=index43.js.map
|
package/dist/esm/index43.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index43.js","sources":["../../src/constants/
|
|
1
|
+
{"version":3,"file":"index43.js","sources":["../../src/constants/entity-references.ts"],"sourcesContent":["/**\n * Common entity reference patterns used across the application\n */\nexport const ENTITY_PATTERNS = {\n TOPIC_REFERENCE: 'the topic',\n TOKEN_REFERENCE: 'the token',\n ACCOUNT_REFERENCE: 'the account',\n TRANSACTION_REFERENCE: 'the transaction',\n CONTRACT_REFERENCE: 'the contract',\n} as const;\n\n/**\n * Entity type identifiers\n */\nimport { EntityFormat } from '../services/formatters/types';\n\nexport const ENTITY_TYPES = {\n TOPIC: EntityFormat.TOPIC_ID,\n TOKEN: EntityFormat.TOKEN_ID,\n ACCOUNT: EntityFormat.ACCOUNT_ID,\n TRANSACTION: 'transaction',\n CONTRACT: EntityFormat.CONTRACT_ID,\n} as const;\n"],"names":[],"mappings":";AAGO,MAAM,kBAAkB;AAAA,EAC7B,iBAAiB;AAAA,EACjB,iBAAiB;AAInB;AAAA,CAO4B;AAAA,EAC1B,OAAO,aAAa;AAAA,EACpB,OAAO,aAAa;AAAA,EACpB,SAAS,aAAa;AAAA,EAEtB,UAAU,aAAa;AACzB;"}
|
package/dist/esm/index44.js
CHANGED
|
@@ -1,15 +1,325 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Logger } from "@hashgraphonline/standards-sdk";
|
|
3
|
+
import { wrapToolWithFormValidation } from "./index32.js";
|
|
4
|
+
import { FormGenerator } from "./index10.js";
|
|
5
|
+
import { fieldGuidanceRegistry } from "./index13.js";
|
|
6
|
+
import { isFormValidatable } from "@hashgraphonline/standards-agent-kit";
|
|
7
|
+
class ToolRegistry {
|
|
8
|
+
constructor(logger) {
|
|
9
|
+
this.tools = /* @__PURE__ */ new Map();
|
|
10
|
+
this.formGenerator = new FormGenerator();
|
|
11
|
+
this.logger = logger || new Logger({ module: "ToolRegistry" });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Register a tool with the registry
|
|
15
|
+
*/
|
|
16
|
+
registerTool(tool, options = {}) {
|
|
17
|
+
const capabilities = this.analyzeToolCapabilities(tool);
|
|
18
|
+
const metadata = {
|
|
19
|
+
name: tool.name,
|
|
20
|
+
version: "1.0.0",
|
|
21
|
+
category: options.metadata?.category || "core",
|
|
22
|
+
description: tool.description,
|
|
23
|
+
capabilities,
|
|
24
|
+
dependencies: [],
|
|
25
|
+
schema: tool.schema,
|
|
26
|
+
...options.metadata
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
if (!metadata.entityResolutionPreferences) {
|
|
30
|
+
const schemaRecord = tool.schema;
|
|
31
|
+
const rawPrefs = schemaRecord && typeof schemaRecord === "object" && schemaRecord["_entityResolutionPreferences"];
|
|
32
|
+
if (rawPrefs && typeof rawPrefs === "object") {
|
|
33
|
+
metadata.entityResolutionPreferences = rawPrefs;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const schemaRecord = tool.schema;
|
|
40
|
+
const schemaDef = schemaRecord && schemaRecord._def;
|
|
41
|
+
if (schemaDef?.typeName === "ZodObject") {
|
|
42
|
+
const shape = typeof schemaDef.shape === "function" ? schemaDef.shape?.() || {} : schemaDef.shape || {};
|
|
43
|
+
const metadataField = shape["metadata"];
|
|
44
|
+
const isStringArray = !!metadataField && metadataField._def?.typeName === "ZodArray" && metadataField._def?.type?._def?.typeName === "ZodString";
|
|
45
|
+
if (isStringArray && typeof tool.description === "string") {
|
|
46
|
+
if (!metadata.entityResolutionPreferences) {
|
|
47
|
+
metadata.entityResolutionPreferences = {
|
|
48
|
+
inscription: "hrl"
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const note = " NOTE: When referencing inscriptions or media, provide canonical Hashlink Resource Locators (e.g., hcs://<standard>/<topicId>) rather than external URLs or embedded JSON.";
|
|
52
|
+
if (!tool.description.includes("Hashlink Resource Locators")) {
|
|
53
|
+
tool.description = `${tool.description}${note}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
let finalTool = tool;
|
|
60
|
+
let wrapper;
|
|
61
|
+
if (this.shouldWrapTool(tool, capabilities, options)) {
|
|
62
|
+
wrapper = wrapToolWithFormValidation(
|
|
63
|
+
tool,
|
|
64
|
+
this.formGenerator,
|
|
65
|
+
{
|
|
66
|
+
requireAllFields: false,
|
|
67
|
+
skipFields: ["metaOptions"],
|
|
68
|
+
...options.wrapperConfig
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
finalTool = wrapper;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
if (metadata.entityResolutionPreferences) {
|
|
75
|
+
finalTool["entityResolutionPreferences"] = metadata.entityResolutionPreferences;
|
|
76
|
+
}
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
const entry = {
|
|
80
|
+
tool: finalTool,
|
|
81
|
+
metadata,
|
|
82
|
+
wrapper,
|
|
83
|
+
originalTool: tool,
|
|
84
|
+
options: {
|
|
85
|
+
priority: capabilities.priority,
|
|
86
|
+
capability: "basic",
|
|
87
|
+
// Default capability
|
|
88
|
+
enabled: true,
|
|
89
|
+
// All tools are enabled by default
|
|
90
|
+
namespace: metadata.category
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
this.tools.set(tool.name, entry);
|
|
94
|
+
try {
|
|
95
|
+
const metaFG = metadata.fieldGuidance;
|
|
96
|
+
if (metaFG) {
|
|
97
|
+
fieldGuidanceRegistry.registerToolConfiguration(metaFG);
|
|
98
|
+
}
|
|
99
|
+
const provider = metadata.fieldGuidanceProvider;
|
|
100
|
+
if (provider) {
|
|
101
|
+
const pattern = metaFG?.toolPattern ?? tool.name;
|
|
102
|
+
fieldGuidanceRegistry.registerToolProvider(pattern, provider, {
|
|
103
|
+
id: `${tool.name}:field-guidance-provider`,
|
|
104
|
+
priority: 0
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get a tool by name
|
|
112
|
+
*/
|
|
113
|
+
getTool(name) {
|
|
114
|
+
return this.tools.get(name) || null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get tools by capability
|
|
118
|
+
*/
|
|
119
|
+
getToolsByCapability(capability, value) {
|
|
120
|
+
const results = [];
|
|
121
|
+
for (const entry of this.tools.values()) {
|
|
122
|
+
if (value !== void 0) {
|
|
123
|
+
if (entry.metadata.capabilities[capability] === value) {
|
|
124
|
+
results.push(entry);
|
|
125
|
+
}
|
|
126
|
+
} else if (entry.metadata.capabilities[capability]) {
|
|
127
|
+
results.push(entry);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return results;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get tools by query
|
|
134
|
+
*/
|
|
135
|
+
getToolsByQuery(query) {
|
|
136
|
+
const results = [];
|
|
137
|
+
for (const entry of this.tools.values()) {
|
|
138
|
+
let matches = true;
|
|
139
|
+
if (query.name && entry.metadata.name !== query.name) {
|
|
140
|
+
matches = false;
|
|
141
|
+
}
|
|
142
|
+
if (query.category && entry.metadata.category !== query.category) {
|
|
143
|
+
matches = false;
|
|
144
|
+
}
|
|
145
|
+
if (query.capabilities) {
|
|
146
|
+
for (const [key, value] of Object.entries(query.capabilities)) {
|
|
147
|
+
if (entry.metadata.capabilities[key] !== value) {
|
|
148
|
+
matches = false;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (matches) {
|
|
154
|
+
results.push(entry);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return results;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get all registered tools
|
|
161
|
+
*/
|
|
162
|
+
getAllTools() {
|
|
163
|
+
return Array.from(this.tools.values()).map((entry) => entry.tool);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get all registry entries
|
|
167
|
+
*/
|
|
168
|
+
getAllRegistryEntries() {
|
|
169
|
+
return Array.from(this.tools.values());
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get all tool names
|
|
173
|
+
*/
|
|
174
|
+
getToolNames() {
|
|
175
|
+
return Array.from(this.tools.keys());
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get tools by priority
|
|
179
|
+
*/
|
|
180
|
+
getToolsByPriority(priority) {
|
|
181
|
+
return this.getToolsByCapability("priority", priority);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get enabled tools (all tools are considered enabled by default)
|
|
185
|
+
*/
|
|
186
|
+
getEnabledTools() {
|
|
187
|
+
return this.getAllRegistryEntries();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get tools by namespace/category
|
|
191
|
+
*/
|
|
192
|
+
getToolsByNamespace(namespace) {
|
|
193
|
+
if (!namespace) {
|
|
194
|
+
return this.getAllRegistryEntries();
|
|
195
|
+
}
|
|
196
|
+
return this.getToolsByQuery({ category: namespace });
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Check if registry has capability
|
|
200
|
+
*/
|
|
201
|
+
hasCapability(capability) {
|
|
202
|
+
for (const entry of this.tools.values()) {
|
|
203
|
+
if (entry.metadata.capabilities[capability]) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Update tool options (metadata)
|
|
211
|
+
*/
|
|
212
|
+
updateToolOptions(name, options) {
|
|
213
|
+
const entry = this.tools.get(name);
|
|
214
|
+
if (!entry) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
entry.metadata = { ...entry.metadata, ...options };
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Check if a tool is registered
|
|
222
|
+
*/
|
|
223
|
+
hasTool(name) {
|
|
224
|
+
return this.tools.has(name);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Unregister a tool
|
|
228
|
+
*/
|
|
229
|
+
unregisterTool(name) {
|
|
230
|
+
return this.tools.delete(name);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Clear all tools
|
|
234
|
+
*/
|
|
235
|
+
clear() {
|
|
236
|
+
this.tools.clear();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Analyze tool capabilities
|
|
240
|
+
*/
|
|
241
|
+
analyzeToolCapabilities(tool) {
|
|
242
|
+
const implementsFormValidatable = isFormValidatable(tool);
|
|
243
|
+
const hasRenderConfig = this.hasRenderConfig(tool);
|
|
244
|
+
const isZodObjectLike = this.isZodObjectLike(tool.schema);
|
|
245
|
+
const supportsFormValidation = implementsFormValidatable || hasRenderConfig;
|
|
246
|
+
const requiresWrapper = supportsFormValidation && isZodObjectLike;
|
|
247
|
+
let priority = "medium";
|
|
248
|
+
let category = "core";
|
|
249
|
+
if (supportsFormValidation && requiresWrapper) {
|
|
250
|
+
priority = "critical";
|
|
251
|
+
} else if (supportsFormValidation) {
|
|
252
|
+
priority = "high";
|
|
253
|
+
} else if (tool.description?.toLowerCase().includes("query") || tool.description?.toLowerCase().includes("search")) {
|
|
254
|
+
priority = "low";
|
|
255
|
+
}
|
|
256
|
+
const toolAsAny = tool;
|
|
257
|
+
if (tool.constructor.name.includes("MCP") || toolAsAny.isMCPTool) {
|
|
258
|
+
category = "mcp";
|
|
259
|
+
} else if (toolAsAny.isExtension || tool.constructor.name.includes("Extension")) {
|
|
260
|
+
category = "extension";
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
supportsFormValidation,
|
|
264
|
+
requiresWrapper,
|
|
265
|
+
priority,
|
|
266
|
+
category
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Check if tool has render configuration
|
|
271
|
+
*/
|
|
272
|
+
hasRenderConfig(tool) {
|
|
273
|
+
const schema = tool.schema;
|
|
274
|
+
return !!(schema && schema._renderConfig);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Determine if tool should be wrapped
|
|
278
|
+
*/
|
|
279
|
+
shouldWrapTool(tool, capabilities, options) {
|
|
280
|
+
if (options.skipWrapper) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
if (options.forceWrapper) {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
return capabilities.requiresWrapper;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Check if schema is ZodObject-like
|
|
290
|
+
*/
|
|
291
|
+
isZodObjectLike(schema) {
|
|
292
|
+
if (!schema || typeof schema !== "object") {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
const schemaRecord = schema;
|
|
296
|
+
const schemaDef = schemaRecord._def;
|
|
297
|
+
return schema instanceof z.ZodObject || schemaDef?.typeName === "ZodObject" || "shape" in schemaRecord && typeof schemaRecord.shape === "object";
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get statistics about the registry
|
|
301
|
+
*/
|
|
302
|
+
getStatistics() {
|
|
303
|
+
const stats = {
|
|
304
|
+
totalTools: this.tools.size,
|
|
305
|
+
wrappedTools: 0,
|
|
306
|
+
unwrappedTools: 0,
|
|
307
|
+
categoryCounts: { core: 0, extension: 0, mcp: 0 },
|
|
308
|
+
priorityCounts: { low: 0, medium: 0, high: 0, critical: 0 }
|
|
309
|
+
};
|
|
310
|
+
for (const entry of this.tools.values()) {
|
|
311
|
+
if (entry.wrapper) {
|
|
312
|
+
stats.wrappedTools++;
|
|
313
|
+
} else {
|
|
314
|
+
stats.unwrappedTools++;
|
|
315
|
+
}
|
|
316
|
+
stats.categoryCounts[entry.metadata.category]++;
|
|
317
|
+
stats.priorityCounts[entry.metadata.capabilities.priority]++;
|
|
318
|
+
}
|
|
319
|
+
return stats;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
12
322
|
export {
|
|
13
|
-
|
|
323
|
+
ToolRegistry
|
|
14
324
|
};
|
|
15
325
|
//# sourceMappingURL=index44.js.map
|
package/dist/esm/index44.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index44.js","sources":["../../src/constants/entity-references.ts"],"sourcesContent":["/**\n * Common entity reference patterns used across the application\n */\nexport const ENTITY_PATTERNS = {\n TOPIC_REFERENCE: 'the topic',\n TOKEN_REFERENCE: 'the token',\n ACCOUNT_REFERENCE: 'the account',\n TRANSACTION_REFERENCE: 'the transaction',\n CONTRACT_REFERENCE: 'the contract',\n} as const;\n\n/**\n * Entity type identifiers\n */\nimport { EntityFormat } from '../services/formatters/types';\n\nexport const ENTITY_TYPES = {\n TOPIC: EntityFormat.TOPIC_ID,\n TOKEN: EntityFormat.TOKEN_ID,\n ACCOUNT: EntityFormat.ACCOUNT_ID,\n TRANSACTION: 'transaction',\n CONTRACT: EntityFormat.CONTRACT_ID,\n} as const;\n"],"names":[],"mappings":";AAGO,MAAM,kBAAkB;AAAA,EAC7B,iBAAiB;AAAA,EACjB,iBAAiB;AAInB;AAAA,CAO4B;AAAA,EAC1B,OAAO,aAAa;AAAA,EACpB,OAAO,aAAa;AAAA,EACpB,SAAS,aAAa;AAAA,EAEtB,UAAU,aAAa;AACzB;"}
|
|
1
|
+
{"version":3,"file":"index44.js","sources":["../../src/core/tool-registry.ts"],"sourcesContent":["import { StructuredTool } from '@langchain/core/tools';\nimport { z } from 'zod';\nimport { Logger } from '@hashgraphonline/standards-sdk';\nimport {\n FormValidatingToolWrapper,\n wrapToolWithFormValidation,\n} from '../langchain/form-validating-tool-wrapper';\nimport { FormGenerator } from '../forms/form-generator';\nimport {\n fieldGuidanceRegistry,\n} from '../forms/field-guidance-registry';\nimport type {\n ToolFieldConfiguration as FG_ToolFieldConfiguration,\n FieldGuidanceProvider as FG_FieldGuidanceProvider,\n} from '../forms/field-guidance-registry';\nimport { isFormValidatable } from '@hashgraphonline/standards-agent-kit';\n\n/**\n * Tool capabilities configuration for registry entries\n */\nexport interface ToolCapabilities {\n supportsFormValidation: boolean;\n requiresWrapper: boolean;\n priority: 'low' | 'medium' | 'high' | 'critical';\n category: 'core' | 'extension' | 'mcp';\n}\n\n/**\n * Entity resolution format preferences for tools\n */\nexport interface EntityResolutionPreferences {\n inscription?: 'hrl' | 'topicId' | 'metadata' | 'any';\n token?: 'tokenId' | 'address' | 'symbol' | 'any';\n nft?: 'serialNumber' | 'metadata' | 'hrl' | 'any';\n account?: 'accountId' | 'alias' | 'evmAddress' | 'any';\n}\n\n/**\n * Tool metadata for comprehensive tool information\n */\nexport interface ToolMetadata {\n name: string;\n version: string;\n category: ToolCapabilities['category'];\n description: string;\n capabilities: ToolCapabilities;\n dependencies: string[];\n schema: unknown;\n entityResolutionPreferences?: EntityResolutionPreferences;\n fieldGuidance?: FG_ToolFieldConfiguration;\n fieldGuidanceProvider?: FG_FieldGuidanceProvider;\n}\n\n/**\n * Registry entry containing tool instance and metadata\n */\nexport interface ToolRegistryEntry {\n tool: StructuredTool;\n metadata: ToolMetadata;\n wrapper?: FormValidatingToolWrapper<z.ZodObject<z.ZodRawShape>> | undefined;\n originalTool: StructuredTool;\n options?: {\n priority?: ToolCapabilities['priority'];\n capability?: string;\n enabled?: boolean;\n namespace?: string;\n };\n}\n\n/**\n * Options for tool registration\n */\nexport interface ToolRegistrationOptions {\n forceWrapper?: boolean;\n skipWrapper?: boolean;\n wrapperConfig?: {\n requireAllFields?: boolean;\n skipFields?: string[];\n };\n metadata?: Partial<ToolMetadata>;\n}\n\n/**\n * Query interface for finding tools\n */\nexport interface ToolQuery {\n name?: string;\n category?: ToolMetadata['category'];\n capabilities?: Partial<ToolCapabilities>;\n}\n\n/**\n * Centralized tool registry for managing tool lifecycle\n */\nexport class ToolRegistry {\n private tools = new Map<string, ToolRegistryEntry>();\n private formGenerator: FormGenerator;\n private logger: Logger;\n\n constructor(logger?: Logger) {\n this.formGenerator = new FormGenerator();\n this.logger = logger || new Logger({ module: 'ToolRegistry' });\n }\n\n /**\n * Register a tool with the registry\n */\n registerTool(\n tool: StructuredTool,\n options: ToolRegistrationOptions = {}\n ): void {\n const capabilities = this.analyzeToolCapabilities(tool);\n const metadata: ToolMetadata = {\n name: tool.name,\n version: '1.0.0',\n category: options.metadata?.category || 'core',\n description: tool.description,\n capabilities,\n dependencies: [],\n schema: tool.schema,\n ...options.metadata,\n };\n\n try {\n if (!metadata.entityResolutionPreferences) {\n const schemaRecord = tool.schema as unknown as Record<string, unknown>;\n const rawPrefs =\n schemaRecord &&\n typeof schemaRecord === 'object' &&\n (schemaRecord as Record<string, unknown>)[\n '_entityResolutionPreferences'\n ];\n if (rawPrefs && typeof rawPrefs === 'object') {\n metadata.entityResolutionPreferences = rawPrefs as unknown as EntityResolutionPreferences;\n }\n }\n } catch {\n }\n\n try {\n const schemaRecord = tool.schema as unknown as Record<string, unknown>;\n const schemaDef = (schemaRecord && (schemaRecord as Record<string, unknown>)._def) as\n | { typeName?: string; shape?: unknown }\n | undefined;\n if (schemaDef?.typeName === 'ZodObject') {\n const shape: Record<string, unknown> =\n typeof (schemaDef as { shape?: () => Record<string, unknown> }).shape === 'function'\n ? ((schemaDef as { shape: () => Record<string, unknown> }).shape?.() || {})\n : ((schemaDef as { shape?: Record<string, unknown> }).shape || {});\n\n const metadataField = shape['metadata'] as\n | { _def?: { typeName?: string; type?: { _def?: { typeName?: string } } } }\n | undefined;\n const isStringArray =\n !!metadataField &&\n metadataField._def?.typeName === 'ZodArray' &&\n metadataField._def?.type?._def?.typeName === 'ZodString';\n\n if (isStringArray && typeof tool.description === 'string') {\n if (!metadata.entityResolutionPreferences) {\n metadata.entityResolutionPreferences = {\n inscription: 'hrl',\n } as EntityResolutionPreferences;\n }\n const note =\n ' NOTE: When referencing inscriptions or media, provide canonical Hashlink Resource Locators (e.g., hcs://<standard>/<topicId>) rather than external URLs or embedded JSON.';\n if (!tool.description.includes('Hashlink Resource Locators')) {\n (tool as unknown as { description: string }).description = `${tool.description}${note}`;\n }\n }\n }\n } catch {}\n\n let finalTool: StructuredTool = tool;\n let wrapper:\n | FormValidatingToolWrapper<z.ZodObject<z.ZodRawShape>>\n | undefined;\n\n if (this.shouldWrapTool(tool, capabilities, options)) {\n wrapper = wrapToolWithFormValidation(\n tool as StructuredTool<z.ZodObject<z.ZodRawShape>>,\n this.formGenerator,\n {\n requireAllFields: false,\n skipFields: ['metaOptions'],\n ...options.wrapperConfig,\n }\n ) as FormValidatingToolWrapper<z.ZodObject<z.ZodRawShape>>;\n finalTool = wrapper as StructuredTool;\n }\n\n try {\n if (metadata.entityResolutionPreferences) {\n (finalTool as unknown as Record<string, unknown>)[\n 'entityResolutionPreferences'\n ] = metadata.entityResolutionPreferences;\n }\n } catch {\n }\n\n const entry: ToolRegistryEntry = {\n tool: finalTool,\n metadata,\n wrapper,\n originalTool: tool,\n options: {\n priority: capabilities.priority,\n capability: 'basic', // Default capability\n enabled: true, // All tools are enabled by default\n namespace: metadata.category,\n },\n };\n\n this.tools.set(tool.name, entry);\n\n try {\n const metaFG = metadata.fieldGuidance as FG_ToolFieldConfiguration | undefined;\n if (metaFG) {\n fieldGuidanceRegistry.registerToolConfiguration(metaFG);\n }\n const provider = metadata.fieldGuidanceProvider as FG_FieldGuidanceProvider | undefined;\n if (provider) {\n const pattern = metaFG?.toolPattern ?? tool.name;\n fieldGuidanceRegistry.registerToolProvider(pattern, provider, {\n id: `${tool.name}:field-guidance-provider`,\n priority: 0,\n });\n }\n } catch {}\n }\n\n /**\n * Get a tool by name\n */\n getTool(name: string): ToolRegistryEntry | null {\n return this.tools.get(name) || null;\n }\n\n /**\n * Get tools by capability\n */\n getToolsByCapability(\n capability: keyof ToolCapabilities,\n value?: unknown\n ): ToolRegistryEntry[] {\n const results: ToolRegistryEntry[] = [];\n\n for (const entry of this.tools.values()) {\n if (value !== undefined) {\n if (entry.metadata.capabilities[capability] === value) {\n results.push(entry);\n }\n } else if (entry.metadata.capabilities[capability]) {\n results.push(entry);\n }\n }\n\n return results;\n }\n\n /**\n * Get tools by query\n */\n getToolsByQuery(query: ToolQuery): ToolRegistryEntry[] {\n const results: ToolRegistryEntry[] = [];\n\n for (const entry of this.tools.values()) {\n let matches = true;\n\n if (query.name && entry.metadata.name !== query.name) {\n matches = false;\n }\n\n if (query.category && entry.metadata.category !== query.category) {\n matches = false;\n }\n\n if (query.capabilities) {\n for (const [key, value] of Object.entries(query.capabilities)) {\n if (\n entry.metadata.capabilities[key as keyof ToolCapabilities] !== value\n ) {\n matches = false;\n break;\n }\n }\n }\n\n if (matches) {\n results.push(entry);\n }\n }\n\n return results;\n }\n\n /**\n * Get all registered tools\n */\n getAllTools(): StructuredTool[] {\n return Array.from(this.tools.values()).map((entry) => entry.tool);\n }\n\n /**\n * Get all registry entries\n */\n getAllRegistryEntries(): ToolRegistryEntry[] {\n return Array.from(this.tools.values());\n }\n\n /**\n * Get all tool names\n */\n getToolNames(): string[] {\n return Array.from(this.tools.keys());\n }\n\n /**\n * Get tools by priority\n */\n getToolsByPriority(priority: ToolCapabilities['priority']): ToolRegistryEntry[] {\n return this.getToolsByCapability('priority', priority);\n }\n\n /**\n * Get enabled tools (all tools are considered enabled by default)\n */\n getEnabledTools(): ToolRegistryEntry[] {\n return this.getAllRegistryEntries();\n }\n\n /**\n * Get tools by namespace/category\n */\n getToolsByNamespace(namespace?: string): ToolRegistryEntry[] {\n if (!namespace) {\n return this.getAllRegistryEntries();\n }\n return this.getToolsByQuery({ category: namespace as ToolMetadata['category'] });\n }\n\n /**\n * Check if registry has capability\n */\n hasCapability(capability: keyof ToolCapabilities): boolean {\n for (const entry of this.tools.values()) {\n if (entry.metadata.capabilities[capability]) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Update tool options (metadata)\n */\n updateToolOptions(name: string, options: Partial<ToolMetadata>): boolean {\n const entry = this.tools.get(name);\n if (!entry) {\n return false;\n }\n\n entry.metadata = { ...entry.metadata, ...options };\n return true;\n }\n\n /**\n * Check if a tool is registered\n */\n hasTool(name: string): boolean {\n return this.tools.has(name);\n }\n\n /**\n * Unregister a tool\n */\n unregisterTool(name: string): boolean {\n return this.tools.delete(name);\n }\n\n /**\n * Clear all tools\n */\n clear(): void {\n this.tools.clear();\n }\n\n /**\n * Analyze tool capabilities\n */\n private analyzeToolCapabilities(tool: StructuredTool): ToolCapabilities {\n const implementsFormValidatable = isFormValidatable(tool);\n const hasRenderConfig = this.hasRenderConfig(tool);\n const isZodObjectLike = this.isZodObjectLike(tool.schema);\n\n const supportsFormValidation = implementsFormValidatable || hasRenderConfig;\n const requiresWrapper = supportsFormValidation && isZodObjectLike;\n\n let priority: ToolCapabilities['priority'] = 'medium';\n let category: ToolCapabilities['category'] = 'core';\n\n if (supportsFormValidation && requiresWrapper) {\n priority = 'critical';\n } else if (supportsFormValidation) {\n priority = 'high';\n } else if (\n tool.description?.toLowerCase().includes('query') ||\n tool.description?.toLowerCase().includes('search')\n ) {\n priority = 'low';\n }\n\n const toolAsAny = tool as unknown as Record<string, unknown>;\n if (tool.constructor.name.includes('MCP') || toolAsAny.isMCPTool) {\n category = 'mcp';\n } else if (\n toolAsAny.isExtension ||\n tool.constructor.name.includes('Extension')\n ) {\n category = 'extension';\n }\n\n return {\n supportsFormValidation,\n requiresWrapper,\n priority,\n category,\n };\n }\n\n /**\n * Check if tool has render configuration\n */\n private hasRenderConfig(tool: StructuredTool): boolean {\n const schema = tool.schema as Record<string, unknown>;\n return !!(schema && schema._renderConfig);\n }\n\n /**\n * Determine if tool should be wrapped\n */\n private shouldWrapTool(\n tool: StructuredTool,\n capabilities: ToolCapabilities,\n options: ToolRegistrationOptions\n ): boolean {\n if (options.skipWrapper) {\n return false;\n }\n\n if (options.forceWrapper) {\n return true;\n }\n\n return capabilities.requiresWrapper;\n }\n\n /**\n * Check if schema is ZodObject-like\n */\n private isZodObjectLike(schema: unknown): boolean {\n if (!schema || typeof schema !== 'object') {\n return false;\n }\n\n const schemaRecord = schema as Record<string, unknown>;\n const schemaDef = schemaRecord._def as Record<string, unknown> | undefined;\n\n return (\n schema instanceof z.ZodObject ||\n schemaDef?.typeName === 'ZodObject' ||\n ('shape' in schemaRecord && typeof schemaRecord.shape === 'object')\n );\n }\n\n /**\n * Get statistics about the registry\n */\n getStatistics(): {\n totalTools: number;\n wrappedTools: number;\n unwrappedTools: number;\n categoryCounts: Record<ToolCapabilities['category'], number>;\n priorityCounts: Record<ToolCapabilities['priority'], number>;\n } {\n const stats = {\n totalTools: this.tools.size,\n wrappedTools: 0,\n unwrappedTools: 0,\n categoryCounts: { core: 0, extension: 0, mcp: 0 } as Record<\n ToolCapabilities['category'],\n number\n >,\n priorityCounts: { low: 0, medium: 0, high: 0, critical: 0 } as Record<\n ToolCapabilities['priority'],\n number\n >,\n };\n\n for (const entry of this.tools.values()) {\n if (entry.wrapper) {\n stats.wrappedTools++;\n } else {\n stats.unwrappedTools++;\n }\n\n stats.categoryCounts[entry.metadata.category]++;\n stats.priorityCounts[entry.metadata.capabilities.priority]++;\n }\n\n return stats;\n }\n}\n"],"names":[],"mappings":";;;;;;AA8FO,MAAM,aAAa;AAAA,EAKxB,YAAY,QAAiB;AAJ7B,SAAQ,4BAAY,IAAA;AAKlB,SAAK,gBAAgB,IAAI,cAAA;AACzB,SAAK,SAAS,UAAU,IAAI,OAAO,EAAE,QAAQ,gBAAgB;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA,EAKA,aACE,MACA,UAAmC,IAC7B;AACN,UAAM,eAAe,KAAK,wBAAwB,IAAI;AACtD,UAAM,WAAyB;AAAA,MAC7B,MAAM,KAAK;AAAA,MACX,SAAS;AAAA,MACT,UAAU,QAAQ,UAAU,YAAY;AAAA,MACxC,aAAa,KAAK;AAAA,MAClB;AAAA,MACA,cAAc,CAAA;AAAA,MACd,QAAQ,KAAK;AAAA,MACb,GAAG,QAAQ;AAAA,IAAA;AAGb,QAAI;AACF,UAAI,CAAC,SAAS,6BAA6B;AACzC,cAAM,eAAe,KAAK;AAC1B,cAAM,WACJ,gBACA,OAAO,iBAAiB,YACvB,aACC,8BACF;AACF,YAAI,YAAY,OAAO,aAAa,UAAU;AAC5C,mBAAS,8BAA8B;AAAA,QACzC;AAAA,MACF;AAAA,IACF,QAAQ;AAAA,IACR;AAEA,QAAI;AACF,YAAM,eAAe,KAAK;AAC1B,YAAM,YAAa,gBAAiB,aAAyC;AAG7E,UAAI,WAAW,aAAa,aAAa;AACvC,cAAM,QACJ,OAAQ,UAAwD,UAAU,aACpE,UAAuD,aAAa,CAAA,IACpE,UAAkD,SAAS,CAAA;AAEn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