@openclaw-cloud/agent-controller 2.3.1 → 2.3.3
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/mcp-client.d.ts +35 -0
- package/dist/mcp-client.js +124 -15
- package/dist/mcp-client.js.map +1 -1
- package/dist/providers/openclaw/auto-pair.d.ts +16 -0
- package/dist/providers/openclaw/auto-pair.js +84 -0
- package/dist/providers/openclaw/auto-pair.js.map +1 -0
- package/dist/providers/openclaw/index.js +10 -0
- package/dist/providers/openclaw/index.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp-client.d.ts
CHANGED
|
@@ -12,6 +12,18 @@ export interface McpBoardClientOptions {
|
|
|
12
12
|
/**
|
|
13
13
|
* MCP client for communicating with the openclaw-cloud MCP server.
|
|
14
14
|
* Used by BoardHandler to call board tools and receive board event notifications.
|
|
15
|
+
*
|
|
16
|
+
* The backend stores MCP sessions in Redis with a TTL that is refreshed on each
|
|
17
|
+
* request and on SSE keepalives. If the session disappears server-side (Redis
|
|
18
|
+
* flush during deploy, TTL expiry during long idle, transient network drop where
|
|
19
|
+
* the GET SSE channel never recovered) every subsequent callTool returns
|
|
20
|
+
* `-32001 Session not found`. Without recovery, the agent-controller is stuck
|
|
21
|
+
* with a dead client until process restart.
|
|
22
|
+
*
|
|
23
|
+
* `callTool` and `listTools` transparently re-establish the session on
|
|
24
|
+
* `Session not found` and retry exactly once. A mutex prevents concurrent
|
|
25
|
+
* reconnects when many calls fail at the same moment. Persistent failure
|
|
26
|
+
* bubbles up and is handled by the restart-loop.
|
|
15
27
|
*/
|
|
16
28
|
export declare class McpBoardClient {
|
|
17
29
|
private client;
|
|
@@ -19,6 +31,7 @@ export declare class McpBoardClient {
|
|
|
19
31
|
private onBoardEvent?;
|
|
20
32
|
private url;
|
|
21
33
|
private token;
|
|
34
|
+
private reconnectInFlight;
|
|
22
35
|
constructor(options: McpBoardClientOptions);
|
|
23
36
|
setEventHandler(handler: (event: Record<string, unknown>) => void): void;
|
|
24
37
|
connect(): Promise<void>;
|
|
@@ -26,4 +39,26 @@ export declare class McpBoardClient {
|
|
|
26
39
|
callTool(name: string, args?: Record<string, unknown>): Promise<McpToolResult>;
|
|
27
40
|
listTools(): Promise<string[]>;
|
|
28
41
|
isConnected(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Match either an `McpError` carrying `code: -32001` or a generic Error whose
|
|
44
|
+
* message contains the JSON-RPC text / HTTP 404 status from the SDK transport.
|
|
45
|
+
*/
|
|
46
|
+
private isSessionLost;
|
|
47
|
+
private handleSessionLost;
|
|
48
|
+
/**
|
|
49
|
+
* Mutex-guarded reconnect. Concurrent callers all await the same in-flight
|
|
50
|
+
* promise so a burst of failed callTool invocations triggers exactly one
|
|
51
|
+
* fresh transport+session, not N. Capped at a single retry per failure —
|
|
52
|
+
* if the retry also fails, the error propagates and the supervising
|
|
53
|
+
* restart-loop takes over.
|
|
54
|
+
*/
|
|
55
|
+
private reconnect;
|
|
56
|
+
private performReconnect;
|
|
57
|
+
/**
|
|
58
|
+
* Notification handler is registered on the Client instance, so we must
|
|
59
|
+
* re-install it every time we replace that instance during reconnect.
|
|
60
|
+
* Listens for `board/event` notifications dispatched by the backend's
|
|
61
|
+
* McpSessionManager.
|
|
62
|
+
*/
|
|
63
|
+
private installNotificationHandler;
|
|
29
64
|
}
|
package/dist/mcp-client.js
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
2
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { logCollector } from './connection.js';
|
|
5
|
+
// Notification schema is shared across the initial connect() and every reconnect()
|
|
6
|
+
// so we install the same handler each time the underlying Client is replaced.
|
|
7
|
+
const BoardEventNotification = z.object({
|
|
8
|
+
method: z.literal('board/event'),
|
|
9
|
+
params: z.object({}).passthrough().optional(),
|
|
10
|
+
});
|
|
4
11
|
/**
|
|
5
12
|
* MCP client for communicating with the openclaw-cloud MCP server.
|
|
6
13
|
* Used by BoardHandler to call board tools and receive board event notifications.
|
|
14
|
+
*
|
|
15
|
+
* The backend stores MCP sessions in Redis with a TTL that is refreshed on each
|
|
16
|
+
* request and on SSE keepalives. If the session disappears server-side (Redis
|
|
17
|
+
* flush during deploy, TTL expiry during long idle, transient network drop where
|
|
18
|
+
* the GET SSE channel never recovered) every subsequent callTool returns
|
|
19
|
+
* `-32001 Session not found`. Without recovery, the agent-controller is stuck
|
|
20
|
+
* with a dead client until process restart.
|
|
21
|
+
*
|
|
22
|
+
* `callTool` and `listTools` transparently re-establish the session on
|
|
23
|
+
* `Session not found` and retry exactly once. A mutex prevents concurrent
|
|
24
|
+
* reconnects when many calls fail at the same moment. Persistent failure
|
|
25
|
+
* bubbles up and is handled by the restart-loop.
|
|
7
26
|
*/
|
|
8
27
|
export class McpBoardClient {
|
|
9
28
|
client;
|
|
@@ -11,6 +30,7 @@ export class McpBoardClient {
|
|
|
11
30
|
onBoardEvent;
|
|
12
31
|
url;
|
|
13
32
|
token;
|
|
33
|
+
reconnectInFlight = null;
|
|
14
34
|
constructor(options) {
|
|
15
35
|
this.url = options.url;
|
|
16
36
|
this.token = options.token;
|
|
@@ -27,17 +47,7 @@ export class McpBoardClient {
|
|
|
27
47
|
});
|
|
28
48
|
await this.client.connect(transport);
|
|
29
49
|
this.connected = true;
|
|
30
|
-
|
|
31
|
-
// The backend dispatches these as method 'board/event' via McpSessionManager.
|
|
32
|
-
const BoardEventNotification = z.object({
|
|
33
|
-
method: z.literal('board/event'),
|
|
34
|
-
params: z.object({}).passthrough().optional(),
|
|
35
|
-
});
|
|
36
|
-
this.client.setNotificationHandler(BoardEventNotification, (notification) => {
|
|
37
|
-
if (this.onBoardEvent && notification.params) {
|
|
38
|
-
this.onBoardEvent(notification.params);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
50
|
+
this.installNotificationHandler();
|
|
41
51
|
console.log('[mcp] Client connected to', this.url);
|
|
42
52
|
}
|
|
43
53
|
async disconnect() {
|
|
@@ -54,17 +64,116 @@ export class McpBoardClient {
|
|
|
54
64
|
async callTool(name, args = {}) {
|
|
55
65
|
if (!this.connected)
|
|
56
66
|
throw new Error('MCP client not connected');
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
try {
|
|
68
|
+
return (await this.client.callTool({ name, arguments: args }));
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (!this.isSessionLost(err))
|
|
72
|
+
throw err;
|
|
73
|
+
await this.handleSessionLost(err, { tool: name });
|
|
74
|
+
return (await this.client.callTool({ name, arguments: args }));
|
|
75
|
+
}
|
|
59
76
|
}
|
|
60
77
|
async listTools() {
|
|
61
78
|
if (!this.connected)
|
|
62
79
|
throw new Error('MCP client not connected');
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
try {
|
|
81
|
+
const result = await this.client.listTools();
|
|
82
|
+
return result.tools.map((t) => t.name);
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
if (!this.isSessionLost(err))
|
|
86
|
+
throw err;
|
|
87
|
+
await this.handleSessionLost(err, { tool: 'listTools' });
|
|
88
|
+
const result = await this.client.listTools();
|
|
89
|
+
return result.tools.map((t) => t.name);
|
|
90
|
+
}
|
|
65
91
|
}
|
|
66
92
|
isConnected() {
|
|
67
93
|
return this.connected;
|
|
68
94
|
}
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// Reconnect / recovery internals
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
/**
|
|
99
|
+
* Match either an `McpError` carrying `code: -32001` or a generic Error whose
|
|
100
|
+
* message contains the JSON-RPC text / HTTP 404 status from the SDK transport.
|
|
101
|
+
*/
|
|
102
|
+
isSessionLost(err) {
|
|
103
|
+
if (err &&
|
|
104
|
+
typeof err === 'object' &&
|
|
105
|
+
'code' in err &&
|
|
106
|
+
err.code === -32001) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
110
|
+
return /-32001|Session not found|HTTP 404/i.test(msg);
|
|
111
|
+
}
|
|
112
|
+
async handleSessionLost(err, ctx) {
|
|
113
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
114
|
+
logCollector?.push('mcp_session_lost', 'warn', `Reconnecting after: ${message}`, ctx);
|
|
115
|
+
await this.reconnect();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Mutex-guarded reconnect. Concurrent callers all await the same in-flight
|
|
119
|
+
* promise so a burst of failed callTool invocations triggers exactly one
|
|
120
|
+
* fresh transport+session, not N. Capped at a single retry per failure —
|
|
121
|
+
* if the retry also fails, the error propagates and the supervising
|
|
122
|
+
* restart-loop takes over.
|
|
123
|
+
*/
|
|
124
|
+
async reconnect() {
|
|
125
|
+
if (this.reconnectInFlight) {
|
|
126
|
+
return this.reconnectInFlight;
|
|
127
|
+
}
|
|
128
|
+
this.reconnectInFlight = this.performReconnect().finally(() => {
|
|
129
|
+
this.reconnectInFlight = null;
|
|
130
|
+
});
|
|
131
|
+
return this.reconnectInFlight;
|
|
132
|
+
}
|
|
133
|
+
async performReconnect() {
|
|
134
|
+
// Best-effort close — transport may already be dead.
|
|
135
|
+
try {
|
|
136
|
+
await this.client.close();
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// ignored
|
|
140
|
+
}
|
|
141
|
+
// The SDK transport caches sessionId per instance; we must replace both
|
|
142
|
+
// the Client and the StreamableHTTPClientTransport, not reuse them.
|
|
143
|
+
this.client = new Client({ name: 'agent-controller', version: '1.0.0' }, { capabilities: {} });
|
|
144
|
+
const transport = new StreamableHTTPClientTransport(new URL(this.url), {
|
|
145
|
+
requestInit: {
|
|
146
|
+
headers: { Authorization: `Bearer ${this.token}` },
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
await this.client.connect(transport);
|
|
150
|
+
this.connected = true;
|
|
151
|
+
this.installNotificationHandler();
|
|
152
|
+
let toolCount;
|
|
153
|
+
try {
|
|
154
|
+
const result = await this.client.listTools();
|
|
155
|
+
toolCount = result.tools.length;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// Tool count is informational only — don't fail the reconnect over it.
|
|
159
|
+
}
|
|
160
|
+
logCollector?.push('mcp_reconnected', 'info', 'MCP session re-established', {
|
|
161
|
+
url: this.url,
|
|
162
|
+
tools: toolCount,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Notification handler is registered on the Client instance, so we must
|
|
167
|
+
* re-install it every time we replace that instance during reconnect.
|
|
168
|
+
* Listens for `board/event` notifications dispatched by the backend's
|
|
169
|
+
* McpSessionManager.
|
|
170
|
+
*/
|
|
171
|
+
installNotificationHandler() {
|
|
172
|
+
this.client.setNotificationHandler(BoardEventNotification, (notification) => {
|
|
173
|
+
if (this.onBoardEvent && notification.params) {
|
|
174
|
+
this.onBoardEvent(notification.params);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
69
178
|
}
|
|
70
179
|
//# sourceMappingURL=mcp-client.js.map
|
package/dist/mcp-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client.js","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-client.js","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,O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C,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;QACzE,CAAC;QAED,YAAY,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,4BAA4B,EAAE;YAC1E,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACK,0BAA0B;QAChC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,sBAAsB,EAAE,CAAC,YAAY,EAAE,EAAE;YAC1E,IAAI,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC7C,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,MAAiC,CAAC,CAAC;YACpE,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type AutoPairOutcome = {
|
|
2
|
+
status: 'approved';
|
|
3
|
+
requestId: string;
|
|
4
|
+
deviceId: string;
|
|
5
|
+
} | {
|
|
6
|
+
status: 'skipped';
|
|
7
|
+
reason: 'cli_missing' | 'no_pending' | 'no_match' | 'list_failed' | 'approve_failed' | 'identity_error';
|
|
8
|
+
detail?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Best-effort one-shot auto-approval of our own pending pairing request via
|
|
12
|
+
* the local `openclaw` CLI. Never throws — all failures resolve to a
|
|
13
|
+
* `{ status: 'skipped', reason }` outcome so the caller can treat it as a
|
|
14
|
+
* no-op and continue its retry loop.
|
|
15
|
+
*/
|
|
16
|
+
export declare function autoApproveOwnPairing(): Promise<AutoPairOutcome>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import { logCollector } from '../../connection.js';
|
|
4
|
+
import { toErrorMessage } from '../../utils/response.js';
|
|
5
|
+
import { loadOrCreateDeviceIdentity } from './device-identity.js';
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
const CLI_TIMEOUT_MS = 10_000;
|
|
8
|
+
function isErrnoException(e) {
|
|
9
|
+
return e instanceof Error && typeof e.code === 'string';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Best-effort one-shot auto-approval of our own pending pairing request via
|
|
13
|
+
* the local `openclaw` CLI. Never throws — all failures resolve to a
|
|
14
|
+
* `{ status: 'skipped', reason }` outcome so the caller can treat it as a
|
|
15
|
+
* no-op and continue its retry loop.
|
|
16
|
+
*/
|
|
17
|
+
export async function autoApproveOwnPairing() {
|
|
18
|
+
let ownDeviceId;
|
|
19
|
+
try {
|
|
20
|
+
ownDeviceId = loadOrCreateDeviceIdentity().deviceId;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
const detail = toErrorMessage(err);
|
|
24
|
+
logCollector?.push('chat_provider_auto_pair', 'warn', `Failed to load device identity: ${detail}`, {});
|
|
25
|
+
return { status: 'skipped', reason: 'identity_error', detail };
|
|
26
|
+
}
|
|
27
|
+
logCollector?.push('chat_provider_auto_pair', 'info', 'Pairing required — attempting auto-approve', { deviceId: ownDeviceId });
|
|
28
|
+
// 1. List pending pairing requests.
|
|
29
|
+
let listStdout;
|
|
30
|
+
try {
|
|
31
|
+
const { stdout } = await execFileAsync('openclaw', ['devices', 'list', '--json'], {
|
|
32
|
+
timeout: CLI_TIMEOUT_MS,
|
|
33
|
+
});
|
|
34
|
+
listStdout = stdout;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
if (isErrnoException(err) && err.code === 'ENOENT') {
|
|
38
|
+
logCollector?.push('chat_provider_auto_pair', 'warn', 'openclaw CLI not found in PATH — skipping auto-pair', { deviceId: ownDeviceId });
|
|
39
|
+
return { status: 'skipped', reason: 'cli_missing' };
|
|
40
|
+
}
|
|
41
|
+
const detail = toErrorMessage(err);
|
|
42
|
+
logCollector?.push('chat_provider_auto_pair', 'warn', `openclaw devices list failed: ${detail}`, { deviceId: ownDeviceId });
|
|
43
|
+
return { status: 'skipped', reason: 'list_failed', detail };
|
|
44
|
+
}
|
|
45
|
+
// 2. Parse the JSON payload.
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = JSON.parse(listStdout);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
const detail = toErrorMessage(err);
|
|
52
|
+
logCollector?.push('chat_provider_auto_pair', 'warn', `openclaw devices list failed: ${detail}`, { deviceId: ownDeviceId, parseError: true });
|
|
53
|
+
return { status: 'skipped', reason: 'list_failed', detail };
|
|
54
|
+
}
|
|
55
|
+
const pending = Array.isArray(parsed?.pending) ? parsed.pending : [];
|
|
56
|
+
if (pending.length === 0) {
|
|
57
|
+
logCollector?.push('chat_provider_auto_pair', 'info', 'No pending pairing requests on gateway', { deviceId: ownDeviceId });
|
|
58
|
+
return { status: 'skipped', reason: 'no_pending' };
|
|
59
|
+
}
|
|
60
|
+
// 3. Match our own deviceId.
|
|
61
|
+
const match = pending.find((p) => p?.deviceId === ownDeviceId);
|
|
62
|
+
if (!match) {
|
|
63
|
+
logCollector?.push('chat_provider_auto_pair', 'warn', 'No pending request matches our deviceId', { ownDeviceId, pendingCount: pending.length });
|
|
64
|
+
return { status: 'skipped', reason: 'no_match' };
|
|
65
|
+
}
|
|
66
|
+
// 4. Approve.
|
|
67
|
+
const { requestId } = match;
|
|
68
|
+
try {
|
|
69
|
+
await execFileAsync('openclaw', ['devices', 'approve', requestId, '--json'], {
|
|
70
|
+
timeout: CLI_TIMEOUT_MS,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
const detail = toErrorMessage(err);
|
|
75
|
+
logCollector?.push('chat_provider_auto_pair', 'warn', `openclaw devices approve failed: ${detail}`, { requestId, deviceId: ownDeviceId });
|
|
76
|
+
return { status: 'skipped', reason: 'approve_failed', detail };
|
|
77
|
+
}
|
|
78
|
+
logCollector?.push('chat_provider_auto_pair', 'info', 'Approved own pending pairing request', {
|
|
79
|
+
requestId,
|
|
80
|
+
deviceId: ownDeviceId,
|
|
81
|
+
});
|
|
82
|
+
return { status: 'approved', requestId, deviceId: ownDeviceId };
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=auto-pair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-pair.js","sourceRoot":"","sources":["../../../src/providers/openclaw/auto-pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,cAAc,GAAG,MAAM,CAAC;AAyB9B,SAAS,gBAAgB,CAAC,CAAU;IAClC,OAAO,CAAC,YAAY,KAAK,IAAI,OAAQ,CAA2B,CAAC,IAAI,KAAK,QAAQ,CAAC;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,IAAI,WAAmB,CAAC;IACxB,IAAI,CAAC;QACH,WAAW,GAAG,0BAA0B,EAAE,CAAC,QAAQ,CAAC;IACtD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACnC,YAAY,EAAE,IAAI,CAChB,yBAAyB,EACzB,MAAM,EACN,mCAAmC,MAAM,EAAE,EAC3C,EAAE,CACH,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EA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AAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACnC,YAAY,EAAE,IAAI,CAChB,yBAAyB,EACzB,MAAM,EACN,oCAAoC,MAAM,EAAE,EAC5C,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,CACrC,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IACjE,CAAC;IAED,YAAY,EAAE,IAAI,CAAC,yBAAyB,EAAE,MAAM,EAAE,sCAAsC,EAAE;QAC5F,SAAS;QACT,QAAQ,EAAE,WAAW;KACtB,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import net from 'node:net';
|
|
2
2
|
import { OpenclawGatewayAdapter } from './gateway-adapter.js';
|
|
3
|
+
import { autoApproveOwnPairing } from './auto-pair.js';
|
|
3
4
|
export { OpenclawGatewayAdapter } from './gateway-adapter.js';
|
|
4
5
|
function tcpPing(host, port, timeoutMs) {
|
|
5
6
|
return new Promise((resolve) => {
|
|
@@ -41,6 +42,7 @@ export class OpenclawProvider {
|
|
|
41
42
|
this._connecting = (async () => {
|
|
42
43
|
const maxRetries = 5;
|
|
43
44
|
const baseDelayMs = 2000;
|
|
45
|
+
let attemptedAutoPair = false;
|
|
44
46
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
45
47
|
try {
|
|
46
48
|
// Always create fresh adapter — old one may have stale state after gateway restart
|
|
@@ -55,6 +57,14 @@ export class OpenclawProvider {
|
|
|
55
57
|
console.warn(`Chat provider connect failed (attempt ${attempt}/${maxRetries}): ${msg}`);
|
|
56
58
|
this.adapter?.disconnect();
|
|
57
59
|
this.adapter = null;
|
|
60
|
+
if (!attemptedAutoPair && msg.includes('pairing required')) {
|
|
61
|
+
attemptedAutoPair = true;
|
|
62
|
+
const outcome = await autoApproveOwnPairing();
|
|
63
|
+
if (outcome.status === 'approved') {
|
|
64
|
+
// Skip back-off — retry immediately on the next iteration
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
58
68
|
if (attempt < maxRetries) {
|
|
59
69
|
await new Promise((r) => setTimeout(r, baseDelayMs * Math.min(attempt, 5)));
|
|
60
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/openclaw/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAG3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/openclaw/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAG3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,SAAS,OAAO,CAAC,IAAY,EAAE,IAAY,EAAE,SAAiB;IAC5D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;YAC9B,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,OAAO,EAAE,CAAC;Y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