@artinet/cruiser 0.1.5 → 0.1.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/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 "@openai/agents";
62
- import { dock } from "@artinet/cruiser/openai";
63
- import { serve } from "@artinet/sdk";
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
- name: "assistant",
68
- instructions: "You are a helpful assistant",
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: "My Assistant" });
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 "@artinet/sdk";
86
- import { dock as dockMastra } from "@artinet/cruiser/mastra";
87
- import { dock as dockOpenAI } from "@artinet/cruiser/openai";
88
- import { Agent as MastraAgent } from "@mastra/core/agent";
89
- import { Agent as OpenAIAgent } from "@openai/agents";
90
- import { MastraModel } from "./mastra-model";
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
- new OpenAIAgent({ name: "researcher", instructions: "Research topics" }),
95
- { name: "Researcher" }
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
- new MastraAgent({ name: "writer", instructions: "Write content", model }),
100
- { name: "Writer" }
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("Orchestrator Agent")
105
- // The researcher will receive the incoming user message
106
- .sendMessage({ agent: researcher })
107
- // The results are passed to the writer with additional instructions
108
- .sendMessage({
109
- agent: writer,
110
- message: "use the research results to create a publishable article",
111
- }).agent;
112
-
113
- console.log(await agent.sendMessage("I want to learn about the Roman Empire."));
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 "@artinet/cruiser/openai";
139
+ import { dock } from '@artinet/cruiser/openai';
136
140
 
