@hashgraphonline/conversational-agent 0.1.215 → 0.1.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.
Files changed (123) hide show
  1. package/dist/cjs/conversational-agent.d.ts +8 -0
  2. package/dist/cjs/core/ToolRegistry.d.ts +130 -0
  3. package/dist/cjs/execution/ExecutionPipeline.d.ts +81 -0
  4. package/dist/cjs/forms/FormEngine.d.ts +121 -0
  5. package/dist/cjs/forms/form-generator.d.ts +39 -2
  6. package/dist/cjs/forms/types.d.ts +21 -2
  7. package/dist/cjs/index.cjs +1 -1
  8. package/dist/cjs/index.cjs.map +1 -1
  9. package/dist/cjs/index.d.ts +3 -4
  10. package/dist/cjs/langchain/FormAwareAgentExecutor.d.ts +53 -4
  11. package/dist/cjs/langchain/FormValidatingToolWrapper.d.ts +43 -6
  12. package/dist/cjs/langchain-agent.d.ts +49 -0
  13. package/dist/cjs/memory/ContentStorage.d.ts +7 -0
  14. package/dist/cjs/memory/SmartMemoryManager.d.ts +1 -0
  15. package/dist/cjs/services/ContentStoreManager.d.ts +11 -1
  16. package/dist/cjs/utils/ResponseFormatter.d.ts +26 -0
  17. package/dist/esm/index.js +2 -6
  18. package/dist/esm/index12.js +1 -1
  19. package/dist/esm/index12.js.map +1 -1
  20. package/dist/esm/index14.js +23 -5
  21. package/dist/esm/index14.js.map +1 -1
  22. package/dist/esm/index15.js +25 -4
  23. package/dist/esm/index15.js.map +1 -1
  24. package/dist/esm/index16.js +4 -2
  25. package/dist/esm/index16.js.map +1 -1
  26. package/dist/esm/index17.js +2 -7
  27. package/dist/esm/index17.js.map +1 -1
  28. package/dist/esm/index18.js +292 -150
  29. package/dist/esm/index18.js.map +1 -1
  30. package/dist/esm/index19.js +158 -65
  31. package/dist/esm/index19.js.map +1 -1
  32. package/dist/esm/index20.js +94 -270
  33. package/dist/esm/index20.js.map +1 -1
  34. package/dist/esm/index21.js +1 -1
  35. package/dist/esm/index23.js +14 -0
  36. package/dist/esm/index23.js.map +1 -1
  37. package/dist/esm/index24.js +508 -12
  38. package/dist/esm/index24.js.map +1 -1
  39. package/dist/esm/index25.js +1 -1
  40. package/dist/esm/index25.js.map +1 -1
  41. package/dist/esm/index26.js +1 -1
  42. package/dist/esm/index26.js.map +1 -1
  43. package/dist/esm/index27.js +189 -128
  44. package/dist/esm/index27.js.map +1 -1
  45. package/dist/esm/index28.js +164 -45
  46. package/dist/esm/index28.js.map +1 -1
  47. package/dist/esm/index29.js +302 -24
  48. package/dist/esm/index29.js.map +1 -1
  49. package/dist/esm/index30.js +144 -80
  50. package/dist/esm/index30.js.map +1 -1
  51. package/dist/esm/index31.js +63 -7
  52. package/dist/esm/index31.js.map +1 -1
  53. package/dist/esm/index32.js +24 -236
  54. package/dist/esm/index32.js.map +1 -1
  55. package/dist/esm/index33.js +95 -0
  56. package/dist/esm/index33.js.map +1 -0
  57. package/dist/esm/index34.js +245 -0
  58. package/dist/esm/index34.js.map +1 -0
  59. package/dist/esm/index5.js.map +1 -1
  60. package/dist/esm/index6.js +61 -22
  61. package/dist/esm/index6.js.map +1 -1
  62. package/dist/esm/index8.js +653 -131
  63. package/dist/esm/index8.js.map +1 -1
  64. package/dist/types/conversational-agent.d.ts +8 -0
  65. package/dist/types/core/ToolRegistry.d.ts +130 -0
  66. package/dist/types/execution/ExecutionPipeline.d.ts +81 -0
  67. package/dist/types/forms/FormEngine.d.ts +121 -0
  68. package/dist/types/forms/form-generator.d.ts +39 -2
  69. package/dist/types/forms/types.d.ts +21 -2
  70. package/dist/types/index.d.ts +3 -4
  71. package/dist/types/langchain/FormAwareAgentExecutor.d.ts +53 -4
  72. package/dist/types/langchain/FormValidatingToolWrapper.d.ts +43 -6
  73. package/dist/types/langchain-agent.d.ts +49 -0
  74. package/dist/types/memory/ContentStorage.d.ts +7 -0
  75. package/dist/types/memory/SmartMemoryManager.d.ts +1 -0
  76. package/dist/types/services/ContentStoreManager.d.ts +11 -1
  77. package/dist/types/utils/ResponseFormatter.d.ts +26 -0
  78. package/package.json +13 -10
  79. package/src/config/system-message.ts +14 -0
  80. package/src/context/ReferenceContextManager.ts +1 -1
  81. package/src/conversational-agent.ts +91 -36
  82. package/src/core/ToolRegistry.ts +358 -0
  83. package/src/execution/ExecutionPipeline.ts +301 -0
  84. package/src/forms/FormEngine.ts +443 -0
  85. package/src/forms/field-type-registry.ts +1 -13
  86. package/src/forms/form-generator.ts +394 -237
  87. package/src/forms/types.ts +20 -3
  88. package/src/index.ts +6 -10
  89. package/src/langchain/FormAwareAgentExecutor.ts +653 -22
  90. package/src/langchain/FormValidatingToolWrapper.ts +216 -93
  91. package/src/langchain-agent.ts +924 -185
  92. package/src/mcp/ContentProcessor.ts +20 -4
  93. package/src/mcp/MCPClientManager.ts +1 -1
  94. package/src/mcp/adapters/langchain.ts +1 -1
  95. package/src/memory/ContentStorage.ts +25 -5
  96. package/src/memory/SmartMemoryManager.ts +27 -4
  97. package/src/memory/TokenCounter.ts +1 -1
  98. package/src/plugins/hbar/HbarPlugin.ts +0 -1
  99. package/src/scripts/test-external-tool-wrapper.ts +3 -12
  100. package/src/scripts/test-hedera-kit-wrapper.ts +6 -22
  101. package/src/scripts/test-inscribe-form-generation.ts +24 -42
  102. package/src/scripts/test-inscribe-wrapper-verification.ts +1 -7
  103. package/src/services/ContentStoreManager.ts +23 -9
  104. package/src/services/EntityResolver.ts +2 -9
  105. package/src/tools/EntityResolverTool.ts +5 -8
  106. package/src/utils/ResponseFormatter.ts +146 -0
  107. package/dist/cjs/examples/external-tool-wrapper-example.d.ts +0 -131
  108. package/dist/cjs/langchain/ContentAwareAgentExecutor.d.ts +0 -14
  109. package/dist/cjs/langchain/external-tool-wrapper.d.ts +0 -179
  110. package/dist/cjs/scripts/test-external-tool-wrapper.d.ts +0 -5
  111. package/dist/cjs/scripts/test-hedera-kit-wrapper.d.ts +0 -36
  112. package/dist/cjs/scripts/test-inscribe-form-generation.d.ts +0 -15
  113. package/dist/cjs/scripts/test-inscribe-wrapper-verification.d.ts +0 -13
  114. package/dist/types/examples/external-tool-wrapper-example.d.ts +0 -131
  115. package/dist/types/langchain/ContentAwareAgentExecutor.d.ts +0 -14
  116. package/dist/types/langchain/external-tool-wrapper.d.ts +0 -179
  117. package/dist/types/scripts/test-external-tool-wrapper.d.ts +0 -5
  118. package/dist/types/scripts/test-hedera-kit-wrapper.d.ts +0 -36
  119. package/dist/types/scripts/test-inscribe-form-generation.d.ts +0 -15
  120. package/dist/types/scripts/test-inscribe-wrapper-verification.d.ts +0 -13
  121. package/src/examples/external-tool-wrapper-example.ts +0 -227
  122. package/src/langchain/ContentAwareAgentExecutor.ts +0 -19
  123. package/src/langchain/external-tool-wrapper.ts +0 -486
