@hashgraphonline/conversational-agent 0.2.214 → 0.2.216

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.
@@ -4,7 +4,7 @@ import { Logger } from "@hashgraphonline/standards-sdk";
4
4
  import { fieldTypeRegistry } from "./index12.js";
5
5
  import { fieldGuidanceRegistry } from "./index13.js";
6
6
  import "./index43.js";
7
- import { FIELD_PRIORITIES } from "./index46.js";
7
+ import { FIELD_PRIORITIES } from "./index48.js";
8
8
  function isZodObjectSchema(schema) {
9
9
  return typeof schema === "object" && schema !== null && "shape" in schema;
10
10
  }
@@ -1,5 +1,5 @@
1
1
  import { ReferenceIdGenerator } from "./index22.js";
2
- import { DEFAULT_CONTENT_REFERENCE_CONFIG, ContentReferenceError } from "./index47.js";
2
+ import { DEFAULT_CONTENT_REFERENCE_CONFIG, ContentReferenceError } from "./index46.js";
3
3
  const _ContentStorage = class _ContentStorage {
4
4
  constructor(maxStorage = _ContentStorage.DEFAULT_MAX_STORAGE, referenceConfig) {
5
5
  this.messages = [];
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { AccountBuilder } from "./index48.js";
2
+ import { AccountBuilder } from "./index47.js";
3
3
  import { BaseHederaTransactionTool } from "hedera-agent-kit";
4
4
  const HbarTransferInputSchema = z.object({
5
5
  accountId: z.string().describe('Account ID for the transfer (e.g., "0.0.xxxx").'),
@@ -1,10 +1,30 @@
1
- const FIELD_PRIORITIES = {
2
- ESSENTIAL: "essential",
3
- COMMON: "common",
4
- ADVANCED: "advanced",
5
- EXPERT: "expert"
1
+ const DEFAULT_CONTENT_REFERENCE_CONFIG = {
2
+ sizeThresholdBytes: 10 * 1024,
3
+ maxAgeMs: 60 * 60 * 1e3,
4
+ maxReferences: 100,
5
+ maxTotalStorageBytes: 100 * 1024 * 1024,
6
+ enableAutoCleanup: true,
7
+ cleanupIntervalMs: 5 * 60 * 1e3,
8
+ enablePersistence: false,
9
+ storageBackend: "memory",
10
+ cleanupPolicies: {
11
+ recent: { maxAgeMs: 30 * 60 * 1e3, priority: 1 },
12
+ userContent: { maxAgeMs: 2 * 60 * 60 * 1e3, priority: 2 },
13
+ agentGenerated: { maxAgeMs: 60 * 60 * 1e3, priority: 3 },
14
+ default: { maxAgeMs: 60 * 60 * 1e3, priority: 4 }
15
+ }
6
16
  };
17
+ class ContentReferenceError extends Error {
18
+ constructor(message, type, referenceId, suggestedActions) {
19
+ super(message);
20
+ this.type = type;
21
+ this.referenceId = referenceId;
22
+ this.suggestedActions = suggestedActions;
23
+ this.name = "ContentReferenceError";
24
+ }
25
+ }
7
26
  export {
8
- FIELD_PRIORITIES
27
+ ContentReferenceError,
28
+ DEFAULT_CONTENT_REFERENCE_CONFIG
9
29
  };
10
30
  //# sourceMappingURL=index46.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index46.js","sources":["../../src/constants/form-priorities.ts"],"sourcesContent":["/**\n * Form field priorities for progressive disclosure\n */\nexport const FIELD_PRIORITIES = {\n ESSENTIAL: 'essential',\n COMMON: 'common', \n ADVANCED: 'advanced',\n EXPERT: 'expert'\n} as const;\n\n/**\n * Form field types\n */\nexport const FORM_FIELD_TYPES = {\n TEXT: 'text',\n NUMBER: 'number',\n SELECT: 'select',\n CHECKBOX: 'checkbox',\n TEXTAREA: 'textarea',\n FILE: 'file',\n ARRAY: 'array',\n OBJECT: 'object',\n CURRENCY: 'currency',\n PERCENTAGE: 'percentage',\n} as const;"],"names":[],"mappings":"AAGO,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,QAAQ;AACV;"}
1
+ {"version":3,"file":"index46.js","sources":["../../src/types/content-reference.ts"],"sourcesContent":["/**\n * Content Reference System Types\n *\n * Shared interfaces for the Reference-Based Content System that handles\n * large content storage with unique reference IDs to optimize context window usage.\n */\n\n/**\n * Unique identifier for stored content references\n * Format: Cryptographically secure 32-byte identifier with base64url encoding\n */\nexport type ReferenceId = string;\n\n/**\n * Lifecycle state of a content reference\n */\nexport type ReferenceLifecycleState =\n | 'active'\n | 'expired'\n | 'cleanup_pending'\n | 'invalid';\n\n/**\n * Content types supported by the reference system\n */\nexport type ContentType =\n | 'text'\n | 'json'\n | 'html'\n | 'markdown'\n | 'binary'\n | 'unknown';\n\n/**\n * Sources that created the content reference\n */\nexport type ContentSource =\n | 'mcp_tool'\n | 'user_upload'\n | 'agent_generated'\n | 'system';\n\n/**\n * Metadata associated with stored content\n */\nexport interface ContentMetadata {\n /** Content type classification */\n contentType: ContentType;\n\n /** MIME type of the original content */\n mimeType?: string;\n\n /** Size in bytes of the stored content */\n sizeBytes: number;\n\n /** When the content was originally stored */\n createdAt: Date;\n\n /** Last time the content was accessed via reference resolution */\n lastAccessedAt: Date;\n\n /** Source that created this content reference */\n source: ContentSource;\n\n /** Name of the MCP tool that generated the content (if applicable) */\n mcpToolName?: string;\n\n /** Original filename or suggested name for the content */\n fileName?: string;\n\n /** Number of times this reference has been resolved */\n accessCount: number;\n\n /** Tags for categorization and cleanup policies */\n tags?: string[];\n\n /** Custom metadata from the source */\n customMetadata?: Record<string, unknown>;\n}\n\n/**\n * Core content reference object passed through agent context\n * Designed to be lightweight (<100 tokens) while providing enough\n * information for agent decision-making\n */\nexport interface ContentReference {\n /** Unique identifier for resolving the content */\n referenceId: ReferenceId;\n\n /** Current lifecycle state */\n state: ReferenceLifecycleState;\n\n /** Brief description or preview of the content (max 200 chars) */\n preview: string;\n\n /** Essential metadata for agent decision-making */\n metadata: Pick<\n ContentMetadata,\n 'contentType' | 'sizeBytes' | 'source' | 'fileName' | 'mimeType'\n >;\n\n /** When this reference was created */\n createdAt: Date;\n\n /** Special format indicator for reference IDs in content */\n readonly format: 'ref://{id}';\n}\n\n/**\n * Result of attempting to resolve a content reference\n */\nexport interface ReferenceResolutionResult {\n /** Whether the resolution was successful */\n success: boolean;\n\n /** The resolved content if successful */\n content?: Buffer;\n\n /** Complete metadata if successful */\n metadata?: ContentMetadata;\n\n /** Error message if resolution failed */\n error?: string;\n\n /** Specific error type for targeted error handling */\n errorType?:\n | 'not_found'\n | 'expired'\n | 'corrupted'\n | 'access_denied'\n | 'system_error';\n\n /** Suggested actions for recovery */\n suggestedActions?: string[];\n}\n\n/**\n * Configuration for content reference storage and lifecycle\n */\nexport interface ContentReferenceConfig {\n /** Size threshold above which content should be stored as references (default: 10KB) */\n sizeThresholdBytes: number;\n\n /** Maximum age for unused references before cleanup (default: 1 hour) */\n maxAgeMs: number;\n\n /** Maximum number of references to store simultaneously */\n maxReferences: number;\n\n /** Maximum total storage size for all references */\n maxTotalStorageBytes: number;\n\n /** Whether to enable automatic cleanup */\n enableAutoCleanup: boolean;\n\n /** Interval for cleanup checks in milliseconds */\n cleanupIntervalMs: number;\n\n /** Whether to persist references across restarts */\n enablePersistence: boolean;\n\n /** Storage backend configuration */\n storageBackend: 'memory' | 'filesystem' | 'hybrid';\n\n /** Cleanup policies for different content types */\n cleanupPolicies: {\n /** Policy for content marked as \"recent\" from MCP tools */\n recent: { maxAgeMs: number; priority: number };\n\n /** Policy for user-uploaded content */\n userContent: { maxAgeMs: number; priority: number };\n\n /** Policy for agent-generated content */\n agentGenerated: { maxAgeMs: number; priority: number };\n\n /** Default policy for other content */\n default: { maxAgeMs: number; priority: number };\n };\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONTENT_REFERENCE_CONFIG: ContentReferenceConfig = {\n sizeThresholdBytes: 10 * 1024,\n maxAgeMs: 60 * 60 * 1000,\n maxReferences: 100,\n maxTotalStorageBytes: 100 * 1024 * 1024,\n enableAutoCleanup: true,\n cleanupIntervalMs: 5 * 60 * 1000,\n enablePersistence: false,\n storageBackend: 'memory',\n cleanupPolicies: {\n recent: { maxAgeMs: 30 * 60 * 1000, priority: 1 },\n userContent: { maxAgeMs: 2 * 60 * 60 * 1000, priority: 2 },\n agentGenerated: { maxAgeMs: 60 * 60 * 1000, priority: 3 },\n default: { maxAgeMs: 60 * 60 * 1000, priority: 4 },\n },\n};\n\n/**\n * Statistics about content reference usage and storage\n */\nexport interface ContentReferenceStats {\n /** Total number of active references */\n activeReferences: number;\n\n /** Total storage used by all references in bytes */\n totalStorageBytes: number;\n\n /** Number of references cleaned up in last cleanup cycle */\n recentlyCleanedUp: number;\n\n /** Number of successful reference resolutions since startup */\n totalResolutions: number;\n\n /** Number of failed resolution attempts */\n failedResolutions: number;\n\n /** Average content size in bytes */\n averageContentSize: number;\n\n /** Most frequently accessed reference ID */\n mostAccessedReferenceId?: ReferenceId;\n\n /** Storage utilization percentage */\n storageUtilization: number;\n\n /** Performance metrics */\n performanceMetrics: {\n /** Average time to create a reference in milliseconds */\n averageCreationTimeMs: number;\n\n /** Average time to resolve a reference in milliseconds */\n averageResolutionTimeMs: number;\n\n /** Average cleanup time in milliseconds */\n averageCleanupTimeMs: number;\n };\n}\n\n/**\n * Error types for content reference operations\n */\nexport class ContentReferenceError extends Error {\n constructor(\n message: string,\n public readonly type: ReferenceResolutionResult['errorType'],\n public readonly referenceId?: ReferenceId,\n public readonly suggestedActions?: string[]\n ) {\n super(message);\n this.name = 'ContentReferenceError';\n }\n}\n\n/**\n * Interface for content reference storage implementations\n */\nexport interface ContentReferenceStore {\n /**\n * Store content and return a reference\n */\n storeContent(\n content: Buffer,\n metadata: Omit<\n ContentMetadata,\n 'createdAt' | 'lastAccessedAt' | 'accessCount'\n >\n ): Promise<ContentReference>;\n\n /**\n * Resolve a reference to its content\n */\n resolveReference(\n referenceId: ReferenceId\n ): Promise<ReferenceResolutionResult>;\n\n /**\n * Check if a reference exists and is valid\n */\n hasReference(referenceId: ReferenceId): Promise<boolean>;\n\n /**\n * Mark a reference for cleanup\n */\n cleanupReference(referenceId: ReferenceId): Promise<boolean>;\n\n /**\n * Get current storage statistics\n */\n getStats(): Promise<ContentReferenceStats>;\n\n /**\n * Update configuration\n */\n updateConfig(config: Partial<ContentReferenceConfig>): Promise<void>;\n\n /**\n * Perform cleanup based on current policies\n */\n performCleanup(): Promise<{ cleanedUp: number; errors: string[] }>;\n\n /**\n * Dispose of resources\n */\n dispose(): Promise<void>;\n}\n"],"names":[],"mappings":"AAuLO,MAAM,mCAA2D;AAAA,EACtE,oBAAoB,KAAK;AAAA,EACzB,UAAU,KAAK,KAAK;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB,MAAM,OAAO;AAAA,EACnC,mBAAmB;AAAA,EACnB,mBAAmB,IAAI,KAAK;AAAA,EAC5B,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,IACf,QAAQ,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IAC9C,aAAa,EAAE,UAAU,IAAI,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IACvD,gBAAgB,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IACtD,SAAS,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,EAAE;AAErD;AA8CO,MAAM,8BAA8B,MAAM;AAAA,EAC/C,YACE,SACgB,MACA,aACA,kBAChB;AACA,UAAM,OAAO;AAJG,SAAA,OAAA;AACA,SAAA,cAAA;AACA,SAAA,mBAAA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;"}
@@ -1,30 +1,98 @@
1
- const DEFAULT_CONTENT_REFERENCE_CONFIG = {
2
- sizeThresholdBytes: 10 * 1024,
3
- maxAgeMs: 60 * 60 * 1e3,
4
- maxReferences: 100,
5
- maxTotalStorageBytes: 100 * 1024 * 1024,
6
- enableAutoCleanup: true,
7
- cleanupIntervalMs: 5 * 60 * 1e3,
8
- enablePersistence: false,
9
- storageBackend: "memory",
10
- cleanupPolicies: {
11
- recent: { maxAgeMs: 30 * 60 * 1e3, priority: 1 },
12
- userContent: { maxAgeMs: 2 * 60 * 60 * 1e3, priority: 2 },
13
- agentGenerated: { maxAgeMs: 60 * 60 * 1e3, priority: 3 },
14
- default: { maxAgeMs: 60 * 60 * 1e3, priority: 4 }
1
+ import { TransferTransaction, AccountId, Hbar } from "@hashgraph/sdk";
2
+ import BigNumber from "bignumber.js";
3
+ import { BaseServiceBuilder } from "hedera-agent-kit";
4
+ class AccountBuilder extends BaseServiceBuilder {
5
+ constructor(hederaKit) {
6
+ super(hederaKit);
15
7
  }
16
- };
17
- class ContentReferenceError extends Error {
18
- constructor(message, type, referenceId, suggestedActions) {
19
- super(message);
20
- this.type = type;
21
- this.referenceId = referenceId;
22
- this.suggestedActions = suggestedActions;
23
- this.name = "ContentReferenceError";
8
+ /**
9
+ * Transfers HBAR between accounts with proper decimal handling
10
+ */
11
+ transferHbar(params, isUserInitiated = true) {
12
+ this.clearNotes();
13
+ const transaction = new TransferTransaction();
14
+ if (!params.transfers || params.transfers.length === 0) {
15
+ throw new Error("HbarTransferParams must include at least one transfer.");
16
+ }
17
+ let netZeroInTinybars = new BigNumber(0);
18
+ let userTransferProcessedForScheduling = false;
19
+ if (isUserInitiated && this.kit.userAccountId && this.kit.operationalMode === "provideBytes" && params.transfers.length === 1) {
20
+ const receiverTransfer = params.transfers[0];
21
+ const amountValue = typeof receiverTransfer.amount === "string" || typeof receiverTransfer.amount === "number" ? receiverTransfer.amount : receiverTransfer.amount.toString();
22
+ const amountBigNum = new BigNumber(amountValue);
23
+ if (amountBigNum.isPositive()) {
24
+ const recipientAccountId = typeof receiverTransfer.accountId === "string" ? AccountId.fromString(receiverTransfer.accountId) : receiverTransfer.accountId;
25
+ const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);
26
+ const sdkHbarAmount = Hbar.fromString(roundedAmount);
27
+ this.logger.info(
28
+ `[AccountBuilder.transferHbar] Configuring user-initiated scheduled transfer: ${sdkHbarAmount.toString()} from ${this.kit.userAccountId} to ${recipientAccountId.toString()}`
29
+ );
30
+ this.addNote(
31
+ `Configured HBAR transfer from your account (${this.kit.userAccountId}) to ${recipientAccountId.toString()} for ${sdkHbarAmount.toString()}.`
32
+ );
33
+ transaction.addHbarTransfer(recipientAccountId, sdkHbarAmount);
34
+ transaction.addHbarTransfer(
35
+ AccountId.fromString(this.kit.userAccountId),
36
+ sdkHbarAmount.negated()
37
+ );
38
+ userTransferProcessedForScheduling = true;
39
+ }
40
+ }
41
+ if (!userTransferProcessedForScheduling) {
42
+ const processedTransfers = [];
43
+ for (const transferInput of params.transfers) {
44
+ const accountId = typeof transferInput.accountId === "string" ? AccountId.fromString(transferInput.accountId) : transferInput.accountId;
45
+ const amountValue = typeof transferInput.amount === "string" || typeof transferInput.amount === "number" ? transferInput.amount : transferInput.amount.toString();
46
+ const amountBigNum = new BigNumber(amountValue);
47
+ const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);
48
+ this.logger.info(
49
+ `Processing transfer: ${amountValue} HBAR (rounded to ${roundedAmount}) for account ${accountId.toString()}`
50
+ );
51
+ const sdkHbarAmount = Hbar.fromString(roundedAmount);
52
+ processedTransfers.push({
53
+ accountId,
54
+ amount: amountBigNum,
55
+ hbar: sdkHbarAmount
56
+ });
57
+ const tinybarsContribution = sdkHbarAmount.toTinybars();
58
+ netZeroInTinybars = netZeroInTinybars.plus(
59
+ tinybarsContribution.toString()
60
+ );
61
+ }
62
+ if (!netZeroInTinybars.isZero()) {
63
+ this.logger.warn(
64
+ `Transfer sum not zero: ${netZeroInTinybars.toString()} tinybars off. Adjusting last transfer.`
65
+ );
66
+ if (processedTransfers.length > 0) {
67
+ const lastTransfer = processedTransfers[processedTransfers.length - 1];
68
+ const adjustment = netZeroInTinybars.dividedBy(-1e8);
69
+ const adjustedAmount = lastTransfer.amount.plus(adjustment);
70
+ const adjustedRounded = adjustedAmount.toFixed(
71
+ 8,
72
+ BigNumber.ROUND_DOWN
73
+ );
74
+ lastTransfer.hbar = Hbar.fromString(adjustedRounded);
75
+ this.logger.info(
76
+ `Adjusted last transfer for ${lastTransfer.accountId.toString()} to ${adjustedRounded} HBAR`
77
+ );
78
+ }
79
+ }
80
+ for (const transfer of processedTransfers) {
81
+ transaction.addHbarTransfer(transfer.accountId, transfer.hbar);
82
+ }
83
+ }
84
+ if (typeof params.memo !== "undefined") {
85
+ if (params.memo === null) {
86
+ this.logger.warn("Received null for memo in transferHbar.");
87
+ } else {
88
+ transaction.setTransactionMemo(params.memo);
89
+ }
90
+ }
91
+ this.setCurrentTransaction(transaction);
92
+ return this;
24
93
  }
25
94
  }
26
95
  export {
27
- ContentReferenceError,
28
- DEFAULT_CONTENT_REFERENCE_CONFIG
96
+ AccountBuilder
29
97
  };
30
98
  //# sourceMappingURL=index47.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index47.js","sources":["../../src/types/content-reference.ts"],"sourcesContent":["/**\n * Content Reference System Types\n *\n * Shared interfaces for the Reference-Based Content System that handles\n * large content storage with unique reference IDs to optimize context window usage.\n */\n\n/**\n * Unique identifier for stored content references\n * Format: Cryptographically secure 32-byte identifier with base64url encoding\n */\nexport type ReferenceId = string;\n\n/**\n * Lifecycle state of a content reference\n */\nexport type ReferenceLifecycleState =\n | 'active'\n | 'expired'\n | 'cleanup_pending'\n | 'invalid';\n\n/**\n * Content types supported by the reference system\n */\nexport type ContentType =\n | 'text'\n | 'json'\n | 'html'\n | 'markdown'\n | 'binary'\n | 'unknown';\n\n/**\n * Sources that created the content reference\n */\nexport type ContentSource =\n | 'mcp_tool'\n | 'user_upload'\n | 'agent_generated'\n | 'system';\n\n/**\n * Metadata associated with stored content\n */\nexport interface ContentMetadata {\n /** Content type classification */\n contentType: ContentType;\n\n /** MIME type of the original content */\n mimeType?: string;\n\n /** Size in bytes of the stored content */\n sizeBytes: number;\n\n /** When the content was originally stored */\n createdAt: Date;\n\n /** Last time the content was accessed via reference resolution */\n lastAccessedAt: Date;\n\n /** Source that created this content reference */\n source: ContentSource;\n\n /** Name of the MCP tool that generated the content (if applicable) */\n mcpToolName?: string;\n\n /** Original filename or suggested name for the content */\n fileName?: string;\n\n /** Number of times this reference has been resolved */\n accessCount: number;\n\n /** Tags for categorization and cleanup policies */\n tags?: string[];\n\n /** Custom metadata from the source */\n customMetadata?: Record<string, unknown>;\n}\n\n/**\n * Core content reference object passed through agent context\n * Designed to be lightweight (<100 tokens) while providing enough\n * information for agent decision-making\n */\nexport interface ContentReference {\n /** Unique identifier for resolving the content */\n referenceId: ReferenceId;\n\n /** Current lifecycle state */\n state: ReferenceLifecycleState;\n\n /** Brief description or preview of the content (max 200 chars) */\n preview: string;\n\n /** Essential metadata for agent decision-making */\n metadata: Pick<\n ContentMetadata,\n 'contentType' | 'sizeBytes' | 'source' | 'fileName' | 'mimeType'\n >;\n\n /** When this reference was created */\n createdAt: Date;\n\n /** Special format indicator for reference IDs in content */\n readonly format: 'ref://{id}';\n}\n\n/**\n * Result of attempting to resolve a content reference\n */\nexport interface ReferenceResolutionResult {\n /** Whether the resolution was successful */\n success: boolean;\n\n /** The resolved content if successful */\n content?: Buffer;\n\n /** Complete metadata if successful */\n metadata?: ContentMetadata;\n\n /** Error message if resolution failed */\n error?: string;\n\n /** Specific error type for targeted error handling */\n errorType?:\n | 'not_found'\n | 'expired'\n | 'corrupted'\n | 'access_denied'\n | 'system_error';\n\n /** Suggested actions for recovery */\n suggestedActions?: string[];\n}\n\n/**\n * Configuration for content reference storage and lifecycle\n */\nexport interface ContentReferenceConfig {\n /** Size threshold above which content should be stored as references (default: 10KB) */\n sizeThresholdBytes: number;\n\n /** Maximum age for unused references before cleanup (default: 1 hour) */\n maxAgeMs: number;\n\n /** Maximum number of references to store simultaneously */\n maxReferences: number;\n\n /** Maximum total storage size for all references */\n maxTotalStorageBytes: number;\n\n /** Whether to enable automatic cleanup */\n enableAutoCleanup: boolean;\n\n /** Interval for cleanup checks in milliseconds */\n cleanupIntervalMs: number;\n\n /** Whether to persist references across restarts */\n enablePersistence: boolean;\n\n /** Storage backend configuration */\n storageBackend: 'memory' | 'filesystem' | 'hybrid';\n\n /** Cleanup policies for different content types */\n cleanupPolicies: {\n /** Policy for content marked as \"recent\" from MCP tools */\n recent: { maxAgeMs: number; priority: number };\n\n /** Policy for user-uploaded content */\n userContent: { maxAgeMs: number; priority: number };\n\n /** Policy for agent-generated content */\n agentGenerated: { maxAgeMs: number; priority: number };\n\n /** Default policy for other content */\n default: { maxAgeMs: number; priority: number };\n };\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONTENT_REFERENCE_CONFIG: ContentReferenceConfig = {\n sizeThresholdBytes: 10 * 1024,\n maxAgeMs: 60 * 60 * 1000,\n maxReferences: 100,\n maxTotalStorageBytes: 100 * 1024 * 1024,\n enableAutoCleanup: true,\n cleanupIntervalMs: 5 * 60 * 1000,\n enablePersistence: false,\n storageBackend: 'memory',\n cleanupPolicies: {\n recent: { maxAgeMs: 30 * 60 * 1000, priority: 1 },\n userContent: { maxAgeMs: 2 * 60 * 60 * 1000, priority: 2 },\n agentGenerated: { maxAgeMs: 60 * 60 * 1000, priority: 3 },\n default: { maxAgeMs: 60 * 60 * 1000, priority: 4 },\n },\n};\n\n/**\n * Statistics about content reference usage and storage\n */\nexport interface ContentReferenceStats {\n /** Total number of active references */\n activeReferences: number;\n\n /** Total storage used by all references in bytes */\n totalStorageBytes: number;\n\n /** Number of references cleaned up in last cleanup cycle */\n recentlyCleanedUp: number;\n\n /** Number of successful reference resolutions since startup */\n totalResolutions: number;\n\n /** Number of failed resolution attempts */\n failedResolutions: number;\n\n /** Average content size in bytes */\n averageContentSize: number;\n\n /** Most frequently accessed reference ID */\n mostAccessedReferenceId?: ReferenceId;\n\n /** Storage utilization percentage */\n storageUtilization: number;\n\n /** Performance metrics */\n performanceMetrics: {\n /** Average time to create a reference in milliseconds */\n averageCreationTimeMs: number;\n\n /** Average time to resolve a reference in milliseconds */\n averageResolutionTimeMs: number;\n\n /** Average cleanup time in milliseconds */\n averageCleanupTimeMs: number;\n };\n}\n\n/**\n * Error types for content reference operations\n */\nexport class ContentReferenceError extends Error {\n constructor(\n message: string,\n public readonly type: ReferenceResolutionResult['errorType'],\n public readonly referenceId?: ReferenceId,\n public readonly suggestedActions?: string[]\n ) {\n super(message);\n this.name = 'ContentReferenceError';\n }\n}\n\n/**\n * Interface for content reference storage implementations\n */\nexport interface ContentReferenceStore {\n /**\n * Store content and return a reference\n */\n storeContent(\n content: Buffer,\n metadata: Omit<\n ContentMetadata,\n 'createdAt' | 'lastAccessedAt' | 'accessCount'\n >\n ): Promise<ContentReference>;\n\n /**\n * Resolve a reference to its content\n */\n resolveReference(\n referenceId: ReferenceId\n ): Promise<ReferenceResolutionResult>;\n\n /**\n * Check if a reference exists and is valid\n */\n hasReference(referenceId: ReferenceId): Promise<boolean>;\n\n /**\n * Mark a reference for cleanup\n */\n cleanupReference(referenceId: ReferenceId): Promise<boolean>;\n\n /**\n * Get current storage statistics\n */\n getStats(): Promise<ContentReferenceStats>;\n\n /**\n * Update configuration\n */\n updateConfig(config: Partial<ContentReferenceConfig>): Promise<void>;\n\n /**\n * Perform cleanup based on current policies\n */\n performCleanup(): Promise<{ cleanedUp: number; errors: string[] }>;\n\n /**\n * Dispose of resources\n */\n dispose(): Promise<void>;\n}\n"],"names":[],"mappings":"AAuLO,MAAM,mCAA2D;AAAA,EACtE,oBAAoB,KAAK;AAAA,EACzB,UAAU,KAAK,KAAK;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB,MAAM,OAAO;AAAA,EACnC,mBAAmB;AAAA,EACnB,mBAAmB,IAAI,KAAK;AAAA,EAC5B,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,IACf,QAAQ,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IAC9C,aAAa,EAAE,UAAU,IAAI,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IACvD,gBAAgB,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,IACtD,SAAS,EAAE,UAAU,KAAK,KAAK,KAAM,UAAU,EAAA;AAAA,EAAE;AAErD;AA8CO,MAAM,8BAA8B,MAAM;AAAA,EAC/C,YACE,SACgB,MACA,aACA,kBAChB;AACA,UAAM,OAAO;AAJG,SAAA,OAAA;AACA,SAAA,cAAA;AACA,SAAA,mBAAA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;"}
1
+ {"version":3,"file":"index47.js","sources":["../../src/plugins/hbar/AccountBuilder.ts"],"sourcesContent":["import { AccountId, Hbar, TransferTransaction } from '@hashgraph/sdk';\nimport BigNumber from 'bignumber.js';\nimport { HederaAgentKit, BaseServiceBuilder } from 'hedera-agent-kit';\nimport { HbarTransferParams } from './types';\n\n/**\n * Custom AccountBuilder that properly handles HBAR decimal conversion\n */\nexport class AccountBuilder extends BaseServiceBuilder {\n constructor(hederaKit: HederaAgentKit) {\n super(hederaKit);\n }\n\n /**\n * Transfers HBAR between accounts with proper decimal handling\n */\n public transferHbar(\n params: HbarTransferParams,\n isUserInitiated: boolean = true\n ): this {\n this.clearNotes();\n const transaction = new TransferTransaction();\n\n if (!params.transfers || params.transfers.length === 0) {\n throw new Error('HbarTransferParams must include at least one transfer.');\n }\n\n let netZeroInTinybars = new BigNumber(0);\n let userTransferProcessedForScheduling = false;\n\n if (\n isUserInitiated &&\n this.kit.userAccountId &&\n (this.kit.operationalMode as string) === 'provideBytes' &&\n params.transfers.length === 1\n ) {\n const receiverTransfer = params.transfers[0];\n const amountValue =\n typeof receiverTransfer.amount === 'string' ||\n typeof receiverTransfer.amount === 'number'\n ? receiverTransfer.amount\n : receiverTransfer.amount.toString();\n\n const amountBigNum = new BigNumber(amountValue);\n\n if (amountBigNum.isPositive()) {\n const recipientAccountId =\n typeof receiverTransfer.accountId === 'string'\n ? AccountId.fromString(receiverTransfer.accountId)\n : receiverTransfer.accountId;\n\n const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);\n const sdkHbarAmount = Hbar.fromString(roundedAmount);\n\n this.logger.info(\n `[AccountBuilder.transferHbar] Configuring user-initiated scheduled transfer: ${sdkHbarAmount.toString()} from ${\n this.kit.userAccountId\n } to ${recipientAccountId.toString()}`\n );\n\n this.addNote(\n `Configured HBAR transfer from your account (${\n this.kit.userAccountId\n }) to ${recipientAccountId.toString()} for ${sdkHbarAmount.toString()}.`\n );\n\n transaction.addHbarTransfer(recipientAccountId, sdkHbarAmount);\n transaction.addHbarTransfer(\n AccountId.fromString(this.kit.userAccountId),\n sdkHbarAmount.negated()\n );\n\n userTransferProcessedForScheduling = true;\n }\n }\n\n if (!userTransferProcessedForScheduling) {\n const processedTransfers: Array<{\n accountId: AccountId;\n amount: BigNumber;\n hbar: Hbar;\n }> = [];\n\n for (const transferInput of params.transfers) {\n const accountId =\n typeof transferInput.accountId === 'string'\n ? AccountId.fromString(transferInput.accountId)\n : transferInput.accountId;\n\n const amountValue =\n typeof transferInput.amount === 'string' ||\n typeof transferInput.amount === 'number'\n ? transferInput.amount\n : transferInput.amount.toString();\n\n const amountBigNum = new BigNumber(amountValue);\n const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);\n\n this.logger.info(\n `Processing transfer: ${amountValue} HBAR (rounded to ${roundedAmount}) for account ${accountId.toString()}`\n );\n\n const sdkHbarAmount = Hbar.fromString(roundedAmount);\n processedTransfers.push({\n accountId,\n amount: amountBigNum,\n hbar: sdkHbarAmount,\n });\n\n const tinybarsContribution = sdkHbarAmount.toTinybars();\n netZeroInTinybars = netZeroInTinybars.plus(\n tinybarsContribution.toString()\n );\n }\n\n if (!netZeroInTinybars.isZero()) {\n this.logger.warn(\n `Transfer sum not zero: ${netZeroInTinybars.toString()} tinybars off. Adjusting last transfer.`\n );\n\n if (processedTransfers.length > 0) {\n const lastTransfer =\n processedTransfers[processedTransfers.length - 1];\n const adjustment = netZeroInTinybars.dividedBy(-100000000);\n const adjustedAmount = lastTransfer.amount.plus(adjustment);\n const adjustedRounded = adjustedAmount.toFixed(\n 8,\n BigNumber.ROUND_DOWN\n );\n lastTransfer.hbar = Hbar.fromString(adjustedRounded);\n\n this.logger.info(\n `Adjusted last transfer for ${lastTransfer.accountId.toString()} to ${adjustedRounded} HBAR`\n );\n }\n }\n\n for (const transfer of processedTransfers) {\n transaction.addHbarTransfer(transfer.accountId, transfer.hbar);\n }\n }\n\n if (typeof params.memo !== 'undefined') {\n if (params.memo === null) {\n this.logger.warn('Received null for memo in transferHbar.');\n } else {\n transaction.setTransactionMemo(params.memo);\n }\n }\n\n this.setCurrentTransaction(transaction);\n return this;\n }\n}\n"],"names":[],"mappings":"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"}
@@ -1,98 +1,10 @@
1
- import { TransferTransaction, AccountId, Hbar } from "@hashgraph/sdk";
2
- import BigNumber from "bignumber.js";
3
- import { BaseServiceBuilder } from "hedera-agent-kit";
4
- class AccountBuilder extends BaseServiceBuilder {
5
- constructor(hederaKit) {
6
- super(hederaKit);
7
- }
8
- /**
9
- * Transfers HBAR between accounts with proper decimal handling
10
- */
11
- transferHbar(params, isUserInitiated = true) {
12
- this.clearNotes();
13
- const transaction = new TransferTransaction();
14
- if (!params.transfers || params.transfers.length === 0) {
15
- throw new Error("HbarTransferParams must include at least one transfer.");
16
- }
17
- let netZeroInTinybars = new BigNumber(0);
18
- let userTransferProcessedForScheduling = false;
19
- if (isUserInitiated && this.kit.userAccountId && this.kit.operationalMode === "provideBytes" && params.transfers.length === 1) {
20
- const receiverTransfer = params.transfers[0];
21
- const amountValue = typeof receiverTransfer.amount === "string" || typeof receiverTransfer.amount === "number" ? receiverTransfer.amount : receiverTransfer.amount.toString();
22
- const amountBigNum = new BigNumber(amountValue);
23
- if (amountBigNum.isPositive()) {
24
- const recipientAccountId = typeof receiverTransfer.accountId === "string" ? AccountId.fromString(receiverTransfer.accountId) : receiverTransfer.accountId;
25
- const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);
26
- const sdkHbarAmount = Hbar.fromString(roundedAmount);
27
- this.logger.info(
28
- `[AccountBuilder.transferHbar] Configuring user-initiated scheduled transfer: ${sdkHbarAmount.toString()} from ${this.kit.userAccountId} to ${recipientAccountId.toString()}`
29
- );
30
- this.addNote(
31
- `Configured HBAR transfer from your account (${this.kit.userAccountId}) to ${recipientAccountId.toString()} for ${sdkHbarAmount.toString()}.`
32
- );
33
- transaction.addHbarTransfer(recipientAccountId, sdkHbarAmount);
34
- transaction.addHbarTransfer(
35
- AccountId.fromString(this.kit.userAccountId),
36
- sdkHbarAmount.negated()
37
- );
38
- userTransferProcessedForScheduling = true;
39
- }
40
- }
41
- if (!userTransferProcessedForScheduling) {
42
- const processedTransfers = [];
43
- for (const transferInput of params.transfers) {
44
- const accountId = typeof transferInput.accountId === "string" ? AccountId.fromString(transferInput.accountId) : transferInput.accountId;
45
- const amountValue = typeof transferInput.amount === "string" || typeof transferInput.amount === "number" ? transferInput.amount : transferInput.amount.toString();
46
- const amountBigNum = new BigNumber(amountValue);
47
- const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);
48
- this.logger.info(
49
- `Processing transfer: ${amountValue} HBAR (rounded to ${roundedAmount}) for account ${accountId.toString()}`
50
- );
51
- const sdkHbarAmount = Hbar.fromString(roundedAmount);
52
- processedTransfers.push({
53
- accountId,
54
- amount: amountBigNum,
55
- hbar: sdkHbarAmount
56
- });
57
- const tinybarsContribution = sdkHbarAmount.toTinybars();
58
- netZeroInTinybars = netZeroInTinybars.plus(
59
- tinybarsContribution.toString()
60
- );
61
- }
62
- if (!netZeroInTinybars.isZero()) {
63
- this.logger.warn(
64
- `Transfer sum not zero: ${netZeroInTinybars.toString()} tinybars off. Adjusting last transfer.`
65
- );
66
- if (processedTransfers.length > 0) {
67
- const lastTransfer = processedTransfers[processedTransfers.length - 1];
68
- const adjustment = netZeroInTinybars.dividedBy(-1e8);
69
- const adjustedAmount = lastTransfer.amount.plus(adjustment);
70
- const adjustedRounded = adjustedAmount.toFixed(
71
- 8,
72
- BigNumber.ROUND_DOWN
73
- );
74
- lastTransfer.hbar = Hbar.fromString(adjustedRounded);
75
- this.logger.info(
76
- `Adjusted last transfer for ${lastTransfer.accountId.toString()} to ${adjustedRounded} HBAR`
77
- );
78
- }
79
- }
80
- for (const transfer of processedTransfers) {
81
- transaction.addHbarTransfer(transfer.accountId, transfer.hbar);
82
- }
83
- }
84
- if (typeof params.memo !== "undefined") {
85
- if (params.memo === null) {
86
- this.logger.warn("Received null for memo in transferHbar.");
87
- } else {
88
- transaction.setTransactionMemo(params.memo);
89
- }
90
- }
91
- this.setCurrentTransaction(transaction);
92
- return this;
93
- }
94
- }
1
+ const FIELD_PRIORITIES = {
2
+ ESSENTIAL: "essential",
3
+ COMMON: "common",
4
+ ADVANCED: "advanced",
5
+ EXPERT: "expert"
6
+ };
95
7
  export {
96
- AccountBuilder
8
+ FIELD_PRIORITIES
97
9
  };
98
10
  //# sourceMappingURL=index48.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index48.js","sources":["../../src/plugins/hbar/AccountBuilder.ts"],"sourcesContent":["import { AccountId, Hbar, TransferTransaction } from '@hashgraph/sdk';\nimport BigNumber from 'bignumber.js';\nimport { HederaAgentKit, BaseServiceBuilder } from 'hedera-agent-kit';\nimport { HbarTransferParams } from './types';\n\n/**\n * Custom AccountBuilder that properly handles HBAR decimal conversion\n */\nexport class AccountBuilder extends BaseServiceBuilder {\n constructor(hederaKit: HederaAgentKit) {\n super(hederaKit);\n }\n\n /**\n * Transfers HBAR between accounts with proper decimal handling\n */\n public transferHbar(\n params: HbarTransferParams,\n isUserInitiated: boolean = true\n ): this {\n this.clearNotes();\n const transaction = new TransferTransaction();\n\n if (!params.transfers || params.transfers.length === 0) {\n throw new Error('HbarTransferParams must include at least one transfer.');\n }\n\n let netZeroInTinybars = new BigNumber(0);\n let userTransferProcessedForScheduling = false;\n\n if (\n isUserInitiated &&\n this.kit.userAccountId &&\n (this.kit.operationalMode as string) === 'provideBytes' &&\n params.transfers.length === 1\n ) {\n const receiverTransfer = params.transfers[0];\n const amountValue =\n typeof receiverTransfer.amount === 'string' ||\n typeof receiverTransfer.amount === 'number'\n ? receiverTransfer.amount\n : receiverTransfer.amount.toString();\n\n const amountBigNum = new BigNumber(amountValue);\n\n if (amountBigNum.isPositive()) {\n const recipientAccountId =\n typeof receiverTransfer.accountId === 'string'\n ? AccountId.fromString(receiverTransfer.accountId)\n : receiverTransfer.accountId;\n\n const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);\n const sdkHbarAmount = Hbar.fromString(roundedAmount);\n\n this.logger.info(\n `[AccountBuilder.transferHbar] Configuring user-initiated scheduled transfer: ${sdkHbarAmount.toString()} from ${\n this.kit.userAccountId\n } to ${recipientAccountId.toString()}`\n );\n\n this.addNote(\n `Configured HBAR transfer from your account (${\n this.kit.userAccountId\n }) to ${recipientAccountId.toString()} for ${sdkHbarAmount.toString()}.`\n );\n\n transaction.addHbarTransfer(recipientAccountId, sdkHbarAmount);\n transaction.addHbarTransfer(\n AccountId.fromString(this.kit.userAccountId),\n sdkHbarAmount.negated()\n );\n\n userTransferProcessedForScheduling = true;\n }\n }\n\n if (!userTransferProcessedForScheduling) {\n const processedTransfers: Array<{\n accountId: AccountId;\n amount: BigNumber;\n hbar: Hbar;\n }> = [];\n\n for (const transferInput of params.transfers) {\n const accountId =\n typeof transferInput.accountId === 'string'\n ? AccountId.fromString(transferInput.accountId)\n : transferInput.accountId;\n\n const amountValue =\n typeof transferInput.amount === 'string' ||\n typeof transferInput.amount === 'number'\n ? transferInput.amount\n : transferInput.amount.toString();\n\n const amountBigNum = new BigNumber(amountValue);\n const roundedAmount = amountBigNum.toFixed(8, BigNumber.ROUND_DOWN);\n\n this.logger.info(\n `Processing transfer: ${amountValue} HBAR (rounded to ${roundedAmount}) for account ${accountId.toString()}`\n );\n\n const sdkHbarAmount = Hbar.fromString(roundedAmount);\n processedTransfers.push({\n accountId,\n amount: amountBigNum,\n hbar: sdkHbarAmount,\n });\n\n const tinybarsContribution = sdkHbarAmount.toTinybars();\n netZeroInTinybars = netZeroInTinybars.plus(\n tinybarsContribution.toString()\n );\n }\n\n if (!netZeroInTinybars.isZero()) {\n this.logger.warn(\n `Transfer sum not zero: ${netZeroInTinybars.toString()} tinybars off. Adjusting last transfer.`\n );\n\n if (processedTransfers.length > 0) {\n const lastTransfer =\n processedTransfers[processedTransfers.length - 1];\n const adjustment = netZeroInTinybars.dividedBy(-100000000);\n const adjustedAmount = lastTransfer.amount.plus(adjustment);\n const adjustedRounded = adjustedAmount.toFixed(\n 8,\n BigNumber.ROUND_DOWN\n );\n lastTransfer.hbar = Hbar.fromString(adjustedRounded);\n\n this.logger.info(\n `Adjusted last transfer for ${lastTransfer.accountId.toString()} to ${adjustedRounded} HBAR`\n );\n }\n }\n\n for (const transfer of processedTransfers) {\n transaction.addHbarTransfer(transfer.accountId, transfer.hbar);\n }\n }\n\n if (typeof params.memo !== 'undefined') {\n if (params.memo === null) {\n this.logger.warn('Received null for memo in transferHbar.');\n } else {\n transaction.setTransactionMemo(params.memo);\n }\n }\n\n this.setCurrentTransaction(transaction);\n return this;\n }\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index48.js","sources":["../../src/constants/form-priorities.ts"],"sourcesContent":["/**\n * Form field priorities for progressive disclosure\n */\nexport const FIELD_PRIORITIES = {\n ESSENTIAL: 'essential',\n COMMON: 'common', \n ADVANCED: 'advanced',\n EXPERT: 'expert'\n} as const;\n\n/**\n * Form field types\n */\nexport const FORM_FIELD_TYPES = {\n TEXT: 'text',\n NUMBER: 'number',\n SELECT: 'select',\n CHECKBOX: 'checkbox',\n TEXTAREA: 'textarea',\n FILE: 'file',\n ARRAY: 'array',\n OBJECT: 'object',\n CURRENCY: 'currency',\n PERCENTAGE: 'percentage',\n} as const;"],"names":[],"mappings":"AAGO,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,QAAQ;AACV;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraphonline/conversational-agent",
3
- "version": "0.2.214",
3
+ "version": "0.2.216",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/esm/index.js",
@@ -76,8 +76,8 @@
76
76
  "dependencies": {
77
77
  "@hashgraph/sdk": "^2.72.0",
78
78
  "@hashgraphonline/hashinal-wc": "^1.0.107",
79
- "@hashgraphonline/standards-agent-kit": "^0.2.160",
80
- "@hashgraphonline/standards-sdk": "0.1.110",
79
+ "@hashgraphonline/standards-agent-kit": "^0.2.164",
80
+ "@hashgraphonline/standards-sdk": "0.1.111",
81
81
  "@langchain/anthropic": "^0.3.28",
82
82
  "@langchain/core": "^0.3.77",
83
83
  "@langchain/openai": "^0.6.13",