@hashgraphonline/standards-agent-kit 0.0.6 → 0.0.7
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/index.es.js +2503 -2273
- package/dist/index.es.js.map +1 -1
- package/dist/src/hcs10/index.d.ts +1 -0
- package/dist/src/index.d.ts +5 -7
- package/dist/src/{open-convai-state.d.ts → state/open-convai-state.d.ts} +12 -4
- package/dist/src/tools/CheckMessagesTool.d.ts +2 -2
- package/dist/src/tools/ConnectionTool.d.ts +2 -2
- package/dist/src/tools/FindRegistrationsTool.d.ts +27 -0
- package/dist/src/tools/InitiateConnectionTool.d.ts +2 -2
- package/dist/src/tools/ListConnectionsTool.d.ts +2 -2
- package/dist/src/tools/SendMessageToConnectionTool.d.ts +2 -2
- package/dist/src/tools/index.d.ts +7 -0
- package/package.json +1 -1
- package/dist/src/utils/logger.d.ts +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HCS10Client';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { HCS10Client } 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 {
|
|
5
|
+
import { IStateManager } from './state/open-convai-state';
|
|
6
6
|
export interface HCS10InitializationOptions {
|
|
7
7
|
useEncryption?: boolean;
|
|
8
8
|
registryUrl?: string;
|
|
9
|
-
|
|
9
|
+
stateManager?: IStateManager;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Initializes the HCS10 client and returns pre-registered LangChain tools.
|
|
13
13
|
*
|
|
14
|
-
* @param options - Optional settings including useEncryption, registryUrl, and
|
|
14
|
+
* @param options - Optional settings including useEncryption, registryUrl, and stateManager.
|
|
15
15
|
*/
|
|
16
16
|
export declare function initializeHCS10Client(options?: HCS10InitializationOptions): Promise<{
|
|
17
17
|
hcs10Client: HCS10Client;
|
|
@@ -21,7 +21,5 @@ export declare function initializeHCS10Client(options?: HCS10InitializationOptio
|
|
|
21
21
|
connectionTool: ConnectionTool;
|
|
22
22
|
};
|
|
23
23
|
}>;
|
|
24
|
-
export * from './hcs10
|
|
25
|
-
export * from './tools
|
|
26
|
-
export * from './tools/SendMessageTool';
|
|
27
|
-
export * from './tools/ConnectionTool';
|
|
24
|
+
export * from './hcs10';
|
|
25
|
+
export * from './tools';
|
|
@@ -11,12 +11,20 @@ export interface ActiveConnection {
|
|
|
11
11
|
targetInboundTopicId: string;
|
|
12
12
|
connectionTopicId: string;
|
|
13
13
|
}
|
|
14
|
+
export interface IStateManager {
|
|
15
|
+
setCurrentAgent(agent: RegisteredAgent | null): void;
|
|
16
|
+
getCurrentAgent(): RegisteredAgent | null;
|
|
17
|
+
addActiveConnection(connection: ActiveConnection): void;
|
|
18
|
+
listConnections(): ActiveConnection[];
|
|
19
|
+
getConnectionByIdentifier(identifier: string): ActiveConnection | undefined;
|
|
20
|
+
getLastTimestamp(connectionTopicId: string): number;
|
|
21
|
+
updateTimestamp(connectionTopicId: string, timestampNanos: number): void;
|
|
22
|
+
}
|
|
14
23
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* via their `stateManager` constructor parameter to track connections.
|
|
24
|
+
* An example implementation of the `IStateManager` interface.
|
|
25
|
+
* All tools should have a state manager instance.
|
|
18
26
|
*/
|
|
19
|
-
export declare class OpenConvaiState {
|
|
27
|
+
export declare class OpenConvaiState implements IStateManager {
|
|
20
28
|
currentAgent: RegisteredAgent | null;
|
|
21
29
|
activeConnections: ActiveConnection[];
|
|
22
30
|
connectionMessageTimestamps: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import {
|
|
4
|
+
import { IStateManager } from '../state/open-convai-state';
|
|
5
5
|
export interface CheckMessagesToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
|
-
stateManager:
|
|
7
|
+
stateManager: IStateManager;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A tool to check for new messages on an active HCS-10 connection topic.
|
|
@@ -2,10 +2,10 @@ 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 {
|
|
5
|
+
import { IStateManager } from '../state/open-convai-state';
|
|
6
6
|
export interface ConnectionToolParams extends ToolParams {
|
|
7
7
|
client: HCS10Client;
|
|
8
|
-
stateManager:
|
|
8
|
+
stateManager: IStateManager;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* ConnectionTool monitors the *current* agent's inbound topic for connection requests
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
+
export interface FindRegistrationsToolParams extends ToolParams {
|
|
5
|
+
hcsClient: HCS10Client;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A tool to search for registered HCS-10 agents using the configured registry.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FindRegistrationsTool extends StructuredTool {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
schema: z.ZodObject<{
|
|
14
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
accountId?: string | undefined;
|
|
18
|
+
tags?: string[] | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
accountId?: string | undefined;
|
|
21
|
+
tags?: string[] | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
private hcsClient;
|
|
24
|
+
private logger;
|
|
25
|
+
constructor({ hcsClient, ...rest }: FindRegistrationsToolParams);
|
|
26
|
+
protected _call({ accountId, tags, }: z.infer<this['schema']>): Promise<string>;
|
|
27
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import {
|
|
4
|
+
import { IStateManager } from '../state/open-convai-state';
|
|
5
5
|
export interface InitiateConnectionToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
|
-
stateManager:
|
|
7
|
+
stateManager: IStateManager;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A tool to actively START a NEW HCS-10 connection TO a target agent.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { IStateManager } from '../state/open-convai-state';
|
|
4
4
|
export interface ListConnectionsToolParams extends ToolParams {
|
|
5
|
-
stateManager:
|
|
5
|
+
stateManager: IStateManager;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* A tool to list currently active HCS-10 connections stored in the state manager.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { StructuredTool, ToolParams } from '@langchain/core/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HCS10Client } from '../hcs10/HCS10Client';
|
|
4
|
-
import {
|
|
4
|
+
import { IStateManager } from '../state/open-convai-state';
|
|
5
5
|
export interface SendMessageToConnectionToolParams extends ToolParams {
|
|
6
6
|
hcsClient: HCS10Client;
|
|
7
|
-
stateManager:
|
|
7
|
+
stateManager: IStateManager;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A tool to send a message to an agent over an established HCS-10 connection.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './RegisterAgentTool';
|
|
2
|
+
export * from './SendMessageTool';
|
|
3
|
+
export * from './ConnectionTool';
|
|
4
|
+
export * from './SendMessageToConnectionTool';
|
|
5
|
+
export * from './InitiateConnectionTool';
|
|
6
|
+
export * from './ListConnectionsTool';
|
|
7
|
+
export * from './CheckMessagesTool';
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
-
export interface LoggerOptions {
|
|
3
|
-
module?: string;
|
|
4
|
-
level?: LogLevel;
|
|
5
|
-
prettyPrint?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare class Logger {
|
|
8
|
-
private static instances;
|
|
9
|
-
private moduleName;
|
|
10
|
-
private minLevel;
|
|
11
|
-
private constructor();
|
|
12
|
-
static getInstance(options?: LoggerOptions): Logger;
|
|
13
|
-
private log;
|
|
14
|
-
debug(message: string, ...args: any[]): void;
|
|
15
|
-
info(message: string, ...args: any[]): void;
|
|
16
|
-
warn(message: string, ...args: any[]): void;
|
|
17
|
-
error(message: string, ...args: any[]): void;
|
|
18
|
-
}
|