commanderclaw 1.1.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/README.md +57 -0
- package/bin/commanderclaw.cjs +77 -0
- package/binaries/darwin-arm64/coordination-server +0 -0
- package/dist/cli/config.js +116 -0
- package/dist/cli/gateway.js +250 -0
- package/dist/cli/index.js +53 -0
- package/dist/cli/plugin.js +400 -0
- package/dist/cli/utils.js +121 -0
- package/dist/plugin/client.d.ts +76 -0
- package/dist/plugin/client.d.ts.map +1 -0
- package/dist/plugin/config.d.ts +25 -0
- package/dist/plugin/config.d.ts.map +1 -0
- package/dist/plugin/index.cjs +4538 -0
- package/dist/plugin/index.cjs.map +1 -0
- package/dist/plugin/index.d.ts +15 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.mjs +4536 -0
- package/dist/plugin/index.mjs.map +1 -0
- package/dist/plugin/skills/commanderclaw/SKILL.md +177 -0
- package/dist/plugin/tools/command.d.ts +7 -0
- package/dist/plugin/tools/command.d.ts.map +1 -0
- package/dist/plugin/tools/command.ts +136 -0
- package/dist/plugin/tools/nodes.d.ts +7 -0
- package/dist/plugin/tools/nodes.d.ts.map +1 -0
- package/dist/plugin/tools/nodes.ts +71 -0
- package/dist/plugin/tools/status.d.ts +7 -0
- package/dist/plugin/tools/status.d.ts.map +1 -0
- package/dist/plugin/tools/status.ts +59 -0
- package/dist/plugin/tools/task.d.ts +7 -0
- package/dist/plugin/tools/task.d.ts.map +1 -0
- package/dist/plugin/tools/task.ts +254 -0
- package/dist/plugin/types.d.ts +133 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/openclaw.plugin.json +51 -0
- package/package.json +86 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commanderclaw
|
|
3
|
+
description: Connect to CommanderClaw coordination server for multi-agent task coordination
|
|
4
|
+
metadata:
|
|
5
|
+
{
|
|
6
|
+
"openclaw":
|
|
7
|
+
{
|
|
8
|
+
"requires": { "config": ["plugins.entries.commanderclaw.config.serverUrl"] },
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# CommanderClaw Integration
|
|
14
|
+
|
|
15
|
+
This skill enables coordination with a CommanderClaw cluster for multi-agent task distribution and management.
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
CommanderClaw is a multi-device Agent coordination framework. This skill allows OpenClaw to:
|
|
20
|
+
|
|
21
|
+
- Register as a node in the CommanderClaw cluster
|
|
22
|
+
- Receive and execute tasks assigned by the Commander
|
|
23
|
+
- Create and manage tasks
|
|
24
|
+
- Monitor cluster status
|
|
25
|
+
|
|
26
|
+
## Available Tools
|
|
27
|
+
|
|
28
|
+
### `commanderclaw_nodes`
|
|
29
|
+
|
|
30
|
+
List all nodes in the cluster with their status, roles, and capabilities.
|
|
31
|
+
|
|
32
|
+
**Example usage:**
|
|
33
|
+
```
|
|
34
|
+
What nodes are available in the cluster?
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `commanderclaw_task`
|
|
38
|
+
|
|
39
|
+
Create, query, and manage tasks.
|
|
40
|
+
|
|
41
|
+
**Actions:**
|
|
42
|
+
|
|
43
|
+
| Action | Description |
|
|
44
|
+
|--------|-------------|
|
|
45
|
+
| `create` | Create a new task |
|
|
46
|
+
| `list` | List all tasks |
|
|
47
|
+
| `get` | Get details of a specific task |
|
|
48
|
+
| `abort` | Abort a running task |
|
|
49
|
+
| `pause` | Pause a running task |
|
|
50
|
+
| `resume` | Resume a paused task |
|
|
51
|
+
|
|
52
|
+
**Example usage:**
|
|
53
|
+
```
|
|
54
|
+
Create a new task called "Analyze data" with high priority
|
|
55
|
+
List all tasks in the cluster
|
|
56
|
+
Abort task abc123 with reason "no longer needed"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `commanderclaw_status`
|
|
60
|
+
|
|
61
|
+
Check connection status and cluster health.
|
|
62
|
+
|
|
63
|
+
**Example usage:**
|
|
64
|
+
```
|
|
65
|
+
What's the status of the CommanderClaw connection?
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### `commanderclaw_command`
|
|
69
|
+
|
|
70
|
+
Send King commands to the cluster.
|
|
71
|
+
|
|
72
|
+
**Commands:**
|
|
73
|
+
|
|
74
|
+
| Command | Description |
|
|
75
|
+
|---------|-------------|
|
|
76
|
+
| `appoint` | Appoint a specific node as Commander |
|
|
77
|
+
| `abort` | Abort a task |
|
|
78
|
+
| `pause` | Pause a task |
|
|
79
|
+
| `resume` | Resume a task |
|
|
80
|
+
|
|
81
|
+
**Example usage:**
|
|
82
|
+
```
|
|
83
|
+
Appoint node xyz789 as the new Commander
|
|
84
|
+
Pause task abc123
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Configuration
|
|
88
|
+
|
|
89
|
+
Configure the plugin in `~/.openclaw/openclaw.json`:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"plugins": {
|
|
94
|
+
"entries": {
|
|
95
|
+
"commanderclaw": {
|
|
96
|
+
"enabled": true,
|
|
97
|
+
"config": {
|
|
98
|
+
"serverUrl": "ws://your-server:8080/ws",
|
|
99
|
+
"token": "your-auth-token",
|
|
100
|
+
"deviceName": "OpenClaw Agent",
|
|
101
|
+
"autoConnect": true,
|
|
102
|
+
"reconnect": {
|
|
103
|
+
"enabled": true,
|
|
104
|
+
"maxAttempts": 10,
|
|
105
|
+
"delayMs": 5000
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Configuration Options
|
|
115
|
+
|
|
116
|
+
| Option | Type | Required | Default | Description |
|
|
117
|
+
|--------|------|----------|---------|-------------|
|
|
118
|
+
| `serverUrl` | string | Yes | - | WebSocket URL of the CommanderClaw server |
|
|
119
|
+
| `token` | string | No | - | Authentication token |
|
|
120
|
+
| `deviceName` | string | No | "OpenClaw Agent" | Name to register with the cluster |
|
|
121
|
+
| `autoConnect` | boolean | No | true | Auto-connect on gateway start |
|
|
122
|
+
| `reconnect.enabled` | boolean | No | true | Enable automatic reconnection |
|
|
123
|
+
| `reconnect.maxAttempts` | number | No | 10 | Max reconnection attempts |
|
|
124
|
+
| `reconnect.delayMs` | number | No | 5000 | Delay between attempts (ms) |
|
|
125
|
+
|
|
126
|
+
## Architecture
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
130
|
+
│ OpenClaw │
|
|
131
|
+
│ ┌─────────────────────────────────────────────────────────┐│
|
|
132
|
+
│ │ CommanderClaw Plugin ││
|
|
133
|
+
│ │ ││
|
|
134
|
+
│ │ Tools: ││
|
|
135
|
+
│ │ • commanderclaw_nodes ││
|
|
136
|
+
│ │ • commanderclaw_task ││
|
|
137
|
+
│ │ • commanderclaw_status ││
|
|
138
|
+
│ │ • commanderclaw_command ││
|
|
139
|
+
│ │ ││
|
|
140
|
+
│ │ Internal: ││
|
|
141
|
+
│ │ • WebSocket client ││
|
|
142
|
+
│ │ • Auto-reconnect ││
|
|
143
|
+
│ │ • Heartbeat management ││
|
|
144
|
+
│ └──────────────────────────────┬──────────────────────────┘│
|
|
145
|
+
└──────────────────────────────────┼──────────────────────────┘
|
|
146
|
+
│
|
|
147
|
+
│ WebSocket
|
|
148
|
+
▼
|
|
149
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
150
|
+
│ CommanderClaw Server │
|
|
151
|
+
│ │
|
|
152
|
+
│ • Node registration │
|
|
153
|
+
│ • Commander election │
|
|
154
|
+
│ • Task distribution │
|
|
155
|
+
│ • King command handling │
|
|
156
|
+
└─────────────────────────────────────────────────────────────┘
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Troubleshooting
|
|
160
|
+
|
|
161
|
+
### Connection fails
|
|
162
|
+
|
|
163
|
+
1. Check if the CommanderClaw server is running
|
|
164
|
+
2. Verify the server URL is correct
|
|
165
|
+
3. Check if the token is valid (if auth is enabled)
|
|
166
|
+
|
|
167
|
+
### Tasks not being assigned
|
|
168
|
+
|
|
169
|
+
1. Check if the node is connected: `commanderclaw_status`
|
|
170
|
+
2. Verify capabilities match task requirements
|
|
171
|
+
3. Check if there's an active Commander in the cluster
|
|
172
|
+
|
|
173
|
+
### Reconnection issues
|
|
174
|
+
|
|
175
|
+
1. Check server logs for errors
|
|
176
|
+
2. Verify network connectivity
|
|
177
|
+
3. Check `reconnect.maxAttempts` setting
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commanderclaw_command tool
|
|
3
|
+
*/
|
|
4
|
+
import type { CommanderClawClient } from "../client";
|
|
5
|
+
import type { ToolDefinition } from "../types";
|
|
6
|
+
export declare function createCommandTool(getClient: () => CommanderClawClient | null): ToolDefinition;
|
|
7
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/plugin/tools/command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,mBAAmB,GAAG,IAAI,GAAG,cAAc,CA+H7F"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commanderclaw_command tool
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Type } from "@sinclair/typebox";
|
|
6
|
+
import type { CommanderClawClient } from "../client";
|
|
7
|
+
import type { ToolDefinition } from "../types";
|
|
8
|
+
|
|
9
|
+
export function createCommandTool(getClient: () => CommanderClawClient | null): ToolDefinition {
|
|
10
|
+
return {
|
|
11
|
+
name: "commanderclaw_command",
|
|
12
|
+
description: `Send King commands to the CommanderClaw cluster.
|
|
13
|
+
|
|
14
|
+
Commands:
|
|
15
|
+
- appoint: Appoint a specific node as the Commander
|
|
16
|
+
- abort: Abort a task (alias for commanderclaw_task with action=abort)
|
|
17
|
+
- pause: Pause a running task
|
|
18
|
+
- resume: Resume a paused task
|
|
19
|
+
|
|
20
|
+
Note: Some commands may require King-level permissions.`,
|
|
21
|
+
parameters: Type.Object({
|
|
22
|
+
command: Type.Union([
|
|
23
|
+
Type.Literal("appoint"),
|
|
24
|
+
Type.Literal("abort"),
|
|
25
|
+
Type.Literal("pause"),
|
|
26
|
+
Type.Literal("resume"),
|
|
27
|
+
]),
|
|
28
|
+
nodeId: Type.Optional(Type.String()),
|
|
29
|
+
taskId: Type.Optional(Type.String()),
|
|
30
|
+
reason: Type.Optional(Type.String()),
|
|
31
|
+
}),
|
|
32
|
+
async execute(_id: string, params: Record<string, unknown>) {
|
|
33
|
+
const client = getClient();
|
|
34
|
+
if (!client?.isConnected()) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: "text" as const,
|
|
39
|
+
text: "Not connected to CommanderClaw server. Check plugin configuration.",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
switch (params.command) {
|
|
47
|
+
case "appoint": {
|
|
48
|
+
if (!params.nodeId || typeof params.nodeId !== "string") {
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: "text" as const,
|
|
53
|
+
text: "Error: 'nodeId' is required for appoint command. Use commanderclaw_nodes to list available nodes.",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const result = await client.appointCommander(params.nodeId);
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: "text" as const,
|
|
63
|
+
text: `Commander appointed successfully.\n- **New Commander:** ${result.commanderId}`,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
case "abort": {
|
|
70
|
+
if (!params.taskId || typeof params.taskId !== "string") {
|
|
71
|
+
return {
|
|
72
|
+
content: [
|
|
73
|
+
{ type: "text" as const, text: "Error: 'taskId' is required for abort command" },
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
await client.abortTask(params.taskId, params.reason as string | undefined);
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{ type: "text" as const, text: `Task ${params.taskId} has been aborted.` },
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case "pause": {
|
|
86
|
+
if (!params.taskId || typeof params.taskId !== "string") {
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{ type: "text" as const, text: "Error: 'taskId' is required for pause command" },
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
await client.pauseTask(params.taskId);
|
|
94
|
+
return {
|
|
95
|
+
content: [
|
|
96
|
+
{ type: "text" as const, text: `Task ${params.taskId} has been paused.` },
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
case "resume": {
|
|
102
|
+
if (!params.taskId || typeof params.taskId !== "string") {
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{ type: "text" as const, text: "Error: 'taskId' is required for resume command" },
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
await client.resumeTask(params.taskId);
|
|
110
|
+
return {
|
|
111
|
+
content: [
|
|
112
|
+
{ type: "text" as const, text: `Task ${params.taskId} has been resumed.` },
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
default:
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{ type: "text" as const, text: `Unknown command: ${params.command}` },
|
|
121
|
+
],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
} catch (error) {
|
|
125
|
+
return {
|
|
126
|
+
content: [
|
|
127
|
+
{
|
|
128
|
+
type: "text" as const,
|
|
129
|
+
text: `Failed to execute command: ${error instanceof Error ? error.message : String(error)}`,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commanderclaw_nodes tool
|
|
3
|
+
*/
|
|
4
|
+
import type { CommanderClawClient } from "../client";
|
|
5
|
+
import type { ToolDefinition } from "../types";
|
|
6
|
+
export declare function createNodesTool(getClient: () => CommanderClawClient | null): ToolDefinition;
|
|
7
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../src/plugin/tools/nodes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,mBAAmB,GAAG,IAAI,GAAG,cAAc,CA8D3F"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commanderclaw_nodes tool
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Type } from "@sinclair/typebox";
|
|
6
|
+
import type { CommanderClawClient } from "../client";
|
|
7
|
+
import type { ToolDefinition } from "../types";
|
|
8
|
+
|
|
9
|
+
export function createNodesTool(getClient: () => CommanderClawClient | null): ToolDefinition {
|
|
10
|
+
return {
|
|
11
|
+
name: "commanderclaw_nodes",
|
|
12
|
+
description:
|
|
13
|
+
"List all nodes connected to the CommanderClaw cluster. Use this to see available nodes, their status, roles, and capabilities.",
|
|
14
|
+
parameters: Type.Object({}),
|
|
15
|
+
async execute() {
|
|
16
|
+
const client = getClient();
|
|
17
|
+
if (!client?.isConnected()) {
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: "text" as const,
|
|
22
|
+
text: "Not connected to CommanderClaw server. Check plugin configuration.",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const nodes = await client.listNodes();
|
|
30
|
+
const currentNode = client.getNodeId();
|
|
31
|
+
const commanderId = client.getCommanderId();
|
|
32
|
+
|
|
33
|
+
let text = `## CommanderClaw Cluster Nodes\n\n`;
|
|
34
|
+
text += `**Total nodes:** ${nodes.length}\n`;
|
|
35
|
+
text += `**Commander:** ${commanderId || "None elected"}\n`;
|
|
36
|
+
text += `**Current node:** ${currentNode || "Unknown"}\n\n`;
|
|
37
|
+
|
|
38
|
+
if (nodes.length === 0) {
|
|
39
|
+
text += "No nodes connected to the cluster.\n";
|
|
40
|
+
} else {
|
|
41
|
+
for (const node of nodes) {
|
|
42
|
+
const isCommander = node.id === commanderId;
|
|
43
|
+
const isCurrent = node.id === currentNode;
|
|
44
|
+
const marker = isCurrent ? " (you)" : "";
|
|
45
|
+
const roleMarker = isCommander ? " 👑 Commander" : "";
|
|
46
|
+
|
|
47
|
+
text += `### ${node.name || node.id}${marker}${roleMarker}\n`;
|
|
48
|
+
text += `- **Status:** ${node.status}\n`;
|
|
49
|
+
text += `- **Role:** ${node.role}\n`;
|
|
50
|
+
text += `- **Load:** ${node.load}\n`;
|
|
51
|
+
if (node.capabilities?.length) {
|
|
52
|
+
text += `- **Capabilities:** ${node.capabilities.join(", ")}\n`;
|
|
53
|
+
}
|
|
54
|
+
text += "\n";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return { content: [{ type: "text" as const, text }] };
|
|
59
|
+
} catch (error) {
|
|
60
|
+
return {
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
63
|
+
type: "text" as const,
|
|
64
|
+
text: `Failed to list nodes: ${error instanceof Error ? error.message : String(error)}`,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commanderclaw_status tool
|
|
3
|
+
*/
|
|
4
|
+
import type { CommanderClawClient } from "../client";
|
|
5
|
+
import type { ToolDefinition } from "../types";
|
|
6
|
+
export declare function createStatusTool(getClient: () => CommanderClawClient | null): ToolDefinition;
|
|
7
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/plugin/tools/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,mBAAmB,GAAG,IAAI,GAAG,cAAc,CAkD5F"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commanderclaw_status tool
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Type } from "@sinclair/typebox";
|
|
6
|
+
import type { CommanderClawClient } from "../client";
|
|
7
|
+
import type { ToolDefinition } from "../types";
|
|
8
|
+
|
|
9
|
+
export function createStatusTool(getClient: () => CommanderClawClient | null): ToolDefinition {
|
|
10
|
+
return {
|
|
11
|
+
name: "commanderclaw_status",
|
|
12
|
+
description:
|
|
13
|
+
"Get the current status of the CommanderClaw cluster connection and cluster health. Use this to verify connectivity and check overall cluster status.",
|
|
14
|
+
parameters: Type.Object({}),
|
|
15
|
+
async execute() {
|
|
16
|
+
const client = getClient();
|
|
17
|
+
|
|
18
|
+
if (!client) {
|
|
19
|
+
return {
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
type: "text" as const,
|
|
23
|
+
text: "CommanderClaw plugin not initialized. Check plugin configuration.",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const connected = client.isConnected();
|
|
30
|
+
const nodeId = client.getNodeId();
|
|
31
|
+
const commanderId = client.getCommanderId();
|
|
32
|
+
const peers = client.getPeers();
|
|
33
|
+
|
|
34
|
+
let text = `## CommanderClaw Status\n\n`;
|
|
35
|
+
text += `**Connection:** ${connected ? "✅ Connected" : "❌ Disconnected"}\n`;
|
|
36
|
+
text += `**Node ID:** ${nodeId || "Not registered"}\n`;
|
|
37
|
+
text += `**Commander:** ${commanderId || "None elected"}\n`;
|
|
38
|
+
text += `**Peers:** ${peers.length}\n\n`;
|
|
39
|
+
|
|
40
|
+
if (connected) {
|
|
41
|
+
try {
|
|
42
|
+
const health = await client.getStatus();
|
|
43
|
+
text += `### Cluster Health\n`;
|
|
44
|
+
text += `- **Status:** ${health.status}\n`;
|
|
45
|
+
text += `- **Total nodes:** ${health.nodes}\n`;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
text += `**Health check failed:** ${error instanceof Error ? error.message : String(error)}\n`;
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
text += `### Troubleshooting\n`;
|
|
51
|
+
text += `- Check if the CommanderClaw server is running\n`;
|
|
52
|
+
text += `- Verify the server URL in plugin configuration\n`;
|
|
53
|
+
text += `- Check if the authentication token is correct\n`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return { content: [{ type: "text" as const, text }] };
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commanderclaw_task tool
|
|
3
|
+
*/
|
|
4
|
+
import type { CommanderClawClient } from "../client";
|
|
5
|
+
import type { ToolDefinition } from "../types";
|
|
6
|
+
export declare function createTaskTool(getClient: () => CommanderClawClient | null): ToolDefinition;
|
|
7
|
+
//# sourceMappingURL=task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../src/plugin/tools/task.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAQ,MAAM,UAAU,CAAC;AAErD,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,mBAAmB,GAAG,IAAI,GAAG,cAAc,CAuL1F"}
|