@artinet/cruiser 0.1.6 → 0.1.8
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 +49 -45
- package/dist/openclaw/client.js +5 -3
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ Universal adapters for multi-agent interoperability.
|
|
|
25
25
|
| **Claude Agent SDK** | `@artinet/cruiser/claude` | Text ✅ |
|
|
26
26
|
| **LangChain** | `@artinet/cruiser/langchain` | Text ✅ |
|
|
27
27
|
| **Strands (AWS)** | `@artinet/cruiser/strands` | Text ✅ |
|
|
28
|
+
| **OpenClaw** | `@artinet/cruiser/openclaw` | Text ✅ |
|
|
28
29
|
|
|
29
30
|
## Installation
|
|
30
31
|
|
|
@@ -49,6 +50,11 @@ npm install langchain @langchain/core
|
|
|
49
50
|
|
|
50
51
|
# Strands (AWS)
|
|
51
52
|
npm install @strands-agents/sdk
|
|
53
|
+
|
|
54
|
+
# OpenClaw
|
|
55
|
+
# openclaw runs as a gateway service/CLI
|
|
56
|
+
# see: https://github.com/openclaw/openclaw
|
|
57
|
+
# Cruiser's OpenClaw dock uses the standard Gateway WebSocket protocol.
|
|
52
58
|
```
|
|
53
59
|
|
|
54
60
|
## Quick Start
|
|
@@ -58,18 +64,18 @@ npm install @strands-agents/sdk
|
|
|
58
64
|
Create an agent from any of the supported frameworks and dock it onto artinet:
|
|
59
65
|
|
|
60
66
|
```typescript
|
|
61
|
-
import { Agent } from
|
|
62
|
-
import { dock } from
|
|
63
|
-
import { serve } from
|
|
67
|
+
import { Agent } from '@openai/agents';
|
|
68
|
+
import { dock } from '@artinet/cruiser/openai';
|
|
69
|
+
import { serve } from '@artinet/sdk';
|
|
64
70
|
|
|
65
71
|
// 1. Create your agent
|
|
66
72
|
const agent = new Agent({
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
name: 'assistant',
|
|
74
|
+
instructions: 'You are a helpful assistant',
|
|
69
75
|
});
|
|
70
76
|
|
|
71
77
|
// 2. Dock it onto artinet
|
|
72
|
-
const artinetAgent = await dock(agent, { name:
|
|
78
|
+
const artinetAgent = await dock(agent, { name: 'My Assistant' });
|
|
73
79
|
|
|
74
80
|
// 3. Spin it up as an A2A compatible Server
|
|
75
81
|
serve({ agent: artinetAgent, port: 3000 });
|
|
@@ -82,35 +88,33 @@ serve({ agent: artinetAgent, port: 3000 });
|
|
|
82
88
|
Create interoperable multi-agent systems:
|
|
83
89
|
|
|
84
90
|
```typescript
|
|
85
|
-
import { serve, cr8 } from
|
|
86
|
-
import { dock as dockMastra } from
|
|
87
|
-
import { dock as dockOpenAI } from
|
|
88
|
-
import { Agent as MastraAgent } from
|
|
89
|
-
import { Agent as OpenAIAgent } from
|
|
90
|
-
import { MastraModel } from
|
|
91
|
+
import { serve, cr8 } from '@artinet/sdk';
|
|
92
|
+
import { dock as dockMastra } from '@artinet/cruiser/mastra';
|
|
93
|
+
import { dock as dockOpenAI } from '@artinet/cruiser/openai';
|
|
94
|
+
import { Agent as MastraAgent } from '@mastra/core/agent';
|
|
95
|
+
import { Agent as OpenAIAgent } from '@openai/agents';
|
|
96
|
+
import { MastraModel } from './mastra-model';
|
|
91
97
|
|
|
92
98
|
// Use agents from different frameworks
|
|
93
|
-
const researcher = await dockOpenAI(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
99
|
+
const researcher = await dockOpenAI(new OpenAIAgent({ name: 'researcher', instructions: 'Research topics' }), {
|
|
100
|
+
name: 'Researcher',
|
|
101
|
+
});
|
|
97
102
|
|
|
98
|
-
const writer = await dockMastra(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
);
|
|
103
|
+
const writer = await dockMastra(new MastraAgent({ name: 'writer', instructions: 'Write content', model }), {
|
|
104
|
+
name: 'Writer',
|
|
105
|
+
});
|
|
102
106
|
|
|
103
107
|
// Chain them together
|
|
104
|
-
const agent = cr8(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
console.log(await agent.sendMessage(
|
|
108
|
+
const agent = cr8('Orchestrator Agent')
|
|
109
|
+
// The researcher will receive the incoming user message
|
|
110
|
+
.sendMessage({ agent: researcher })
|
|
111
|
+
// The results are passed to the writer with additional instructions
|
|
112
|
+
.sendMessage({
|
|
113
|
+
agent: writer,
|
|
114
|
+
message: 'use the research results to create a publishable article',
|
|
115
|
+
}).agent;
|
|
116
|
+
|
|
117
|
+
console.log(await agent.sendMessage('I want to learn about the Roman Empire.'));
|
|
114
118
|
```
|
|
115
119
|
|
|
116
120
|
- For more information on how to chain agent requests see the [artinet-sdk](https://github.com/the-artinet-project/artinet-sdk/blob/main/docs/create.md#agent-orchestration)
|
|
@@ -132,23 +136,23 @@ Each adapter exports a `dock` function with the same signature:
|
|
|
132
136
|
### Describe your agent
|
|
133
137
|
|
|
134
138
|
```typescript
|
|
135
|
-
import { dock } from
|
|
139
|
+
import { dock } from '@artinet/cruiser/openai';
|
|
136
140
|
|
|
137
141
|
const artinetAgent = await dock(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
myAgent,
|
|
143
|
+
{
|
|
144
|
+
name: 'Production Assistant',
|
|
145
|
+
description: 'Enterprise-grade AI assistant',
|
|
146
|
+
skills: [
|
|
147
|
+
{ id: 'search', name: 'Web Search', description: 'Search the internet' },
|
|
148
|
+
{ id: 'code', name: 'Code Generation', description: 'Write code' },
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
// Most adapters allow for framework specific options to be passed
|
|
153
|
+
maxTurns: 10,
|
|
154
|
+
signal: abortController.signal,
|
|
155
|
+
},
|
|
152
156
|
);
|
|
153
157
|
```
|
|
154
158
|
|
package/dist/openclaw/client.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
import { WebSocket as NodeWebSocket } from 'ws';
|
|
2
3
|
import { createSignedDevicePayload, persistConnectAuth, readStoredAuth, resolveAuthFilePath, resolveOrCreateDeviceIdentity, } from './auth.js';
|
|
4
|
+
const WebSocketImpl = (globalThis.WebSocket ?? NodeWebSocket);
|
|
3
5
|
export class OpenClawGatewayClient {
|
|
4
6
|
url;
|
|
5
7
|
authToken;
|
|
@@ -30,14 +32,14 @@ export class OpenClawGatewayClient {
|
|
|
30
32
|
this.clientId = uuidv4();
|
|
31
33
|
}
|
|
32
34
|
async ensureConnected() {
|
|
33
|
-
if (this.isConnected && this.socket?.readyState ===
|
|
35
|
+
if (this.isConnected && this.socket?.readyState === WebSocketImpl.OPEN) {
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
38
|
if (this.connectPromise) {
|
|
37
39
|
return this.connectPromise;
|
|
38
40
|
}
|
|
39
41
|
this.connectPromise = new Promise((resolve, reject) => {
|
|
40
|
-
const socket = new
|
|
42
|
+
const socket = new WebSocketImpl(this.url);
|
|
41
43
|
this.socket = socket;
|
|
42
44
|
const connectTimeout = setTimeout(() => {
|
|
43
45
|
reject(new Error('OpenClaw gateway connect timeout'));
|
|
@@ -222,7 +224,7 @@ export class OpenClawGatewayClient {
|
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
226
|
sendFrame(frame) {
|
|
225
|
-
if (!this.socket || this.socket.readyState !==
|
|
227
|
+
if (!this.socket || this.socket.readyState !== WebSocketImpl.OPEN) {
|
|
226
228
|
throw new Error('OpenClaw gateway is not connected');
|
|
227
229
|
}
|
|
228
230
|
this.socket.send(JSON.stringify(frame));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artinet/cruiser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "A library for building A2A enabled runtime Agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@artinet/sdk": "^0.6.4",
|
|
90
90
|
"@artinet/types": "^0.1.4",
|
|
91
|
-
"uuid": "^13.0.0"
|
|
91
|
+
"uuid": "^13.0.0",
|
|
92
|
+
"ws": "^8.19.0"
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
95
|
"@a2a-js/sdk": "^0.3.7",
|
|
@@ -114,7 +115,6 @@
|
|
|
114
115
|
}
|
|
115
116
|
},
|
|
116
117
|
"devDependencies": {
|
|
117
|
-
"@openrouter/ai-sdk-provider": "^1.5.4",
|
|
118
118
|
"@a2a-js/sdk": "^0.3.7",
|
|
119
119
|
"@anthropic-ai/claude-agent-sdk": "^0.2.2",
|
|
120
120
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"@mastra/core": "^1.4.0",
|
|
124
124
|
"@mastra/server": "^1.4.0",
|
|
125
125
|
"@openai/agents": "^0.3.7",
|
|
126
|
+
"@openrouter/ai-sdk-provider": "^1.5.4",
|
|
126
127
|
"@strands-agents/sdk": "^0.1.4",
|
|
127
128
|
"@types/jest": "^29.5.14",
|
|
128
129
|
"@types/node": "^25.0.9",
|