@hashgraphonline/standards-agent-kit 0.2.106 → 0.2.107
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/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/es/standards-agent-kit.es10.js +1 -1
- package/dist/es/standards-agent-kit.es10.js.map +1 -1
- package/dist/es/standards-agent-kit.es8.js +55 -3
- package/dist/es/standards-agent-kit.es8.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +1 -1
- package/dist/es/standards-agent-kit.es9.js.map +1 -1
- package/dist/umd/standards-agent-kit.umd.js +1 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/hcs10/InitiateConnectionTool.ts +1 -1
- package/src/tools/hcs10/ListConnectionsTool.ts +1 -1
- package/src/tools/hcs10/SendMessageToConnectionTool.ts +78 -8
|
@@ -10,7 +10,7 @@ class ListConnectionsTool extends BaseHCS10QueryTool {
|
|
|
10
10
|
constructor(params) {
|
|
11
11
|
super(params);
|
|
12
12
|
this.name = "list_connections";
|
|
13
|
-
this.description = "Lists
|
|
13
|
+
this.description = "Lists all active HCS-10 connections. Use this FIRST before sending messages to check if you already have an active connection to a target agent. Shows connection details and agent information for each active connection.";
|
|
14
14
|
this.specificInputSchema = ListConnectionsZodSchema;
|
|
15
15
|
}
|
|
16
16
|
async executeQuery(args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es10.js","sources":["../../src/tools/hcs10/ListConnectionsTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10QueryTool } from './base-hcs10-tools';\nimport { HCS10QueryToolParams } from './hcs10-tool-params';\n\n/**\n * A tool to list currently active HCS-10 connections stored in the state manager.\n * Enhanced to show more details similar to moonscape's implementation.\n */\nconst ListConnectionsZodSchema = z.object({\n includeDetails: z\n .boolean()\n .optional()\n .describe(\n 'Whether to include detailed information about each connection'\n ),\n showPending: z\n .boolean()\n .optional()\n .describe('Whether to include pending connection requests'),\n});\n\nexport class ListConnectionsTool extends BaseHCS10QueryTool<\n typeof ListConnectionsZodSchema\n> {\n name = 'list_connections';\n description =\n 'Lists
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es10.js","sources":["../../src/tools/hcs10/ListConnectionsTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10QueryTool } from './base-hcs10-tools';\nimport { HCS10QueryToolParams } from './hcs10-tool-params';\n\n/**\n * A tool to list currently active HCS-10 connections stored in the state manager.\n * Enhanced to show more details similar to moonscape's implementation.\n */\nconst ListConnectionsZodSchema = z.object({\n includeDetails: z\n .boolean()\n .optional()\n .describe(\n 'Whether to include detailed information about each connection'\n ),\n showPending: z\n .boolean()\n .optional()\n .describe('Whether to include pending connection requests'),\n});\n\nexport class ListConnectionsTool extends BaseHCS10QueryTool<\n typeof ListConnectionsZodSchema\n> {\n name = 'list_connections';\n description =\n 'Lists all active HCS-10 connections. Use this FIRST before sending messages to check if you already have an active connection to a target agent. Shows connection details and agent information for each active connection.';\n specificInputSchema = ListConnectionsZodSchema;\n constructor(params: HCS10QueryToolParams) {\n super(params);\n }\n\n protected async executeQuery(\n args: z.infer<typeof ListConnectionsZodSchema>\n ): Promise<unknown> {\n const hcs10Builder = this.hcs10Builder;\n const params: { includeDetails?: boolean; showPending?: boolean } = {};\n if (args.includeDetails !== undefined) {\n params.includeDetails = args.includeDetails;\n }\n if (args.showPending !== undefined) {\n params.showPending = args.showPending;\n }\n await hcs10Builder.listConnections(params);\n\n const result = await hcs10Builder.execute();\n\n if (result.success && 'rawResult' in result && result.rawResult) {\n const raw = result.rawResult as { formattedOutput?: string; message?: string };\n return {\n success: true,\n data: raw.formattedOutput || raw.message || 'Connections listed'\n };\n }\n\n return result;\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,gBAAgB,EACb,UACA,WACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,aAAa,EACV,QAAA,EACA,SAAA,EACA,SAAS,gDAAgD;AAC9D,CAAC;AAEM,MAAM,4BAA4B,mBAEvC;AAAA,EAKA,YAAY,QAA8B;AACxC,UAAM,MAAM;AALd,SAAA,OAAO;AACP,SAAA,cACE;AACF,SAAA,sBAAsB;AAAA,EAGtB;AAAA,EAEA,MAAgB,aACd,MACkB;AAClB,UAAM,eAAe,KAAK;AAC1B,UAAM,SAA8D,CAAA;AACpE,QAAI,KAAK,mBAAmB,QAAW;AACrC,aAAO,iBAAiB,KAAK;AAAA,IAC/B;AACA,QAAI,KAAK,gBAAgB,QAAW;AAClC,aAAO,cAAc,KAAK;AAAA,IAC5B;AACA,UAAM,aAAa,gBAAgB,MAAM;AAEzC,UAAM,SAAS,MAAM,aAAa,QAAA;AAElC,QAAI,OAAO,WAAW,eAAe,UAAU,OAAO,WAAW;AAC/D,YAAM,MAAM,OAAO;AACnB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,MAAM,IAAI,mBAAmB,IAAI,WAAW;AAAA,MAAA;AAAA,IAEhD;AAEA,WAAO;AAAA,EACT;AACF;"}
|
|
@@ -4,7 +4,9 @@ const SendMessageToConnectionZodSchema = z.object({
|
|
|
4
4
|
targetIdentifier: z.string().optional().describe(
|
|
5
5
|
"The request key (e.g., 'req-1:0.0.6155171@0.0.6154875'), account ID (e.g., 0.0.12345) of the target agent, OR the connection number (e.g., '1', '2') from the 'list_connections' tool. Request key is most deterministic."
|
|
6
6
|
),
|
|
7
|
-
connectionId: z.string().optional().describe(
|
|
7
|
+
connectionId: z.string().optional().describe(
|
|
8
|
+
"The connection number (e.g., '1', '2') from the 'list_connections' tool."
|
|
9
|
+
),
|
|
8
10
|
agentId: z.string().optional().describe("The account ID (e.g., 0.0.12345) of the target agent."),
|
|
9
11
|
message: z.string().describe("The text message content to send."),
|
|
10
12
|
disableMonitoring: z.boolean().optional().default(false)
|
|
@@ -13,7 +15,7 @@ class SendMessageToConnectionTool extends BaseHCS10TransactionTool {
|
|
|
13
15
|
constructor(params) {
|
|
14
16
|
super(params);
|
|
15
17
|
this.name = "send_message_to_connection";
|
|
16
|
-
this.description = "
|
|
18
|
+
this.description = "Use this to send a message to an agent you already have an active connection with. Provide the target agent's account ID (e.g., 0.0.12345) and your message. If no active connection exists, this will fail - use initiate_connection instead to create a new connection first.";
|
|
17
19
|
this.specificInputSchema = SendMessageToConnectionZodSchema;
|
|
18
20
|
this.requiresMultipleTransactions = true;
|
|
19
21
|
this.neverScheduleThisTool = true;
|
|
@@ -22,7 +24,57 @@ class SendMessageToConnectionTool extends BaseHCS10TransactionTool {
|
|
|
22
24
|
const hcs10Builder = builder;
|
|
23
25
|
const targetIdentifier = specificArgs.targetIdentifier || specificArgs.agentId || specificArgs.connectionId;
|
|
24
26
|
if (!targetIdentifier) {
|
|
25
|
-
throw new Error(
|
|
27
|
+
throw new Error(
|
|
28
|
+
"Either targetIdentifier, connectionId, or agentId must be provided"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
const stateManager = hcs10Builder.getStateManager();
|
|
32
|
+
if (stateManager) {
|
|
33
|
+
const connectionsManager = stateManager.getConnectionsManager();
|
|
34
|
+
if (connectionsManager) {
|
|
35
|
+
try {
|
|
36
|
+
const currentAgent = stateManager.getCurrentAgent();
|
|
37
|
+
if (currentAgent && currentAgent.accountId) {
|
|
38
|
+
await connectionsManager.fetchConnectionData(
|
|
39
|
+
currentAgent.accountId
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.debug("Could not refresh connections:", error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (targetIdentifier.match(/^\d+$/)) {
|
|
47
|
+
const connections = stateManager.listConnections();
|
|
48
|
+
const connectionIndex = parseInt(targetIdentifier) - 1;
|
|
49
|
+
const establishedConnections = connections.filter(
|
|
50
|
+
(conn) => conn.status === "established" && !conn.isPending && !conn.needsConfirmation
|
|
51
|
+
);
|
|
52
|
+
if (connectionIndex >= 0 && connectionIndex < establishedConnections.length) {
|
|
53
|
+
const selectedConnection = establishedConnections[connectionIndex];
|
|
54
|
+
if (selectedConnection && selectedConnection.connectionTopicId) {
|
|
55
|
+
await hcs10Builder.sendMessageToConnection({
|
|
56
|
+
targetIdentifier: selectedConnection.connectionTopicId,
|
|
57
|
+
message: specificArgs.message,
|
|
58
|
+
disableMonitoring: specificArgs.disableMonitoring
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (targetIdentifier.match(/^\d+\.\d+\.\d+$/)) {
|
|
65
|
+
const connections = stateManager.listConnections();
|
|
66
|
+
const establishedConnection = connections.find(
|
|
67
|
+
(conn) => (conn.targetAccountId === targetIdentifier || conn.targetAccountId === `0.0.${targetIdentifier}`) && conn.status === "established" && !conn.isPending && !conn.needsConfirmation
|
|
68
|
+
);
|
|
69
|
+
if (establishedConnection && establishedConnection.connectionTopicId) {
|
|
70
|
+
await hcs10Builder.sendMessageToConnection({
|
|
71
|
+
targetIdentifier: establishedConnection.connectionTopicId,
|
|
72
|
+
message: specificArgs.message,
|
|
73
|
+
disableMonitoring: specificArgs.disableMonitoring
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
26
78
|
}
|
|
27
79
|
await hcs10Builder.sendMessageToConnection({
|
|
28
80
|
targetIdentifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es8.js","sources":["../../src/tools/hcs10/SendMessageToConnectionTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10TransactionTool } from './base-hcs10-tools';\nimport { HCS10Builder } from '../../builders/hcs10/hcs10-builder';\nimport { HCS10TransactionToolParams } from './hcs10-tool-params';\nimport { BaseServiceBuilder } from 'hedera-agent-kit';\n\nconst SendMessageToConnectionZodSchema = z.object({\n targetIdentifier: z\n .string()\n .optional()\n .describe(\n \"The request key (e.g., 'req-1:0.0.6155171@0.0.6154875'), account ID (e.g., 0.0.12345) of the target agent, OR the connection number (e.g., '1', '2') from the 'list_connections' tool. Request key is most deterministic.\"\n ),\n connectionId: z\n .string()\n .optional()\n .describe(\"The connection number (e.g., '1', '2') from the 'list_connections' tool.\"),\n agentId: z\n .string()\n .optional()\n .describe(
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es8.js","sources":["../../src/tools/hcs10/SendMessageToConnectionTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10TransactionTool } from './base-hcs10-tools';\nimport { HCS10Builder } from '../../builders/hcs10/hcs10-builder';\nimport { HCS10TransactionToolParams } from './hcs10-tool-params';\nimport { BaseServiceBuilder } from 'hedera-agent-kit';\n\nconst SendMessageToConnectionZodSchema = z.object({\n targetIdentifier: z\n .string()\n .optional()\n .describe(\n \"The request key (e.g., 'req-1:0.0.6155171@0.0.6154875'), account ID (e.g., 0.0.12345) of the target agent, OR the connection number (e.g., '1', '2') from the 'list_connections' tool. Request key is most deterministic.\"\n ),\n connectionId: z\n .string()\n .optional()\n .describe(\n \"The connection number (e.g., '1', '2') from the 'list_connections' tool.\"\n ),\n agentId: z\n .string()\n .optional()\n .describe('The account ID (e.g., 0.0.12345) of the target agent.'),\n message: z.string().describe('The text message content to send.'),\n disableMonitoring: z.boolean().optional().default(false),\n});\n\n/**\n * A tool to send a message to an agent over an established HCS-10 connection.\n */\nexport class SendMessageToConnectionTool extends BaseHCS10TransactionTool<\n typeof SendMessageToConnectionZodSchema\n> {\n name = 'send_message_to_connection';\n description =\n \"Use this to send a message to an agent you already have an active connection with. Provide the target agent's account ID (e.g., 0.0.12345) and your message. If no active connection exists, this will fail - use initiate_connection instead to create a new connection first.\";\n specificInputSchema = SendMessageToConnectionZodSchema;\n constructor(params: HCS10TransactionToolParams) {\n super(params);\n this.requiresMultipleTransactions = true;\n this.neverScheduleThisTool = true;\n }\n\n protected async callBuilderMethod(\n builder: BaseServiceBuilder,\n specificArgs: z.infer<typeof SendMessageToConnectionZodSchema>\n ): Promise<void> {\n const hcs10Builder = builder as HCS10Builder;\n\n const targetIdentifier =\n specificArgs.targetIdentifier ||\n specificArgs.agentId ||\n specificArgs.connectionId;\n\n if (!targetIdentifier) {\n throw new Error(\n 'Either targetIdentifier, connectionId, or agentId must be provided'\n );\n }\n\n const stateManager = hcs10Builder.getStateManager();\n if (stateManager) {\n const connectionsManager = stateManager.getConnectionsManager();\n if (connectionsManager) {\n try {\n const currentAgent = stateManager.getCurrentAgent();\n if (currentAgent && currentAgent.accountId) {\n await connectionsManager.fetchConnectionData(\n currentAgent.accountId\n );\n }\n } catch (error) {\n console.debug('Could not refresh connections:', error);\n }\n }\n\n if (targetIdentifier.match(/^\\d+$/)) {\n const connections = stateManager.listConnections();\n const connectionIndex = parseInt(targetIdentifier) - 1; // Connection numbers are 1-based\n\n const establishedConnections = connections.filter(\n (conn) =>\n conn.status === 'established' &&\n !conn.isPending &&\n !conn.needsConfirmation\n );\n\n if (\n connectionIndex >= 0 &&\n connectionIndex < establishedConnections.length\n ) {\n const selectedConnection = establishedConnections[connectionIndex];\n if (selectedConnection && selectedConnection.connectionTopicId) {\n await hcs10Builder.sendMessageToConnection({\n targetIdentifier: selectedConnection.connectionTopicId,\n message: specificArgs.message,\n disableMonitoring: specificArgs.disableMonitoring,\n });\n return;\n }\n }\n }\n\n if (targetIdentifier.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n const connections = stateManager.listConnections();\n const establishedConnection = connections.find(\n (conn) =>\n (conn.targetAccountId === targetIdentifier ||\n conn.targetAccountId === `0.0.${targetIdentifier}`) &&\n conn.status === 'established' &&\n !conn.isPending &&\n !conn.needsConfirmation\n );\n\n if (establishedConnection && establishedConnection.connectionTopicId) {\n await hcs10Builder.sendMessageToConnection({\n targetIdentifier: establishedConnection.connectionTopicId,\n message: specificArgs.message,\n disableMonitoring: specificArgs.disableMonitoring,\n });\n return;\n }\n }\n }\n\n await hcs10Builder.sendMessageToConnection({\n targetIdentifier: targetIdentifier,\n message: specificArgs.message,\n disableMonitoring: specificArgs.disableMonitoring,\n });\n }\n}\n"],"names":[],"mappings":";;AAMA,MAAM,mCAAmC,EAAE,OAAO;AAAA,EAChD,kBAAkB,EACf,SACA,WACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,cAAc,EACX,SACA,WACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,SAAS,EACN,OAAA,EACA,SAAA,EACA,SAAS,uDAAuD;AAAA,EACnE,SAAS,EAAE,SAAS,SAAS,mCAAmC;AAAA,EAChE,mBAAmB,EAAE,QAAA,EAAU,SAAA,EAAW,QAAQ,KAAK;AACzD,CAAC;AAKM,MAAM,oCAAoC,yBAE/C;AAAA,EAKA,YAAY,QAAoC;AAC9C,UAAM,MAAM;AALd,SAAA,OAAO;AACP,SAAA,cACE;AACF,SAAA,sBAAsB;AAGpB,SAAK,+BAA+B;AACpC,SAAK,wBAAwB;AAAA,EAC/B;AAAA,EAEA,MAAgB,kBACd,SACA,cACe;AACf,UAAM,eAAe;AAErB,UAAM,mBACJ,aAAa,oBACb,aAAa,WACb,aAAa;AAEf,QAAI,CAAC,kBAAkB;AACrB,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,eAAe,aAAa,gBAAA;AAClC,QAAI,cAAc;AAChB,YAAM,qBAAqB,aAAa,sBAAA;AACxC,UAAI,oBAAoB;AACtB,YAAI;AACF,gBAAM,eAAe,aAAa,gBAAA;AAClC,cAAI,gBAAgB,aAAa,WAAW;AAC1C,kBAAM,mBAAmB;AAAA,cACvB,aAAa;AAAA,YAAA;AAAA,UAEjB;AAAA,QACF,SAAS,OAAO;AACd,kBAAQ,MAAM,kCAAkC,KAAK;AAAA,QACvD;AAAA,MACF;AAEA,UAAI,iBAAiB,MAAM,OAAO,GAAG;AACnC,cAAM,cAAc,aAAa,gBAAA;AACjC,cAAM,kBAAkB,SAAS,gBAAgB,IAAI;AAErD,cAAM,yBAAyB,YAAY;AAAA,UACzC,CAAC,SACC,KAAK,WAAW,iBAChB,CAAC,KAAK,aACN,CAAC,KAAK;AAAA,QAAA;AAGV,YACE,mBAAmB,KACnB,kBAAkB,uBAAuB,QACzC;AACA,gBAAM,qBAAqB,uBAAuB,eAAe;AACjE,cAAI,sBAAsB,mBAAmB,mBAAmB;AAC9D,kBAAM,aAAa,wBAAwB;AAAA,cACzC,kBAAkB,mBAAmB;AAAA,cACrC,SAAS,aAAa;AAAA,cACtB,mBAAmB,aAAa;AAAA,YAAA,CACjC;AACD;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,UAAI,iBAAiB,MAAM,iBAAiB,GAAG;AAC7C,cAAM,cAAc,aAAa,gBAAA;AACjC,cAAM,wBAAwB,YAAY;AAAA,UACxC,CAAC,UACE,KAAK,oBAAoB,oBACxB,KAAK,oBAAoB,OAAO,gBAAgB,OAClD,KAAK,WAAW,iBAChB,CAAC,KAAK,aACN,CAAC,KAAK;AAAA,QAAA;AAGV,YAAI,yBAAyB,sBAAsB,mBAAmB;AACpE,gBAAM,aAAa,wBAAwB;AAAA,YACzC,kBAAkB,sBAAsB;AAAA,YACxC,SAAS,aAAa;AAAA,YACtB,mBAAmB,aAAa;AAAA,UAAA,CACjC;AACD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,aAAa,wBAAwB;AAAA,MACzC;AAAA,MACA,SAAS,aAAa;AAAA,MACtB,mBAAmB,aAAa;AAAA,IAAA,CACjC;AAAA,EACH;AACF;"}
|
|
@@ -15,7 +15,7 @@ class InitiateConnectionTool extends BaseHCS10TransactionTool {
|
|
|
15
15
|
constructor(params) {
|
|
16
16
|
super(params);
|
|
17
17
|
this.name = "initiate_connection";
|
|
18
|
-
this.description = "
|
|
18
|
+
this.description = "ONLY use this to START a BRAND NEW connection to an agent you have NEVER connected to before. If you already have an active connection to this agent, use send_message_to_connection instead. This creates a new connection request and waits for acceptance.";
|
|
19
19
|
this.specificInputSchema = InitiateConnectionZodSchema;
|
|
20
20
|
this.neverScheduleThisTool = true;
|
|
21
21
|
this.requiresMultipleTransactions = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es9.js","sources":["../../src/tools/hcs10/InitiateConnectionTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10TransactionTool } from './base-hcs10-tools';\nimport { HCS10Builder } from '../../builders/hcs10/hcs10-builder';\nimport { HCS10TransactionToolParams } from './hcs10-tool-params';\nimport { BaseServiceBuilder } from 'hedera-agent-kit';\n\nconst InitiateConnectionZodSchema = z.object({\n targetAccountId: z\n .string()\n .describe(\n 'The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with.'\n ),\n disableMonitor: z\n .boolean()\n .optional()\n .describe(\n 'If true, does not wait for connection confirmation. Returns immediately after sending the request.'\n ),\n memo: z\n .string()\n .optional()\n .describe(\n 'Optional memo to include with the connection request (e.g., \"Hello from Alice\"). If not provided, defaults to \"true\" or \"false\" based on monitoring preference.'\n ),\n});\n\n/**\n * A tool to actively START a NEW HCS-10 connection TO a target agent.\n * Requires the target agent's account ID.\n * It retrieves their profile, sends a connection request, and optionally waits for confirmation.\n * Use this tool ONLY to actively INITIATE an OUTGOING connection.\n */\nexport class InitiateConnectionTool extends BaseHCS10TransactionTool<\n typeof InitiateConnectionZodSchema\n> {\n name = 'initiate_connection';\n description =\n '
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es9.js","sources":["../../src/tools/hcs10/InitiateConnectionTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseHCS10TransactionTool } from './base-hcs10-tools';\nimport { HCS10Builder } from '../../builders/hcs10/hcs10-builder';\nimport { HCS10TransactionToolParams } from './hcs10-tool-params';\nimport { BaseServiceBuilder } from 'hedera-agent-kit';\n\nconst InitiateConnectionZodSchema = z.object({\n targetAccountId: z\n .string()\n .describe(\n 'The Hedera account ID (e.g., 0.0.12345) of the agent you want to connect with.'\n ),\n disableMonitor: z\n .boolean()\n .optional()\n .describe(\n 'If true, does not wait for connection confirmation. Returns immediately after sending the request.'\n ),\n memo: z\n .string()\n .optional()\n .describe(\n 'Optional memo to include with the connection request (e.g., \"Hello from Alice\"). If not provided, defaults to \"true\" or \"false\" based on monitoring preference.'\n ),\n});\n\n/**\n * A tool to actively START a NEW HCS-10 connection TO a target agent.\n * Requires the target agent's account ID.\n * It retrieves their profile, sends a connection request, and optionally waits for confirmation.\n * Use this tool ONLY to actively INITIATE an OUTGOING connection.\n */\nexport class InitiateConnectionTool extends BaseHCS10TransactionTool<\n typeof InitiateConnectionZodSchema\n> {\n name = 'initiate_connection';\n description =\n 'ONLY use this to START a BRAND NEW connection to an agent you have NEVER connected to before. If you already have an active connection to this agent, use send_message_to_connection instead. This creates a new connection request and waits for acceptance.';\n specificInputSchema = InitiateConnectionZodSchema;\n constructor(params: HCS10TransactionToolParams) {\n super(params);\n this.neverScheduleThisTool = true;\n this.requiresMultipleTransactions = true;\n }\n\n protected async callBuilderMethod(\n builder: BaseServiceBuilder,\n specificArgs: z.infer<typeof InitiateConnectionZodSchema>\n ): Promise<void> {\n const hcs10Builder = builder as HCS10Builder;\n const params: {\n targetAccountId: string;\n disableMonitor?: boolean;\n memo?: string;\n } = {\n targetAccountId: specificArgs.targetAccountId,\n };\n if (specificArgs.disableMonitor !== undefined) {\n params.disableMonitor = specificArgs.disableMonitor;\n }\n if (specificArgs.memo !== undefined) {\n params.memo = specificArgs.memo;\n }\n await hcs10Builder.initiateConnection(params);\n }\n}"],"names":[],"mappings":";;AAMA,MAAM,8BAA8B,EAAE,OAAO;AAAA,EAC3C,iBAAiB,EACd,OAAA,EACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,gBAAgB,EACb,UACA,WACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,MAAM,EACH,SACA,WACA;AAAA,IACC;AAAA,EAAA;AAEN,CAAC;AAQM,MAAM,+BAA+B,yBAE1C;AAAA,EAKA,YAAY,QAAoC;AAC9C,UAAM,MAAM;AALd,SAAA,OAAO;AACP,SAAA,cACE;AACF,SAAA,sBAAsB;AAGpB,SAAK,wBAAwB;AAC7B,SAAK,+BAA+B;AAAA,EACtC;AAAA,EAEA,MAAgB,kBACd,SACA,cACe;AACf,UAAM,eAAe;AACrB,UAAM,SAIF;AAAA,MACF,iBAAiB,aAAa;AAAA,IAAA;AAEhC,QAAI,aAAa,mBAAmB,QAAW;AAC7C,aAAO,iBAAiB,aAAa;AAAA,IACvC;AACA,QAAI,aAAa,SAAS,QAAW;AACnC,aAAO,OAAO,aAAa;AAAA,IAC7B;AACA,UAAM,aAAa,mBAAmB,MAAM;AAAA,EAC9C;AACF;"}
|