137
141
  const artinetAgent = await dock(
138
- myAgent,
139
- {
140
- name: "Production Assistant",
141
- description: "Enterprise-grade AI assistant",
142
- skills: [
143
- { id: "search", name: "Web Search", description: "Search the internet" },
144
- { id: "code", name: "Code Generation", description: "Write code" },
145
- ],
146
- },
147
- {
148
- // Most adapters allow for framework specific options to be passed
149
- maxTurns: 10,
150
- signal: abortController.signal,
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/index.d.ts CHANGED
@@ -17,6 +17,7 @@
17
17
  * | Claude | `@artinet/cruiser/claude` | {@link ClaudeAgent} |
18
18
  * | LangChain | `@artinet/cruiser/langchain` | {@link ReactAgent} |
19
19
  * | Mastra | `@artinet/cruiser/mastra` | {@link MastraAgent} |
20
+ * | OpenClaw | `@artinet/cruiser/openclaw` | {@link OpenClawAgent}|
20
21
  * | OpenAI | `@artinet/cruiser/openai` | {@link OpenAIAgent} |
21
22
  * | Strands | `@artinet/cruiser/strands` | {@link StrandsAgent} |
22
23
  *
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@
17
17
  * | Claude | `@artinet/cruiser/claude` | {@link ClaudeAgent} |
18
18
  * | LangChain | `@artinet/cruiser/langchain` | {@link ReactAgent} |
19
19
  * | Mastra | `@artinet/cruiser/mastra` | {@link MastraAgent} |
20
+ * | OpenClaw | `@artinet/cruiser/openclaw` | {@link OpenClawAgent}|
20
21
  * | OpenAI | `@artinet/cruiser/openai` | {@link OpenAIAgent} |
21
22
  * | Strands | `@artinet/cruiser/strands` | {@link StrandsAgent} |
22
23
  *
@@ -40,9 +40,9 @@
40
40
  *
41
41
  * @see {@link https://mastra.ai/docs} Mastra Documentation
42
42
  */
43
- import { OutputSchema } from "@mastra/core/stream";
44
- import { Agent as MastraAgent, AgentExecutionOptions } from "@mastra/core/agent";
45
- import { Dock, Park } from "../corsair.js";
43
+ import { OutputSchema } from '@mastra/core/stream';
44
+ import { Agent as MastraAgent, AgentExecutionOptions } from '@mastra/core/agent';
45
+ import { Dock, Park } from '../corsair.js';
46
46
  /**
47
47
  * Docks a Mastra agent onto artinet.
48
48
  *
@@ -104,8 +104,8 @@ import { Dock, Park } from "../corsair.js";
104
104
  * });
105
105
  * ```
106
106
  */
107
- export declare const dock: Dock<MastraAgent, AgentExecutionOptions<OutputSchema | undefined, "aisdk" | "mastra">>;
107
+ export declare const dock: Dock<MastraAgent, AgentExecutionOptions<OutputSchema | undefined>>;
108
108
  /**
109
109
  * @deprecated Use {@link dock} instead.
110
110
  */
111
- export declare const park: Park<MastraAgent, AgentExecutionOptions<OutputSchema | undefined, "aisdk" | "mastra">>;
111
+ export declare const park: Park<MastraAgent, AgentExecutionOptions<OutputSchema | undefined>>;
@@ -40,9 +40,9 @@
40
40
  *
41
41
  * @see {@link https://mastra.ai/docs} Mastra Documentation
42
42
  */
43
- import * as sdk from "@artinet/sdk";
44
- import { getAgentCard, convertToCoreMessage } from "./utils.js";
45
- import { v4 as uuidv4 } from "uuid";
43
+ import * as sdk from '@artinet/sdk';
44
+ import { getAgentCard, convertToCoreMessage } from './utils.js';
45
+ import { v4 as uuidv4 } from 'uuid';
46
46
  /**
47
47
  * Docks a Mastra agent onto artinet.
48
48
  *
@@ -135,7 +135,7 @@ export const dock = async (agent, card, options) => {
135
135
  contextId: task.contextId,
136
136
  message: sdk.describe.message({
137
137
  messageId: uuidv4(),
138
- role: "agent",
138
+ role: 'agent',
139
139
  parts: [sdk.describe.part.text(result.text)],
140
140
  metadata,
141
141
  }),
@@ -9,10 +9,10 @@
9
9
  *
10
10
  * @see {@link https://github.com/mastra-ai/mastra} Mastra Source
11
11
  */
12
- import * as sdk from "@artinet/sdk";
13
- import { AgentExecutionOptions, Agent as MastraAgent } from "@mastra/core/agent";
14
- import { CoreMessage } from "@mastra/core/llm";
15
- import { OutputSchema } from "@mastra/core/stream";
12
+ import * as sdk from '@artinet/sdk';
13
+ import { AgentExecutionOptions, Agent as MastraAgent } from '@mastra/core/agent';
14
+ import { CoreMessage } from '@mastra/core/llm';
15
+ import { OutputSchema } from '@mastra/core/stream';
16
16
  /**
17
17
  * Builds an {@link sdk.A2A.AgentCard} from Mastra agent configuration.
18
18
  *
@@ -36,10 +36,10 @@ import { OutputSchema } from "@mastra/core/stream";
36
36
  * });
37
37
  * ```
38
38
  */
39
- export declare function getAgentCard<OUTPUT extends OutputSchema = undefined, FORMAT extends "aisdk" | "mastra" = "mastra">({ agent, card, options: _options, }: {
39
+ export declare function getAgentCard<OUTPUT extends OutputSchema = undefined>({ agent, card, options: _options, }: {
40
40
  agent: MastraAgent;
41
41
  card?: sdk.A2A.AgentCardParams;
42
- options?: AgentExecutionOptions<OUTPUT, FORMAT>;
42
+ options?: AgentExecutionOptions<OUTPUT>;
43
43
  }): Promise<sdk.A2A.AgentCard>;
44
44
  /**
45
45
  * Converts an {@link sdk.A2A.Message} to Mastra's {@link CoreMessage} format.
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @see {@link https://github.com/mastra-ai/mastra} Mastra Source
11
11
  */
12
- import * as sdk from "@artinet/sdk";
12
+ import * as sdk from '@artinet/sdk';
13
13
  /**
14
14
  * Converts Mastra {@link SystemMessage} instructions to a plain string.
15
15
  *
@@ -27,25 +27,25 @@ import * as sdk from "@artinet/sdk";
27
27
  */
28
28
  function convertInstructionsToString(message) {
29
29
  if (!message) {
30
- return "";
30
+ return '';
31
31
  }
32
- if (typeof message === "string") {
32
+ if (typeof message === 'string') {
33
33
  return message;
34
34
  }
35
35
  if (Array.isArray(message)) {
36
36
  return message
37
37
  .map((m) => {
38
- if (typeof m === "string") {
38
+ if (typeof m === 'string') {
39
39
  return m;
40
40
  }
41
41
  // Safely extract content from message objects
42
- return typeof m.content === "string" ? m.content : "";
42
+ return typeof m.content === 'string' ? m.content : '';
43
43
  })
44
44
  .filter((content) => content) // Remove empty strings
45
- .join("\n");
45
+ .join('\n');
46
46
  }
47
47
  // Handle single message object - safely extract content
48
- return typeof message.content === "string" ? message.content : "";
48
+ return typeof message.content === 'string' ? message.content : '';
49
49
  }
50
50
  /**
51
51
  * Builds an {@link sdk.A2A.AgentCard} from Mastra agent configuration.
@@ -71,23 +71,23 @@ function convertInstructionsToString(message) {
71
71
  * ```
72
72
  */
73
73
  export async function getAgentCard({ agent, card, options: _options, }) {
74
- const [instructions, tools] = await Promise.all([agent.getInstructions(), agent.getTools()]);
74
+ const [instructions, tools = {}] = await Promise.all([agent.getInstructions(), agent.listTools?.() ?? Promise.resolve({})]);
75
75
  const agentCard = sdk.describe.card({
76
76
  name: agent.id,
77
- ...(typeof card === "string" ? { name: card } : card),
77
+ ...(typeof card === 'string' ? { name: card } : card),
78
78
  description: convertInstructionsToString(instructions),
79
79
  capabilities: {
80
80
  streaming: true,
81
81
  pushNotifications: true,
82
82
  stateTransitionHistory: false,
83
83
  },
84
- defaultInputModes: ["text"],
85
- defaultOutputModes: ["text"],
84
+ defaultInputModes: ['text'],
85
+ defaultOutputModes: ['text'],
86
86
  skills: Object.entries(tools).map(([toolId, tool]) => ({
87
87
  id: toolId,
88
88
  name: toolId,
89
89
  description: tool.description || `Tool: ${toolId}`,
90
- tags: ["tool"],
90
+ tags: ['tool'],
91
91
  })),
92
92
  });
93
93
  return agentCard;
@@ -112,7 +112,7 @@ export async function getAgentCard({ agent, card, options: _options, }) {
112
112
  */
113
113
  export function convertToCoreMessage(message) {
114
114
  return {
115
- role: message.role === "user" ? "user" : "assistant",
115
+ role: message.role === 'user' ? 'user' : 'assistant',
116
116
  content: message.parts.map((msg) => convertToCoreMessagePart(msg)),
117
117
  };
118
118
  }
@@ -131,21 +131,21 @@ export function convertToCoreMessage(message) {
131
131
  */
132
132
  function convertToCoreMessagePart(part) {
133
133
  switch (part.kind) {
134
- case "text":
134
+ case 'text':
135
135
  return {
136
- type: "text",
136
+ type: 'text',
137
137
  text: part.text,
138
138
  };
139
- case "file":
139
+ case 'file':
140
140
  return {
141
- type: "file",
142
- data: "uri" in part.file && part.file.uri
141
+ type: 'file',
142
+ data: 'uri' in part.file && part.file.uri
143
143
  ? new URL(part.file.uri)
144
144
  : /**Appeasing the type system */
145
145
  part.file.bytes,
146
- mimeType: part.file.mimeType ?? "unknown",
146
+ mimeType: part.file.mimeType ?? 'unknown',
147
147
  };
148
- case "data":
149
- throw new Error("Data parts are not supported in core messages");
148
+ case 'data':
149
+ throw new Error('Data parts are not supported in core messages');
150
150
  }
151
151
  }
@@ -0,0 +1,48 @@
1
+ import type { OpenClawAgent } from './utils.js';
2
+ type StoredAuthFile = {
3
+ version: 1;
4
+ device?: {
5
+ id: string;
6
+ publicKey: string;
7
+ privateKeyPem: string;
8
+ };
9
+ tokens?: {
10
+ operator?: {
11
+ token: string;
12
+ role?: string;
13
+ scopes?: string[];
14
+ updatedAtMs: number;
15
+ };
16
+ };
17
+ };
18
+ export type ResolvedDeviceIdentity = {
19
+ id: string;
20
+ publicKey: string;
21
+ privateKeyPem: string;
22
+ };
23
+ export declare function resolveAuthFilePath(agent: OpenClawAgent): string | undefined;
24
+ export declare function readStoredAuth(path: string | undefined): StoredAuthFile | undefined;
25
+ export declare function writeStoredAuth(path: string | undefined, auth: StoredAuthFile): void;
26
+ export declare function resolveOrCreateDeviceIdentity({ agent, authFilePath, }: {
27
+ agent: OpenClawAgent;
28
+ authFilePath: string | undefined;
29
+ }): ResolvedDeviceIdentity | undefined;
30
+ export declare function createSignedDevicePayload({ identity, scopes, token, nonce, }: {
31
+ identity: ResolvedDeviceIdentity;
32
+ scopes: string[];
33
+ token?: string;
34
+ nonce?: string;
35
+ }): {
36
+ id: string;
37
+ publicKey: string;
38
+ signature: string;
39
+ signedAt: number;
40
+ nonce?: string;
41
+ };
42
+ export declare function persistConnectAuth({ authFilePath, payload, scopes, deviceIdentity, }: {
43
+ authFilePath: string | undefined;
44
+ payload: unknown;
45
+ scopes: string[];
46
+ deviceIdentity?: ResolvedDeviceIdentity;
47
+ }): void;
48
+ export {};
@@ -0,0 +1,152 @@
1
+ import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, sign } from 'node:crypto';
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, join } from 'node:path';
5
+ const ED25519_SPKI_PREFIX = Buffer.from('302a300506032b6570032100', 'hex');
6
+ function base64UrlEncode(buffer) {
7
+ return buffer.toString('base64').replaceAll('+', '-').replaceAll('/', '_').replace(/=+$/g, '');
8
+ }
9
+ function derivePublicKeyRawFromPem(publicKeyPem) {
10
+ const key = createPublicKey(publicKeyPem);
11
+ const spki = key.export({ type: 'spki', format: 'der' });
12
+ if (spki.length === ED25519_SPKI_PREFIX.length + 32 &&
13
+ spki.subarray(0, ED25519_SPKI_PREFIX.length).equals(ED25519_SPKI_PREFIX)) {
14
+ return spki.subarray(ED25519_SPKI_PREFIX.length);
15
+ }
16
+ return spki;
17
+ }
18
+ function fingerprintPublicKey(publicKeyBase64Url) {
19
+ return createHash('sha256')
20
+ .update(Buffer.from(publicKeyBase64Url.replaceAll('-', '+').replaceAll('_', '/'), 'base64'))
21
+ .digest('hex');
22
+ }
23
+ function buildDeviceAuthPayload({ version, deviceId, clientId, clientMode, role, scopes, signedAt, token, nonce, }) {
24
+ const base = [version, deviceId, clientId, clientMode, role, scopes.join(','), String(signedAt), token ?? ''];
25
+ if (version === 'v2') {
26
+ base.push(nonce ?? '');
27
+ }
28
+ return base.join('|');
29
+ }
30
+ export function resolveAuthFilePath(agent) {
31
+ if (agent.autoDeviceAuth === false) {
32
+ return undefined;
33
+ }
34
+ if (agent.authFilePath && agent.authFilePath.trim().length > 0) {
35
+ return agent.authFilePath.trim();
36
+ }
37
+ return join(homedir(), 'artinet-openclaw.auth');
38
+ }
39
+ export function readStoredAuth(path) {
40
+ if (!path || !existsSync(path)) {
41
+ return undefined;
42
+ }
43
+ try {
44
+ const parsed = JSON.parse(readFileSync(path, 'utf8'));
45
+ if (parsed.version !== 1) {
46
+ return undefined;
47
+ }
48
+ return parsed;
49
+ }
50
+ catch {
51
+ return undefined;
52
+ }
53
+ }
54
+ export function writeStoredAuth(path, auth) {
55
+ if (!path) {
56
+ return;
57
+ }
58
+ mkdirSync(dirname(path), { recursive: true });
59
+ writeFileSync(path, `${JSON.stringify(auth, null, 2)}\n`, { encoding: 'utf8' });
60
+ }
61
+ export function resolveOrCreateDeviceIdentity({ agent, authFilePath, }) {
62
+ const manual = agent.device;
63
+ if (manual?.id && manual.publicKey && manual.privateKeyPem) {
64
+ return {
65
+ id: manual.id,
66
+ publicKey: manual.publicKey,
67
+ privateKeyPem: manual.privateKeyPem,
68
+ };
69
+ }
70
+ const stored = readStoredAuth(authFilePath);
71
+ if (stored?.device?.id && stored.device.publicKey && stored.device.privateKeyPem) {
72
+ return stored.device;
73
+ }
74
+ if (agent.autoDeviceAuth === false) {
75
+ return undefined;
76
+ }
77
+ const keyPair = generateKeyPairSync('ed25519');
78
+ const publicKeyPem = keyPair.publicKey.export({ type: 'spki', format: 'pem' }).toString();
79
+ const privateKeyPem = keyPair.privateKey.export({ type: 'pkcs8', format: 'pem' }).toString();
80
+ const publicKey = base64UrlEncode(derivePublicKeyRawFromPem(publicKeyPem));
81
+ const identity = {
82
+ id: fingerprintPublicKey(publicKey),
83
+ publicKey,
84
+ privateKeyPem,
85
+ };
86
+ const nextAuth = stored ?? { version: 1 };
87
+ nextAuth.device = identity;
88
+ writeStoredAuth(authFilePath, nextAuth);
89
+ return identity;
90
+ }
91
+ export function createSignedDevicePayload({ identity, scopes, token, nonce, }) {
92
+ const signedAt = Date.now();
93
+ const version = nonce ? 'v2' : 'v1';
94
+ const payload = buildDeviceAuthPayload({
95
+ version,
96
+ deviceId: identity.id,
97
+ clientId: 'cli',
98
+ clientMode: 'cli',
99
+ role: 'operator',
100
+ scopes,
101
+ signedAt,
102
+ token,
103
+ nonce,
104
+ });
105
+ const signature = base64UrlEncode(sign(null, Buffer.from(payload, 'utf8'), createPrivateKey(identity.privateKeyPem)));
106
+ return {
107
+ id: identity.id,
108
+ publicKey: identity.publicKey,
109
+ signature,
110
+ signedAt,
111
+ ...(nonce ? { nonce } : {}),
112
+ };
113
+ }
114
+ export function persistConnectAuth({ authFilePath, payload, scopes, deviceIdentity, }) {
115
+ if (!authFilePath) {
116
+ return;
117
+ }
118
+ if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
119
+ return;
120
+ }
121
+ const record = payload;
122
+ const auth = record.auth;
123
+ if (!auth || typeof auth !== 'object' || Array.isArray(auth)) {
124
+ return;
125
+ }
126
+ const authRecord = auth;
127
+ const deviceToken = authRecord.deviceToken;
128
+ if (typeof deviceToken !== 'string' || deviceToken.trim().length === 0) {
129
+ return;
130
+ }
131
+ const role = typeof authRecord.role === 'string' ? authRecord.role : 'operator';
132
+ const resolvedScopes = Array.isArray(authRecord.scopes)
133
+ ? authRecord.scopes.filter((scope) => typeof scope === 'string')
134
+ : scopes;
135
+ const existing = readStoredAuth(authFilePath) ?? { version: 1 };
136
+ const next = {
137
+ ...existing,
138
+ tokens: {
139
+ ...(existing.tokens ?? {}),
140
+ operator: {
141
+ token: deviceToken,
142
+ role,
143
+ scopes: resolvedScopes,
144
+ updatedAtMs: Date.now(),
145
+ },
146
+ },
147
+ };
148
+ if (deviceIdentity) {
149
+ next.device = deviceIdentity;
150
+ }
151
+ writeStoredAuth(authFilePath, next);
152
+ }
@@ -0,0 +1,37 @@
1
+ import type { OpenClawAgent, OpenClawResult } from './utils.js';
2
+ export declare class OpenClawGatewayClient {
3
+ private readonly url;
4
+ private readonly authToken?;
5
+ private readonly authPassword?;
6
+ private readonly device?;
7
+ private readonly deviceIdentity?;
8
+ private readonly authFilePath;
9
+ private readonly scopes;
10
+ private readonly connectTimeoutMs;
11
+ private readonly clientId;
12
+ private socket;
13
+ private connectPromise;
14
+ private isConnected;
15
+ private connectRequestId;
16
+ private pendingRequests;
17
+ constructor({ url, authToken, authPassword, agent, device, scopes, connectTimeoutMs, }: {
18
+ url: string;
19
+ authToken?: string;
20
+ authPassword?: string;
21
+ agent: OpenClawAgent;
22
+ device?: OpenClawAgent['device'];
23
+ scopes?: string[];
24
+ connectTimeoutMs: number;
25
+ });
26
+ ensureConnected(): Promise<void>;
27
+ requestAgentRun({ message, agentId, sessionKey, timeoutMs, }: {
28
+ message: string;
29
+ agentId: string;
30
+ sessionKey?: string;
31
+ timeoutMs: number;
32
+ }): Promise<OpenClawResult>;
33
+ private handleMessage;
34
+ private sendConnectRequest;
35
+ private sendFrame;
36
+ private rejectAllPending;
37
+ }