@hashgraphonline/conversational-agent 0.1.219 → 0.1.220

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraphonline/conversational-agent",
3
- "version": "0.1.219",
3
+ "version": "0.1.220",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/esm/index.js",
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "dependencies": {
97
97
  "@hashgraph/sdk": "^2.69.0",
98
- "@hashgraphonline/standards-agent-kit": "file:.yalc/@hashgraphonline/standards-agent-kit",
98
+ "@hashgraphonline/standards-agent-kit": "0.2.135",
99
99
  "@hashgraphonline/standards-sdk": "0.0.187",
100
100
  "@langchain/anthropic": "^0.3.26",
101
101
  "@langchain/core": "^0.3.71",
package/src/base-agent.ts CHANGED
@@ -12,6 +12,7 @@ import type { CostCalculation } from 'hedera-agent-kit';
12
12
  import type { AIProvider, VercelAIProvider, BAMLProvider } from './providers';
13
13
  import { Logger } from '@hashgraphonline/standards-sdk';
14
14
  import type { MCPServerConfig, MCPConnectionStatus } from './mcp/types';
15
+ import type { FormSubmission } from './forms/types';
15
16
 
16
17
  export interface ToolFilterConfig {
17
18
  namespaceWhitelist?: string[];
@@ -112,6 +113,9 @@ export abstract class BaseAgent {
112
113
  message: string,
113
114
  context?: ConversationContext
114
115
  ): Promise<ChatResponse>;
116
+ abstract processFormSubmission(
117
+ submission: FormSubmission
118
+ ): Promise<ChatResponse>;
115
119
  abstract shutdown(): Promise<void>;
116
120
  abstract switchMode(mode: OperationalMode): void;
117
121
  abstract getUsageStats(): UsageStats;
@@ -89,7 +89,8 @@ export interface ConversationalAgentOptions {
89
89
  * @returns A new instance of the ConversationalAgent class.
90
90
  */
91
91
  export class ConversationalAgent {
92
- private static readonly NOT_INITIALIZED_ERROR = 'Agent not initialized. Call initialize() first.';
92
+ private static readonly NOT_INITIALIZED_ERROR =
93
+ 'Agent not initialized. Call initialize() first.';
93
94
  protected agent?: AgentInstance;
94
95
  public hcs10Plugin: HCS10Plugin;
95
96
  public hcs2Plugin: HCS2Plugin;
@@ -333,18 +334,6 @@ export class ConversationalAgent {
333
334
  throw new Error(ConversationalAgent.NOT_INITIALIZED_ERROR);
334
335
  }
335
336
 
336
- const internalAgent = this.agent as {
337
- processFormSubmission?: (
338
- submission: FormSubmission
339
- ) => Promise<ChatResponse>;
340
- };
341
- if (
342
- !internalAgent.processFormSubmission ||
343
- typeof internalAgent.processFormSubmission !== 'function'
344
- ) {
345
- throw new Error('processFormSubmission not available on internal agent');
346
- }
347
-
348
337
  try {
349
338
  this.logger.info('Processing form submission:', {
350
339
  formId: submission.formId,
@@ -352,7 +341,7 @@ export class ConversationalAgent {
352
341
  parameterKeys: Object.keys(submission.parameters || {}),
353
342
  hasContext: !!submission.context,
354
343
  });
355
- const response = await internalAgent.processFormSubmission(submission);
344
+ const response = await this.agent.processFormSubmission(submission);
356
345
  this.logger.info('Form submission processed successfully');
357
346
  return response;
358
347
  } catch (error) {
@@ -29,15 +29,54 @@ interface HashLinkResponse {
29
29
  message: string;
30
30
  }
31
31
 
32
+ interface ToolWithOriginal {
33
+ originalTool?: {
34
+ call?: (args: Record<string, unknown>) => Promise<string>;
35
+ };
36
+ }
37
+
38
+ interface ActionWithToolInput {
39
+ toolInput?: Record<string, unknown>;
40
+ }
41
+
42
+ interface ZodSchemaDefinition {
43
+ _def?: {
44
+ typeName?: string;
45
+ shape?: (() => Record<string, z.ZodTypeAny>) | Record<string, z.ZodTypeAny>;
46
+ innerType?: z.ZodTypeAny;
47
+ defaultValue?: unknown;
48
+ };
49
+ }
50
+
51
+ interface ToolWrapper {
52
+ executeOriginal?: (args: Record<string, unknown>) => Promise<string>;
53
+ getOriginalTool?: () => {
54
+ _call?: (args: Record<string, unknown>) => Promise<string>;
55
+ call?: (args: Record<string, unknown>) => Promise<string>;
56
+ };
57
+ originalTool?: {
58
+ _call?: (args: Record<string, unknown>) => Promise<string>;
59
+ call?: (args: Record<string, unknown>) => Promise<string>;
60
+ };
61
+ call?: (args: Record<string, unknown>) => Promise<string>;
62
+ }
63
+
64
+ interface CallableTool {
65
+ _call?: (args: Record<string, unknown>) => Promise<string>;
66
+ call?: (args: Record<string, unknown>) => Promise<string>;
67
+ }
68
+
69
+ interface ToolWithSchema {
70
+ schema?: Record<string, unknown>;
71
+ }
72
+
32
73
  interface PendingFormData {
33
74
  toolName: string;
34
75
  originalInput: unknown;
35
76
  originalToolInput?: unknown;
36
77
  schema: unknown;
37
78
  toolRef?: ToolInterface | undefined;
38
- originalToolRef?:
39
- | { call?: (args: Record<string, unknown>) => Promise<string> }
40
- | undefined;
79
+ originalToolRef?: ToolWithOriginal['originalTool'];
41
80
  }
42
81
 
43
82
  interface ToolResponse {
@@ -368,13 +407,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
368
407
  originalToolInput: toolInput,
369
408
  schema: schemaToUse,
370
409
  toolRef: tool as ToolInterface | undefined,
371
- originalToolRef: (
372
- tool as unknown as {
373
- originalTool?: {
374
- call?: (args: Record<string, unknown>) => Promise<string>;
375
- };
376
- }
377
- ).originalTool,
410
+ originalToolRef: (tool as ToolWithOriginal).originalTool,
378
411
  };
379
412
  this.pendingForms.set(formMessage.id, formData);
380
413
  globalPendingForms.set(formMessage.id, formData);
@@ -416,7 +449,8 @@ export class FormAwareAgentExecutor extends AgentExecutor {
416
449
  typeof preprocessedInput === 'object' &&
417
450
  '__requestForm' in (preprocessedInput as Record<string, unknown>)
418
451
  ) {
419
- const rf = (preprocessedInput as Record<string, unknown>).__requestForm as {
452
+ const rf = (preprocessedInput as Record<string, unknown>)
453
+ .__requestForm as {
420
454
  id?: string;
421
455
  title?: string;
422
456
  description?: string;
@@ -430,7 +464,9 @@ export class FormAwareAgentExecutor extends AgentExecutor {
430
464
  submitLabel?: string;
431
465
  };
432
466
 
433
- const formId = rf.id || `form_${Date.now()}_${Math.random().toString(36).slice(2)}`;
467
+ const formId =
468
+ rf.id ||
469
+ `form_${Date.now()}_${Math.random().toString(36).slice(2)}`;
434
470
  const formMessage = {
435
471
  type: 'form',
436
472
  id: formId,
@@ -484,9 +520,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
484
520
  originalToolInput: toolInput,
485
521
  schema: resolvedSchema,
486
522
  toolRef: tool as ToolInterface | undefined,
487
- originalToolRef: (
488
- tool as unknown as { originalTool?: { call?: (a: Record<string, unknown>) => Promise<string> } }
489
- ).originalTool,
523
+ originalToolRef: (tool as ToolWithOriginal).originalTool,
490
524
  });
491
525
  globalPendingForms.set(formId, {
492
526
  toolName,
@@ -511,8 +545,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
511
545
  });
512
546
 
513
547
  try {
514
- (action as unknown as { toolInput?: Record<string, unknown> }).toolInput =
515
- preprocessedInput as Record<string, unknown>;
548
+ (action as ActionWithToolInput).toolInput = preprocessedInput;
516
549
  } catch {}
517
550
  } else {
518
551
  this.formLogger.debug(`No parameter changes needed for ${toolName}`);
@@ -543,15 +576,13 @@ export class FormAwareAgentExecutor extends AgentExecutor {
543
576
  }
544
577
 
545
578
  try {
546
- const obj = schema as { _def?: { typeName?: string; shape?: unknown } };
579
+ const obj = schema as ZodSchemaDefinition;
547
580
  const def = obj._def;
548
581
  if (!def || def.typeName !== 'ZodObject') {
549
582
  return false;
550
583
  }
551
584
  const rawShape: unknown =
552
- typeof (def as { shape?: unknown }).shape === 'function'
553
- ? (def as { shape: () => Record<string, z.ZodTypeAny> }).shape()
554
- : (def as { shape?: Record<string, z.ZodTypeAny> }).shape;
585
+ typeof def.shape === 'function' ? def.shape() : def.shape;
555
586
  if (!rawShape || typeof rawShape !== 'object') {
556
587
  return false;
557
588
  }
@@ -561,22 +592,14 @@ export class FormAwareAgentExecutor extends AgentExecutor {
561
592
  return false;
562
593
  }
563
594
  const unwrapOptional = (s: z.ZodTypeAny): z.ZodTypeAny => {
564
- const inner = (
565
- s as unknown as {
566
- _def?: { typeName?: string; innerType?: z.ZodTypeAny };
567
- }
568
- )._def;
595
+ const inner = (s as ZodSchemaDefinition)._def;
569
596
  if (inner && inner.typeName === 'ZodOptional' && inner.innerType) {
570
597
  return inner.innerType;
571
598
  }
572
599
  return s;
573
600
  };
574
601
  const unwrapped = unwrapOptional(fieldSchema);
575
- const fdef = (
576
- unwrapped as unknown as {
577
- _def?: { typeName?: string; defaultValue?: unknown };
578
- }
579
- )._def;
602
+ const fdef = (unwrapped as ZodSchemaDefinition)._def;
580
603
  if (!fdef) {
581
604
  return true;
582
605
  }
@@ -626,11 +649,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
626
649
  (t) => t.name === actionToolName
627
650
  ) as ToolInterface | undefined;
628
651
  const originalToolCandidate =
629
- (toolInstance as unknown as {
630
- originalTool?: {
631
- call?: (args: Record<string, unknown>) => Promise<string>;
632
- };
633
- }) || {};
652
+ (toolInstance as ToolWithOriginal) || {};
634
653
  const pf: PendingFormData = {
635
654
  toolName: actionToolName,
636
655
  originalInput: inputs,
@@ -901,35 +920,19 @@ export class FormAwareAgentExecutor extends AgentExecutor {
901
920
  }
902
921
 
903
922
  try {
904
- const maybeWrapper = tool as unknown as {
905
- executeOriginal?: (args: Record<string, unknown>) => Promise<string>;
906
- getOriginalTool?: () => {
907
- _call?: (args: Record<string, unknown>) => Promise<string>;
908
- call?: (args: Record<string, unknown>) => Promise<string>;
909
- };
910
- originalTool?: {
911
- _call?: (args: Record<string, unknown>) => Promise<string>;
912
- call?: (args: Record<string, unknown>) => Promise<string>;
913
- };
914
- call?: (args: Record<string, unknown>) => Promise<string>;
915
- };
923
+ const maybeWrapper = tool as ToolWrapper;
916
924
  let toolOutput: string;
917
925
  if (typeof maybeWrapper.executeOriginal === 'function') {
918
926
  toolOutput = await maybeWrapper.executeOriginal(mergedToolInput);
919
927
  } else if (typeof maybeWrapper.getOriginalTool === 'function') {
920
928
  const ot = maybeWrapper.getOriginalTool();
921
- const otCall = ot as unknown as {
922
- _call?: (a: Record<string, unknown>) => Promise<string>;
923
- call?: (a: Record<string, unknown>) => Promise<string>;
924
- };
929
+ const otCall = ot as CallableTool;
925
930
  if (ot && typeof otCall._call === 'function') {
926
931
  toolOutput = await otCall._call(mergedToolInput);
927
932
  } else if (ot && typeof otCall.call === 'function') {
928
933
  toolOutput = await otCall.call(mergedToolInput);
929
934
  } else {
930
- const tcall = tool as unknown as {
931
- call?: (a: Record<string, unknown>) => Promise<string>;
932
- };
935
+ const tcall = tool as CallableTool;
933
936
  if (typeof tcall.call === 'function') {
934
937
  toolOutput = await tcall.call(mergedToolInput);
935
938
  } else {
@@ -948,18 +951,8 @@ export class FormAwareAgentExecutor extends AgentExecutor {
948
951
  typeof maybeWrapper.originalTool.call === 'function'
949
952
  ) {
950
953
  toolOutput = await maybeWrapper.originalTool.call(mergedToolInput);
951
- } else if (
952
- typeof (
953
- tool as unknown as {
954
- call?: (a: Record<string, unknown>) => Promise<string>;
955
- }
956
- ).call === 'function'
957
- ) {
958
- toolOutput = await (
959
- tool as unknown as {
960
- call: (a: Record<string, unknown>) => Promise<string>;
961
- }
962
- ).call(mergedToolInput);
954
+ } else if (typeof (tool as CallableTool).call === 'function') {
955
+ toolOutput = await (tool as CallableTool).call!(mergedToolInput);
963
956
  } else {
964
957
  throw new Error(
965
958
  'No callable tool implementation found for form submission'
@@ -969,16 +962,6 @@ export class FormAwareAgentExecutor extends AgentExecutor {
969
962
  let responseMetadata: Record<string, unknown> = {};
970
963
  let formattedOutput: string;
971
964
 
972
- this.formLogger.info('🔍 METADATA EXTRACTION: Analyzing tool output', {
973
- outputType: typeof toolOutput,
974
- outputLength: toolOutput?.length || 0,
975
- isString: typeof toolOutput === 'string',
976
- firstChars:
977
- typeof toolOutput === 'string'
978
- ? toolOutput.substring(0, 100)
979
- : 'not-string',
980
- });
981
-
982
965
  try {
983
966
  const parsed = JSON.parse(toolOutput);
984
967
  this.formLogger.info(
@@ -1077,7 +1060,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
1077
1060
  );
1078
1061
  return {
1079
1062
  toolName: lastStep.action.tool,
1080
- schema: (tool as unknown as Record<string, unknown>).schema,
1063
+ schema: (tool as ToolWithSchema).schema,
1081
1064
  };
1082
1065
  }
1083
1066
  }
@@ -1102,7 +1085,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
1102
1085
  this.formLogger.info('Found tool from input steps:', action.tool);
1103
1086
  return {
1104
1087
  toolName: action.tool,
1105
- schema: (tool as unknown as Record<string, unknown>).schema,
1088
+ schema: (tool as ToolWithSchema).schema,
1106
1089
  };
1107
1090
  }
1108
1091
  }
@@ -1144,7 +1127,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
1144
1127
  if ('schema' in tool) {
1145
1128
  return {
1146
1129
  toolName: tool.name,
1147
- schema: (tool as unknown as Record<string, unknown>).schema,
1130
+ schema: (tool as ToolWithSchema).schema,
1148
1131
  };
1149
1132
  }
1150
1133
  }
@@ -1163,7 +1146,7 @@ export class FormAwareAgentExecutor extends AgentExecutor {
1163
1146
 
1164
1147
  for (const tool of this.tools) {
1165
1148
  if ('schema' in tool) {
1166
- const toolSchema = (tool as unknown as Record<string, unknown>).schema;
1149
+ const toolSchema = (tool as ToolWithSchema).schema;
1167
1150
  if (this.schemaMatchesErrorPaths(toolSchema, errorPaths)) {
1168
1151
  this.formLogger.info(
1169
1152
  'Detected tool from error path analysis:',
@@ -54,6 +54,21 @@ interface ToolExecutionData {
54
54
  type: string;
55
55
  formId?: string;
56
56
  parameters?: Record<string, unknown>;
57
+ toolName?: string;
58
+ }
59
+
60
+ interface ToolWithOriginal {
61
+ originalTool?: {
62
+ call?: (args: Record<string, unknown>) => Promise<string>;
63
+ };
64
+ }
65
+
66
+ interface ExecutorWithRestore {
67
+ restorePendingForms?: (p: Map<string, unknown>) => void;
68
+ }
69
+
70
+ interface ResultWithToolName {
71
+ toolName?: string;
57
72
  }
58
73
 
59
74
  interface IntermediateStep {
@@ -289,11 +304,7 @@ export class LangChainAgent extends BaseAgent {
289
304
  const mergedArgs = { ...processedParameters, renderForm: false };
290
305
 
291
306
  if (entry.wrapper) {
292
- const maybeWrapper = entry.tool as unknown as {
293
- originalTool?: {
294
- call?: (a: Record<string, unknown>) => Promise<string>;
295
- };
296
- };
307
+ const maybeWrapper = entry.tool as ToolWithOriginal;
297
308
  if (maybeWrapper.originalTool?.call) {
298
309
  return await maybeWrapper.originalTool.call(mergedArgs);
299
310
  }
@@ -342,8 +353,7 @@ export class LangChainAgent extends BaseAgent {
342
353
  string,
343
354
  unknown
344
355
  >;
345
- const toolName = (toolExecutionData as unknown as { toolName?: string })
346
- .toolName;
356
+ const toolName = toolExecutionData.toolName;
347
357
 
348
358
  if (toolName) {
349
359
  const toolOutput = await this.executeToolDirect(toolName, params);
@@ -359,8 +369,7 @@ export class LangChainAgent extends BaseAgent {
359
369
 
360
370
  const formSubmission: FormSubmission = {
361
371
  formId: toolExecutionData.formId,
362
- toolName:
363
- (toolExecutionData as unknown as { toolName?: string }).toolName || '',
372
+ toolName: toolExecutionData.toolName || '',
364
373
  parameters: toolExecutionData.parameters || {},
365
374
  timestamp: Date.now(),
366
375
  };
@@ -511,7 +520,7 @@ export class LangChainAgent extends BaseAgent {
511
520
  parsed =
512
521
  typeof toolOutput === 'string'
513
522
  ? (JSON.parse(toolOutput) as Record<string, unknown>)
514
- : (toolOutput as unknown as Record<string, unknown>);
523
+ : (toolOutput as Record<string, unknown>);
515
524
  } catch {}
516
525
 
517
526
  if (parsed && parsed['requiresForm'] && parsed['formMessage']) {
@@ -538,16 +547,10 @@ export class LangChainAgent extends BaseAgent {
538
547
  schema: null,
539
548
  });
540
549
 
541
- const maybeRestore = this.executor as unknown as {
542
- restorePendingForms?: (p: Map<string, unknown>) => void;
543
- };
550
+ const maybeRestore = this.executor as ExecutorWithRestore;
544
551
 
545
552
  if (typeof maybeRestore.restorePendingForms === 'function') {
546
- (
547
- maybeRestore.restorePendingForms as unknown as (
548
- p: Map<string, unknown>
549
- ) => void
550
- )(pending as unknown as Map<string, unknown>);
553
+ maybeRestore.restorePendingForms!(pending);
551
554
  }
552
555
 
553
556
  const outputMsg =
@@ -559,7 +562,7 @@ export class LangChainAgent extends BaseAgent {
559
562
  message: outputMsg,
560
563
  notes: [],
561
564
  requiresForm: true,
562
- formMessage: formMessage as unknown as ChatResponse['formMessage'],
565
+ formMessage: formMessage as ChatResponse['formMessage'],
563
566
  } as ChatResponse;
564
567
  }
565
568
  } catch {}
@@ -1079,39 +1082,11 @@ export class LangChainAgent extends BaseAgent {
1079
1082
  submission: FormSubmission,
1080
1083
  context?: ConversationContext
1081
1084
  ): Promise<ChatResponse> {
1082
- this.logger.info('🔥 LangChainAgent.processFormSubmission START');
1083
-
1084
1085
  if (!this.initialized || !this.executor || !this.smartMemory) {
1085
- this.logger.error(
1086
- '🔥 LangChainAgent.processFormSubmission - Agent not initialized'
1087
- );
1088
1086
  throw new Error('Agent not initialized. Call boot() first.');
1089
1087
  }
1090
1088
 
1091
- this.logger.info(
1092
- '🔥 LangChainAgent.processFormSubmission - After initialization check'
1093
- );
1094
-
1095
1089
  try {
1096
- this.logger.info(
1097
- '🔥 LangChainAgent.processFormSubmission - About to log submission info'
1098
- );
1099
-
1100
- this.logger.info('Processing form submission:', {
1101
- formId: submission.formId,
1102
- toolName: submission.toolName,
1103
- parameterKeys: Object.keys(submission.parameters || {}),
1104
- hasParameters: !!submission.parameters,
1105
- parametersType: typeof submission.parameters,
1106
- parametersIsNull: submission.parameters === null,
1107
- parametersIsUndefined: submission.parameters === undefined,
1108
- hasContext: !!submission.context,
1109
- });
1110
-
1111
- this.logger.info(
1112
- '🔥 LangChainAgent.processFormSubmission - After submission info logged'
1113
- );
1114
-
1115
1090
  if (!submission.parameters || typeof submission.parameters !== 'object') {
1116
1091
  this.logger.error('Invalid form submission parameters:', {
1117
1092
  parameters: submission.parameters,
@@ -1123,70 +1098,17 @@ export class LangChainAgent extends BaseAgent {
1123
1098
  );
1124
1099
  }
1125
1100
 
1126
- this.logger.info(
1127
- '🔥 LangChainAgent.processFormSubmission - Parameters validated'
1128
- );
1129
-
1130
1101
  this.loadContextMessages(context);
1131
1102
 
1132
- this.logger.info(
1133
- '🔥 LangChainAgent.processFormSubmission - Context loaded'
1134
- );
1135
-
1136
- try {
1137
- const currentMessages = this.smartMemory.getMessages();
1138
- this.logger.info('Current messages in memory (form path):', {
1139
- count: currentMessages.length,
1140
- messages: currentMessages.map((m) => m.content),
1141
- });
1142
- } catch {}
1143
-
1144
1103
  const safeSubmission = {
1145
1104
  ...submission,
1146
1105
  parameters: submission.parameters || {},
1147
1106
  };
1148
1107
 
1149
- this.logger.info(
1150
- '🔥 LangChainAgent.processFormSubmission - Safe submission created'
1151
- );
1152
-
1153
- this.logger.info('About to call executor.processFormSubmission with:', {
1154
- formId: safeSubmission.formId,
1155
- toolName: safeSubmission.toolName,
1156
- parameterKeys: Object.keys(safeSubmission.parameters),
1157
- parameterCount: Object.keys(safeSubmission.parameters).length,
1158
- });
1159
-
1160
1108
  const result = await this.executor.processFormSubmission(safeSubmission);
1161
1109
 
1162
- this.logger.info('🔍 DEBUG: Raw result from FormAwareAgentExecutor:', {
1163
- hasResult: !!result,
1164
- resultKeys: result ? Object.keys(result) : [],
1165
- hasMetadata: !!result?.metadata,
1166
- metadataKeys: result?.metadata ? Object.keys(result.metadata) : [],
1167
- hasHashLinkBlock: hasHashLinkBlock(result?.metadata),
1168
- hashLinkBlockContent: hasHashLinkBlock(result?.metadata)
1169
- ? result.metadata.hashLinkBlock
1170
- : undefined,
1171
- });
1172
-
1173
- if (result?.metadata) {
1174
- this.logger.info(
1175
- '🔍 DEBUG: Full metadata from executor:',
1176
- JSON.stringify(result.metadata)
1177
- );
1178
- }
1179
-
1180
1110
  const preservedMetadata = result?.metadata ? { ...result.metadata } : {};
1181
1111
 
1182
- this.logger.info('Executor processFormSubmission result:', {
1183
- hasResult: !!result,
1184
- hasOutput: !!result.output,
1185
- hasError: !!result.error,
1186
- hasMetadata: !!result.metadata,
1187
- outputType: typeof result.output,
1188
- });
1189
-
1190
1112
  try {
1191
1113
  const maybeRaw = (
1192
1114
  result as unknown as {
@@ -1194,8 +1116,7 @@ export class LangChainAgent extends BaseAgent {
1194
1116
  toolName?: string;
1195
1117
  }
1196
1118
  ).rawToolOutput;
1197
- const toolName =
1198
- (result as unknown as { toolName?: string }).toolName || 'unknown';
1119
+ const toolName = (result as ResultWithToolName).toolName || 'unknown';
1199
1120
  if (typeof maybeRaw === 'string' && maybeRaw.trim().length > 0) {
1200
1121
  const payload = this.isJSON(maybeRaw)
1201
1122
  ? maybeRaw
@@ -1235,7 +1156,6 @@ export class LangChainAgent extends BaseAgent {
1235
1156
  ? response.metadata.hashLinkBlock
1236
1157
  : undefined,
1237
1158
  });
1238
-
1239
1159
  }
1240
1160
 
1241
1161
  if (result.requiresForm && result.formMessage) {
@@ -1422,7 +1342,7 @@ export class LangChainAgent extends BaseAgent {
1422
1342
  new MessagesPlaceholder('agent_scratchpad'),
1423
1343
  ]);
1424
1344
 
1425
- const langchainTools = this.tools as unknown as StructuredTool[];
1345
+ const langchainTools = this.tools as StructuredTool[];
1426
1346
 
1427
1347
  const inscriptionTool = this.getInscriptionTool();
1428
1348
  if (inscriptionTool) {
@@ -124,11 +124,6 @@ export class FormatConverterRegistry {
124
124
  const networkType = (context.networkType as NetworkType) || 'testnet';
125
125
  const mirrorNode = new HederaMirrorNode(networkType, this.logger);
126
126
 
127
- mirrorNode.configureRetry({
128
- maxRetries: 3,
129
- maxDelayMs: 1000,
130
- });
131
-
132
127
  const checks = await Promise.allSettled([
133
128
  mirrorNode
134
129
  .getAccountBalance(entity)