agentxjs 1.9.4-dev → 1.9.5-dev
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/build.ts +26 -0
- package/package.json +4 -9
- package/tsconfig.json +11 -0
- package/dist/RemoteClient.d.ts +0 -51
- package/dist/index.d.ts +0 -66
- package/dist/index.js +0 -13122
- package/dist/index.js.map +0 -256
- package/dist/presentation/Presentation.d.ts +0 -73
- package/dist/presentation/index.d.ts +0 -9
- package/dist/presentation/reducer.d.ts +0 -20
- package/dist/presentation/types.d.ts +0 -83
- package/dist/types.d.ts +0 -264
package/build.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build script for agentxjs
|
|
3
|
+
*
|
|
4
|
+
* Generates dist/ with JS and .d.ts files
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { $ } from "bun";
|
|
8
|
+
|
|
9
|
+
console.log("Building agentxjs...");
|
|
10
|
+
|
|
11
|
+
// Clean dist
|
|
12
|
+
await $`rm -rf dist`;
|
|
13
|
+
|
|
14
|
+
// Generate .d.ts using tsc
|
|
15
|
+
await $`tsc --emitDeclarationOnly --outDir dist`;
|
|
16
|
+
|
|
17
|
+
// Build with bun
|
|
18
|
+
await Bun.build({
|
|
19
|
+
entrypoints: ["./src/index.ts"],
|
|
20
|
+
outdir: "./dist",
|
|
21
|
+
format: "esm",
|
|
22
|
+
target: "node",
|
|
23
|
+
sourcemap: "external",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
console.log("Build complete!");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentxjs",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5-dev",
|
|
4
4
|
"description": "AgentX Client SDK - Connect to AgentX servers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -8,22 +8,17 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"types": "./
|
|
12
|
-
"
|
|
13
|
-
"default": "./dist/index.js"
|
|
11
|
+
"types": "./src/index.ts",
|
|
12
|
+
"default": "./src/index.ts"
|
|
14
13
|
}
|
|
15
14
|
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist",
|
|
18
|
-
"src"
|
|
19
|
-
],
|
|
20
15
|
"scripts": {
|
|
21
16
|
"build": "bun run build.ts",
|
|
22
17
|
"typecheck": "tsc --noEmit",
|
|
23
18
|
"test": "bun test"
|
|
24
19
|
},
|
|
25
20
|
"dependencies": {
|
|
26
|
-
"@agentxjs/core": "1.9.
|
|
21
|
+
"@agentxjs/core": "1.9.5-dev",
|
|
27
22
|
"reconnecting-websocket": "^4.4.0",
|
|
28
23
|
"ws": "^8.18.0"
|
|
29
24
|
},
|
package/tsconfig.json
ADDED
package/dist/RemoteClient.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RemoteClient - AgentX client for remote server
|
|
3
|
-
*
|
|
4
|
-
* Uses RpcClient from @agentxjs/core/network for JSON-RPC communication.
|
|
5
|
-
* This class focuses on business logic, not protocol details.
|
|
6
|
-
*/
|
|
7
|
-
import type { BusEvent, EventBus, BusEventHandler, Unsubscribe } from "@agentxjs/core/event";
|
|
8
|
-
import type { AgentX, AgentXConfig, AgentCreateResponse, AgentGetResponse, AgentListResponse, ImageCreateResponse, ImageGetResponse, ImageListResponse, ContainerCreateResponse, ContainerGetResponse, ContainerListResponse, MessageSendResponse, BaseResponse } from "./types";
|
|
9
|
-
import { Presentation, type PresentationOptions } from "./presentation";
|
|
10
|
-
/**
|
|
11
|
-
* RemoteClient implementation using JSON-RPC 2.0
|
|
12
|
-
*/
|
|
13
|
-
export declare class RemoteClient implements AgentX {
|
|
14
|
-
private readonly config;
|
|
15
|
-
private readonly eventBus;
|
|
16
|
-
private readonly rpcClient;
|
|
17
|
-
constructor(config: AgentXConfig);
|
|
18
|
-
get connected(): boolean;
|
|
19
|
-
get events(): EventBus;
|
|
20
|
-
connect(): Promise<void>;
|
|
21
|
-
disconnect(): Promise<void>;
|
|
22
|
-
dispose(): Promise<void>;
|
|
23
|
-
createContainer(containerId: string): Promise<ContainerCreateResponse>;
|
|
24
|
-
getContainer(containerId: string): Promise<ContainerGetResponse>;
|
|
25
|
-
listContainers(): Promise<ContainerListResponse>;
|
|
26
|
-
createImage(params: {
|
|
27
|
-
containerId: string;
|
|
28
|
-
name?: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
systemPrompt?: string;
|
|
31
|
-
mcpServers?: Record<string, unknown>;
|
|
32
|
-
}): Promise<ImageCreateResponse>;
|
|
33
|
-
getImage(imageId: string): Promise<ImageGetResponse>;
|
|
34
|
-
listImages(containerId?: string): Promise<ImageListResponse>;
|
|
35
|
-
deleteImage(imageId: string): Promise<BaseResponse>;
|
|
36
|
-
createAgent(params: {
|
|
37
|
-
imageId: string;
|
|
38
|
-
agentId?: string;
|
|
39
|
-
}): Promise<AgentCreateResponse>;
|
|
40
|
-
getAgent(agentId: string): Promise<AgentGetResponse>;
|
|
41
|
-
listAgents(containerId?: string): Promise<AgentListResponse>;
|
|
42
|
-
destroyAgent(agentId: string): Promise<BaseResponse>;
|
|
43
|
-
sendMessage(agentId: string, content: string | unknown[]): Promise<MessageSendResponse>;
|
|
44
|
-
interrupt(agentId: string): Promise<BaseResponse>;
|
|
45
|
-
on<T extends string>(type: T, handler: BusEventHandler<BusEvent & {
|
|
46
|
-
type: T;
|
|
47
|
-
}>): Unsubscribe;
|
|
48
|
-
onAny(handler: BusEventHandler): Unsubscribe;
|
|
49
|
-
subscribe(sessionId: string): void;
|
|
50
|
-
presentation(agentId: string, options?: PresentationOptions): Presentation;
|
|
51
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* agentxjs - AgentX Client SDK
|
|
3
|
-
*
|
|
4
|
-
* Connect to AgentX servers from Node.js and browsers.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { createAgentX } from "agentxjs";
|
|
9
|
-
*
|
|
10
|
-
* // Connect to server
|
|
11
|
-
* const agentx = await createAgentX({
|
|
12
|
-
* serverUrl: "ws://localhost:5200",
|
|
13
|
-
* headers: { Authorization: "Bearer sk-xxx" },
|
|
14
|
-
* context: { userId: "123", tenantId: "abc" },
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* // Create container and image
|
|
18
|
-
* await agentx.createContainer("my-container");
|
|
19
|
-
* const { record: image } = await agentx.createImage({
|
|
20
|
-
* containerId: "my-container",
|
|
21
|
-
* name: "Assistant",
|
|
22
|
-
* systemPrompt: "You are a helpful assistant",
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* // Create agent and send message
|
|
26
|
-
* const { agentId } = await agentx.createAgent({ imageId: image.imageId });
|
|
27
|
-
*
|
|
28
|
-
* // Subscribe to events
|
|
29
|
-
* agentx.on("text_delta", (event) => {
|
|
30
|
-
* process.stdout.write(event.data.text);
|
|
31
|
-
* });
|
|
32
|
-
*
|
|
33
|
-
* agentx.on("assistant_message", (event) => {
|
|
34
|
-
* console.log("Complete:", event.data.content);
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* // Send message
|
|
38
|
-
* await agentx.sendMessage(agentId, "Hello!");
|
|
39
|
-
*
|
|
40
|
-
* // Cleanup
|
|
41
|
-
* await agentx.dispose();
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @example Dynamic headers and context
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const agentx = await createAgentX({
|
|
47
|
-
* serverUrl: "ws://localhost:5200",
|
|
48
|
-
* headers: () => ({ Authorization: `Bearer ${getToken()}` }),
|
|
49
|
-
* context: async () => ({
|
|
50
|
-
* userId: await getUserId(),
|
|
51
|
-
* permissions: await getPermissions(),
|
|
52
|
-
* }),
|
|
53
|
-
* });
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
import type { AgentX, AgentXConfig } from "./types";
|
|
57
|
-
/**
|
|
58
|
-
* Create an AgentX client
|
|
59
|
-
*
|
|
60
|
-
* @param config - Client configuration
|
|
61
|
-
* @returns Connected AgentX client
|
|
62
|
-
*/
|
|
63
|
-
export declare function createAgentX(config: AgentXConfig): Promise<AgentX>;
|
|
64
|
-
export type { AgentX, AgentXConfig, MaybeAsync, AgentInfo, ImageRecord, ContainerInfo, AgentCreateResponse, AgentGetResponse, AgentListResponse, ImageCreateResponse, ImageGetResponse, ImageListResponse, ContainerCreateResponse, ContainerGetResponse, ContainerListResponse, MessageSendResponse, BaseResponse, } from "./types";
|
|
65
|
-
export type { Block, TextBlock, ToolBlock, ImageBlock, Conversation, UserConversation, AssistantConversation, ErrorConversation, PresentationState, PresentationOptions, PresentationUpdateHandler, PresentationErrorHandler, } from "./presentation";
|
|
66
|
-
export { Presentation, presentationReducer, addUserConversation, createInitialState, initialPresentationState, } from "./presentation";
|