@hashgraphonline/conversational-agent 0.1.217 → 0.1.219
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/cli/readme.md +181 -0
- package/dist/cjs/constants/entity-references.d.ts +18 -0
- package/dist/cjs/constants/form-priorities.d.ts +24 -0
- package/dist/cjs/constants/index.d.ts +4 -0
- package/dist/cjs/constants/messages.d.ts +19 -0
- package/dist/cjs/constants/test-constants.d.ts +42 -0
- package/dist/cjs/conversational-agent.d.ts +3 -8
- package/dist/{types/core/ToolRegistry.d.ts → cjs/core/tool-registry.d.ts} +11 -1
- package/dist/{types/execution/ExecutionPipeline.d.ts → cjs/execution/execution-pipeline.d.ts} +3 -3
- package/dist/cjs/forms/field-guidance-registry.d.ts +108 -0
- package/dist/cjs/forms/form-generator.d.ts +2 -7
- package/dist/cjs/forms/index.d.ts +3 -0
- package/dist/cjs/forms/types.d.ts +9 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +7 -12
- package/dist/cjs/langchain/external-tool-wrapper.d.ts +101 -0
- package/dist/{types/langchain/FormAwareAgentExecutor.d.ts → cjs/langchain/form-aware-agent-executor.d.ts} +19 -4
- package/dist/cjs/langchain/index.d.ts +3 -0
- package/dist/{types → cjs/langchain}/langchain-agent.d.ts +15 -7
- package/dist/cjs/mcp/adapters/index.d.ts +1 -0
- package/dist/cjs/mcp/adapters/langchain.d.ts +1 -1
- package/dist/{types/mcp/ContentProcessor.d.ts → cjs/mcp/content-processor.d.ts} +1 -1
- package/dist/cjs/mcp/index.d.ts +5 -0
- package/dist/{types/mcp/MCPClientManager.d.ts → cjs/mcp/mcp-client-manager.d.ts} +1 -1
- package/dist/cjs/memory/{ContentStorage.d.ts → content-storage.d.ts} +4 -4
- package/dist/cjs/memory/index.d.ts +5 -7
- package/dist/{types/memory/MemoryWindow.d.ts → cjs/memory/memory-window.d.ts} +1 -1
- package/dist/{types/memory/SmartMemoryManager.d.ts → cjs/memory/smart-memory-manager.d.ts} +1 -1
- package/dist/cjs/services/{ContentStoreManager.d.ts → content-store-manager.d.ts} +6 -6
- package/dist/cjs/services/context/resolution-context.d.ts +49 -0
- package/dist/cjs/services/entity-resolver.d.ts +58 -0
- package/dist/cjs/services/formatters/converters/index.d.ts +2 -0
- package/dist/cjs/services/formatters/converters/string-normalization-converter.d.ts +13 -0
- package/dist/cjs/services/formatters/converters/topic-id-to-hrl-converter.d.ts +17 -0
- package/dist/cjs/services/formatters/format-converter-registry.d.ts +66 -0
- package/dist/cjs/services/formatters/index.d.ts +3 -0
- package/dist/cjs/services/formatters/types.d.ts +29 -0
- package/dist/cjs/services/index.d.ts +3 -0
- package/dist/cjs/services/resolution/resolution-pipeline.d.ts +44 -0
- package/dist/cjs/tools/index.d.ts +1 -0
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/esm/index.js +40 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index10.js +669 -13
- package/dist/esm/index10.js.map +1 -1
- package/dist/esm/index11.js +310 -95
- package/dist/esm/index11.js.map +1 -1
- package/dist/esm/index12.js +130 -95
- package/dist/esm/index12.js.map +1 -1
- package/dist/esm/index13.js +262 -153
- package/dist/esm/index13.js.map +1 -1
- package/dist/esm/index14.js +100 -664
- package/dist/esm/index14.js.map +1 -1
- package/dist/esm/index15.js +135 -408
- package/dist/esm/index15.js.map +1 -1
- package/dist/esm/index16.js +240 -122
- package/dist/esm/index16.js.map +1 -1
- package/dist/esm/index17.js +147 -135
- package/dist/esm/index17.js.map +1 -1
- package/dist/esm/index18.js +376 -533
- package/dist/esm/index18.js.map +1 -1
- package/dist/esm/index19.js +87 -214
- package/dist/esm/index19.js.map +1 -1
- package/dist/esm/index2.js +21 -4
- package/dist/esm/index2.js.map +1 -1
- package/dist/esm/index20.js +158 -92
- package/dist/esm/index20.js.map +1 -1
- package/dist/esm/index21.js +717 -44
- package/dist/esm/index21.js.map +1 -1
- package/dist/esm/index22.js +58 -96
- package/dist/esm/index22.js.map +1 -1
- package/dist/esm/index23.js +324 -34
- package/dist/esm/index23.js.map +1 -1
- package/dist/esm/index24.js +125 -712
- package/dist/esm/index24.js.map +1 -1
- package/dist/esm/index25.js +113 -133
- package/dist/esm/index25.js.map +1 -1
- package/dist/esm/index26.js +18 -152
- package/dist/esm/index26.js.map +1 -1
- package/dist/esm/index27.js +14 -210
- package/dist/esm/index27.js.map +1 -1
- package/dist/esm/index28.js +70 -173
- package/dist/esm/index28.js.map +1 -1
- package/dist/esm/index29.js +882 -220
- package/dist/esm/index29.js.map +1 -1
- package/dist/esm/index30.js +218 -126
- package/dist/esm/index30.js.map +1 -1
- package/dist/esm/index31.js +1258 -44
- package/dist/esm/index31.js.map +1 -1
- package/dist/esm/index32.js +132 -24
- package/dist/esm/index32.js.map +1 -1
- package/dist/esm/index33.js +104 -82
- package/dist/esm/index33.js.map +1 -1
- package/dist/esm/index34.js +43 -239
- package/dist/esm/index34.js.map +1 -1
- package/dist/esm/index35.js +106 -0
- package/dist/esm/index35.js.map +1 -0
- package/dist/esm/index36.js +24 -0
- package/dist/esm/index36.js.map +1 -0
- package/dist/esm/index37.js +8 -0
- package/dist/esm/index37.js.map +1 -0
- package/dist/esm/index38.js +15 -0
- package/dist/esm/index38.js.map +1 -0
- package/dist/esm/index39.js +258 -0
- package/dist/esm/index39.js.map +1 -0
- package/dist/esm/index40.js +187 -0
- package/dist/esm/index40.js.map +1 -0
- package/dist/esm/index41.js +30 -0
- package/dist/esm/index41.js.map +1 -0
- package/dist/esm/index42.js +10 -0
- package/dist/esm/index42.js.map +1 -0
- package/dist/esm/index43.js +95 -0
- package/dist/esm/index43.js.map +1 -0
- package/dist/esm/index5.js +2 -2
- package/dist/esm/index5.js.map +1 -1
- package/dist/esm/index6.js +44 -67
- package/dist/esm/index6.js.map +1 -1
- package/dist/esm/index7.js +9 -0
- package/dist/esm/index7.js.map +1 -1
- package/dist/esm/index8.js +13 -1095
- package/dist/esm/index8.js.map +1 -1
- package/dist/esm/index9.js +17 -13
- package/dist/esm/index9.js.map +1 -1
- package/dist/types/constants/entity-references.d.ts +18 -0
- package/dist/types/constants/form-priorities.d.ts +24 -0
- package/dist/types/constants/index.d.ts +4 -0
- package/dist/types/constants/messages.d.ts +19 -0
- package/dist/types/constants/test-constants.d.ts +42 -0
- package/dist/types/conversational-agent.d.ts +3 -8
- package/dist/{cjs/core/ToolRegistry.d.ts → types/core/tool-registry.d.ts} +11 -1
- package/dist/{cjs/execution/ExecutionPipeline.d.ts → types/execution/execution-pipeline.d.ts} +3 -3
- package/dist/types/forms/field-guidance-registry.d.ts +108 -0
- package/dist/types/forms/form-generator.d.ts +2 -7
- package/dist/types/forms/index.d.ts +3 -0
- package/dist/types/forms/types.d.ts +9 -1
- package/dist/types/index.d.ts +7 -12
- package/dist/types/langchain/external-tool-wrapper.d.ts +101 -0
- package/dist/{cjs/langchain/FormAwareAgentExecutor.d.ts → types/langchain/form-aware-agent-executor.d.ts} +19 -4
- package/dist/types/langchain/index.d.ts +3 -0
- package/dist/{cjs → types/langchain}/langchain-agent.d.ts +15 -7
- package/dist/types/mcp/adapters/index.d.ts +1 -0
- package/dist/types/mcp/adapters/langchain.d.ts +1 -1
- package/dist/{cjs/mcp/ContentProcessor.d.ts → types/mcp/content-processor.d.ts} +1 -1
- package/dist/types/mcp/index.d.ts +5 -0
- package/dist/{cjs/mcp/MCPClientManager.d.ts → types/mcp/mcp-client-manager.d.ts} +1 -1
- package/dist/types/memory/{ContentStorage.d.ts → content-storage.d.ts} +4 -4
- package/dist/types/memory/index.d.ts +5 -7
- package/dist/{cjs/memory/MemoryWindow.d.ts → types/memory/memory-window.d.ts} +1 -1
- package/dist/{cjs/memory/SmartMemoryManager.d.ts → types/memory/smart-memory-manager.d.ts} +1 -1
- package/dist/types/services/{ContentStoreManager.d.ts → content-store-manager.d.ts} +6 -6
- package/dist/types/services/context/resolution-context.d.ts +49 -0
- package/dist/types/services/entity-resolver.d.ts +58 -0
- package/dist/types/services/formatters/converters/index.d.ts +2 -0
- package/dist/types/services/formatters/converters/string-normalization-converter.d.ts +13 -0
- package/dist/types/services/formatters/converters/topic-id-to-hrl-converter.d.ts +17 -0
- package/dist/types/services/formatters/format-converter-registry.d.ts +66 -0
- package/dist/types/services/formatters/index.d.ts +3 -0
- package/dist/types/services/formatters/types.d.ts +29 -0
- package/dist/types/services/index.d.ts +3 -0
- package/dist/types/services/resolution/resolution-pipeline.d.ts +44 -0
- package/dist/types/tools/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +30 -27
- package/src/agent-factory.ts +1 -1
- package/src/base-agent.ts +9 -0
- package/src/config/system-message.ts +2 -15
- package/src/constants/entity-references.ts +23 -0
- package/src/constants/form-priorities.ts +25 -0
- package/src/constants/index.ts +4 -0
- package/src/constants/messages.ts +20 -0
- package/src/constants/test-constants.ts +49 -0
- package/src/conversational-agent.ts +42 -69
- package/src/core/{ToolRegistry.ts → tool-registry.ts} +71 -1
- package/src/examples/external-tool-wrapper-example.ts +56 -0
- package/src/execution/{ExecutionPipeline.ts → execution-pipeline.ts} +3 -3
- package/src/forms/field-guidance-registry.ts +415 -0
- package/src/forms/field-type-registry.ts +49 -48
- package/src/forms/{FormEngine.ts → form-engine.ts} +66 -43
- package/src/forms/form-generator.ts +91 -17
- package/src/forms/index.ts +4 -1
- package/src/forms/types.ts +9 -1
- package/src/index.ts +7 -37
- package/src/langchain/external-tool-wrapper.ts +90 -0
- package/src/langchain/{FormAwareAgentExecutor.ts → form-aware-agent-executor.ts} +615 -231
- package/src/langchain/{FormValidatingToolWrapper.ts → form-validating-tool-wrapper.ts} +2 -1
- package/src/langchain/index.ts +3 -0
- package/src/{langchain-agent.ts → langchain/langchain-agent.ts} +389 -113
- package/src/mcp/adapters/index.ts +1 -0
- package/src/mcp/adapters/langchain.ts +27 -18
- package/src/mcp/{ContentProcessor.ts → content-processor.ts} +71 -47
- package/src/mcp/index.ts +5 -0
- package/src/mcp/{MCPClientManager.ts → mcp-client-manager.ts} +2 -2
- package/src/memory/{ContentStorage.ts → content-storage.ts} +263 -167
- package/src/memory/index.ts +5 -8
- package/src/memory/{MemoryWindow.ts → memory-window.ts} +47 -24
- package/src/memory/{SmartMemoryManager.ts → smart-memory-manager.ts} +49 -22
- package/src/plugins/hbar/HbarPlugin.ts +1 -1
- package/src/plugins/hcs-10/HCS10Plugin.ts +46 -28
- package/src/scripts/test-external-tool-wrapper.ts +6 -6
- package/src/scripts/test-inscribe-form-generation.ts +22 -21
- package/src/scripts/test-inscribe-wrapper-verification.ts +5 -4
- package/src/services/{ContentStoreManager.ts → content-store-manager.ts} +75 -33
- package/src/services/context/resolution-context.ts +80 -0
- package/src/services/entity-resolver.ts +425 -0
- package/src/services/formatters/converters/index.ts +2 -0
- package/src/services/formatters/converters/string-normalization-converter.ts +106 -0
- package/src/services/formatters/converters/topic-id-to-hrl-converter.ts +25 -0
- package/src/services/formatters/format-converter-registry.ts +229 -0
- package/src/services/formatters/index.ts +3 -0
- package/src/services/formatters/types.ts +31 -0
- package/src/services/index.ts +3 -0
- package/src/services/resolution/resolution-pipeline.ts +106 -0
- package/src/tools/index.ts +1 -0
- package/src/types/content-reference.ts +87 -60
- package/src/utils/index.ts +1 -0
- package/cli/dist/CLIApp.d.ts +0 -9
- package/cli/dist/CLIApp.js +0 -127
- package/cli/dist/LocalConversationalAgent.d.ts +0 -37
- package/cli/dist/LocalConversationalAgent.js +0 -58
- package/cli/dist/app.d.ts +0 -16
- package/cli/dist/app.js +0 -13
- package/cli/dist/cli.d.ts +0 -2
- package/cli/dist/cli.js +0 -51
- package/cli/dist/components/AppContainer.d.ts +0 -16
- package/cli/dist/components/AppContainer.js +0 -24
- package/cli/dist/components/AppScreens.d.ts +0 -2
- package/cli/dist/components/AppScreens.js +0 -259
- package/cli/dist/components/ChatScreen.d.ts +0 -15
- package/cli/dist/components/ChatScreen.js +0 -39
- package/cli/dist/components/DebugLoadingScreen.d.ts +0 -5
- package/cli/dist/components/DebugLoadingScreen.js +0 -31
- package/cli/dist/components/LoadingScreen.d.ts +0 -2
- package/cli/dist/components/LoadingScreen.js +0 -16
- package/cli/dist/components/LoadingScreenDebug.d.ts +0 -5
- package/cli/dist/components/LoadingScreenDebug.js +0 -27
- package/cli/dist/components/MCPConfigScreen.d.ts +0 -28
- package/cli/dist/components/MCPConfigScreen.js +0 -168
- package/cli/dist/components/ScreenRouter.d.ts +0 -12
- package/cli/dist/components/ScreenRouter.js +0 -22
- package/cli/dist/components/SetupScreen.d.ts +0 -15
- package/cli/dist/components/SetupScreen.js +0 -65
- package/cli/dist/components/SingleLoadingScreen.d.ts +0 -5
- package/cli/dist/components/SingleLoadingScreen.js +0 -27
- package/cli/dist/components/StatusBadge.d.ts +0 -7
- package/cli/dist/components/StatusBadge.js +0 -28
- package/cli/dist/components/TerminalWindow.d.ts +0 -8
- package/cli/dist/components/TerminalWindow.js +0 -24
- package/cli/dist/components/WelcomeScreen.d.ts +0 -11
- package/cli/dist/components/WelcomeScreen.js +0 -47
- package/cli/dist/context/AppContext.d.ts +0 -68
- package/cli/dist/context/AppContext.js +0 -363
- package/cli/dist/hooks/useInitializeAgent.d.ts +0 -19
- package/cli/dist/hooks/useInitializeAgent.js +0 -28
- package/cli/dist/hooks/useStableState.d.ts +0 -38
- package/cli/dist/hooks/useStableState.js +0 -68
- package/cli/dist/managers/AgentManager.d.ts +0 -57
- package/cli/dist/managers/AgentManager.js +0 -119
- package/cli/dist/managers/ConfigManager.d.ts +0 -53
- package/cli/dist/managers/ConfigManager.js +0 -173
- package/cli/dist/types.d.ts +0 -31
- package/cli/dist/types.js +0 -19
- package/dist/cjs/context/ReferenceContextManager.d.ts +0 -84
- package/dist/cjs/context/ReferenceResponseProcessor.d.ts +0 -76
- package/dist/cjs/services/EntityResolver.d.ts +0 -26
- package/dist/types/context/ReferenceContextManager.d.ts +0 -84
- package/dist/types/context/ReferenceResponseProcessor.d.ts +0 -76
- package/dist/types/services/EntityResolver.d.ts +0 -26
- package/src/context/ReferenceContextManager.ts +0 -350
- package/src/context/ReferenceResponseProcessor.ts +0 -295
- package/src/scripts/test-hedera-kit-wrapper.ts +0 -265
- package/src/services/EntityResolver.ts +0 -128
- /package/dist/cjs/forms/{FormEngine.d.ts → form-engine.d.ts} +0 -0
- /package/dist/cjs/langchain/{FormValidatingToolWrapper.d.ts → form-validating-tool-wrapper.d.ts} +0 -0
- /package/dist/cjs/memory/{ReferenceIdGenerator.d.ts → reference-id-generator.d.ts} +0 -0
- /package/dist/cjs/memory/{TokenCounter.d.ts → token-counter.d.ts} +0 -0
- /package/dist/cjs/tools/{EntityResolverTool.d.ts → entity-resolver-tool.d.ts} +0 -0
- /package/dist/cjs/utils/{ResponseFormatter.d.ts → response-formatter.d.ts} +0 -0
- /package/dist/types/forms/{FormEngine.d.ts → form-engine.d.ts} +0 -0
- /package/dist/types/langchain/{FormValidatingToolWrapper.d.ts → form-validating-tool-wrapper.d.ts} +0 -0
- /package/dist/types/memory/{ReferenceIdGenerator.d.ts → reference-id-generator.d.ts} +0 -0
- /package/dist/types/memory/{TokenCounter.d.ts → token-counter.d.ts} +0 -0
- /package/dist/types/tools/{EntityResolverTool.d.ts → entity-resolver-tool.d.ts} +0 -0
- /package/dist/types/utils/{ResponseFormatter.d.ts → response-formatter.d.ts} +0 -0
- /package/src/memory/{ReferenceIdGenerator.ts → reference-id-generator.ts} +0 -0
- /package/src/memory/{TokenCounter.ts → token-counter.ts} +0 -0
- /package/src/tools/{EntityResolverTool.ts → entity-resolver-tool.ts} +0 -0
- /package/src/utils/{ResponseFormatter.ts → response-formatter.ts} +0 -0
package/dist/esm/index26.js
CHANGED
|
@@ -1,155 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Context: ${serverConfig.additionalContext}`;
|
|
20
|
-
}
|
|
21
|
-
return new DynamicStructuredTool({
|
|
22
|
-
name: sanitizedName,
|
|
23
|
-
description,
|
|
24
|
-
schema: zodSchema,
|
|
25
|
-
func: async (input) => {
|
|
26
|
-
try {
|
|
27
|
-
const result = await mcpManager.executeTool(
|
|
28
|
-
tool.serverName,
|
|
29
|
-
tool.name,
|
|
30
|
-
input
|
|
31
|
-
);
|
|
32
|
-
let responseText = "";
|
|
33
|
-
if (typeof result === "string") {
|
|
34
|
-
responseText = result;
|
|
35
|
-
} else if (result && typeof result === "object" && "content" in result) {
|
|
36
|
-
const content = result.content;
|
|
37
|
-
if (Array.isArray(content)) {
|
|
38
|
-
const textParts = content.filter(
|
|
39
|
-
(item) => typeof item === "object" && item !== null && "type" in item && item.type === "text" && "text" in item
|
|
40
|
-
).map((item) => item.text);
|
|
41
|
-
responseText = textParts.join("\n");
|
|
42
|
-
} else {
|
|
43
|
-
responseText = JSON.stringify(content);
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
responseText = JSON.stringify(result);
|
|
47
|
-
}
|
|
48
|
-
const responseBuffer = Buffer.from(responseText, "utf8");
|
|
49
|
-
const MCP_REFERENCE_THRESHOLD = 10 * 1024;
|
|
50
|
-
const shouldStoreMCPContent = responseBuffer.length > MCP_REFERENCE_THRESHOLD;
|
|
51
|
-
if (shouldStoreMCPContent || shouldUseReference(responseBuffer)) {
|
|
52
|
-
const contentStore = ContentStoreService.getInstance();
|
|
53
|
-
if (contentStore) {
|
|
54
|
-
try {
|
|
55
|
-
const referenceId = await contentStore.storeContent(responseBuffer, {
|
|
56
|
-
contentType: "text",
|
|
57
|
-
source: "mcp",
|
|
58
|
-
mcpToolName: `${tool.serverName}_${tool.name}`,
|
|
59
|
-
originalSize: responseBuffer.length
|
|
60
|
-
});
|
|
61
|
-
return `content-ref:${referenceId}`;
|
|
62
|
-
} catch {
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return responseText;
|
|
67
|
-
} catch (error) {
|
|
68
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
69
|
-
return `Error executing MCP tool ${tool.name}: ${errorMessage}`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function jsonSchemaToZod(schema) {
|
|
75
|
-
if (!schema || typeof schema !== "object") {
|
|
76
|
-
return z.object({});
|
|
77
|
-
}
|
|
78
|
-
const schemaObj = schema;
|
|
79
|
-
if (schemaObj.type && schemaObj.type !== "object") {
|
|
80
|
-
return convertType(schemaObj);
|
|
81
|
-
}
|
|
82
|
-
if (!schemaObj.properties || typeof schemaObj.properties !== "object") {
|
|
83
|
-
return z.object({});
|
|
84
|
-
}
|
|
85
|
-
const shape = {};
|
|
86
|
-
for (const [key, value] of Object.entries(schemaObj.properties)) {
|
|
87
|
-
let zodType = convertType(value);
|
|
88
|
-
const isRequired = Array.isArray(schemaObj.required) && schemaObj.required.includes(key);
|
|
89
|
-
if (!isRequired) {
|
|
90
|
-
zodType = zodType.optional();
|
|
91
|
-
}
|
|
92
|
-
shape[key] = zodType;
|
|
93
|
-
}
|
|
94
|
-
return z.object(shape);
|
|
95
|
-
}
|
|
96
|
-
function convertType(schema) {
|
|
97
|
-
if (!schema || typeof schema !== "object" || !("type" in schema)) {
|
|
98
|
-
return z.unknown();
|
|
99
|
-
}
|
|
100
|
-
const schemaObj = schema;
|
|
101
|
-
let zodType;
|
|
102
|
-
switch (schemaObj.type) {
|
|
103
|
-
case "string":
|
|
104
|
-
zodType = z.string();
|
|
105
|
-
if (schemaObj.enum && Array.isArray(schemaObj.enum)) {
|
|
106
|
-
zodType = z.enum(schemaObj.enum);
|
|
107
|
-
}
|
|
108
|
-
break;
|
|
109
|
-
case "number":
|
|
110
|
-
zodType = z.number();
|
|
111
|
-
if ("minimum" in schemaObj && typeof schemaObj.minimum === "number") {
|
|
112
|
-
zodType = zodType.min(schemaObj.minimum);
|
|
113
|
-
}
|
|
114
|
-
if ("maximum" in schemaObj && typeof schemaObj.maximum === "number") {
|
|
115
|
-
zodType = zodType.max(schemaObj.maximum);
|
|
116
|
-
}
|
|
117
|
-
break;
|
|
118
|
-
case "integer":
|
|
119
|
-
zodType = z.number().int();
|
|
120
|
-
if ("minimum" in schemaObj && typeof schemaObj.minimum === "number") {
|
|
121
|
-
zodType = zodType.min(schemaObj.minimum);
|
|
122
|
-
}
|
|
123
|
-
if ("maximum" in schemaObj && typeof schemaObj.maximum === "number") {
|
|
124
|
-
zodType = zodType.max(schemaObj.maximum);
|
|
125
|
-
}
|
|
126
|
-
break;
|
|
127
|
-
case "boolean":
|
|
128
|
-
zodType = z.boolean();
|
|
129
|
-
break;
|
|
130
|
-
case "array":
|
|
131
|
-
if (schemaObj.items) {
|
|
132
|
-
zodType = z.array(convertType(schemaObj.items));
|
|
133
|
-
} else {
|
|
134
|
-
zodType = z.array(z.unknown());
|
|
135
|
-
}
|
|
136
|
-
break;
|
|
137
|
-
case "object":
|
|
138
|
-
if ("properties" in schemaObj) {
|
|
139
|
-
zodType = jsonSchemaToZod(schemaObj);
|
|
140
|
-
} else {
|
|
141
|
-
zodType = z.object({}).passthrough();
|
|
142
|
-
}
|
|
143
|
-
break;
|
|
144
|
-
default:
|
|
145
|
-
zodType = z.unknown();
|
|
146
|
-
}
|
|
147
|
-
if ("description" in schemaObj && typeof schemaObj.description === "string") {
|
|
148
|
-
zodType = zodType.describe(schemaObj.description);
|
|
149
|
-
}
|
|
150
|
-
return zodType;
|
|
151
|
-
}
|
|
1
|
+
var EntityFormat = /* @__PURE__ */ ((EntityFormat2) => {
|
|
2
|
+
EntityFormat2["TOPIC_ID"] = "topicId";
|
|
3
|
+
EntityFormat2["HRL"] = "hrl";
|
|
4
|
+
EntityFormat2["SCHEDULE_ID"] = "scheduleId";
|
|
5
|
+
EntityFormat2["TOKEN_ID"] = "tokenId";
|
|
6
|
+
EntityFormat2["ADDRESS"] = "address";
|
|
7
|
+
EntityFormat2["SYMBOL"] = "symbol";
|
|
8
|
+
EntityFormat2["SERIAL_NUMBER"] = "serialNumber";
|
|
9
|
+
EntityFormat2["METADATA"] = "metadata";
|
|
10
|
+
EntityFormat2["ACCOUNT_ID"] = "accountId";
|
|
11
|
+
EntityFormat2["ALIAS"] = "alias";
|
|
12
|
+
EntityFormat2["EVM_ADDRESS"] = "evmAddress";
|
|
13
|
+
EntityFormat2["CONTRACT_ID"] = "contractId";
|
|
14
|
+
EntityFormat2["FILE_ID"] = "fileId";
|
|
15
|
+
EntityFormat2["ANY"] = "any";
|
|
16
|
+
return EntityFormat2;
|
|
17
|
+
})(EntityFormat || {});
|
|
152
18
|
export {
|
|
153
|
-
|
|
19
|
+
EntityFormat
|
|
154
20
|
};
|
|
155
21
|
//# sourceMappingURL=index26.js.map
|
package/dist/esm/index26.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index26.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index26.js","sources":["../../src/services/formatters/types.ts"],"sourcesContent":["export enum EntityFormat {\n TOPIC_ID = 'topicId',\n HRL = 'hrl',\n SCHEDULE_ID = 'scheduleId',\n TOKEN_ID = 'tokenId',\n ADDRESS = 'address',\n SYMBOL = 'symbol',\n SERIAL_NUMBER = 'serialNumber',\n METADATA = 'metadata',\n ACCOUNT_ID = 'accountId',\n ALIAS = 'alias',\n EVM_ADDRESS = 'evmAddress',\n CONTRACT_ID = 'contractId',\n FILE_ID = 'fileId',\n ANY = 'any'\n}\n\nexport interface ConversionContext {\n networkType?: string;\n sessionId?: string;\n toolName?: string;\n toolPreferences?: Record<string, string>;\n [key: string]: unknown;\n}\n\nexport interface FormatConverter<TSource = string, TTarget = string> {\n sourceFormat: EntityFormat;\n targetFormat: EntityFormat;\n canConvert(source: string, context: ConversionContext): boolean;\n convert(entity: TSource, context: ConversionContext): Promise<TTarget>;\n}"],"names":["EntityFormat"],"mappings":"AAAO,IAAK,iCAAAA,kBAAL;AACLA,gBAAA,UAAA,IAAW;AACXA,gBAAA,KAAA,IAAM;AACNA,gBAAA,aAAA,IAAc;AACdA,gBAAA,UAAA,IAAW;AACXA,gBAAA,SAAA,IAAU;AACVA,gBAAA,QAAA,IAAS;AACTA,gBAAA,eAAA,IAAgB;AAChBA,gBAAA,UAAA,IAAW;AACXA,gBAAA,YAAA,IAAa;AACbA,gBAAA,OAAA,IAAQ;AACRA,gBAAA,aAAA,IAAc;AACdA,gBAAA,aAAA,IAAc;AACdA,gBAAA,SAAA,IAAU;AACVA,gBAAA,KAAA,IAAM;AAdI,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;"}
|
package/dist/esm/index27.js
CHANGED
|
@@ -1,221 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ToolRegistry {
|
|
7
|
-
constructor(logger) {
|
|
8
|
-
this.tools = /* @__PURE__ */ new Map();
|
|
9
|
-
this.formGenerator = new FormGenerator();
|
|
10
|
-
this.logger = logger || new Logger({ module: "ToolRegistry" });
|
|
1
|
+
import { EntityFormat } from "./index26.js";
|
|
2
|
+
class TopicIdToHrlConverter {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.sourceFormat = EntityFormat.TOPIC_ID;
|
|
5
|
+
this.targetFormat = EntityFormat.HRL;
|
|
11
6
|
}
|
|
12
7
|
/**
|
|
13
|
-
*
|
|
8
|
+
* Check if the source string is a valid topic ID
|
|
14
9
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const metadata = {
|
|
18
|
-
name: tool.name,
|
|
19
|
-
version: "1.0.0",
|
|
20
|
-
category: options.metadata?.category || "core",
|
|
21
|
-
description: tool.description,
|
|
22
|
-
capabilities,
|
|
23
|
-
dependencies: [],
|
|
24
|
-
schema: tool.schema,
|
|
25
|
-
...options.metadata
|
|
26
|
-
};
|
|
27
|
-
let finalTool = tool;
|
|
28
|
-
let wrapper;
|
|
29
|
-
if (this.shouldWrapTool(tool, capabilities, options)) {
|
|
30
|
-
wrapper = wrapToolWithFormValidation(
|
|
31
|
-
tool,
|
|
32
|
-
this.formGenerator,
|
|
33
|
-
{
|
|
34
|
-
requireAllFields: false,
|
|
35
|
-
skipFields: ["metaOptions"],
|
|
36
|
-
...options.wrapperConfig
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
finalTool = wrapper;
|
|
40
|
-
}
|
|
41
|
-
const entry = {
|
|
42
|
-
tool: finalTool,
|
|
43
|
-
metadata,
|
|
44
|
-
wrapper,
|
|
45
|
-
originalTool: tool
|
|
46
|
-
};
|
|
47
|
-
this.tools.set(tool.name, entry);
|
|
10
|
+
canConvert(source, _context) {
|
|
11
|
+
return /^0\.0\.\d+$/.test(source);
|
|
48
12
|
}
|
|
49
13
|
/**
|
|
50
|
-
*
|
|
14
|
+
* Convert topic ID to HRL format based on network type
|
|
51
15
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* Get tools by capability
|
|
57
|
-
*/
|
|
58
|
-
getToolsByCapability(capability, value) {
|
|
59
|
-
const results = [];
|
|
60
|
-
for (const entry of this.tools.values()) {
|
|
61
|
-
if (value !== void 0) {
|
|
62
|
-
if (entry.metadata.capabilities[capability] === value) {
|
|
63
|
-
results.push(entry);
|
|
64
|
-
}
|
|
65
|
-
} else if (entry.metadata.capabilities[capability]) {
|
|
66
|
-
results.push(entry);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return results;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Get tools by query
|
|
73
|
-
*/
|
|
74
|
-
getToolsByQuery(query) {
|
|
75
|
-
const results = [];
|
|
76
|
-
for (const entry of this.tools.values()) {
|
|
77
|
-
let matches = true;
|
|
78
|
-
if (query.name && entry.metadata.name !== query.name) {
|
|
79
|
-
matches = false;
|
|
80
|
-
}
|
|
81
|
-
if (query.category && entry.metadata.category !== query.category) {
|
|
82
|
-
matches = false;
|
|
83
|
-
}
|
|
84
|
-
if (query.capabilities) {
|
|
85
|
-
for (const [key, value] of Object.entries(query.capabilities)) {
|
|
86
|
-
if (entry.metadata.capabilities[key] !== value) {
|
|
87
|
-
matches = false;
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (matches) {
|
|
93
|
-
results.push(entry);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return results;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Get all registered tools
|
|
100
|
-
*/
|
|
101
|
-
getAllTools() {
|
|
102
|
-
return Array.from(this.tools.values()).map((entry) => entry.tool);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Get all registry entries
|
|
106
|
-
*/
|
|
107
|
-
getAllRegistryEntries() {
|
|
108
|
-
return Array.from(this.tools.values());
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Get all tool names
|
|
112
|
-
*/
|
|
113
|
-
getToolNames() {
|
|
114
|
-
return Array.from(this.tools.keys());
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if a tool is registered
|
|
118
|
-
*/
|
|
119
|
-
hasTool(name) {
|
|
120
|
-
return this.tools.has(name);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Unregister a tool
|
|
124
|
-
*/
|
|
125
|
-
unregisterTool(name) {
|
|
126
|
-
return this.tools.delete(name);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Clear all tools
|
|
130
|
-
*/
|
|
131
|
-
clear() {
|
|
132
|
-
this.tools.clear();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Analyze tool capabilities
|
|
136
|
-
*/
|
|
137
|
-
analyzeToolCapabilities(tool) {
|
|
138
|
-
const implementsFormValidatable = isFormValidatable(tool);
|
|
139
|
-
const hasRenderConfig = this.hasRenderConfig(tool);
|
|
140
|
-
const isZodObjectLike = this.isZodObjectLike(tool.schema);
|
|
141
|
-
const supportsFormValidation = implementsFormValidatable || hasRenderConfig;
|
|
142
|
-
const requiresWrapper = supportsFormValidation && isZodObjectLike;
|
|
143
|
-
let priority = "medium";
|
|
144
|
-
let category = "core";
|
|
145
|
-
if (supportsFormValidation && requiresWrapper) {
|
|
146
|
-
priority = "critical";
|
|
147
|
-
} else if (supportsFormValidation) {
|
|
148
|
-
priority = "high";
|
|
149
|
-
} else if (tool.description?.toLowerCase().includes("query") || tool.description?.toLowerCase().includes("search")) {
|
|
150
|
-
priority = "low";
|
|
151
|
-
}
|
|
152
|
-
const toolAsAny = tool;
|
|
153
|
-
if (tool.constructor.name.includes("MCP") || toolAsAny.isMCPTool) {
|
|
154
|
-
category = "mcp";
|
|
155
|
-
} else if (toolAsAny.isExtension || tool.constructor.name.includes("Extension")) {
|
|
156
|
-
category = "extension";
|
|
157
|
-
}
|
|
158
|
-
return {
|
|
159
|
-
supportsFormValidation,
|
|
160
|
-
requiresWrapper,
|
|
161
|
-
priority,
|
|
162
|
-
category
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Check if tool has render configuration
|
|
167
|
-
*/
|
|
168
|
-
hasRenderConfig(tool) {
|
|
169
|
-
const schema = tool.schema;
|
|
170
|
-
return !!(schema && schema._renderConfig);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Determine if tool should be wrapped
|
|
174
|
-
*/
|
|
175
|
-
shouldWrapTool(tool, capabilities, options) {
|
|
176
|
-
if (options.skipWrapper) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
if (options.forceWrapper) {
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
return capabilities.requiresWrapper;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Check if schema is ZodObject-like
|
|
186
|
-
*/
|
|
187
|
-
isZodObjectLike(schema) {
|
|
188
|
-
if (!schema || typeof schema !== "object") {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
const schemaRecord = schema;
|
|
192
|
-
const schemaDef = schemaRecord._def;
|
|
193
|
-
return schema instanceof z.ZodObject || schemaDef?.typeName === "ZodObject" || "shape" in schemaRecord && typeof schemaRecord.shape === "object";
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Get statistics about the registry
|
|
197
|
-
*/
|
|
198
|
-
getStatistics() {
|
|
199
|
-
const stats = {
|
|
200
|
-
totalTools: this.tools.size,
|
|
201
|
-
wrappedTools: 0,
|
|
202
|
-
unwrappedTools: 0,
|
|
203
|
-
categoryCounts: { core: 0, extension: 0, mcp: 0 },
|
|
204
|
-
priorityCounts: { low: 0, medium: 0, high: 0, critical: 0 }
|
|
205
|
-
};
|
|
206
|
-
for (const entry of this.tools.values()) {
|
|
207
|
-
if (entry.wrapper) {
|
|
208
|
-
stats.wrappedTools++;
|
|
209
|
-
} else {
|
|
210
|
-
stats.unwrappedTools++;
|
|
211
|
-
}
|
|
212
|
-
stats.categoryCounts[entry.metadata.category]++;
|
|
213
|
-
stats.priorityCounts[entry.metadata.capabilities.priority]++;
|
|
214
|
-
}
|
|
215
|
-
return stats;
|
|
16
|
+
async convert(topicId, context) {
|
|
17
|
+
const networkType = context.networkType || "testnet";
|
|
18
|
+
const networkId = networkType === "mainnet" ? "0" : "1";
|
|
19
|
+
return `hcs://${networkId}/${topicId}`;
|
|
216
20
|
}
|
|
217
21
|
}
|
|
218
22
|
export {
|
|
219
|
-
|
|
23
|
+
TopicIdToHrlConverter
|
|
220
24
|
};
|
|
221
25
|
//# sourceMappingURL=index27.js.map
|
package/dist/esm/index27.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index27.js","sources":["../../src/core/ToolRegistry.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/FormValidatingToolWrapper';\nimport { FormGenerator } from '../forms/form-generator';\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 * 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}\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}\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 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 const entry: ToolRegistryEntry = {\n tool: finalTool,\n metadata,\n wrapper,\n originalTool: tool,\n };\n\n this.tools.set(tool.name, entry);\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 * 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":";;;;;AAoEO,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,MAC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,cAAM;AAAA,MACR;AAEA,YAAM,eAAe,MAAM,SAAS,QAAQ;AAC5C,YAAM,eAAe,MAAM,SAAS,aAAa,QAAQ;AAAA,IAC3D;AAEA,WAAO;AAAA,EACT;AACF;"}
|
|
1
|
+
{"version":3,"file":"index27.js","sources":["../../src/services/formatters/converters/topic-id-to-hrl-converter.ts"],"sourcesContent":["import { EntityFormat, FormatConverter, ConversionContext } from '../types';\n\n/**\n * Converts Hedera topic IDs to HRL format for consensus service messages\n */\nexport class TopicIdToHrlConverter implements FormatConverter<string, string> {\n sourceFormat = EntityFormat.TOPIC_ID;\n targetFormat = EntityFormat.HRL;\n\n /**\n * Check if the source string is a valid topic ID\n */\n canConvert(source: string, _context: ConversionContext): boolean {\n return /^0\\.0\\.\\d+$/.test(source);\n }\n\n /**\n * Convert topic ID to HRL format based on network type\n */\n async convert(topicId: string, context: ConversionContext): Promise<string> {\n const networkType = context.networkType || 'testnet';\n const networkId = networkType === 'mainnet' ? '0' : '1';\n return `hcs://${networkId}/${topicId}`;\n }\n}\n"],"names":[],"mappings":";AAKO,MAAM,sBAAiE;AAAA,EAAvE,cAAA;AACL,SAAA,eAAe,aAAa;AAC5B,SAAA,eAAe,aAAa;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAK5B,WAAW,QAAgB,UAAsC;AAC/D,WAAO,cAAc,KAAK,MAAM;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAQ,SAAiB,SAA6C;AAC1E,UAAM,cAAc,QAAQ,eAAe;AAC3C,UAAM,YAAY,gBAAgB,YAAY,MAAM;AACpD,WAAO,SAAS,SAAS,IAAI,OAAO;AAAA,EACtC;AACF;"}
|