clawmatrix 0.1.15 → 0.1.16
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/BOOTSTRAP.md +17 -2
- package/package.json +1 -1
- package/src/auth.ts +42 -12
- package/src/cluster-service.ts +31 -4
- package/src/compat.ts +3 -0
- package/src/connection.ts +15 -6
- package/src/handoff.ts +311 -17
- package/src/http-utils.ts +35 -0
- package/src/index.ts +33 -15
- package/src/model-proxy.ts +19 -16
- package/src/peer-manager.ts +55 -5
- package/src/router.ts +62 -28
- package/src/tool-proxy.ts +22 -7
- package/src/tools/cluster-events.ts +119 -0
- package/src/tools/cluster-exec.ts +4 -0
- package/src/tools/cluster-handoff-reply.ts +77 -0
- package/src/tools/cluster-handoff.ts +12 -0
- package/src/tools/cluster-peers.ts +17 -1
- package/src/tools/cluster-send.ts +1 -3
- package/src/tools/cluster-tool.ts +2 -5
- package/src/types.ts +93 -0
- package/src/web-ui.ts +490 -345
- package/src/web.ts +675 -53
|
@@ -6,10 +6,7 @@ export function createClusterToolTool(): AnyAgentTool {
|
|
|
6
6
|
name: "cluster_tool",
|
|
7
7
|
label: "Cluster Tool",
|
|
8
8
|
description:
|
|
9
|
-
"Invoke any OpenClaw tool on a remote cluster node. "
|
|
10
|
-
"Supports all tools available on the remote node (exec, read, write, edit, " +
|
|
11
|
-
"web_search, web_fetch, browser, process, etc.). " +
|
|
12
|
-
"Use nodeId or 'tags:<tag>' to specify the target.",
|
|
9
|
+
"Invoke any OpenClaw tool on a remote cluster node. Use nodeId or 'tags:<tag>' to specify the target.",
|
|
13
10
|
parameters: {
|
|
14
11
|
type: "object",
|
|
15
12
|
properties: {
|
|
@@ -19,7 +16,7 @@ export function createClusterToolTool(): AnyAgentTool {
|
|
|
19
16
|
},
|
|
20
17
|
tool: {
|
|
21
18
|
type: "string",
|
|
22
|
-
description: "Tool name to invoke
|
|
19
|
+
description: "Tool name to invoke on the remote node",
|
|
23
20
|
},
|
|
24
21
|
args: {
|
|
25
22
|
type: "object",
|
package/src/types.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface AuthRequest extends ClusterFrame {
|
|
|
24
24
|
models?: ModelInfo[];
|
|
25
25
|
tags?: string[];
|
|
26
26
|
deviceInfo?: DeviceInfo;
|
|
27
|
+
toolProxy?: ToolProxyInfo;
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -35,6 +36,7 @@ export interface AuthOk extends ClusterFrame {
|
|
|
35
36
|
models: ModelInfo[];
|
|
36
37
|
tags: string[];
|
|
37
38
|
deviceInfo?: DeviceInfo;
|
|
39
|
+
toolProxy?: ToolProxyInfo;
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -44,10 +46,27 @@ export interface AuthFail extends ClusterFrame {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
// ── Peer discovery ─────────────────────────────────────────────────
|
|
49
|
+
export interface SatelliteContext {
|
|
50
|
+
nodeId: string;
|
|
51
|
+
ssid?: string;
|
|
52
|
+
ip?: string;
|
|
53
|
+
router?: string;
|
|
54
|
+
cellular: boolean;
|
|
55
|
+
country?: string;
|
|
56
|
+
tools?: string[];
|
|
57
|
+
ts: number;
|
|
58
|
+
// Extended context
|
|
59
|
+
battery?: number; // 0-100
|
|
60
|
+
charging?: boolean;
|
|
61
|
+
platform?: string; // "ios" | "macos"
|
|
62
|
+
location?: string; // user-defined location name from WiFi mapping
|
|
63
|
+
}
|
|
64
|
+
|
|
47
65
|
export interface PeerSync extends ClusterFrame {
|
|
48
66
|
type: "peer_sync";
|
|
49
67
|
payload: {
|
|
50
68
|
peers: PeerInfo[];
|
|
69
|
+
satellites?: SatelliteContext[];
|
|
51
70
|
};
|
|
52
71
|
}
|
|
53
72
|
|
|
@@ -113,6 +132,14 @@ export interface ModelStreamChunk extends ClusterFrame {
|
|
|
113
132
|
}
|
|
114
133
|
|
|
115
134
|
// ── Handoff ────────────────────────────────────────────────────────
|
|
135
|
+
export type HandoffStatus = "working" | "input_required" | "completed" | "failed" | "canceled";
|
|
136
|
+
|
|
137
|
+
export interface Artifact {
|
|
138
|
+
name: string;
|
|
139
|
+
mimeType: string;
|
|
140
|
+
data: string; // text content or base64-encoded binary
|
|
141
|
+
}
|
|
142
|
+
|
|
116
143
|
export interface HandoffRequest extends ClusterFrame {
|
|
117
144
|
type: "handoff_req";
|
|
118
145
|
id: string;
|
|
@@ -129,6 +156,7 @@ export interface HandoffStreamChunk extends ClusterFrame {
|
|
|
129
156
|
payload: {
|
|
130
157
|
delta: string;
|
|
131
158
|
done: boolean;
|
|
159
|
+
artifacts?: Artifact[];
|
|
132
160
|
};
|
|
133
161
|
}
|
|
134
162
|
|
|
@@ -141,6 +169,48 @@ export interface HandoffResponse extends ClusterFrame {
|
|
|
141
169
|
agent?: string;
|
|
142
170
|
result?: string;
|
|
143
171
|
error?: string;
|
|
172
|
+
artifacts?: Artifact[];
|
|
173
|
+
inputRequired?: boolean;
|
|
174
|
+
handoffId?: string;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface HandoffCancel extends ClusterFrame {
|
|
179
|
+
type: "handoff_cancel";
|
|
180
|
+
id: string;
|
|
181
|
+
payload?: unknown;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface HandoffStatusQuery extends ClusterFrame {
|
|
185
|
+
type: "handoff_status";
|
|
186
|
+
id: string;
|
|
187
|
+
payload?: unknown;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface HandoffStatusResponse extends ClusterFrame {
|
|
191
|
+
type: "handoff_status_res";
|
|
192
|
+
id: string;
|
|
193
|
+
payload: {
|
|
194
|
+
status: HandoffStatus;
|
|
195
|
+
nodeId: string;
|
|
196
|
+
agent: string;
|
|
197
|
+
elapsedMs: number;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface HandoffInputRequired extends ClusterFrame {
|
|
202
|
+
type: "handoff_input_required";
|
|
203
|
+
id: string;
|
|
204
|
+
payload: {
|
|
205
|
+
message: string;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface HandoffInput extends ClusterFrame {
|
|
210
|
+
type: "handoff_input";
|
|
211
|
+
id: string;
|
|
212
|
+
payload: {
|
|
213
|
+
message: string;
|
|
144
214
|
};
|
|
145
215
|
}
|
|
146
216
|
|
|
@@ -213,6 +283,12 @@ export interface ModelInfo {
|
|
|
213
283
|
compat?: ModelCompatInfo;
|
|
214
284
|
}
|
|
215
285
|
|
|
286
|
+
export interface ToolProxyInfo {
|
|
287
|
+
enabled: boolean;
|
|
288
|
+
allow: string[];
|
|
289
|
+
deny: string[];
|
|
290
|
+
}
|
|
291
|
+
|
|
216
292
|
export interface PeerInfo {
|
|
217
293
|
nodeId: string;
|
|
218
294
|
agents: AgentInfo[];
|
|
@@ -221,6 +297,7 @@ export interface PeerInfo {
|
|
|
221
297
|
reachableVia?: string; // nodeId of the relay node
|
|
222
298
|
directPeers?: string[]; // nodeIds this node has direct connections to
|
|
223
299
|
deviceInfo?: DeviceInfo; // system/hardware info
|
|
300
|
+
toolProxy?: ToolProxyInfo;
|
|
224
301
|
}
|
|
225
302
|
|
|
226
303
|
export interface NodeCapabilities {
|
|
@@ -229,6 +306,17 @@ export interface NodeCapabilities {
|
|
|
229
306
|
models: ModelInfo[];
|
|
230
307
|
tags: string[];
|
|
231
308
|
deviceInfo?: DeviceInfo;
|
|
309
|
+
toolProxy?: ToolProxyInfo;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ── Ingested events (from Shortcuts automations, etc.) ────────────
|
|
313
|
+
export interface IngestedEvent {
|
|
314
|
+
id: string;
|
|
315
|
+
source: string; // e.g. "shortcuts", "iphone-14", "surge"
|
|
316
|
+
type: string; // e.g. "message_received", "call_missed", "location_changed"
|
|
317
|
+
data: Record<string, unknown>;
|
|
318
|
+
ts: number; // ingestion timestamp
|
|
319
|
+
consumed: boolean; // whether an agent has consumed this event
|
|
232
320
|
}
|
|
233
321
|
|
|
234
322
|
// ── Union of all frame types ───────────────────────────────────────
|
|
@@ -248,6 +336,11 @@ export type AnyClusterFrame =
|
|
|
248
336
|
| HandoffRequest
|
|
249
337
|
| HandoffStreamChunk
|
|
250
338
|
| HandoffResponse
|
|
339
|
+
| HandoffCancel
|
|
340
|
+
| HandoffStatusQuery
|
|
341
|
+
| HandoffStatusResponse
|
|
251
342
|
| SendMessage
|
|
343
|
+
| HandoffInputRequired
|
|
344
|
+
| HandoffInput
|
|
252
345
|
| ToolProxyRequest
|
|
253
346
|
| ToolProxyResponse;
|