@@ -1,179 +0,0 @@
1
- import { StructuredTool } from '@langchain/core/tools';
2
- import { z } from 'zod';
3
- import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
4
- import { RenderConfigSchema } from '@hashgraphonline/standards-agent-kit';
5
-
6
- /**
7
- * Configuration for wrapping external tools with render configs
8
- */
9
- export interface ExternalToolWrapperConfig {
10
- renderConfig?: RenderConfigSchema;
11
- fieldConfigs?: Record<string, RenderConfigSchema>;
12
- ui?: {
13
- label?: string;
14
- description?: string;
15
- };
16
- preserveOriginalSchema?: boolean;
17
- }
18
- /**
19
- * Wrapper class that adds render configs to external tools
20
- */
21
- export declare class ExternalToolWrapper<TSchema extends z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny>> extends StructuredTool<TSchema> {
22
- private originalTool;
23
- private wrapperConfig;
24
- private logger;
25
- private enhancedSchema;
26
- name: string;
27
- description: string;
28
- schema: TSchema;
29
- constructor(originalTool: StructuredTool<TSchema>, config?: ExternalToolWrapperConfig);
30
- /**
31
- * Creates an enhanced schema with render configurations
32
- */
33
- private createEnhancedSchema;
34
- /**
35
- * Adds field-level render configurations to the schema
36
- */
37
- private addFieldRenderConfigs;
38
- /**
39
- * Adds render configuration to a specific field
40
- */
41
- private addRenderConfigToField;
42
- /**
43
- * Adds tool-level render configuration to the schema
44
- */
45
- private addToolRenderConfig;
46
- /**
47
- * Override _call to delegate to the original tool
48
- */
49
- protected _call(input: z.infer<TSchema>, runManager?: CallbackManagerForToolRun): Promise<string>;
50
- }
51
- /**
52
- * Predefined render config helpers for common field types
53
- */
54
- export declare const renderConfigs: {
55
- /**
56
- * Text input field configuration
57
- */
58
- text: (label: string, placeholder?: string, helpText?: string) => RenderConfigSchema;
59
- /**
60
- * Number input field configuration
61
- */
62
- number: (label: string, min?: number, max?: number, placeholder?: string) => RenderConfigSchema;
63
- /**
64
- * Select dropdown field configuration
65
- */
66
- select: (label: string, options: Array<{
67
- value: string | number;
68
- label: string;
69
- disabled?: boolean;
70
- }>, helpText?: string) => RenderConfigSchema;
71
- /**
72
- * Textarea field configuration
73
- */
74
- textarea: (label: string, placeholder?: string, maxLength?: number) => RenderConfigSchema;
75
- /**
76
- * Checkbox field configuration
77
- */
78
- checkbox: (label: string, helpText?: string) => RenderConfigSchema;
79
- /**
80
- * Currency field configuration
81
- */
82
- currency: (label: string, currency?: string, min?: number, max?: number) => RenderConfigSchema;
83
- /**
84
- * Account ID field configuration
85
- */
86
- accountId: (label?: string) => RenderConfigSchema;
87
- /**
88
- * Token ID field configuration
89
- */
90
- tokenId: (label?: string) => RenderConfigSchema;
91
- /**
92
- * Private key field configuration
93
- */
94
- privateKey: (label?: string) => RenderConfigSchema;
95
- };
96
- /**
97
- * Wraps an external tool with render configurations
98
- *
99
- * @param tool The external StructuredTool to wrap
100
- * @param config Configuration for render configs and UI
101
- * @returns Enhanced tool with render configurations
102
- *
103
- * @example
104
- * ```typescript
105
- * import { SomeHederaTool } from 'hedera-agent-kit';
106
- *
107
- * const externalTool = new SomeHederaTool();
108
- * const wrappedTool = wrapExternalToolWithRenderConfig(externalTool, {
109
- * renderConfig: {
110
- * fieldType: 'form',
111
- * ui: { label: 'Transfer HBAR', description: 'Transfer HBAR between accounts' }
112
- * },
113
- * fieldConfigs: {
114
- * fromAccountId: renderConfigs.accountId('From Account'),
115
- * toAccountId: renderConfigs.accountId('To Account'),
116
- * amount: renderConfigs.currency('Amount', 'HBAR', 0.00000001),
117
- * memo: renderConfigs.text('Memo', 'Optional memo', 'Transaction memo (optional)')
118
- * }
119
- * });
120
- * ```
121
- */
122
- export declare function wrapExternalToolWithRenderConfig<TSchema extends z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny>>(tool: StructuredTool<TSchema>, config?: ExternalToolWrapperConfig): ExternalToolWrapper<TSchema>;
123
- /**
124
- * Batch wrapper for multiple external tools
125
- *
126
- * @param tools Array of tools with their configurations
127
- * @returns Array of wrapped tools
128
- *
129
- * @example
130
- * ```typescript
131
- * const wrappedTools = wrapExternalTools([
132
- * {
133
- * tool: new TransferHbarTool(),
134
- * config: {
135
- * fieldConfigs: {
136
- * fromAccountId: renderConfigs.accountId('From Account'),
137
- * toAccountId: renderConfigs.accountId('To Account'),
138
- * amount: renderConfigs.currency('Amount', 'HBAR')
139
- * }
140
- * }
141
- * },
142
- * {
143
- * tool: new CreateTokenTool(),
144
- * config: {
145
- * fieldConfigs: {
146
- * treasuryAccountId: renderConfigs.accountId('Treasury Account'),
147
- * tokenName: renderConfigs.text('Token Name'),
148
- * tokenSymbol: renderConfigs.text('Token Symbol')
149
- * }
150
- * }
151
- * }
152
- * ]);
153
- * ```
154
- */
155
- export declare function wrapExternalTools<TSchema extends z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny>>(tools: Array<{
156
- tool: StructuredTool<TSchema>;
157
- config?: ExternalToolWrapperConfig;
158
- }>): ExternalToolWrapper<TSchema>[];
159
- /**
160
- * Configuration preset for common Hedera tools
161
- */
162
- export declare const hederaToolConfigs: {
163
- /**
164
- * Standard configuration for HBAR transfer tools
165
- */
166
- hbarTransfer: () => ExternalToolWrapperConfig;
167
- /**
168
- * Standard configuration for token creation tools
169
- */
170
- tokenCreation: () => ExternalToolWrapperConfig;
171
- /**
172
- * Standard configuration for account creation tools
173
- */
174
- accountCreation: () => ExternalToolWrapperConfig;
175
- /**
176
- * Standard configuration for smart contract tools
177
- */
178
- smartContract: () => ExternalToolWrapperConfig;
179
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * Test script for the external tool wrapper functionality
3
- * Run with: pnpm tsx src/scripts/test-external-tool-wrapper.ts
4
- */
5
- export {};
@@ -1,36 +0,0 @@
1
- /**
2
- * Test script to validate external tool wrapper functionality with hedera-agent-kit tools
3
- *
4
- * This test demonstrates that the external-tool-wrapper solution works successfully with
5
- * hedera-agent-kit tools by:
6
- *
7
- * 1. Creating mock tools that simulate hedera-agent-kit tool structure
8
- * 2. Wrapping them with render configurations using wrapExternalToolWithRenderConfig
9
- * 3. Integrating wrapped tools with FormValidatingToolWrapper
10
- * 4. Verifying form generation works with missing fields
11
- * 5. Testing batch wrapping with predefined configurations
12
- * 6. Confirming TypeScript type safety is maintained
13
- * 7. Validating tool delegation functionality is preserved
14
- *
15
- * Expected Output:
16
- * ✅ External tool wrapping with render configs works
17
- * ✅ Integration with FormValidatingToolWrapper works
18
- * ✅ Form generation for missing fields works
19
- * ✅ Batch wrapping with predefined configs works
20
- * ✅ TypeScript type safety maintained
21
- * ✅ Tool delegation functionality preserved
22
- *
23
- * Acceptance Criteria Met:
24
- * - Test runs successfully ✅
25
- * - Uses realistic hedera-agent-kit tool structure ✅
26
- * - Demonstrates external tool wrapping works ✅
27
- * - No TypeScript errors or linting violations ✅
28
- * - Shows form generation integration ✅
29
- * - Validates render config enhancement ✅
30
- */
31
- declare function testHederaKitWrapper(): Promise<void>;
32
- /**
33
- * Demonstrate specific render config scenarios
34
- */
35
- declare function demonstrateRenderConfigs(): void;
36
- export { testHederaKitWrapper, demonstrateRenderConfigs };
@@ -1,15 +0,0 @@
1
- /**
2
- * Test script to verify that InscribeHashinalTool generates a form when attributes field is missing
3
- *
4
- * This script tests the end-to-end form generation functionality for the InscribeHashinalTool
5
- * when required fields are missing from the input.
6
- *
7
- * Expected behavior:
8
- * 1. Tool should be wrapped with FormValidatingToolWrapper (due to extendZodSchema)
9
- * 2. When attributes field is missing, validation should fail
10
- * 3. A form should be generated containing the missing attributes field
11
- * 4. Tool should NOT execute directly but return form generation response
12
- *
13
- * Run with: pnpm tsx src/scripts/test-inscribe-form-generation.ts
14
- */
15
- export {};
@@ -1,13 +0,0 @@
1
- /**
2
- * Simplified test script to verify that InscribeHashinalTool is wrapped with FormValidatingToolWrapper
3
- *
4
- * This script verifies the fix for isZodObjectLike detection in langchain-agent.ts
5
- *
6
- * Expected behavior:
7
- * 1. InscribeHashinalTool should be detected as having extendZodSchema with render config
8
- * 2. Tool should be wrapped with FormValidatingToolWrapper during initialization
9
- * 3. Wrapper type should be confirmed in the tools array
10
- *
11
- * Run with: pnpm tsx src/scripts/test-inscribe-wrapper-verification.ts
12
- */
13
- export {};
@@ -1,227 +0,0 @@
1
- /**
2
- * Example demonstrating how to wrap external tools with render configs
3
- * This example shows how to wrap tools from hedera-agent-kit with form configurations
4
- */
5
-
6
- import { z } from 'zod';
7
- import { StructuredTool } from '@langchain/core/tools';
8
- import {
9
- wrapExternalToolWithRenderConfig,
10
- wrapExternalTools,
11
- renderConfigs,
12
- hederaToolConfigs
13
- } from '../langchain/external-tool-wrapper';
14
- import { FormGenerator } from '../forms/form-generator';
15
- import { wrapToolWithFormValidation } from '../langchain/FormValidatingToolWrapper';
16
-
17
- // Example: Mock external tool from hedera-agent-kit
18
- class MockTransferHbarTool extends StructuredTool {
19
- name = 'transfer_hbar';
20
- description = 'Transfer HBAR between accounts';
21
-
22
- schema = z.object({
23
- fromAccountId: z.string().describe('Source account ID'),
24
- toAccountId: z.string().describe('Destination account ID'),
25
- amount: z.number().describe('Amount to transfer in tinybars'),
26
- memo: z.string().optional().describe('Optional transaction memo')
27
- });
28
-
29
- protected async _call(input: z.infer<typeof this.schema>): Promise<string> {
30
- // Mock implementation
31
- return `Transferred ${input.amount} tinybars from ${input.fromAccountId} to ${input.toAccountId}${input.memo ? ` with memo: ${input.memo}` : ''}`;
32
- }
33
- }
34
-
35
- class MockCreateTokenTool extends StructuredTool {
36
- name = 'create_token';
37
- description = 'Create a new token on Hedera';
38
-
39
- schema = z.object({
40
- treasuryAccountId: z.string().describe('Treasury account ID'),
41
- tokenName: z.string().describe('Token name'),
42
- tokenSymbol: z.string().describe('Token symbol'),
43
- maxSupply: z.number().optional().describe('Maximum token supply'),
44
- decimals: z.number().optional().describe('Number of decimal places')
45
- });
46
-
47
- protected async _call(input: z.infer<typeof this.schema>): Promise<string> {
48
- // Mock implementation
49
- return `Created token ${input.tokenSymbol} (${input.tokenName}) with treasury ${input.treasuryAccountId}`;
50
- }
51
- }
52
-
53
- /**
54
- * Example 1: Basic external tool wrapping with custom render configs
55
- */
56
- export function exampleBasicWrapping() {
57
- const externalTool = new MockTransferHbarTool();
58
-
59
- const wrappedTool = wrapExternalToolWithRenderConfig(externalTool, {
60
- renderConfig: {
61
- fieldType: 'object',
62
- ui: {
63
- label: 'Transfer HBAR',
64
- description: 'Transfer HBAR between accounts'
65
- }
66
- },
67
- fieldConfigs: {
68
- fromAccountId: renderConfigs.accountId('From Account'),
69
- toAccountId: renderConfigs.accountId('To Account'),
70
- amount: renderConfigs.currency('Amount', 'HBAR', 0.00000001),
71
- memo: renderConfigs.text('Memo', 'Optional memo', 'Transaction memo (optional)')
72
- }
73
- });
74
-
75
- console.log('Wrapped tool name:', wrappedTool.name);
76
- console.log('Wrapped tool description:', wrappedTool.description);
77
- console.log('Schema has render config:', !!(wrappedTool.schema as any)._renderConfig);
78
-
79
- return wrappedTool;
80
- }
81
-
82
- /**
83
- * Example 2: Using predefined configurations for common Hedera tools
84
- */
85
- export function examplePresetConfigurations() {
86
- const externalTool = new MockTransferHbarTool();
87
-
88
- const wrappedTool = wrapExternalToolWithRenderConfig(
89
- externalTool,
90
- hederaToolConfigs.hbarTransfer()
91
- );
92
-
93
- return wrappedTool;
94
- }
95
-
96
- /**
97
- * Example 3: Batch wrapping multiple tools
98
- */
99
- export function exampleBatchWrapping() {
100
- const transferTool = new MockTransferHbarTool();
101
- const createTokenTool = new MockCreateTokenTool();
102
-
103
- const wrappedTools = [
104
- wrapExternalToolWithRenderConfig(transferTool, hederaToolConfigs.hbarTransfer()),
105
- wrapExternalToolWithRenderConfig(createTokenTool, hederaToolConfigs.tokenCreation())
106
- ];
107
-
108
- console.log(`Wrapped ${wrappedTools.length} tools`);
109
-
110
- return wrappedTools;
111
- }
112
-
113
- /**
114
- * Example 4: Integration with FormValidatingToolWrapper
115
- */
116
- export function exampleFormValidationIntegration() {
117
- const externalTool = new MockTransferHbarTool();
118
-
119
- // Step 1: Wrap with render configs
120
- const wrappedTool = wrapExternalToolWithRenderConfig(externalTool, {
121
- fieldConfigs: {
122
- fromAccountId: renderConfigs.accountId('From Account'),
123
- toAccountId: renderConfigs.accountId('To Account'),
124
- amount: renderConfigs.currency('Amount', 'HBAR', 0.00000001),
125
- memo: renderConfigs.text('Memo', 'Optional memo')
126
- }
127
- });
128
-
129
- // Step 2: Wrap with form validation
130
- const formGenerator = new FormGenerator();
131
- const formValidatingTool = wrapToolWithFormValidation(
132
- wrappedTool,
133
- formGenerator,
134
- {
135
- requireAllFields: false,
136
- skipFields: ['memo'] // memo is optional
137
- }
138
- );
139
-
140
- console.log('Fully wrapped tool ready for form generation');
141
-
142
- return formValidatingTool;
143
- }
144
-
145
- /**
146
- * Example 5: Custom field configurations for specialized tools
147
- */
148
- export function exampleCustomFieldConfigs() {
149
- const externalTool = new MockCreateTokenTool();
150
-
151
- const wrappedTool = wrapExternalToolWithRenderConfig(externalTool, {
152
- ui: {
153
- label: 'Create Hedera Token',
154
- description: 'Create a new fungible token on Hedera'
155
- },
156
- fieldConfigs: {
157
- treasuryAccountId: renderConfigs.accountId('Treasury Account'),
158
- tokenName: renderConfigs.text('Token Name', 'My Awesome Token'),
159
- tokenSymbol: renderConfigs.text('Symbol', 'MAT', '3-6 characters recommended'),
160
- maxSupply: renderConfigs.number('Max Supply', 1, 9223372036854775807, 'Leave blank for infinite'),
161
- decimals: renderConfigs.select(
162
- 'Decimals',
163
- [
164
- { value: 0, label: '0 (whole numbers only)' },
165
- { value: 2, label: '2 (like USD cents)' },
166
- { value: 8, label: '8 (like Bitcoin)' },
167
- { value: 18, label: '18 (like Ethereum)' }
168
- ],
169
- 'Number of decimal places for the token'
170
- )
171
- }
172
- });
173
-
174
- return wrappedTool;
175
- }
176
-
177
- /**
178
- * Example 6: Working with actual hedera-agent-kit tools
179
- * This example shows how you would wrap real tools from the hedera-agent-kit package
180
- */
181
- export function exampleRealHederaAgentKitTools() {
182
- // This is how you would import and wrap real tools from hedera-agent-kit:
183
-
184
- /*
185
- import {
186
- HederaCreateAccountTool,
187
- HederaTransferTool,
188
- HederaCreateTokenTool
189
- } from 'hedera-agent-kit';
190
-
191
- const createAccountTool = new HederaCreateAccountTool();
192
- const transferTool = new HederaTransferTool();
193
- const createTokenTool = new HederaCreateTokenTool();
194
-
195
- const wrappedTools = wrapExternalTools([
196
- {
197
- tool: createAccountTool,
198
- config: hederaToolConfigs.accountCreation()
199
- },
200
- {
201
- tool: transferTool,
202
- config: hederaToolConfigs.hbarTransfer()
203
- },
204
- {
205
- tool: createTokenTool,
206
- config: hederaToolConfigs.tokenCreation()
207
- }
208
- ]);
209
-
210
- return wrappedTools;
211
- */
212
-
213
- console.log('This example shows how to wrap real hedera-agent-kit tools');
214
- console.log('Uncomment the code above to use with actual hedera-agent-kit tools');
215
-
216
- return [];
217
- }
218
-
219
- // Export all examples for easy testing
220
- export const examples = {
221
- basicWrapping: exampleBasicWrapping,
222
- presetConfigurations: examplePresetConfigurations,
223
- batchWrapping: exampleBatchWrapping,
224
- formValidationIntegration: exampleFormValidationIntegration,
225
- customFieldConfigs: exampleCustomFieldConfigs,
226
- realHederaAgentKitTools: exampleRealHederaAgentKitTools
227
- };
@@ -1,19 +0,0 @@
1
- import { AgentExecutor } from 'langchain/agents';
2
- import { Logger } from '@hashgraphonline/standards-sdk';
3
-
4
- /**
5
- * Custom AgentExecutor that intercepts large tool outputs and converts them to content references
6
- * before they are sent to the LLM to avoid token limit issues.
7
- *
8
- * Note: The content reference conversion is already handled in the MCP adapter,
9
- * so this class currently just extends AgentExecutor without modifications.
10
- * We keep it as a placeholder for future enhancements.
11
- */
12
- export class ContentAwareAgentExecutor extends AgentExecutor {
13
- private logger: Logger;
14
-
15
- constructor(config: any) {
16
- super(config);
17
- this.logger = new Logger({ module: 'ContentAwareAgentExecutor' });
18
- }
19
- }