@hashgraphonline/conversational-agent 0.2.216 → 0.2.217
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/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/SwarmPlugin.d.ts +17 -0
- package/dist/cjs/plugins/community/swarm/__tests__/SwarmPlugin.mocks.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/SwarmPlugin.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.d.ts +14 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadDataTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadFileTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.d.ts +1 -0
- package/dist/cjs/plugins/community/swarm/config.d.ts +6 -0
- package/dist/cjs/plugins/community/swarm/constants.d.ts +8 -0
- package/dist/cjs/plugins/community/swarm/index.d.ts +2 -0
- package/dist/cjs/plugins/community/swarm/model.d.ts +23 -0
- package/dist/cjs/plugins/community/swarm/tools/CreatePostageStampTool.d.ts +47 -0
- package/dist/cjs/plugins/community/swarm/tools/DownloadDataTool.d.ts +35 -0
- package/dist/cjs/plugins/community/swarm/tools/DownloadFilesTool.d.ts +41 -0
- package/dist/cjs/plugins/community/swarm/tools/ExtendPostageStampTool.d.ts +47 -0
- package/dist/cjs/plugins/community/swarm/tools/GetPostageStampTool.d.ts +35 -0
- package/dist/cjs/plugins/community/swarm/tools/ListPostageStampsTool.d.ts +53 -0
- package/dist/cjs/plugins/community/swarm/tools/QueryUploadProgressTool.d.ts +35 -0
- package/dist/cjs/plugins/community/swarm/tools/ReadFeedTool.d.ts +41 -0
- package/dist/cjs/plugins/community/swarm/tools/UpdateFeedTool.d.ts +47 -0
- package/dist/cjs/plugins/community/swarm/tools/UploadDataTool.d.ts +47 -0
- package/dist/cjs/plugins/community/swarm/tools/UploadFileTool.d.ts +53 -0
- package/dist/cjs/plugins/community/swarm/tools/UploadFolderTool.d.ts +47 -0
- package/dist/cjs/plugins/community/swarm/utils.d.ts +22 -0
- package/dist/cjs/plugins/index.d.ts +1 -0
- package/dist/esm/index.js +33 -31
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index10.js +13 -677
- package/dist/esm/index10.js.map +1 -1
- package/dist/esm/index11.js +601 -234
- package/dist/esm/index11.js.map +1 -1
- package/dist/esm/index12.js +296 -136
- package/dist/esm/index12.js.map +1 -1
- package/dist/esm/index13.js +127 -235
- package/dist/esm/index13.js.map +1 -1
- package/dist/esm/index14.js +247 -84
- package/dist/esm/index14.js.map +1 -1
- package/dist/esm/index15.js +81 -159
- package/dist/esm/index15.js.map +1 -1
- package/dist/esm/index16.js +155 -229
- package/dist/esm/index16.js.map +1 -1
- package/dist/esm/index17.js +238 -140
- package/dist/esm/index17.js.map +1 -1
- package/dist/esm/index18.js +139 -493
- package/dist/esm/index18.js.map +1 -1
- package/dist/esm/index19.js +479 -91
- package/dist/esm/index19.js.map +1 -1
- package/dist/esm/index20.js +88 -147
- package/dist/esm/index20.js.map +1 -1
- package/dist/esm/index21.js +127 -666
- package/dist/esm/index21.js.map +1 -1
- package/dist/esm/index22.js +698 -44
- package/dist/esm/index22.js.map +1 -1
- package/dist/esm/index23.js +45 -304
- package/dist/esm/index23.js.map +1 -1
- package/dist/esm/index24.js +303 -153
- package/dist/esm/index24.js.map +1 -1
- package/dist/esm/index25.js +150 -117
- package/dist/esm/index25.js.map +1 -1
- package/dist/esm/index26.js +154 -18
- package/dist/esm/index26.js.map +1 -1
- package/dist/esm/index27.js +18 -22
- package/dist/esm/index27.js.map +1 -1
- package/dist/esm/index28.js +15 -74
- package/dist/esm/index28.js.map +1 -1
- package/dist/esm/index29.js +70 -295
- package/dist/esm/index29.js.map +1 -1
- package/dist/esm/index30.js +279 -100
- package/dist/esm/index30.js.map +1 -1
- package/dist/esm/index31.js +86 -922
- package/dist/esm/index31.js.map +1 -1
- package/dist/esm/index32.js +904 -189
- package/dist/esm/index32.js.map +1 -1
- package/dist/esm/index33.js +185 -1169
- package/dist/esm/index33.js.map +1 -1
- package/dist/esm/index34.js +1218 -112
- package/dist/esm/index34.js.map +1 -1
- package/dist/esm/index35.js +111 -99
- package/dist/esm/index35.js.map +1 -1
- package/dist/esm/index36.js +113 -8
- package/dist/esm/index36.js.map +1 -1
- package/dist/esm/index37.js +8 -45
- package/dist/esm/index37.js.map +1 -1
- package/dist/esm/index38.js +41 -102
- package/dist/esm/index38.js.map +1 -1
- package/dist/esm/index39.js +96 -55
- package/dist/esm/index39.js.map +1 -1
- package/dist/esm/index4.js +1 -1
- package/dist/esm/index40.js +58 -71
- package/dist/esm/index40.js.map +1 -1
- package/dist/esm/index41.js +79 -21
- package/dist/esm/index41.js.map +1 -1
- package/dist/esm/index42.js +21 -5
- package/dist/esm/index42.js.map +1 -1
- package/dist/esm/index43.js +4 -11
- package/dist/esm/index43.js.map +1 -1
- package/dist/esm/index44.js +12 -322
- package/dist/esm/index44.js.map +1 -1
- package/dist/esm/index45.js +280 -142
- package/dist/esm/index45.js.map +1 -1
- package/dist/esm/index46.js +181 -24
- package/dist/esm/index46.js.map +1 -1
- package/dist/esm/index47.js +7 -95
- package/dist/esm/index47.js.map +1 -1
- package/dist/esm/index48.js +77 -7
- package/dist/esm/index48.js.map +1 -1
- package/dist/esm/index49.js +75 -0
- package/dist/esm/index49.js.map +1 -0
- package/dist/esm/index5.js +2 -2
- package/dist/esm/index50.js +57 -0
- package/dist/esm/index50.js.map +1 -0
- package/dist/esm/index51.js +103 -0
- package/dist/esm/index51.js.map +1 -0
- package/dist/esm/index52.js +79 -0
- package/dist/esm/index52.js.map +1 -0
- package/dist/esm/index53.js +75 -0
- package/dist/esm/index53.js.map +1 -0
- package/dist/esm/index54.js +124 -0
- package/dist/esm/index54.js.map +1 -0
- package/dist/esm/index55.js +58 -0
- package/dist/esm/index55.js.map +1 -0
- package/dist/esm/index56.js +83 -0
- package/dist/esm/index56.js.map +1 -0
- package/dist/esm/index57.js +100 -0
- package/dist/esm/index57.js.map +1 -0
- package/dist/esm/index58.js +118 -0
- package/dist/esm/index58.js.map +1 -0
- package/dist/esm/index59.js +108 -0
- package/dist/esm/index59.js.map +1 -0
- package/dist/esm/index6.js +132 -833
- package/dist/esm/index6.js.map +1 -1
- package/dist/esm/index60.js +30 -0
- package/dist/esm/index60.js.map +1 -0
- package/dist/esm/index61.js +98 -0
- package/dist/esm/index61.js.map +1 -0
- package/dist/esm/index62.js +131 -0
- package/dist/esm/index62.js.map +1 -0
- package/dist/esm/index63.js +19 -0
- package/dist/esm/index63.js.map +1 -0
- package/dist/esm/index7.js +826 -75
- package/dist/esm/index7.js.map +1 -1
- package/dist/esm/index8.js +91 -13
- package/dist/esm/index8.js.map +1 -1
- package/dist/esm/index9.js +13 -17
- package/dist/esm/index9.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugins/community/swarm/SwarmPlugin.d.ts +17 -0
- package/dist/types/plugins/community/swarm/__tests__/SwarmPlugin.mocks.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/SwarmPlugin.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.d.ts +14 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/UploadDataTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/UploadFileTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.d.ts +1 -0
- package/dist/types/plugins/community/swarm/config.d.ts +6 -0
- package/dist/types/plugins/community/swarm/constants.d.ts +8 -0
- package/dist/types/plugins/community/swarm/index.d.ts +2 -0
- package/dist/types/plugins/community/swarm/model.d.ts +23 -0
- package/dist/types/plugins/community/swarm/tools/CreatePostageStampTool.d.ts +47 -0
- package/dist/types/plugins/community/swarm/tools/DownloadDataTool.d.ts +35 -0
- package/dist/types/plugins/community/swarm/tools/DownloadFilesTool.d.ts +41 -0
- package/dist/types/plugins/community/swarm/tools/ExtendPostageStampTool.d.ts +47 -0
- package/dist/types/plugins/community/swarm/tools/GetPostageStampTool.d.ts +35 -0
- package/dist/types/plugins/community/swarm/tools/ListPostageStampsTool.d.ts +53 -0
- package/dist/types/plugins/community/swarm/tools/QueryUploadProgressTool.d.ts +35 -0
- package/dist/types/plugins/community/swarm/tools/ReadFeedTool.d.ts +41 -0
- package/dist/types/plugins/community/swarm/tools/UpdateFeedTool.d.ts +47 -0
- package/dist/types/plugins/community/swarm/tools/UploadDataTool.d.ts +47 -0
- package/dist/types/plugins/community/swarm/tools/UploadFileTool.d.ts +53 -0
- package/dist/types/plugins/community/swarm/tools/UploadFolderTool.d.ts +47 -0
- package/dist/types/plugins/community/swarm/utils.d.ts +22 -0
- package/dist/types/plugins/index.d.ts +1 -0
- package/package.json +36 -26
- package/src/index.ts +1 -0
- package/src/plugins/community/swarm/README.md +279 -0
- package/src/plugins/community/swarm/SwarmPlugin.ts +178 -0
- package/src/plugins/community/swarm/__tests__/SwarmPlugin.mocks.ts +105 -0
- package/src/plugins/community/swarm/__tests__/SwarmPlugin.test.ts +93 -0
- package/src/plugins/community/swarm/__tests__/tools/CreatePostageStampTool.test.ts +152 -0
- package/src/plugins/community/swarm/__tests__/tools/DownloadDataTool.test.ts +93 -0
- package/src/plugins/community/swarm/__tests__/tools/DownloadFilesTool.test.ts +163 -0
- package/src/plugins/community/swarm/__tests__/tools/ExtendPostageStampTool.test.ts +132 -0
- package/src/plugins/community/swarm/__tests__/tools/GetPostageStampTool.test.ts +83 -0
- package/src/plugins/community/swarm/__tests__/tools/ListPostageStampsTool.test.ts +219 -0
- package/src/plugins/community/swarm/__tests__/tools/QueryUploadProgressTool.test.ts +169 -0
- package/src/plugins/community/swarm/__tests__/tools/ReadFeedTool.test.ts +133 -0
- package/src/plugins/community/swarm/__tests__/tools/SwarmTool.mocks.ts +67 -0
- package/src/plugins/community/swarm/__tests__/tools/UpdateFeedTool.test.ts +148 -0
- package/src/plugins/community/swarm/__tests__/tools/UploadDataTool.test.ts +125 -0
- package/src/plugins/community/swarm/__tests__/tools/UploadFileTool.test.ts +194 -0
- package/src/plugins/community/swarm/__tests__/tools/UploadFolderTool.test.ts +118 -0
- package/src/plugins/community/swarm/config.ts +6 -0
- package/src/plugins/community/swarm/constants.ts +12 -0
- package/src/plugins/community/swarm/index.ts +2 -0
- package/src/plugins/community/swarm/model.ts +23 -0
- package/src/plugins/community/swarm/tools/CreatePostageStampTool.ts +137 -0
- package/src/plugins/community/swarm/tools/DownloadDataTool.ts +79 -0
- package/src/plugins/community/swarm/tools/DownloadFilesTool.ts +155 -0
- package/src/plugins/community/swarm/tools/ExtendPostageStampTool.ts +112 -0
- package/src/plugins/community/swarm/tools/GetPostageStampTool.ts +92 -0
- package/src/plugins/community/swarm/tools/ListPostageStampsTool.ts +124 -0
- package/src/plugins/community/swarm/tools/QueryUploadProgressTool.ts +109 -0
- package/src/plugins/community/swarm/tools/ReadFeedTool.ts +110 -0
- package/src/plugins/community/swarm/tools/UpdateFeedTool.ts +149 -0
- package/src/plugins/community/swarm/tools/UploadDataTool.ts +109 -0
- package/src/plugins/community/swarm/tools/UploadFileTool.ts +163 -0
- package/src/plugins/community/swarm/tools/UploadFolderTool.ts +150 -0
- package/src/plugins/community/swarm/utils.ts +172 -0
- package/src/plugins/index.ts +1 -0
- package/cli/dist/CLIApp.d.ts +0 -11
- package/cli/dist/CLIApp.d.ts.map +0 -1
- package/cli/dist/CLIApp.js +0 -128
- package/cli/dist/CLIApp.js.map +0 -1
- package/cli/dist/LocalConversationalAgent.d.ts +0 -37
- package/cli/dist/LocalConversationalAgent.js +0 -58
- package/cli/dist/app.d.ts +0 -18
- package/cli/dist/app.d.ts.map +0 -1
- package/cli/dist/app.js +0 -14
- package/cli/dist/app.js.map +0 -1
- package/cli/dist/cli.d.ts +0 -3
- package/cli/dist/cli.d.ts.map +0 -1
- package/cli/dist/cli.js +0 -87
- package/cli/dist/cli.js.map +0 -1
- 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 -21
- package/cli/dist/components/ChatScreen.d.ts.map +0 -1
- package/cli/dist/components/ChatScreen.js +0 -40
- package/cli/dist/components/ChatScreen.js.map +0 -1
- 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 -3
- package/cli/dist/components/LoadingScreen.d.ts.map +0 -1
- package/cli/dist/components/LoadingScreen.js +0 -17
- package/cli/dist/components/LoadingScreen.js.map +0 -1
- 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.d.ts.map +0 -1
- package/cli/dist/components/MCPConfigScreen.js +0 -186
- package/cli/dist/components/MCPConfigScreen.js.map +0 -1
- package/cli/dist/components/ScreenRouter.d.ts +0 -13
- package/cli/dist/components/ScreenRouter.d.ts.map +0 -1
- package/cli/dist/components/ScreenRouter.js +0 -23
- package/cli/dist/components/ScreenRouter.js.map +0 -1
- package/cli/dist/components/SetupScreen.d.ts +0 -16
- package/cli/dist/components/SetupScreen.d.ts.map +0 -1
- package/cli/dist/components/SetupScreen.js +0 -67
- package/cli/dist/components/SetupScreen.js.map +0 -1
- 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 -10
- package/cli/dist/components/StatusBadge.d.ts.map +0 -1
- package/cli/dist/components/StatusBadge.js +0 -24
- package/cli/dist/components/StatusBadge.js.map +0 -1
- package/cli/dist/components/TerminalWindow.d.ts +0 -9
- package/cli/dist/components/TerminalWindow.d.ts.map +0 -1
- package/cli/dist/components/TerminalWindow.js +0 -19
- package/cli/dist/components/TerminalWindow.js.map +0 -1
- package/cli/dist/components/WelcomeScreen.d.ts +0 -12
- package/cli/dist/components/WelcomeScreen.d.ts.map +0 -1
- package/cli/dist/components/WelcomeScreen.js +0 -47
- package/cli/dist/components/WelcomeScreen.js.map +0 -1
- package/cli/dist/context/AppContext.d.ts +0 -68
- package/cli/dist/context/AppContext.js +0 -363
- package/cli/dist/headless-runner.d.ts +0 -17
- package/cli/dist/headless-runner.d.ts.map +0 -1
- package/cli/dist/headless-runner.js +0 -128
- package/cli/dist/headless-runner.js.map +0 -1
- package/cli/dist/hooks/useInitializeAgent.d.ts +0 -19
- package/cli/dist/hooks/useInitializeAgent.d.ts.map +0 -1
- package/cli/dist/hooks/useInitializeAgent.js +0 -29
- package/cli/dist/hooks/useInitializeAgent.js.map +0 -1
- package/cli/dist/hooks/useStableState.d.ts +0 -38
- package/cli/dist/hooks/useStableState.d.ts.map +0 -1
- package/cli/dist/hooks/useStableState.js +0 -69
- package/cli/dist/hooks/useStableState.js.map +0 -1
- package/cli/dist/managers/AgentManager.d.ts +0 -58
- package/cli/dist/managers/AgentManager.d.ts.map +0 -1
- package/cli/dist/managers/AgentManager.js +0 -121
- package/cli/dist/managers/AgentManager.js.map +0 -1
- package/cli/dist/managers/ConfigManager.d.ts +0 -54
- package/cli/dist/managers/ConfigManager.d.ts.map +0 -1
- package/cli/dist/managers/ConfigManager.js +0 -188
- package/cli/dist/managers/ConfigManager.js.map +0 -1
- package/cli/dist/types.d.ts +0 -52
- package/cli/dist/types.d.ts.map +0 -1
- package/cli/dist/types.js +0 -34
- package/cli/dist/types.js.map +0 -1
package/dist/esm/index30.js
CHANGED
|
@@ -1,130 +1,309 @@
|
|
|
1
1
|
import { Logger } from "@hashgraphonline/standards-sdk";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { EntityFormat } from "./index27.js";
|
|
3
|
+
import "./index29.js";
|
|
4
|
+
class ParameterService {
|
|
5
|
+
constructor(formatConverterRegistry, networkType) {
|
|
6
|
+
this.logger = new Logger({ module: "ParameterService" });
|
|
7
|
+
this.formatConverterRegistry = formatConverterRegistry;
|
|
8
|
+
this.networkType = networkType;
|
|
5
9
|
}
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
11
|
+
* Unified preprocessing entrypoint (DRY):
|
|
12
|
+
* - Optional AI-driven resolution via provided entityResolver
|
|
13
|
+
* - Deterministic post-pass for safe format enforcement
|
|
8
14
|
*/
|
|
9
|
-
async
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
totalSize: attachments.reduce((sum, att) => sum + att.size, 0)
|
|
16
|
-
});
|
|
17
|
-
if (contentStoreManager && contentStoreManager.isInitialized()) {
|
|
18
|
-
return this.processWithContentStore(content, attachments, contentStoreManager);
|
|
19
|
-
} else {
|
|
20
|
-
this.logger.warn("Content storage not available, creating simple file references");
|
|
21
|
-
return this.processWithSimpleReferences(content, attachments);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Process attachments using content store manager
|
|
26
|
-
*/
|
|
27
|
-
async processWithContentStore(content, attachments, contentStoreManager) {
|
|
28
|
-
const contentReferences = [];
|
|
29
|
-
for (const attachment of attachments) {
|
|
15
|
+
async preprocessParameters(toolName, parameters, entities = [], options) {
|
|
16
|
+
const sessionId = options?.sessionId;
|
|
17
|
+
const entityResolver = options?.entityResolver;
|
|
18
|
+
const preferences = options?.preferences;
|
|
19
|
+
let working = { ...parameters };
|
|
20
|
+
if (entityResolver && entities.length > 0) {
|
|
30
21
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (contentRef) {
|
|
43
|
-
if (attachment.type.startsWith("image/")) {
|
|
44
|
-
contentReferences.push(
|
|
45
|
-
`[Image File: ${attachment.name}] (content-ref:${contentRef.referenceId})`
|
|
22
|
+
this.logger.info("AI-driven preprocessing phase", {
|
|
23
|
+
toolName,
|
|
24
|
+
entityCount: entities.length,
|
|
25
|
+
sessionId
|
|
26
|
+
});
|
|
27
|
+
const aiProcessed = { ...working };
|
|
28
|
+
for (const [paramName, paramValue] of Object.entries(working)) {
|
|
29
|
+
if (typeof paramValue === "string") {
|
|
30
|
+
const resolved = await entityResolver.resolveReferences(
|
|
31
|
+
paramValue,
|
|
32
|
+
entities
|
|
46
33
|
);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
const converted = await this.convertParameterEntities(
|
|
35
|
+
resolved,
|
|
36
|
+
entities,
|
|
37
|
+
preferences
|
|
50
38
|
);
|
|
39
|
+
aiProcessed[paramName] = converted;
|
|
40
|
+
} else if (Array.isArray(paramValue)) {
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const item of paramValue) {
|
|
43
|
+
if (typeof item === "string") {
|
|
44
|
+
const resolved = await entityResolver.resolveReferences(
|
|
45
|
+
item,
|
|
46
|
+
entities
|
|
47
|
+
);
|
|
48
|
+
const converted = await this.convertParameterEntities(
|
|
49
|
+
resolved,
|
|
50
|
+
entities,
|
|
51
|
+
preferences
|
|
52
|
+
);
|
|
53
|
+
out.push(converted);
|
|
54
|
+
} else {
|
|
55
|
+
out.push(item);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
aiProcessed[paramName] = out;
|
|
51
59
|
}
|
|
52
|
-
} else {
|
|
53
|
-
contentReferences.push(
|
|
54
|
-
this.createInlineReference(attachment, base64Data)
|
|
55
|
-
);
|
|
56
60
|
}
|
|
61
|
+
working = aiProcessed;
|
|
57
62
|
} catch (error) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
const message = error instanceof Error ? error.message : "unknown";
|
|
64
|
+
this.logger.warn(
|
|
65
|
+
"AI phase failed; continuing with deterministic pass",
|
|
66
|
+
{
|
|
67
|
+
toolName,
|
|
68
|
+
error: message
|
|
69
|
+
}
|
|
64
70
|
);
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
try {
|
|
74
|
+
const processed = { ...working };
|
|
75
|
+
for (const [paramName, paramValue] of Object.entries(working)) {
|
|
76
|
+
if (typeof paramValue === "string") {
|
|
77
|
+
const converted = await this.convertParameterEntities(
|
|
78
|
+
paramValue,
|
|
79
|
+
entities,
|
|
80
|
+
preferences
|
|
81
|
+
);
|
|
82
|
+
processed[paramName] = converted;
|
|
83
|
+
} else if (Array.isArray(paramValue)) {
|
|
84
|
+
const out = [];
|
|
85
|
+
for (const item of paramValue) {
|
|
86
|
+
if (typeof item === "string") {
|
|
87
|
+
const converted = await this.convertParameterEntities(
|
|
88
|
+
item,
|
|
89
|
+
entities,
|
|
90
|
+
preferences
|
|
91
|
+
);
|
|
92
|
+
out.push(converted);
|
|
93
|
+
} else {
|
|
94
|
+
out.push(item);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
processed[paramName] = out;
|
|
98
|
+
}
|
|
88
99
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
working = processed;
|
|
101
|
+
} catch (e) {
|
|
102
|
+
this.logger.warn("Deterministic post-pass failed", {
|
|
103
|
+
toolName,
|
|
104
|
+
error: e instanceof Error ? e.message : "unknown"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return working;
|
|
95
108
|
}
|
|
96
109
|
/**
|
|
97
|
-
*
|
|
110
|
+
* Attach unified preprocessing callback directly to the agent.
|
|
98
111
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
attachToAgent(agent, deps) {
|
|
113
|
+
const getSessionId = deps?.getSessionId ?? (() => null);
|
|
114
|
+
const getEntities = deps?.getEntities ?? (async () => []);
|
|
115
|
+
const entityResolver = deps?.entityResolver;
|
|
116
|
+
const maybe = agent;
|
|
117
|
+
const attach = (target) => {
|
|
118
|
+
const t = target;
|
|
119
|
+
if (typeof t.setParameterPreprocessingCallback === "function") {
|
|
120
|
+
t.setParameterPreprocessingCallback(
|
|
121
|
+
async (toolName, parameters) => {
|
|
122
|
+
const sessionId = getSessionId();
|
|
123
|
+
const entities = await getEntities(sessionId);
|
|
124
|
+
const opts = {};
|
|
125
|
+
if (entityResolver) {
|
|
126
|
+
opts.entityResolver = entityResolver;
|
|
127
|
+
}
|
|
128
|
+
if (sessionId) {
|
|
129
|
+
opts.sessionId = sessionId;
|
|
130
|
+
}
|
|
131
|
+
return this.preprocessParameters(toolName, parameters, entities, opts);
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
this.logger.info("Parameter preprocessing callback attached");
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
};
|
|
139
|
+
if (!attach(agent) && typeof maybe.getAgent === "function") {
|
|
140
|
+
const underlying = maybe.getAgent();
|
|
141
|
+
if (underlying) {
|
|
142
|
+
void attach(underlying);
|
|
106
143
|
}
|
|
107
|
-
} else {
|
|
108
|
-
return `[File: ${attachment.name} (${this.formatFileSize(attachment.size)}) - Content too large to include inline]`;
|
|
109
144
|
}
|
|
110
145
|
}
|
|
111
146
|
/**
|
|
112
|
-
*
|
|
147
|
+
* Preprocess tool parameters by applying format conversions based on tool's entity resolution preferences
|
|
113
148
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
149
|
+
async preprocessToolParameters(toolName, parameters, entities, sessionId) {
|
|
150
|
+
try {
|
|
151
|
+
if (!entities || entities.length === 0) {
|
|
152
|
+
this.logger.info(
|
|
153
|
+
"Tool parameter preprocessing skipped - no entities provided:",
|
|
154
|
+
{
|
|
155
|
+
toolName,
|
|
156
|
+
originalParams: Object.keys(parameters)
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
return parameters;
|
|
160
|
+
}
|
|
161
|
+
const processedParameters = { ...parameters };
|
|
162
|
+
const preferences = void 0;
|
|
163
|
+
let hasChanges = false;
|
|
164
|
+
for (const [paramName, paramValue] of Object.entries(parameters)) {
|
|
165
|
+
if (typeof paramValue === "string") {
|
|
166
|
+
const convertedValue = await this.convertParameterEntities(
|
|
167
|
+
paramValue,
|
|
168
|
+
entities,
|
|
169
|
+
preferences
|
|
170
|
+
);
|
|
171
|
+
if (convertedValue !== paramValue) {
|
|
172
|
+
processedParameters[paramName] = convertedValue;
|
|
173
|
+
hasChanges = true;
|
|
174
|
+
this.logger.info("Parameter entity conversion applied:", {
|
|
175
|
+
toolName,
|
|
176
|
+
paramName,
|
|
177
|
+
original: paramValue,
|
|
178
|
+
converted: convertedValue
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
} else if (Array.isArray(paramValue)) {
|
|
182
|
+
const originalArray = paramValue;
|
|
183
|
+
const convertedArray = [];
|
|
184
|
+
let arrayChanged = false;
|
|
185
|
+
for (const item of originalArray) {
|
|
186
|
+
if (typeof item === "string") {
|
|
187
|
+
const convertedItem = await this.convertParameterEntities(
|
|
188
|
+
item,
|
|
189
|
+
entities,
|
|
190
|
+
preferences
|
|
191
|
+
);
|
|
192
|
+
convertedArray.push(convertedItem);
|
|
193
|
+
if (convertedItem !== item) {
|
|
194
|
+
arrayChanged = true;
|
|
195
|
+
this.logger.info("Parameter array item conversion applied:", {
|
|
196
|
+
toolName,
|
|
197
|
+
paramName,
|
|
198
|
+
original: item,
|
|
199
|
+
converted: convertedItem
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
convertedArray.push(item);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (arrayChanged) {
|
|
207
|
+
processedParameters[paramName] = convertedArray;
|
|
208
|
+
hasChanges = true;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
this.logger.info("Tool parameter preprocessing completed:", {
|
|
213
|
+
toolName,
|
|
214
|
+
originalParams: Object.keys(parameters),
|
|
215
|
+
hasChanges,
|
|
216
|
+
sessionId
|
|
217
|
+
});
|
|
218
|
+
return processedParameters;
|
|
219
|
+
} catch (error) {
|
|
220
|
+
this.logger.warn("Tool parameter preprocessing failed:", {
|
|
221
|
+
toolName,
|
|
222
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
223
|
+
});
|
|
224
|
+
return parameters;
|
|
225
|
+
}
|
|
119
226
|
}
|
|
120
227
|
/**
|
|
121
|
-
*
|
|
228
|
+
* Convert entity references in a parameter value based on tool preferences
|
|
122
229
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
230
|
+
async convertParameterEntities(parameterValue, entities, preferences) {
|
|
231
|
+
let convertedValue = parameterValue;
|
|
232
|
+
for (const entity of entities) {
|
|
233
|
+
const containsEntityId = convertedValue.includes(entity.entityId);
|
|
234
|
+
const containsEntityName = convertedValue.includes(entity.entityName);
|
|
235
|
+
if (!containsEntityId && !containsEntityName) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
let targetFormat = null;
|
|
239
|
+
if (entity.entityType === EntityFormat.TOPIC_ID) {
|
|
240
|
+
if (preferences?.inscription === "hrl" || preferences?.topic === "hrl") {
|
|
241
|
+
targetFormat = EntityFormat.HRL;
|
|
242
|
+
} else if (preferences?.inscription === "topicId" || preferences?.topic === "topicId") {
|
|
243
|
+
targetFormat = EntityFormat.TOPIC_ID;
|
|
244
|
+
}
|
|
245
|
+
} else if (entity.entityType === EntityFormat.TOKEN_ID) {
|
|
246
|
+
if (preferences?.token === "tokenId") {
|
|
247
|
+
targetFormat = EntityFormat.TOKEN_ID;
|
|
248
|
+
} else if (preferences?.token === "symbol") {
|
|
249
|
+
targetFormat = EntityFormat.SYMBOL;
|
|
250
|
+
}
|
|
251
|
+
} else if (entity.entityType === EntityFormat.ACCOUNT_ID) {
|
|
252
|
+
if (preferences?.account === "accountId" || preferences?.supplyKey === "accountId" || preferences?.adminKey === "accountId") {
|
|
253
|
+
targetFormat = EntityFormat.ACCOUNT_ID;
|
|
254
|
+
} else if (preferences?.account === "alias") {
|
|
255
|
+
targetFormat = EntityFormat.ALIAS;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (targetFormat) {
|
|
259
|
+
try {
|
|
260
|
+
const context = {
|
|
261
|
+
networkType: this.networkType,
|
|
262
|
+
sessionId: "unknown"
|
|
263
|
+
};
|
|
264
|
+
if (preferences) {
|
|
265
|
+
context.toolPreferences = preferences;
|
|
266
|
+
}
|
|
267
|
+
const convertedEntityValue = await this.formatConverterRegistry.convertEntity(
|
|
268
|
+
entity.entityId,
|
|
269
|
+
targetFormat,
|
|
270
|
+
context
|
|
271
|
+
);
|
|
272
|
+
if (containsEntityId) {
|
|
273
|
+
convertedValue = convertedValue.replace(
|
|
274
|
+
new RegExp(`\\b${entity.entityId.replace(/\./g, "\\.")}\\b`, "g"),
|
|
275
|
+
convertedEntityValue
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
if (containsEntityName) {
|
|
279
|
+
convertedValue = convertedValue.replace(
|
|
280
|
+
new RegExp(
|
|
281
|
+
`\\b${entity.entityName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`,
|
|
282
|
+
"g"
|
|
283
|
+
),
|
|
284
|
+
convertedEntityValue
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
this.logger.info("Applied format conversion to parameter:", {
|
|
288
|
+
entityId: entity.entityId,
|
|
289
|
+
entityType: entity.entityType,
|
|
290
|
+
targetFormat,
|
|
291
|
+
convertedValue: convertedEntityValue,
|
|
292
|
+
parameterValue: convertedValue
|
|
293
|
+
});
|
|
294
|
+
} catch (error) {
|
|
295
|
+
this.logger.warn("Format conversion failed for parameter:", {
|
|
296
|
+
entityId: entity.entityId,
|
|
297
|
+
targetFormat,
|
|
298
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return convertedValue;
|
|
125
304
|
}
|
|
126
305
|
}
|
|
127
306
|
export {
|
|
128
|
-
|
|
307
|
+
ParameterService
|
|
129
308
|
};
|
|
130
309
|
//# sourceMappingURL=index30.js.map
|
package/dist/esm/index30.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index30.js","sources":["../../src/services/attachment-processor.ts"],"sourcesContent":["import { Logger } from '@hashgraphonline/standards-sdk';\nimport type { ContentStoreManager as PackageContentStoreManager } from './content-store-manager';\n\nexport interface AttachmentData {\n name: string;\n data: string;\n type: string;\n size: number;\n}\n\nexport type ContentStoreManager = PackageContentStoreManager;\n\n/**\n * Utility for processing file attachments and content references\n */\nexport class AttachmentProcessor {\n private logger: Logger;\n\n constructor() {\n this.logger = new Logger({ module: 'AttachmentProcessor' });\n }\n\n /**\n * Process attachments and create content references\n */\n async processAttachments(\n content: string,\n attachments: AttachmentData[],\n contentStoreManager?: ContentStoreManager\n ): Promise<string> {\n if (attachments.length === 0) {\n return content;\n }\n\n this.logger.info('Processing attachments with content reference system:', {\n attachmentCount: attachments.length,\n totalSize: attachments.reduce((sum, att) => sum + att.size, 0),\n });\n\n if (contentStoreManager && contentStoreManager.isInitialized()) {\n return this.processWithContentStore(content, attachments, contentStoreManager);\n } else {\n this.logger.warn('Content storage not available, creating simple file references');\n return this.processWithSimpleReferences(content, attachments);\n }\n }\n\n /**\n * Process attachments using content store manager\n */\n private async processWithContentStore(\n content: string,\n attachments: AttachmentData[],\n contentStoreManager: ContentStoreManager\n ): Promise<string> {\n const contentReferences: string[] = [];\n\n for (const attachment of attachments) {\n try {\n const base64Data = attachment.data.includes('base64,')\n ? attachment.data.split('base64,')[1]\n : attachment.data;\n const buffer = Buffer.from(base64Data, 'base64');\n\n const contentRef = await contentStoreManager.storeContentIfLarge(\n buffer,\n {\n mimeType: attachment.type,\n source: 'user_upload',\n fileName: attachment.name,\n tags: ['attachment', 'user_file'],\n }\n );\n\n if (contentRef) {\n if (attachment.type.startsWith('image/')) {\n contentReferences.push(\n `[Image File: ${attachment.name}] (content-ref:${contentRef.referenceId})`\n );\n } else {\n contentReferences.push(\n `[File: ${attachment.name}] (content-ref:${contentRef.referenceId})`\n );\n }\n } else {\n contentReferences.push(\n this.createInlineReference(attachment, base64Data)\n );\n }\n } catch (error) {\n this.logger.error('Failed to process attachment:', {\n fileName: attachment.name,\n error: error instanceof Error ? error.message : 'Unknown error',\n });\n contentReferences.push(\n `[File: ${attachment.name} - Error processing file: ${\n error instanceof Error ? error.message : 'Unknown error'\n }]`\n );\n }\n }\n\n const fileList = this.createFileList(attachments);\n return content\n ? `${content}\\n\\nAttached files:\\n${fileList}\\n\\n${contentReferences.join('\\n')}`\n : `Attached files:\\n${fileList}\\n\\n${contentReferences.join('\\n')}`;\n }\n\n /**\n * Process attachments with simple file references\n */\n private processWithSimpleReferences(content: string, attachments: AttachmentData[]): string {\n const fileReferences = attachments.map((attachment) => {\n const sizeStr = this.formatFileSize(attachment.size);\n\n if (attachment.type.startsWith('image/')) {\n return `📎 Image: ${attachment.name} (${sizeStr}, ${attachment.type})`;\n } else {\n return `📎 File: ${attachment.name} (${sizeStr}, ${attachment.type})`;\n }\n });\n\n return content\n ? `${content}\\n\\nAttached files:\\n${fileReferences.join('\\n')}`\n : `Attached files:\\n${fileReferences.join('\\n')}`;\n }\n\n /**\n * Create inline reference for small files\n */\n private createInlineReference(attachment: AttachmentData, base64Data: string): string {\n if (attachment.size < 50000) {\n if (attachment.type.startsWith('image/')) {\n return ``;\n } else {\n return `[File: ${attachment.name} (${this.formatFileSize(attachment.size)})]\\nContent: ${base64Data}`;\n }\n } else {\n return `[File: ${attachment.name} (${this.formatFileSize(attachment.size)}) - Content too large to include inline]`;\n }\n }\n\n /**\n * Create formatted file list\n */\n private createFileList(attachments: AttachmentData[]): string {\n return attachments\n .map((file) => {\n const sizeStr = this.formatFileSize(file.size);\n return `📎 ${file.name} (${sizeStr})`;\n })\n .join('\\n');\n }\n\n /**\n * Format file size for display\n */\n private formatFileSize(size: number): string {\n return size >= 1024 * 1024\n ? `${(size / (1024 * 1024)).toFixed(1)}MB`\n : `${(size / 1024).toFixed(1)}KB`;\n }\n}\n"],"names":[],"mappings":";AAeO,MAAM,oBAAoB;AAAA,EAG/B,cAAc;AACZ,SAAK,SAAS,IAAI,OAAO,EAAE,QAAQ,uBAAuB;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBACJ,SACA,aACA,qBACiB;AACjB,QAAI,YAAY,WAAW,GAAG;AAC5B,aAAO;AAAA,IACT;AAEA,SAAK,OAAO,KAAK,yDAAyD;AAAA,MACxE,iBAAiB,YAAY;AAAA,MAC7B,WAAW,YAAY,OAAO,CAAC,KAAK,QAAQ,MAAM,IAAI,MAAM,CAAC;AAAA,IAAA,CAC9D;AAED,QAAI,uBAAuB,oBAAoB,iBAAiB;AAC9D,aAAO,KAAK,wBAAwB,SAAS,aAAa,mBAAmB;AAAA,IAC/E,OAAO;AACL,WAAK,OAAO,KAAK,gEAAgE;AACjF,aAAO,KAAK,4BAA4B,SAAS,WAAW;AAAA,IAC9D;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,wBACZ,SACA,aACA,qBACiB;AACjB,UAAM,oBAA8B,CAAA;AAEpC,eAAW,cAAc,aAAa;AACpC,UAAI;AACF,cAAM,aAAa,WAAW,KAAK,SAAS,SAAS,IACjD,WAAW,KAAK,MAAM,SAAS,EAAE,CAAC,IAClC,WAAW;AACf,cAAM,SAAS,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AO,aAAa,WAAW,IAAI,KAAK,OAAO,KAAK,WAAW,IAAI;AAAA,MACrE,OAAO;AACL,eAAO,YAAY,WAAW,IAAI,KAAK,OAAO,KAAK,WAAW,IAAI;AAAA,MACpE;AAAA,IACF,CAAC;AAED,WAAO,UACH,GAAG,OAAO;AAAA;AAAA;AAAA,EAAwB,eAAe,KAAK,IAAI,CAAC,KAC3D;AAAA,EAAoB,eAAe,KAAK,IAAI,CAAC;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA,EAKQ,sBAAsB,YAA4B,YAA4B;AACpF,QAAI,WAAW,OAAO,KAAO;AAC3B,UAAI,WAAW,KAAK,WAAW,QAAQ,GAAG;AACxC,eAAO,KAAK,WAAW,IAAI,UAAU,WAAW,IAAI,WAAW,UAAU;AAAA,MAC3E,OAAO;AACL,eAAO,UAAU,WAAW,IAAI,KAAK,KAAK,eAAe,WAAW,IAAI,CAAC;AAAA,WAAgB,UAAU;AAAA,MACrG;AAAA,IACF,OAAO;AACL,aAAO,UAAU,WAAW,IAAI,KAAK,KAAK,eAAe,WAAW,IAAI,CAAC;AAAA,IAC3E;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKQ,eAAe,aAAuC;AAC5D,WAAO,YACJ,IAAI,CAAC,SAAS;AACb,YAAM,UAAU,KAAK,eAAe,KAAK,IAAI;AAC7C,aAAO,MAAM,KAAK,IAAI,KAAK,OAAO;AAAA,IACpC,CAAC,EACA,KAAK,IAAI;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKQ,eAAe,MAAsB;AAC3C,WAAO,QAAQ,OAAO,OAClB,IAAI,QAAQ,OAAO,OAAO,QAAQ,CAAC,CAAC,OACpC,IAAI,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,EACjC;AACF;"}
|
|
1
|
+
{"version":3,"file":"index30.js","sources":["../../src/services/parameter-service.ts"],"sourcesContent":["import { Logger, type NetworkType } from '@hashgraphonline/standards-sdk';\nimport { EntityFormat, FormatConverterRegistry } from './formatters';\nimport type { EntityAssociation } from '../memory/smart-memory-manager';\n\n/**\n * Service for processing tool parameters and applying entity format conversions\n */\nexport class ParameterService {\n private logger: Logger;\n private formatConverterRegistry: FormatConverterRegistry;\n private networkType: NetworkType;\n\n constructor(\n formatConverterRegistry: FormatConverterRegistry,\n networkType: NetworkType\n ) {\n this.logger = new Logger({ module: 'ParameterService' });\n this.formatConverterRegistry = formatConverterRegistry;\n this.networkType = networkType;\n }\n\n /**\n * Unified preprocessing entrypoint (DRY):\n * - Optional AI-driven resolution via provided entityResolver\n * - Deterministic post-pass for safe format enforcement\n */\n async preprocessParameters(\n toolName: string,\n parameters: Record<string, unknown>,\n entities: EntityAssociation[] = [],\n options?: {\n entityResolver?: {\n resolveReferences: (\n message: string,\n entities: EntityAssociation[]\n ) => Promise<string>;\n };\n sessionId?: string;\n preferences?: Record<string, string>;\n }\n ): Promise<Record<string, unknown>> {\n const sessionId = options?.sessionId;\n const entityResolver = options?.entityResolver;\n const preferences = options?.preferences;\n\n let working: Record<string, unknown> = { ...parameters };\n\n if (entityResolver && entities.length > 0) {\n try {\n this.logger.info('AI-driven preprocessing phase', {\n toolName,\n entityCount: entities.length,\n sessionId,\n });\n\n const aiProcessed: Record<string, unknown> = { ...working };\n for (const [paramName, paramValue] of Object.entries(working)) {\n if (typeof paramValue === 'string') {\n const resolved = await entityResolver.resolveReferences(\n paramValue,\n entities\n );\n const converted = await this.convertParameterEntities(\n resolved,\n entities,\n preferences\n );\n aiProcessed[paramName] = converted;\n } else if (Array.isArray(paramValue)) {\n const out: unknown[] = [];\n for (const item of paramValue) {\n if (typeof item === 'string') {\n const resolved = await entityResolver.resolveReferences(\n item,\n entities\n );\n const converted = await this.convertParameterEntities(\n resolved,\n entities,\n preferences\n );\n out.push(converted);\n } else {\n out.push(item);\n }\n }\n aiProcessed[paramName] = out;\n }\n }\n working = aiProcessed;\n } catch (error) {\n const message = error instanceof Error ? error.message : 'unknown';\n this.logger.warn(\n 'AI phase failed; continuing with deterministic pass',\n {\n toolName,\n error: message,\n }\n );\n }\n }\n\n try {\n const processed: Record<string, unknown> = { ...working };\n for (const [paramName, paramValue] of Object.entries(working)) {\n if (typeof paramValue === 'string') {\n const converted = await this.convertParameterEntities(\n paramValue,\n entities,\n preferences\n );\n processed[paramName] = converted;\n } else if (Array.isArray(paramValue)) {\n const out: unknown[] = [];\n for (const item of paramValue) {\n if (typeof item === 'string') {\n const converted = await this.convertParameterEntities(\n item,\n entities,\n preferences\n );\n out.push(converted);\n } else {\n out.push(item);\n }\n }\n processed[paramName] = out;\n }\n }\n working = processed;\n } catch (e) {\n this.logger.warn('Deterministic post-pass failed', {\n toolName,\n error: e instanceof Error ? e.message : 'unknown',\n });\n }\n\n return working;\n }\n\n /**\n * Attach unified preprocessing callback directly to the agent.\n */\n attachToAgent(\n agent: unknown,\n deps?: {\n getSessionId?: () => string | null;\n getEntities?: (sessionId: string | null) => Promise<EntityAssociation[]>;\n entityResolver?: {\n resolveReferences: (\n message: string,\n entities: EntityAssociation[]\n ) => Promise<string>;\n };\n }\n ): void {\n const getSessionId = deps?.getSessionId ?? (() => null);\n const getEntities =\n deps?.getEntities ?? (async () => [] as EntityAssociation[]);\n const entityResolver = deps?.entityResolver;\n\n const maybe = agent as {\n setParameterPreprocessingCallback?: (\n callback: (\n toolName: string,\n parameters: Record<string, unknown>,\n toolContext?: {\n entityResolutionPreferences?: Record<string, string>;\n }\n ) => Promise<Record<string, unknown>>\n ) => void;\n getAgent?: () => unknown;\n };\n\n const attach = (target: unknown): boolean => {\n const t = target as {\n setParameterPreprocessingCallback?: (\n callback: (\n toolName: string,\n parameters: Record<string, unknown>,\n toolContext?: {\n entityResolutionPreferences?: Record<string, string>;\n }\n ) => Promise<Record<string, unknown>>\n ) => void;\n };\n if (typeof t.setParameterPreprocessingCallback === 'function') {\n t.setParameterPreprocessingCallback(\n async (\n toolName: string,\n parameters: Record<string, unknown>\n ): Promise<Record<string, unknown>> => {\n const sessionId = getSessionId();\n const entities = await getEntities(sessionId);\n const opts: {\n entityResolver?: {\n resolveReferences: (\n message: string,\n entities: EntityAssociation[]\n ) => Promise<string>;\n };\n sessionId?: string;\n preferences?: Record<string, string>;\n } = {};\n if (entityResolver) {\n opts.entityResolver = entityResolver;\n }\n if (sessionId) {\n opts.sessionId = sessionId;\n }\n return this.preprocessParameters(toolName, parameters, entities, opts);\n }\n );\n this.logger.info('Parameter preprocessing callback attached');\n return true;\n }\n return false;\n };\n\n if (!attach(agent) && typeof maybe.getAgent === 'function') {\n const underlying = maybe.getAgent();\n if (underlying) {\n void attach(underlying);\n }\n }\n }\n\n /**\n * Preprocess tool parameters by applying format conversions based on tool's entity resolution preferences\n */\n async preprocessToolParameters(\n toolName: string,\n parameters: Record<string, unknown>,\n entities?: EntityAssociation[],\n sessionId?: string\n ): Promise<Record<string, unknown>> {\n try {\n if (!entities || entities.length === 0) {\n this.logger.info(\n 'Tool parameter preprocessing skipped - no entities provided:',\n {\n toolName,\n originalParams: Object.keys(parameters),\n }\n );\n return parameters;\n }\n\n const processedParameters = { ...parameters };\n const preferences: Record<string, string> | undefined = undefined;\n let hasChanges = false;\n\n for (const [paramName, paramValue] of Object.entries(parameters)) {\n if (typeof paramValue === 'string') {\n const convertedValue = await this.convertParameterEntities(\n paramValue,\n entities,\n preferences\n );\n\n if (convertedValue !== paramValue) {\n processedParameters[paramName] = convertedValue;\n hasChanges = true;\n\n this.logger.info('Parameter entity conversion applied:', {\n toolName,\n paramName,\n original: paramValue,\n converted: convertedValue,\n });\n }\n } else if (Array.isArray(paramValue)) {\n const originalArray = paramValue as unknown[];\n const convertedArray: unknown[] = [];\n let arrayChanged = false;\n\n for (const item of originalArray) {\n if (typeof item === 'string') {\n const convertedItem = await this.convertParameterEntities(\n item,\n entities,\n preferences\n );\n\n convertedArray.push(convertedItem);\n\n if (convertedItem !== item) {\n arrayChanged = true;\n this.logger.info('Parameter array item conversion applied:', {\n toolName,\n paramName,\n original: item,\n converted: convertedItem,\n });\n }\n } else {\n convertedArray.push(item);\n }\n }\n\n if (arrayChanged) {\n processedParameters[paramName] = convertedArray;\n hasChanges = true;\n }\n }\n }\n\n this.logger.info('Tool parameter preprocessing completed:', {\n toolName,\n originalParams: Object.keys(parameters),\n hasChanges,\n sessionId,\n });\n\n return processedParameters;\n } catch (error) {\n this.logger.warn('Tool parameter preprocessing failed:', {\n toolName,\n error: error instanceof Error ? error.message : 'Unknown error',\n });\n return parameters;\n }\n }\n\n /**\n * Convert entity references in a parameter value based on tool preferences\n */\n async convertParameterEntities(\n parameterValue: string,\n entities: EntityAssociation[],\n preferences?: Record<string, string>\n ): Promise<string> {\n let convertedValue = parameterValue;\n\n for (const entity of entities) {\n const containsEntityId = convertedValue.includes(entity.entityId);\n const containsEntityName = convertedValue.includes(entity.entityName);\n\n if (!containsEntityId && !containsEntityName) {\n continue;\n }\n\n let targetFormat: EntityFormat | null = null;\n\n if (entity.entityType === EntityFormat.TOPIC_ID) {\n if (\n preferences?.inscription === 'hrl' ||\n preferences?.topic === 'hrl'\n ) {\n targetFormat = EntityFormat.HRL;\n } else if (\n preferences?.inscription === 'topicId' ||\n preferences?.topic === 'topicId'\n ) {\n targetFormat = EntityFormat.TOPIC_ID;\n }\n } else if (entity.entityType === EntityFormat.TOKEN_ID) {\n if (preferences?.token === 'tokenId') {\n targetFormat = EntityFormat.TOKEN_ID;\n } else if (preferences?.token === 'symbol') {\n targetFormat = EntityFormat.SYMBOL;\n }\n } else if (entity.entityType === EntityFormat.ACCOUNT_ID) {\n if (\n preferences?.account === 'accountId' ||\n preferences?.supplyKey === 'accountId' ||\n preferences?.adminKey === 'accountId'\n ) {\n targetFormat = EntityFormat.ACCOUNT_ID;\n } else if (preferences?.account === 'alias') {\n targetFormat = EntityFormat.ALIAS;\n }\n }\n\n if (targetFormat) {\n try {\n const context: {\n networkType?: string | NetworkType;\n sessionId?: string;\n toolPreferences?: Record<string, string>;\n } = {\n networkType: this.networkType,\n sessionId: 'unknown',\n };\n if (preferences) {\n context.toolPreferences = preferences;\n }\n const convertedEntityValue = await this.formatConverterRegistry.convertEntity(\n entity.entityId,\n targetFormat,\n context as never\n );\n\n if (containsEntityId) {\n convertedValue = convertedValue.replace(\n new RegExp(`\\\\b${entity.entityId.replace(/\\./g, '\\\\.')}\\\\b`, 'g'),\n convertedEntityValue\n );\n }\n\n if (containsEntityName) {\n convertedValue = convertedValue.replace(\n new RegExp(\n `\\\\b${entity.entityName.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}\\\\b`,\n 'g'\n ),\n convertedEntityValue\n );\n }\n\n this.logger.info('Applied format conversion to parameter:', {\n entityId: entity.entityId,\n entityType: entity.entityType,\n targetFormat,\n convertedValue: convertedEntityValue,\n parameterValue: convertedValue,\n });\n } catch (error) {\n this.logger.warn('Format conversion failed for parameter:', {\n entityId: entity.entityId,\n targetFormat,\n error: error instanceof Error ? error.message : 'Unknown error',\n });\n }\n }\n }\n\n return convertedValue;\n }\n}\n"],"names":[],"mappings":";;;AAOO,MAAM,iBAAiB;AAAA,EAK5B,YACE,yBACA,aACA;AACA,SAAK,SAAS,IAAI,OAAO,EAAE,QAAQ,oBAAoB;AACvD,SAAK,0BAA0B;AAC/B,SAAK,cAAc;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,qBACJ,UACA,YACA,WAAgC,CAAA,GAChC,SAUkC;AAClC,UAAM,YAAY,SAAS;AAC3B,UAAM,iBAAiB,SAAS;AAChC,UAAM,cAAc,SAAS;AAE7B,QAAI,UAAmC,EAAE,GAAG,WAAA;AAE5C,QAAI,kBAAkB,SAAS,SAAS,GAAG;AACzC,UAAI;AACF,aAAK,OAAO,KAAK,iCAAiC;AAAA,UAChD;AAAA,UACA,aAAa,SAAS;AAAA,UACtB;AAAA,QAAA,CACD;AAED,cAAM,cAAuC,EAAE,GAAG,QAAA;AAClD,mBAAW,CAAC,WAAW,UAAU,KAAK,OAAO,QAAQ,OAAO,GAAG;AAC7D,cAAI,OAAO,eAAe,UA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