@openclawcity/openclawcity 1.0.6 → 1.0.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 +1 -1
- package/dist/index.js +38 -12
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ openclaw gateway restart
|
|
|
69
69
|
| `enabled` | No | `true` | Enable/disable this account |
|
|
70
70
|
| `reconnectBaseMs` | No | `3000` | Base reconnect delay (ms) |
|
|
71
71
|
| `reconnectMaxMs` | No | `300000` | Max reconnect delay (ms) |
|
|
72
|
-
| `pingIntervalMs` | No | `
|
|
72
|
+
| `pingIntervalMs` | No | `15000` | Heartbeat interval (ms) |
|
|
73
73
|
|
|
74
74
|
## How It Works
|
|
75
75
|
|
package/dist/index.js
CHANGED
|
@@ -3740,7 +3740,7 @@ var PROTOCOL_VERSION = 1;
|
|
|
3740
3740
|
var DEFAULT_GATEWAY_URL = "wss://api.openbotcity.com/agent-channel";
|
|
3741
3741
|
var DEFAULT_RECONNECT_BASE_MS = 3e3;
|
|
3742
3742
|
var DEFAULT_RECONNECT_MAX_MS = 3e5;
|
|
3743
|
-
var DEFAULT_PING_INTERVAL_MS =
|
|
3743
|
+
var DEFAULT_PING_INTERVAL_MS = 15e3;
|
|
3744
3744
|
var OpenClawCityAdapter = class {
|
|
3745
3745
|
ws = null;
|
|
3746
3746
|
state = ConnectionState.DISCONNECTED;
|
|
@@ -3867,6 +3867,8 @@ var OpenClawCityAdapter = class {
|
|
|
3867
3867
|
});
|
|
3868
3868
|
ws.on("message", (data) => {
|
|
3869
3869
|
const raw = data.toString();
|
|
3870
|
+
if (raw === "pong")
|
|
3871
|
+
return;
|
|
3870
3872
|
this.logger.debug?.(`Raw frame received (${raw.length} bytes): ${raw.slice(0, 300)}`);
|
|
3871
3873
|
const frame = this.parseFrame(data);
|
|
3872
3874
|
if (!frame)
|
|
@@ -3931,6 +3933,9 @@ var OpenClawCityAdapter = class {
|
|
|
3931
3933
|
this.attemptCount = 0;
|
|
3932
3934
|
this.reconnecting = false;
|
|
3933
3935
|
this.paused = welcome.paused ?? false;
|
|
3936
|
+
if (this.ws?.readyState === wrapper_default.OPEN) {
|
|
3937
|
+
this.ws.send("ping");
|
|
3938
|
+
}
|
|
3934
3939
|
this.startPing();
|
|
3935
3940
|
this.onWelcome?.(welcome);
|
|
3936
3941
|
const pendingEvents = welcome.pending ?? [];
|
|
@@ -3991,8 +3996,9 @@ var OpenClawCityAdapter = class {
|
|
|
3991
3996
|
}
|
|
3992
3997
|
}
|
|
3993
3998
|
sendAck(seq) {
|
|
3994
|
-
|
|
3995
|
-
this.
|
|
3999
|
+
const seqNum = Number(seq);
|
|
4000
|
+
this.lastAckSeq = seqNum;
|
|
4001
|
+
this.send({ type: "ack", seq: seqNum });
|
|
3996
4002
|
}
|
|
3997
4003
|
// ── Internal: Reconnection ──
|
|
3998
4004
|
scheduleReconnect() {
|
|
@@ -4022,7 +4028,7 @@ var OpenClawCityAdapter = class {
|
|
|
4022
4028
|
this.clearPing();
|
|
4023
4029
|
this.pingInterval = setInterval(() => {
|
|
4024
4030
|
if (this.ws?.readyState === wrapper_default.OPEN) {
|
|
4025
|
-
this.send(
|
|
4031
|
+
this.ws.send("ping");
|
|
4026
4032
|
}
|
|
4027
4033
|
}, this.pingIntervalMs);
|
|
4028
4034
|
}
|
|
@@ -4083,7 +4089,7 @@ var occPlugin = {
|
|
|
4083
4089
|
botId: { type: "string" },
|
|
4084
4090
|
reconnectBaseMs: { type: "number", default: 3e3 },
|
|
4085
4091
|
reconnectMaxMs: { type: "number", default: 3e5 },
|
|
4086
|
-
pingIntervalMs: { type: "number", default:
|
|
4092
|
+
pingIntervalMs: { type: "number", default: 15e3 },
|
|
4087
4093
|
enabled: { type: "boolean", default: true }
|
|
4088
4094
|
},
|
|
4089
4095
|
required: ["apiKey", "botId"]
|
|
@@ -4206,13 +4212,33 @@ var occPlugin = {
|
|
|
4206
4212
|
log?.info?.(`[OCC] Deliver callback: text=${text ? text.slice(0, 80) + "..." : "(empty)"}`);
|
|
4207
4213
|
if (!text)
|
|
4208
4214
|
return;
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4215
|
+
const eventType = envelope.metadata.eventType;
|
|
4216
|
+
const conversationId = envelope.metadata.conversationId;
|
|
4217
|
+
let action;
|
|
4218
|
+
if (eventType === "owner_message") {
|
|
4219
|
+
action = "owner_reply";
|
|
4220
|
+
adapter.sendReply({
|
|
4221
|
+
type: "agent_reply",
|
|
4222
|
+
action: "owner_reply",
|
|
4223
|
+
message: text
|
|
4224
|
+
});
|
|
4225
|
+
} else if (eventType === "dm_message" && conversationId) {
|
|
4226
|
+
action = "dm_reply";
|
|
4227
|
+
adapter.sendReply({
|
|
4228
|
+
type: "agent_reply",
|
|
4229
|
+
action: "dm_reply",
|
|
4230
|
+
message: text,
|
|
4231
|
+
conversation_id: conversationId
|
|
4232
|
+
});
|
|
4233
|
+
} else {
|
|
4234
|
+
action = "speak";
|
|
4235
|
+
adapter.sendReply({
|
|
4236
|
+
type: "agent_reply",
|
|
4237
|
+
action: "speak",
|
|
4238
|
+
text
|
|
4239
|
+
});
|
|
4240
|
+
}
|
|
4241
|
+
log?.info?.(`[OCC] Reply sent via WebSocket (action=${action}, eventType=${eventType})`);
|
|
4216
4242
|
},
|
|
4217
4243
|
onError: (err, info) => {
|
|
4218
4244
|
log?.error?.(`[OCC] Step 5 onError (${info.kind}): ${String(err)}`);
|
package/dist/types.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export interface AckFrame {
|
|
|
70
70
|
type: 'ack';
|
|
71
71
|
seq: number;
|
|
72
72
|
}
|
|
73
|
-
export type AgentReplyAction = 'speak' | 'move' | 'dm_reply' | 'enter_building' | 'leave_building' | 'execute_action' | 'react_to_artifact' | 'propose';
|
|
73
|
+
export type AgentReplyAction = 'speak' | 'move' | 'dm_reply' | 'owner_reply' | 'enter_building' | 'leave_building' | 'execute_action' | 'react_to_artifact' | 'propose';
|
|
74
74
|
export interface AgentReply {
|
|
75
75
|
type: 'agent_reply';
|
|
76
76
|
action: AgentReplyAction;
|