@hashgraphonline/standards-agent-kit 0.0.13 → 0.0.15
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/README.md +94 -136
- package/dist/index.es.js +8446 -6553
- package/dist/index.es.js.map +1 -1
- package/dist/src/index.d.ts +0 -11
- package/dist/src/init.d.ts +45 -9
- package/dist/src/state/index.d.ts +1 -0
- package/dist/src/state/open-convai-state.d.ts +17 -97
- package/dist/src/state/state-types.d.ts +143 -0
- package/dist/src/tools/AcceptConnectionRequestTool.d.ts +1 -1
- package/dist/src/tools/CheckMessagesTool.d.ts +1 -1
- package/dist/src/tools/ConnectionMonitorTool.d.ts +1 -1
- package/dist/src/tools/ConnectionTool.d.ts +1 -1
- package/dist/src/tools/InitiateConnectionTool.d.ts +1 -1
- package/dist/src/tools/ListConnectionsTool.d.ts +1 -1
- package/dist/src/tools/ListUnapprovedConnectionRequestsTool.d.ts +1 -1
- package/dist/src/tools/ManageConnectionRequestsTool.d.ts +2 -2
- package/dist/src/tools/RegisterAgentTool.d.ts +59 -5
- package/dist/src/tools/RetrieveProfileTool.d.ts +34 -0
- package/dist/src/tools/SendMessageToConnectionTool.d.ts +1 -1
- package/package.json +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -2,14 +2,3 @@ export * from './hcs10';
|
|
|
2
2
|
export * from './tools';
|
|
3
3
|
export * from './state';
|
|
4
4
|
export * from './init';
|
|
5
|
-
export { ConnectionTool } from './tools/ConnectionTool';
|
|
6
|
-
export { ConnectionMonitorTool } from './tools/ConnectionMonitorTool';
|
|
7
|
-
export { ManageConnectionRequestsTool } from './tools/ManageConnectionRequestsTool';
|
|
8
|
-
export { AcceptConnectionRequestTool } from './tools/AcceptConnectionRequestTool';
|
|
9
|
-
export { InitiateConnectionTool } from './tools/InitiateConnectionTool';
|
|
10
|
-
export { ListConnectionsTool } from './tools/ListConnectionsTool';
|
|
11
|
-
export { CheckMessagesTool } from './tools/CheckMessagesTool';
|
|
12
|
-
export { FindRegistrationsTool } from './tools/FindRegistrationsTool';
|
|
13
|
-
export { SendMessageTool } from './tools/SendMessageTool';
|
|
14
|
-
export { SendMessageToConnectionTool } from './tools/SendMessageToConnectionTool';
|
|
15
|
-
export { ListUnapprovedConnectionRequestsTool } from './tools/ListUnapprovedConnectionRequestsTool';
|
package/dist/src/init.d.ts
CHANGED
|
@@ -1,23 +1,59 @@
|
|
|
1
|
-
import { HCS10Client } from './hcs10/HCS10Client';
|
|
1
|
+
import { HCS10Client, StandardNetworkType } from './hcs10/HCS10Client';
|
|
2
2
|
import { RegisterAgentTool } from './tools/RegisterAgentTool';
|
|
3
3
|
import { SendMessageTool } from './tools/SendMessageTool';
|
|
4
4
|
import { ConnectionTool } from './tools/ConnectionTool';
|
|
5
|
-
import { IStateManager } from './state/
|
|
6
|
-
|
|
5
|
+
import { IStateManager } from './state/state-types';
|
|
6
|
+
import { FindRegistrationsTool } from './tools/FindRegistrationsTool';
|
|
7
|
+
import { InitiateConnectionTool } from './tools/InitiateConnectionTool';
|
|
8
|
+
import { ListConnectionsTool } from './tools/ListConnectionsTool';
|
|
9
|
+
import { SendMessageToConnectionTool } from './tools/SendMessageToConnectionTool';
|
|
10
|
+
import { CheckMessagesTool } from './tools/CheckMessagesTool';
|
|
11
|
+
import { ConnectionMonitorTool } from './tools/ConnectionMonitorTool';
|
|
12
|
+
import { ManageConnectionRequestsTool } from './tools/ManageConnectionRequestsTool';
|
|
13
|
+
import { AcceptConnectionRequestTool } from './tools/AcceptConnectionRequestTool';
|
|
14
|
+
import { RetrieveProfileTool } from './tools/RetrieveProfileTool';
|
|
15
|
+
import { ListUnapprovedConnectionRequestsTool } from './tools/ListUnapprovedConnectionRequestsTool';
|
|
16
|
+
export interface HCS10ClientConfig {
|
|
17
|
+
operatorId?: string;
|
|
18
|
+
operatorKey?: string;
|
|
19
|
+
network?: StandardNetworkType;
|
|
7
20
|
useEncryption?: boolean;
|
|
8
21
|
registryUrl?: string;
|
|
22
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
23
|
+
}
|
|
24
|
+
export interface HCS10InitializationOptions {
|
|
25
|
+
clientConfig?: HCS10ClientConfig;
|
|
9
26
|
stateManager?: IStateManager;
|
|
27
|
+
createAllTools?: boolean;
|
|
28
|
+
monitoringClient?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tool collection containing all available tools from the standards-agent-kit
|
|
32
|
+
*/
|
|
33
|
+
export interface HCS10Tools {
|
|
34
|
+
registerAgentTool: RegisterAgentTool;
|
|
35
|
+
findRegistrationsTool: FindRegistrationsTool;
|
|
36
|
+
retrieveProfileTool: RetrieveProfileTool;
|
|
37
|
+
initiateConnectionTool: InitiateConnectionTool;
|
|
38
|
+
listConnectionsTool: ListConnectionsTool;
|
|
39
|
+
sendMessageToConnectionTool: SendMessageToConnectionTool;
|
|
40
|
+
checkMessagesTool: CheckMessagesTool;
|
|
41
|
+
sendMessageTool: SendMessageTool;
|
|
42
|
+
connectionTool: ConnectionTool;
|
|
43
|
+
connectionMonitorTool: ConnectionMonitorTool;
|
|
44
|
+
manageConnectionRequestsTool: ManageConnectionRequestsTool;
|
|
45
|
+
acceptConnectionRequestTool: AcceptConnectionRequestTool;
|
|
46
|
+
listUnapprovedConnectionRequestsTool: ListUnapprovedConnectionRequestsTool;
|
|
10
47
|
}
|
|
11
48
|
/**
|
|
12
49
|
* Initializes the HCS10 client and returns pre-registered LangChain tools.
|
|
13
50
|
*
|
|
14
|
-
* @param options -
|
|
51
|
+
* @param options - Initialization options
|
|
52
|
+
* @returns Object containing hcs10Client and requested tools
|
|
15
53
|
*/
|
|
16
54
|
export declare function initializeHCS10Client(options?: HCS10InitializationOptions): Promise<{
|
|
17
55
|
hcs10Client: HCS10Client;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
connectionTool: ConnectionTool;
|
|
22
|
-
};
|
|
56
|
+
monitoringClient?: HCS10Client;
|
|
57
|
+
tools: Partial<HCS10Tools>;
|
|
58
|
+
stateManager: IStateManager;
|
|
23
59
|
}>;
|
|
@@ -1,100 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: string;
|
|
3
|
-
accountId: string;
|
|
4
|
-
inboundTopicId: string;
|
|
5
|
-
outboundTopicId: string;
|
|
6
|
-
profileTopicId?: string;
|
|
7
|
-
}
|
|
8
|
-
export type ConnectionStatus = 'established' | 'pending' | 'needs confirmation' | 'unknown';
|
|
9
|
-
export interface AgentProfileInfo {
|
|
10
|
-
name?: string;
|
|
11
|
-
bio?: string;
|
|
12
|
-
avatar?: string;
|
|
13
|
-
type?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ConnectionRequestInfo {
|
|
16
|
-
id: number;
|
|
17
|
-
requestorId: string;
|
|
18
|
-
requestorName: string;
|
|
19
|
-
timestamp: Date;
|
|
20
|
-
memo?: string;
|
|
21
|
-
profile?: AgentProfileInfo;
|
|
22
|
-
}
|
|
23
|
-
export interface ActiveConnection {
|
|
24
|
-
targetAccountId: string;
|
|
25
|
-
targetAgentName: string;
|
|
26
|
-
targetInboundTopicId: string;
|
|
27
|
-
connectionTopicId: string;
|
|
28
|
-
status?: ConnectionStatus;
|
|
29
|
-
created?: Date;
|
|
30
|
-
lastActivity?: Date;
|
|
31
|
-
isPending?: boolean;
|
|
32
|
-
needsConfirmation?: boolean;
|
|
33
|
-
profileInfo?: AgentProfileInfo;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Core state management interface for the standards agent toolkit.
|
|
37
|
-
* All tools that need to maintain state should use an implementation of this interface.
|
|
38
|
-
*/
|
|
39
|
-
export interface IStateManager {
|
|
40
|
-
/**
|
|
41
|
-
* Sets the current active agent, clearing any previous connections.
|
|
42
|
-
*/
|
|
43
|
-
setCurrentAgent(agent: RegisteredAgent | null): void;
|
|
44
|
-
/**
|
|
45
|
-
* Gets the current active agent.
|
|
46
|
-
*/
|
|
47
|
-
getCurrentAgent(): RegisteredAgent | null;
|
|
48
|
-
/**
|
|
49
|
-
* Adds a new active connection to the state.
|
|
50
|
-
* Will not add duplicates based on connectionTopicId.
|
|
51
|
-
*/
|
|
52
|
-
addActiveConnection(connection: ActiveConnection): void;
|
|
53
|
-
/**
|
|
54
|
-
* Updates an existing connection or adds it if not found.
|
|
55
|
-
* Preserves existing properties when updating.
|
|
56
|
-
*/
|
|
57
|
-
updateOrAddConnection(connection: ActiveConnection): void;
|
|
58
|
-
/**
|
|
59
|
-
* Lists all active connections for the current agent.
|
|
60
|
-
*/
|
|
61
|
-
listConnections(): ActiveConnection[];
|
|
62
|
-
/**
|
|
63
|
-
* Finds a connection by identifier, which can be:
|
|
64
|
-
* - A 1-based index number as shown in the connection list
|
|
65
|
-
* - A target account ID
|
|
66
|
-
* - A connection topic ID
|
|
67
|
-
*/
|
|
68
|
-
getConnectionByIdentifier(identifier: string): ActiveConnection | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Gets the last processed message timestamp for a connection.
|
|
71
|
-
*/
|
|
72
|
-
getLastTimestamp(connectionTopicId: string): number;
|
|
73
|
-
/**
|
|
74
|
-
* Updates the last processed message timestamp for a connection.
|
|
75
|
-
*/
|
|
76
|
-
updateTimestamp(connectionTopicId: string, timestampNanos: number): void;
|
|
77
|
-
/**
|
|
78
|
-
* Stores a connection request in the state.
|
|
79
|
-
*/
|
|
80
|
-
addConnectionRequest(request: ConnectionRequestInfo): void;
|
|
81
|
-
/**
|
|
82
|
-
* Lists all pending connection requests.
|
|
83
|
-
*/
|
|
84
|
-
listConnectionRequests(): ConnectionRequestInfo[];
|
|
85
|
-
/**
|
|
86
|
-
* Finds a connection request by its ID.
|
|
87
|
-
*/
|
|
88
|
-
getConnectionRequestById(requestId: number): ConnectionRequestInfo | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* Removes a connection request from the state.
|
|
91
|
-
*/
|
|
92
|
-
removeConnectionRequest(requestId: number): void;
|
|
93
|
-
/**
|
|
94
|
-
* Clears all connection requests from the state.
|
|
95
|
-
*/
|
|
96
|
-
clearConnectionRequests(): void;
|
|
97
|
-
}
|
|
1
|
+
import { RegisteredAgent, ActiveConnection, ConnectionRequestInfo, IStateManager, AgentPersistenceOptions } from './state-types';
|
|
98
2
|
/**
|
|
99
3
|
* Implementation of the IStateManager interface for the OpenConvai system.
|
|
100
4
|
* Manages agent state and connection information with thread safety and
|
|
@@ -105,6 +9,16 @@ export declare class OpenConvaiState implements IStateManager {
|
|
|
105
9
|
private activeConnections;
|
|
106
10
|
private connectionMessageTimestamps;
|
|
107
11
|
private connectionRequests;
|
|
12
|
+
private defaultEnvFilePath?;
|
|
13
|
+
private defaultPrefix;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new OpenConvaiState instance
|
|
16
|
+
* @param options - Options for environment variable persistence
|
|
17
|
+
*/
|
|
18
|
+
constructor(options?: {
|
|
19
|
+
defaultEnvFilePath?: string;
|
|
20
|
+
defaultPrefix?: string;
|
|
21
|
+
});
|
|
108
22
|
/**
|
|
109
23
|
* Sets the current active agent and clears any previous connection data.
|
|
110
24
|
* This should be called when switching between agents.
|
|
@@ -161,4 +75,10 @@ export declare class OpenConvaiState implements IStateManager {
|
|
|
161
75
|
getConnectionRequestById(requestId: number): ConnectionRequestInfo | undefined;
|
|
162
76
|
removeConnectionRequest(requestId: number): void;
|
|
163
77
|
clearConnectionRequests(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Persists agent data to environment variables
|
|
80
|
+
* @param agent - The agent data to persist
|
|
81
|
+
* @param options - Environment file persistence options
|
|
82
|
+
*/
|
|
83
|
+
persistAgentData(agent: RegisteredAgent, options?: AgentPersistenceOptions): Promise<void>;
|
|
164
84
|
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic registered agent information
|
|
3
|
+
*/
|
|
4
|
+
export interface RegisteredAgent {
|
|
5
|
+
name: string;
|
|
6
|
+
accountId: string;
|
|
7
|
+
inboundTopicId: string;
|
|
8
|
+
outboundTopicId: string;
|
|
9
|
+
profileTopicId?: string;
|
|
10
|
+
privateKey?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Connection status types
|
|
14
|
+
*/
|
|
15
|
+
export type ConnectionStatus = 'established' | 'pending' | 'needs confirmation' | 'unknown';
|
|
16
|
+
/**
|
|
17
|
+
* Basic agent profile information
|
|
18
|
+
*/
|
|
19
|
+
export interface AgentProfileInfo {
|
|
20
|
+
name?: string;
|
|
21
|
+
bio?: string;
|
|
22
|
+
avatar?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Information about a connection request
|
|
27
|
+
*/
|
|
28
|
+
export interface ConnectionRequestInfo {
|
|
29
|
+
id: number;
|
|
30
|
+
requestorId: string;
|
|
31
|
+
requestorName: string;
|
|
32
|
+
timestamp: Date;
|
|
33
|
+
memo?: string;
|
|
34
|
+
profile?: AgentProfileInfo;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Information about an active connection
|
|
38
|
+
*/
|
|
39
|
+
export interface ActiveConnection {
|
|
40
|
+
targetAccountId: string;
|
|
41
|
+
targetAgentName: string;
|
|
42
|
+
targetInboundTopicId: string;
|
|
43
|
+
connectionTopicId: string;
|
|
44
|
+
status?: ConnectionStatus;
|
|
45
|
+
created?: Date;
|
|
46
|
+
lastActivity?: Date;
|
|
47
|
+
isPending?: boolean;
|
|
48
|
+
needsConfirmation?: boolean;
|
|
49
|
+
profileInfo?: AgentProfileInfo;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Options for environment variable persistence
|
|
53
|
+
*/
|
|
54
|
+
export interface EnvPersistenceOptions {
|
|
55
|
+
prefix?: string;
|
|
56
|
+
envFilePath?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Base persistence options interface
|
|
60
|
+
*/
|
|
61
|
+
export interface PersistenceOptions {
|
|
62
|
+
type: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Environment file persistence options
|
|
66
|
+
*/
|
|
67
|
+
export interface EnvFilePersistenceOptions extends PersistenceOptions {
|
|
68
|
+
type: 'env-file';
|
|
69
|
+
prefix?: string;
|
|
70
|
+
envFilePath?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Persistence options union type
|
|
74
|
+
*/
|
|
75
|
+
export type AgentPersistenceOptions = EnvFilePersistenceOptions;
|
|
76
|
+
/**
|
|
77
|
+
* Core state management interface for the standards agent toolkit.
|
|
78
|
+
* All tools that need to maintain state should use an implementation of this interface.
|
|
79
|
+
*/
|
|
80
|
+
export interface IStateManager {
|
|
81
|
+
/**
|
|
82
|
+
* Sets the current active agent, clearing any previous connections.
|
|
83
|
+
*/
|
|
84
|
+
setCurrentAgent(agent: RegisteredAgent | null): void;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the current active agent.
|
|
87
|
+
*/
|
|
88
|
+
getCurrentAgent(): RegisteredAgent | null;
|
|
89
|
+
/**
|
|
90
|
+
* Adds a new active connection to the state.
|
|
91
|
+
* Will not add duplicates based on connectionTopicId.
|
|
92
|
+
*/
|
|
93
|
+
addActiveConnection(connection: ActiveConnection): void;
|
|
94
|
+
/**
|
|
95
|
+
* Updates an existing connection or adds it if not found.
|
|
96
|
+
* Preserves existing properties when updating.
|
|
97
|
+
*/
|
|
98
|
+
updateOrAddConnection(connection: ActiveConnection): void;
|
|
99
|
+
/**
|
|
100
|
+
* Lists all active connections for the current agent.
|
|
101
|
+
*/
|
|
102
|
+
listConnections(): ActiveConnection[];
|
|
103
|
+
/**
|
|
104
|
+
* Finds a connection by identifier, which can be:
|
|
105
|
+
* - A 1-based index number as shown in the connection list
|
|
106
|
+
* - A target account ID
|
|
107
|
+
* - A connection topic ID
|
|
108
|
+
*/
|
|
109
|
+
getConnectionByIdentifier(identifier: string): ActiveConnection | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Gets the last processed message timestamp for a connection.
|
|
112
|
+
*/
|
|
113
|
+
getLastTimestamp(connectionTopicId: string): number;
|
|
114
|
+
/**
|
|
115
|
+
* Updates the last processed message timestamp for a connection.
|
|
116
|
+
*/
|
|
117
|
+
updateTimestamp(connectionTopicId: string, timestampNanos: number): void;
|
|
118
|
+
/**
|
|
119
|
+
* Stores a connection request in the state.
|
|
120
|
+
*/
|
|
121
|
+
addConnectionRequest(request: ConnectionRequestInfo): void;
|
|
122
|
+
/**
|
|
123
|
+
* Lists all pending connection requests.
|
|
124
|
+
*/
|
|
125
|
+
listConnectionRequests(): ConnectionRequestInfo[];
|
|
126
|
+
/**
|
|
127
|
+
* Finds a connection request by its ID.
|
|
128
|
+
*/
|
|
129
|
+
getConnectionRequestById(requestId: number): ConnectionRequestInfo | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Removes a connection request from the state.
|
|
132
|
+
*/
|
|
133
|
+
removeConnectionRequest(requestId: number): void;
|
|
134
|
+
/**
|
|
135
|
+
* Clears all connection requests from the state.
|
|
136
|
+
*/
|
|
137
|
+
clearConnectionRequests(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Persists agent data to storage
|
|
140
|
+
* Implementation may vary depending on the state manager
|
|
141
|
+
*/
|
|
142
|
+
persistAgentData?(agent: RegisteredAgent, options?: AgentPersistenceOptions): Promise<void>;
|
|
143
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import { IStateManager } from '../state/
|
|
4
|
+
import { IStateManager } from '../state/state-types';
|
|
5
5
|
export interface AcceptConnectionRequestToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
7
|
stateManager: IStateManager;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import { IStateManager } from '../state/
|
|
4
|
+
import { IStateManager } from '../state/state-types';
|
|
5
5
|
export interface CheckMessagesToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
7
|
stateManager: IStateManager;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import { IStateManager } from '../state/
|
|
4
|
+
import { IStateManager } from '../state/state-types';
|
|
5
5
|
export interface FeeDefinition {
|
|
6
6
|
amount: number;
|
|
7
7
|
collectorAccount?: string;
|
|
@@ -2,7 +2,7 @@ import { HCS10Client } from '../hcs10/HCS10Client';
|
|
|
2
2
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { Logger } from '@hashgraphonline/standards-sdk';
|
|
5
|
-
import { IStateManager } from '../state/
|
|
5
|
+
import { IStateManager } from '../state/state-types';
|
|
6
6
|
export interface ConnectionToolParams extends ToolParams {
|
|
7
7
|
client: HCS10Client;
|
|
8
8
|
stateManager: IStateManager;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import { IStateManager } from '../state/
|
|
4
|
+
import { IStateManager } from '../state/state-types';
|
|
5
5
|
export interface InitiateConnectionToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
7
|
stateManager: IStateManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { IStateManager } from '../state/
|
|
3
|
+
import { IStateManager } from '../state/state-types';
|
|
4
4
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
5
5
|
export interface ListConnectionsToolParams extends ToolParams {
|
|
6
6
|
stateManager: IStateManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { IStateManager } from '../state/
|
|
3
|
+
import { IStateManager } from '../state/state-types';
|
|
4
4
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
5
5
|
type ListPendingRequestsToolParams = ToolParams & {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import { IStateManager } from '../state/
|
|
4
|
+
import { IStateManager } from '../state/state-types';
|
|
5
5
|
export interface ManageConnectionRequestsToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
7
|
stateManager: IStateManager;
|
|
@@ -31,7 +31,7 @@ export declare class ManageConnectionRequestsTool extends StructuredTool {
|
|
|
31
31
|
constructor({ hcsClient, stateManager, ...rest }: ManageConnectionRequestsToolParams);
|
|
32
32
|
protected _call({ action, requestId, }: z.infer<this['schema']>): Promise<string>;
|
|
33
33
|
private refreshRequestsIfNeeded;
|
|
34
|
-
|
|
34
|
+
refreshRequests(): Promise<void>;
|
|
35
35
|
private listRequests;
|
|
36
36
|
private viewRequest;
|
|
37
37
|
private rejectRequest;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
2
2
|
import { StructuredTool } from '@langchain/core/tools';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { IStateManager } from '../state/state-types';
|
|
4
5
|
/**
|
|
5
6
|
* RegisterAgentTool wraps the createAndRegisterAgent() function of HCS10Client.
|
|
6
7
|
* It creates and registers an agent on Hedera using the HCS-10 standard SDK flow.
|
|
@@ -10,12 +11,32 @@ export declare class RegisterAgentTool extends StructuredTool {
|
|
|
10
11
|
name: string;
|
|
11
12
|
description: string;
|
|
12
13
|
private client;
|
|
14
|
+
private stateManager?;
|
|
13
15
|
schema: z.ZodObject<{
|
|
14
16
|
name: z.ZodString;
|
|
15
17
|
description: z.ZodOptional<z.ZodString>;
|
|
16
18
|
type: z.ZodOptional<z.ZodEnum<["autonomous", "manual"]>>;
|
|
17
19
|
model: z.ZodOptional<z.ZodString>;
|
|
18
20
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
21
|
+
profilePicture: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
22
|
+
url: z.ZodString;
|
|
23
|
+
filename: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
url: string;
|
|
26
|
+
filename: string;
|
|
27
|
+
}, {
|
|
28
|
+
url: string;
|
|
29
|
+
filename: string;
|
|
30
|
+
}>, z.ZodObject<{
|
|
31
|
+
path: z.ZodString;
|
|
32
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
path: string;
|
|
35
|
+
filename?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
path: string;
|
|
38
|
+
filename?: string | undefined;
|
|
39
|
+
}>]>>;
|
|
19
40
|
feeCollectorAccountId: z.ZodOptional<z.ZodString>;
|
|
20
41
|
hbarFee: z.ZodOptional<z.ZodNumber>;
|
|
21
42
|
tokenFee: z.ZodOptional<z.ZodObject<{
|
|
@@ -52,12 +73,27 @@ export declare class RegisterAgentTool extends StructuredTool {
|
|
|
52
73
|
collectorAccount?: string | undefined;
|
|
53
74
|
}>, "many">>;
|
|
54
75
|
exemptAccountIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
76
|
+
setAsCurrent: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
persistence: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
prefix?: string | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
prefix?: string | undefined;
|
|
83
|
+
}>>;
|
|
55
84
|
}, "strip", z.ZodTypeAny, {
|
|
56
85
|
name: string;
|
|
57
86
|
capabilities?: number[] | undefined;
|
|
58
87
|
description?: string | undefined;
|
|
59
88
|
type?: "autonomous" | "manual" | undefined;
|
|
60
89
|
model?: string | undefined;
|
|
90
|
+
profilePicture?: string | {
|
|
91
|
+
url: string;
|
|
92
|
+
filename: string;
|
|
93
|
+
} | {
|
|
94
|
+
path: string;
|
|
95
|
+
filename?: string | undefined;
|
|
96
|
+
} | undefined;
|
|
61
97
|
feeCollectorAccountId?: string | undefined;
|
|
62
98
|
hbarFee?: number | undefined;
|
|
63
99
|
tokenFee?: {
|
|
@@ -74,12 +110,23 @@ export declare class RegisterAgentTool extends StructuredTool {
|
|
|
74
110
|
collectorAccount?: string | undefined;
|
|
75
111
|
}[] | undefined;
|
|
76
112
|
exemptAccountIds?: string[] | undefined;
|
|
113
|
+
setAsCurrent?: boolean | undefined;
|
|
114
|
+
persistence?: {
|
|
115
|
+
prefix?: string | undefined;
|
|
116
|
+
} | undefined;
|
|
77
117
|
}, {
|
|
78
118
|
name: string;
|
|
79
119
|
capabilities?: number[] | undefined;
|
|
80
120
|
description?: string | undefined;
|
|
81
121
|
type?: "autonomous" | "manual" | undefined;
|
|
82
122
|
model?: string | undefined;
|
|
123
|
+
profilePicture?: string | {
|
|
124
|
+
url: string;
|
|
125
|
+
filename: string;
|
|
126
|
+
} | {
|
|
127
|
+
path: string;
|
|
128
|
+
filename?: string | undefined;
|
|
129
|
+
} | undefined;
|
|
83
130
|
feeCollectorAccountId?: string | undefined;
|
|
84
131
|
hbarFee?: number | undefined;
|
|
85
132
|
tokenFee?: {
|
|
@@ -96,12 +143,23 @@ export declare class RegisterAgentTool extends StructuredTool {
|
|
|
96
143
|
collectorAccount?: string | undefined;
|
|
97
144
|
}[] | undefined;
|
|
98
145
|
exemptAccountIds?: string[] | undefined;
|
|
146
|
+
setAsCurrent?: boolean | undefined;
|
|
147
|
+
persistence?: {
|
|
148
|
+
prefix?: string | undefined;
|
|
149
|
+
} | undefined;
|
|
99
150
|
}>;
|
|
100
151
|
/**
|
|
101
152
|
* Creates a new RegisterAgentTool instance
|
|
102
153
|
* @param client - Instance of HCS10Client (already configured with operator/network)
|
|
154
|
+
* @param stateManager - Optional state manager to store agent details
|
|
103
155
|
*/
|
|
104
|
-
constructor(client: HCS10Client);
|
|
156
|
+
constructor(client: HCS10Client, stateManager?: IStateManager);
|
|
157
|
+
/**
|
|
158
|
+
* Loads a profile picture from a local file or URL and returns a buffer
|
|
159
|
+
* @param profilePicture - Local file path or URL
|
|
160
|
+
* @returns Object containing buffer and filename
|
|
161
|
+
*/
|
|
162
|
+
private loadProfilePicture;
|
|
105
163
|
/**
|
|
106
164
|
* Calls createAndRegisterAgent() with the provided metadata.
|
|
107
165
|
* Returns a JSON string with agent details on success, or an error string.
|
|
@@ -115,10 +173,6 @@ export declare class RegisterAgentTool extends StructuredTool {
|
|
|
115
173
|
* Processes the registration result and returns formatted output
|
|
116
174
|
*/
|
|
117
175
|
private processRegistrationResult;
|
|
118
|
-
/**
|
|
119
|
-
* Updates the environment file with the new agent details
|
|
120
|
-
*/
|
|
121
|
-
private updateEnvironmentFile;
|
|
122
176
|
/**
|
|
123
177
|
* Ensures the agent has enough HBAR for operations
|
|
124
178
|
*/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StructuredTool } from '@langchain/core/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
+
/**
|
|
5
|
+
* Tool for retrieving the HCS-11 profile associated with a Hedera account ID.
|
|
6
|
+
* Utilizes the HCS10Client's retrieveProfile method, which handles fetching.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RetrieveProfileTool extends StructuredTool {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
private client;
|
|
12
|
+
private logger;
|
|
13
|
+
schema: z.ZodObject<{
|
|
14
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
disableCache: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
accountId?: string | undefined;
|
|
18
|
+
disableCache?: boolean | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
accountId?: string | undefined;
|
|
21
|
+
disableCache?: boolean | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new RetrieveProfileTool instance.
|
|
25
|
+
* @param client - An instance of HCS10Client.
|
|
26
|
+
*/
|
|
27
|
+
constructor(client: HCS10Client);
|
|
28
|
+
/**
|
|
29
|
+
* Executes the profile retrieval.
|
|
30
|
+
* @param input - The input object containing accountId and optional disableCache flag.
|
|
31
|
+
* @returns A JSON string of the profile on success, or an error message string.
|
|
32
|
+
*/
|
|
33
|
+
_call(input: z.infer<typeof this.schema>): Promise<string>;
|
|
34
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import { IStateManager } from '../state/
|
|
4
|
+
import { IStateManager } from '../state/state-types';
|
|
5
5
|
export interface SendMessageToConnectionToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
7
|
stateManager: IStateManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashgraphonline/standards-agent-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.es.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@hashgraph/sdk": "^2.62.0",
|
|
71
|
-
"@hashgraphonline/standards-sdk": "0.0.
|
|
71
|
+
"@hashgraphonline/standards-sdk": "0.0.73",
|
|
72
72
|
"@langchain/community": "^0.3.37",
|
|
73
73
|
"@langchain/openai": "^0.5.1",
|
|
74
74
|
"dotenv": "^16.4.1",
|