echoclaw-relay-agent 0.30.4 → 0.32.0
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/{ConfigureHandler-YJIM5G2Q.js → ConfigureHandler-3S5F4TTG.js} +13 -9
- package/dist/{OpenClawConfig-RAWRUWWW.js → OpenClawConfig-S7RF66V3.js} +3 -1
- package/dist/chat/ChatHandler.d.ts +22 -0
- package/dist/{chunk-TV33FN6A.js → chunk-GMXVVWU2.js} +848 -285
- package/dist/{chunk-S2KWH5JY.js → chunk-HKDMYCGL.js} +7 -0
- package/dist/{chunk-HXUJ67U3.js → chunk-NHM6IWCC.js} +15 -2
- package/dist/cli.js +69 -10
- package/dist/configure/OpenClawConfig.d.ts +5 -0
- package/dist/core/AgentCore.d.ts +3 -0
- package/dist/core/types.d.ts +3 -0
- package/dist/gateway/WorkspaceSync.d.ts +24 -21
- package/dist/gateway/index.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -2
- package/dist/install/types.d.ts +1 -0
- package/dist/sync/WorkspaceFileReader.d.ts +29 -8
- package/dist/vm/VmManager.d.ts +123 -0
- package/dist/vm/index.d.ts +8 -0
- package/dist/vm/types.d.ts +50 -0
- package/package.json +1 -1
|
@@ -2,13 +2,14 @@ import {
|
|
|
2
2
|
fetchAvailableModels,
|
|
3
3
|
verifyModel,
|
|
4
4
|
waitForGateway
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NHM6IWCC.js";
|
|
6
6
|
import {
|
|
7
7
|
configureModel,
|
|
8
8
|
detectProvider,
|
|
9
|
+
getGatewayPort,
|
|
9
10
|
getGatewayToken,
|
|
10
11
|
hasApiKeyConfigured
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HKDMYCGL.js";
|
|
12
13
|
|
|
13
14
|
// src/configure/ConfigureHandler.ts
|
|
14
15
|
import { execFile } from "node:child_process";
|
|
@@ -124,7 +125,8 @@ async function handleConfigure(request, sendStatus) {
|
|
|
124
125
|
detail: "\u7B49\u5F85 Gateway \u5C31\u7EEA..."
|
|
125
126
|
}).catch(() => {
|
|
126
127
|
});
|
|
127
|
-
const
|
|
128
|
+
const configuredPort = await getGatewayPort() ?? DEFAULT_GATEWAY_PORT;
|
|
129
|
+
const gatewayReady = await waitForGateway(configuredPort, gatewayToken, 3e4);
|
|
128
130
|
if (!gatewayReady) {
|
|
129
131
|
try {
|
|
130
132
|
await runOpenClaw(["gateway", "status", "--require-rpc"], 1e4);
|
|
@@ -143,7 +145,7 @@ async function handleConfigure(request, sendStatus) {
|
|
|
143
145
|
}).catch(() => {
|
|
144
146
|
});
|
|
145
147
|
const verifyResult = await verifyModel(
|
|
146
|
-
|
|
148
|
+
configuredPort,
|
|
147
149
|
gatewayToken,
|
|
148
150
|
providerConfig.modelId
|
|
149
151
|
);
|
|
@@ -154,12 +156,12 @@ async function handleConfigure(request, sendStatus) {
|
|
|
154
156
|
error: verifyResult.error ?? "\u6A21\u578B\u9A8C\u8BC1\u5931\u8D25"
|
|
155
157
|
};
|
|
156
158
|
}
|
|
157
|
-
const availableModels = await fetchAvailableModels(
|
|
159
|
+
const availableModels = await fetchAvailableModels(configuredPort, gatewayToken);
|
|
158
160
|
return {
|
|
159
161
|
type: "agent_setup_status",
|
|
160
162
|
state: "ready",
|
|
161
163
|
detail: `${providerConfig.provider} \u6A21\u578B\u5DF2\u5C31\u7EEA`,
|
|
162
|
-
gatewayPort:
|
|
164
|
+
gatewayPort: configuredPort,
|
|
163
165
|
activeModel: providerConfig.modelId,
|
|
164
166
|
availableModels: availableModels.length > 0 ? availableModels : void 0
|
|
165
167
|
};
|
|
@@ -177,11 +179,13 @@ async function handleQueryModels() {
|
|
|
177
179
|
if (!gatewayToken) {
|
|
178
180
|
return { type: "query_models_result", models: [], error: "Gateway token \u672A\u627E\u5230\uFF0C\u8BF7\u5148\u5B8C\u6210 API Key \u914D\u7F6E" };
|
|
179
181
|
}
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
+
const port = await getGatewayPort() ?? DEFAULT_GATEWAY_PORT;
|
|
183
|
+
const models = await fetchAvailableModels(port, gatewayToken);
|
|
184
|
+
const config = await (await import("./OpenClawConfig-S7RF66V3.js")).readOpenClawConfig();
|
|
182
185
|
const activeModel = config?.agents?.defaults?.model;
|
|
183
186
|
return { type: "query_models_result", models, activeModel };
|
|
184
187
|
} catch (err) {
|
|
188
|
+
console.log(` [configure] handleQueryModels error: ${err.message}`);
|
|
185
189
|
return { type: "query_models_result", models: [], error: `\u67E5\u8BE2\u6A21\u578B\u5931\u8D25: ${err.message}` };
|
|
186
190
|
}
|
|
187
191
|
}
|
|
@@ -190,7 +194,7 @@ async function handleSetModel(request) {
|
|
|
190
194
|
if (!request.model || typeof request.model !== "string") {
|
|
191
195
|
return { type: "set_model_result", success: false, error: "\u65E0\u6548\u7684\u6A21\u578B ID" };
|
|
192
196
|
}
|
|
193
|
-
const { readOpenClawConfig, writeOpenClawConfig } = await import("./OpenClawConfig-
|
|
197
|
+
const { readOpenClawConfig, writeOpenClawConfig } = await import("./OpenClawConfig-S7RF66V3.js");
|
|
194
198
|
const config = await readOpenClawConfig();
|
|
195
199
|
if (!config.agents) config.agents = {};
|
|
196
200
|
if (!config.agents.defaults) config.agents.defaults = {};
|
|
@@ -3,16 +3,18 @@ import {
|
|
|
3
3
|
OPENCLAW_CONFIG_PATH,
|
|
4
4
|
configureModel,
|
|
5
5
|
detectProvider,
|
|
6
|
+
getGatewayPort,
|
|
6
7
|
getGatewayToken,
|
|
7
8
|
hasApiKeyConfigured,
|
|
8
9
|
readOpenClawConfig,
|
|
9
10
|
writeOpenClawConfig
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HKDMYCGL.js";
|
|
11
12
|
export {
|
|
12
13
|
OPENCLAW_CONFIG_DIR,
|
|
13
14
|
OPENCLAW_CONFIG_PATH,
|
|
14
15
|
configureModel,
|
|
15
16
|
detectProvider,
|
|
17
|
+
getGatewayPort,
|
|
16
18
|
getGatewayToken,
|
|
17
19
|
hasApiKeyConfigured,
|
|
18
20
|
readOpenClawConfig,
|
|
@@ -78,6 +78,11 @@ export declare class ChatHandler {
|
|
|
78
78
|
private _toolUpdateTimestamps;
|
|
79
79
|
/** Buffered messages when _sendBack is null (relay disconnected but OpenClaw still active). */
|
|
80
80
|
private _messageBuffer;
|
|
81
|
+
/**
|
|
82
|
+
* Queued outbound chat.send payloads when gateway is disconnected.
|
|
83
|
+
* Drained automatically on reconnect. Max MAX_PENDING_CHAT_QUEUE entries.
|
|
84
|
+
*/
|
|
85
|
+
private _pendingChatQueue;
|
|
81
86
|
/**
|
|
82
87
|
* Externally registered runIds (e.g. InstallHandler).
|
|
83
88
|
* Chat events for these runs are skipped — the owning handler processes them.
|
|
@@ -110,6 +115,8 @@ export declare class ChatHandler {
|
|
|
110
115
|
private _workspaceReader;
|
|
111
116
|
/** RunIds for which task_ack has already been sent (prevents duplicate sends on accumulated deltas). */
|
|
112
117
|
private _taskAckSentRuns;
|
|
118
|
+
/** Last known CLAW_STEP context — used to synthesise status updates during tool calls. */
|
|
119
|
+
private _activeClawStep;
|
|
113
120
|
/** Status inference engine — produces activity states and heartbeats for Desktop. */
|
|
114
121
|
private readonly _statusEngine;
|
|
115
122
|
/** Heartbeat scheduler — manages periodic heartbeat emission per run. */
|
|
@@ -147,6 +154,16 @@ export declare class ChatHandler {
|
|
|
147
154
|
* and we want to buffer responses for when relay reconnects.
|
|
148
155
|
*/
|
|
149
156
|
clearHistory(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Enqueue a chat payload for later delivery when gateway reconnects.
|
|
159
|
+
* Drops the oldest entry if the queue exceeds MAX_PENDING_CHAT_QUEUE.
|
|
160
|
+
*/
|
|
161
|
+
private _enqueuePendingChat;
|
|
162
|
+
/**
|
|
163
|
+
* Drain the pending chat queue after gateway reconnection.
|
|
164
|
+
* Replays each queued message through _handleChat in FIFO order.
|
|
165
|
+
*/
|
|
166
|
+
private _drainPendingChatQueue;
|
|
150
167
|
/**
|
|
151
168
|
* Register a runId as externally owned (e.g. by InstallHandler).
|
|
152
169
|
* Chat events for this runId will be skipped by _handleChatEvent.
|
|
@@ -198,6 +215,11 @@ export declare class ChatHandler {
|
|
|
198
215
|
* Extract a human-readable detail string from tool args.
|
|
199
216
|
* Only exposes safe, non-sensitive information (file paths, command previews).
|
|
200
217
|
*/
|
|
218
|
+
/**
|
|
219
|
+
* Infer a CLAW_STEP status from tool_start events.
|
|
220
|
+
* Returns the status string ('reading' | 'building' | 'verifying') or null if no mapping.
|
|
221
|
+
*/
|
|
222
|
+
private _inferStatusFromTool;
|
|
201
223
|
private _extractToolDetail;
|
|
202
224
|
/**
|
|
203
225
|
* Emit a chat_user_echo for an externally triggered run.
|