@honor-claw/yoyo 0.0.1-alpha.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/index.ts +25 -0
- package/openclaw.plugin.json +28 -0
- package/package.json +59 -0
- package/skills/yoyo-control/SKILL.md +346 -0
- package/skills/yoyo-control/references/capture-screenshot.md +66 -0
- package/skills/yoyo-control/references/local-search.md +27 -0
- package/skills/yoyo-control/references/open-app.md +54 -0
- package/skills/yoyo-control/references/phone-call.md +217 -0
- package/skills/yoyo-control/references/schedule.md +107 -0
- package/skills/yoyo-control/references/screen-recorder.md +67 -0
- package/skills/yoyo-control/references/search-contact.md +37 -0
- package/skills/yoyo-control/references/send-message.md +155 -0
- package/skills/yoyo-control/references/volume.md +536 -0
- package/skills/yoyo-control/scripts/README.md +103 -0
- package/skills/yoyo-control/scripts/invoke.js +119 -0
- package/skills/yoyo-control/scripts/volume-up.json +7 -0
- package/src/apis/claw-cloud.ts +74 -0
- package/src/apis/helpers.ts +10 -0
- package/src/apis/honor-auth.ts +148 -0
- package/src/apis/http-client.ts +239 -0
- package/src/apis/index.ts +8 -0
- package/src/apis/types.ts +47 -0
- package/src/cloud-channel/channel.ts +230 -0
- package/src/cloud-channel/client.ts +312 -0
- package/src/cloud-channel/index.ts +4 -0
- package/src/cloud-channel/types.ts +81 -0
- package/src/commands/index.ts +19 -0
- package/src/commands/login/impl.ts +21 -0
- package/src/commands/login/index.ts +1 -0
- package/src/commands/logout/index.ts +53 -0
- package/src/commands/status/index.ts +64 -0
- package/src/gateway-client/client.deprecated.ts +376 -0
- package/src/gateway-client/client.ts +76 -0
- package/src/gateway-client/device/auth.ts +57 -0
- package/src/gateway-client/device/builder.ts +105 -0
- package/src/gateway-client/device/helpers.ts +40 -0
- package/src/gateway-client/device/identity.ts +251 -0
- package/src/gateway-client/device/index.ts +40 -0
- package/src/gateway-client/device/types.ts +57 -0
- package/src/gateway-client/index.ts +2 -0
- package/src/gateway-client/types.deprecated.ts +217 -0
- package/src/gateway-client/types.ts +8 -0
- package/src/honor-auth/browser.ts +82 -0
- package/src/honor-auth/callback-server.ts +112 -0
- package/src/honor-auth/cloud.ts +70 -0
- package/src/honor-auth/config.ts +35 -0
- package/src/honor-auth/index.ts +2 -0
- package/src/honor-auth/token-manager.ts +80 -0
- package/src/honor-auth/types.ts +43 -0
- package/src/index.ts +10 -0
- package/src/modules/claw-configs/config-manager.ts +172 -0
- package/src/modules/claw-configs/index.ts +7 -0
- package/src/modules/claw-configs/types.ts +30 -0
- package/src/modules/device/device-info.ts +70 -0
- package/src/modules/device/index.ts +3 -0
- package/src/modules/device/providers/base.ts +27 -0
- package/src/modules/device/providers/pad.ts +114 -0
- package/src/modules/device/providers/windows.ts +67 -0
- package/src/modules/device/registry.ts +34 -0
- package/src/modules/login/impl.ts +70 -0
- package/src/modules/login/index.ts +6 -0
- package/src/runtime.ts +14 -0
- package/src/schemas.ts +20 -0
- package/src/services/connection/impl.ts +259 -0
- package/src/services/connection/index.ts +1 -0
- package/src/services/connection/types.ts +20 -0
- package/src/types.ts +64 -0
- package/src/utils/id.ts +8 -0
- package/src/utils/jwt.ts +36 -0
- package/src/utils/logger.ts +20 -0
- package/src/utils/proxy.ts +58 -0
package/index.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
+
import { setYoyoRuntime } from "./src/runtime.js";
|
|
3
|
+
import { registerCommands } from "./src/commands/index.js";
|
|
4
|
+
import { YoyoPluginConfigSchema } from "./src/schemas.js";
|
|
5
|
+
import { ClawConnectionService } from "./src/services/connection/index.js";
|
|
6
|
+
import { setClawLogger } from "./src/utils/logger.js";
|
|
7
|
+
|
|
8
|
+
const plugin = {
|
|
9
|
+
id: "yoyo",
|
|
10
|
+
name: "YOYOClaw",
|
|
11
|
+
description: "OpenClaw Honor Yoyo connection plugin",
|
|
12
|
+
configSchema: YoyoPluginConfigSchema,
|
|
13
|
+
register(api: OpenClawPluginApi) {
|
|
14
|
+
setYoyoRuntime(api.runtime);
|
|
15
|
+
setClawLogger(api.logger);
|
|
16
|
+
|
|
17
|
+
// 利用服务来管理核心连接任务进行~
|
|
18
|
+
api.registerService(ClawConnectionService);
|
|
19
|
+
|
|
20
|
+
// 注册所有的命令行
|
|
21
|
+
registerCommands(api);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default plugin;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "yoyo",
|
|
3
|
+
"skills": ["./skills"],
|
|
4
|
+
"configSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"user": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"token": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"expired": {
|
|
15
|
+
"type": "number"
|
|
16
|
+
},
|
|
17
|
+
"userId": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"userName": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"additionalProperties": false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@honor-claw/yoyo",
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "OpenClaw Honor Yoyo connection plugin",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test:unit": "vitest run",
|
|
8
|
+
"test:unit:watch": "vitest",
|
|
9
|
+
"test:coverage": "vitest run --coverage",
|
|
10
|
+
"ci:check": "npx tsc --noEmit && npm run test:coverage"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"files": [
|
|
14
|
+
"index.ts",
|
|
15
|
+
"src/**/*.ts",
|
|
16
|
+
"!src/**/__tests__/**",
|
|
17
|
+
"!src/**/*.test.ts",
|
|
18
|
+
"skills",
|
|
19
|
+
"openclaw.plugin.json"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"openclaw",
|
|
23
|
+
"yoyo",
|
|
24
|
+
"ai",
|
|
25
|
+
"honor"
|
|
26
|
+
],
|
|
27
|
+
"openclaw": {
|
|
28
|
+
"extensions": [
|
|
29
|
+
"./index.ts"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@sinclair/typebox": "0.34.48",
|
|
34
|
+
"http-proxy-agent": "^8.0.0",
|
|
35
|
+
"https-proxy-agent": "^8.0.0",
|
|
36
|
+
"jsonwebtoken": "^9.0.3",
|
|
37
|
+
"nanoid": "^5.1.6",
|
|
38
|
+
"open": "^11.0.0",
|
|
39
|
+
"registry-js": "^1.16.1",
|
|
40
|
+
"undici": "^7.3.0",
|
|
41
|
+
"uuid": "^13.0.0",
|
|
42
|
+
"ws": "^8.18.0",
|
|
43
|
+
"zod": "^4.3.6"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
47
|
+
"@types/node": "^25.0.10",
|
|
48
|
+
"@types/ws": "^8.5.13",
|
|
49
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
50
|
+
"commander": "^14.0.3",
|
|
51
|
+
"openclaw": "2026.3.8",
|
|
52
|
+
"tsx": "^4.21.0",
|
|
53
|
+
"typescript": "^5.7.0",
|
|
54
|
+
"vitest": "^2.1.8"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"openclaw": ">=2026.3.8"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yoyo-control
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Whenever a task requires **operating or controlling the phone**, eg. open app, send message, search contact, create schedule, phone calls, screen record, capture screenshot, volume, local search, etc.
|
|
5
|
+
metadata: { "openclaw": { "emoji": "📱", "always": true } }
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Control phone with YOYO
|
|
9
|
+
|
|
10
|
+
Follow the workflow to control phone or pad with YOYO, Don't guess the commands.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
Follow this **4-step workflow** when using the skill:
|
|
15
|
+
|
|
16
|
+
1. Query the device status to identify available device nodes.
|
|
17
|
+
2. Determine the target node, required tool, and execution parameters based on the user's intent.
|
|
18
|
+
3. Call the node tool using the correct parameter format.
|
|
19
|
+
4. Present the result and confirm whether the operation was successful.
|
|
20
|
+
|
|
21
|
+
### Step 1. Discover Nodes
|
|
22
|
+
|
|
23
|
+
**Command**: `openclaw nodes status`
|
|
24
|
+
|
|
25
|
+
**Purpose**: Retrieve current status of all nodes in the system to identify available devices ready to receive commands.
|
|
26
|
+
|
|
27
|
+
**Execution result**:
|
|
28
|
+
|
|
29
|
+
| Node | ID | IP | Detail | Status | Caps |
|
|
30
|
+
| ---------- | -------- | -------- | -------- | -------- | ------ |
|
|
31
|
+
| <nodeName> | <nodeId> | <nodeIP> | <detail> | <status> | <caps> |
|
|
32
|
+
|
|
33
|
+
#### Capability Matching Logic
|
|
34
|
+
|
|
35
|
+
Match device capabilities with user intent:
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
1. Parse user intent → identify required capability keywords
|
|
39
|
+
2. Check each node's `Caps` field for matching capabilities
|
|
40
|
+
3. Filter nodes that support the required operation
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Selection Rules
|
|
44
|
+
|
|
45
|
+
**Automatic Selection** (single best match):
|
|
46
|
+
|
|
47
|
+
- Only one node matches all required capabilities
|
|
48
|
+
|
|
49
|
+
**User Confirmation Required** (multiple candidates):
|
|
50
|
+
|
|
51
|
+
- Multiple nodes have similar capabilities
|
|
52
|
+
- User specified device name is ambiguous
|
|
53
|
+
- No clear capability distinction between candidates
|
|
54
|
+
|
|
55
|
+
**No Match Handling**:
|
|
56
|
+
|
|
57
|
+
- No connected nodes → Inform user: "No devices currently connected"
|
|
58
|
+
- No capability match → Inform user: "No device supports [operation]. Available capabilities: [list]"
|
|
59
|
+
- All nodes offline → Suggest: "Check device connectivity and try again"
|
|
60
|
+
|
|
61
|
+
#### Pre-selection Checklist
|
|
62
|
+
|
|
63
|
+
- ✅ Filter only `status: "connected"` nodes
|
|
64
|
+
- ✅ Never attempt to control offline devices
|
|
65
|
+
- ✅ Match node type and capabilities with user intent
|
|
66
|
+
- ✅ If multiple nodes match, ask user to select OR control all if appropriate
|
|
67
|
+
- ✅ If no suitable node found, clearly inform user with available options
|
|
68
|
+
|
|
69
|
+
## Step 2. Plan Tool and Extract Command & Params
|
|
70
|
+
|
|
71
|
+
**⚠️ MANDATORY: Consult tool reference documentation before every operation**
|
|
72
|
+
|
|
73
|
+
Before executing any device control operation, you **MUST** consult the corresponding tool's command and parameter definition file in the `references/` directory. This is a non-negotiable requirement to ensure correct command and parameters.
|
|
74
|
+
|
|
75
|
+
### Available Tool References
|
|
76
|
+
|
|
77
|
+
| Reference File | Capability | Description | Required Node Caps |
|
|
78
|
+
| ---------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
|
|
79
|
+
| `references/volume.md` | Volume Control | Adjust, set, increase, decrease, mute/unmute device volume; query current volume status; fine-grained control by stream type (media, call, ringtone, notification) | `volume.operate` |
|
|
80
|
+
| `references/phone-call.md` | Phone Call | Initiate and manage phone calls; unified control for call operations | `phone.call` |
|
|
81
|
+
| `references/screen-recorder.md` | Screen Recording | Start/stop screen recording; configure recording parameters; query recording status; app-specific recording control | `screen.record` |
|
|
82
|
+
| `references/capture-screenshot.md` | Screenshot | Capture current screen content as image; support standard and scrolling screenshot modes | `capture.shot` |
|
|
83
|
+
| `references/schedule.md` | Schedule | Provides the ability to create schedules | `schedule.create` |
|
|
84
|
+
| `references/search-contact.md` | Contact | Provides the ability to search contacts | `search.contact ` |
|
|
85
|
+
| `references/open-app.md` | Open Application | Used to help users open a specified app without any specific app internals. | `app.open` |
|
|
86
|
+
| `references/send-message.md` | Send Message | Provide SMS sending services, users can send SMS content to specified numbers by providing phone numbers or contact information. | `send.message` |
|
|
87
|
+
| `references/local-search.md` | Local Search | Search native data for documents, notes, calendars, galleries, yoyo memories, wallets, and more for direct answers to user questions or generate at-a-glance content | `message.send.message` |
|
|
88
|
+
|
|
89
|
+
### Parameter Construction Workflow
|
|
90
|
+
|
|
91
|
+
Execute the following steps **in strict order** for each operation:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
95
|
+
│ Step 1: INTENT RECOGNITION │
|
|
96
|
+
│ Parse user request → Identify target tool and operation │
|
|
97
|
+
└─────────────────────────────────────────────────────────────┘
|
|
98
|
+
↓
|
|
99
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
100
|
+
│ Step 2: DOCUMENT CONSULTATION [MANDATORY] │
|
|
101
|
+
│ Open references/*.md → Read tool definitions │
|
|
102
|
+
│ ⚠️ PROHIBITED: Skip, guess, assume, or rely on memory │
|
|
103
|
+
└─────────────────────────────────────────────────────────────┘
|
|
104
|
+
↓
|
|
105
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
106
|
+
│ Step 3: PARAMETER EXTRACTION │
|
|
107
|
+
│ Extract: type, enum values, required/optional, defaults │
|
|
108
|
+
└─────────────────────────────────────────────────────────────┘
|
|
109
|
+
↓
|
|
110
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
111
|
+
│ Step 4: JSON CONSTRUCTION │
|
|
112
|
+
│ Build params object conforming to JSONSchema definiton │
|
|
113
|
+
└─────────────────────────────────────────────────────────────┘
|
|
114
|
+
↓
|
|
115
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
116
|
+
│ Step 5: VALIDATION │
|
|
117
|
+
│ Verify: required fields present, enum case-sensitive match │
|
|
118
|
+
└─────────────────────────────────────────────────────────────┘
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Error Handling Protocol
|
|
122
|
+
|
|
123
|
+
| Scenario | Required Action |
|
|
124
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| **Ambiguous Request** | User request unclear or missing required fields → Ask clarifying questions before proceeding |
|
|
126
|
+
| **Unsupported Operation** | No matching tool definition found → Inform user: "Operation '[operation]' is not supported. Available operations: [list]" |
|
|
127
|
+
| **Capability Mismatch** | Selected node lacks required capability → Inform user and suggest alternative device or operation |
|
|
128
|
+
|
|
129
|
+
### ⚠️ Prohibited Actions
|
|
130
|
+
|
|
131
|
+
- ❌ **DO NOT** construct parameters from memory or guesswork
|
|
132
|
+
- ❌ **DO NOT** skip document consultation before executing commands
|
|
133
|
+
- ❌ **DO NOT** use parameter values not defined in the documentation
|
|
134
|
+
|
|
135
|
+
## Step 3. Invoke Node With Command And Params
|
|
136
|
+
|
|
137
|
+
**Command**: `openclaw nodes invoke --node <id|ip> --command <command> --params <json>`
|
|
138
|
+
|
|
139
|
+
**Purpose**: Send command to target node and initiate operation.
|
|
140
|
+
|
|
141
|
+
### ⚠️ MANDATORY Validation Steps
|
|
142
|
+
|
|
143
|
+
**Execute these validation steps in order. DO NOT skip any step.**
|
|
144
|
+
|
|
145
|
+
| Step | Validation | Action | On Failure |
|
|
146
|
+
| ---- | ---------------------- | ------------------------------------------------------ | --------------------------------------------------------------- |
|
|
147
|
+
| 1 | **Node Identifier** | Extract `ID` or `IP` column from `nodes status` output | ❌ STOP: "Cannot use node name. Use ID or IP from nodes status" |
|
|
148
|
+
| 2 | **Tool Documentation** | Read `references/<tool>.md` file completely | ❌ STOP: "Tool documentation not found" |
|
|
149
|
+
| 4 | **Command Name** | Extract `command` exactly from tool documentation | ❌ STOP: "Command mismatch. Check documentation" |
|
|
150
|
+
| 3 | **Required Params** | Extract `params` from tool documentation | ❌ STOP: "Missing required field: [field]" |
|
|
151
|
+
|
|
152
|
+
#### Node Identifier Rules
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
156
|
+
│ CORRECT: Use ID or IP from nodes status output │
|
|
157
|
+
│ ✅ openclaw nodes invoke 192.168.1.100 --command ... │
|
|
158
|
+
│ ✅ openclaw nodes invoke f5f8916028aa5 --command ... │
|
|
159
|
+
├─────────────────────────────────────────────────────────────┤
|
|
160
|
+
│ INCORRECT: Use Node name column │
|
|
161
|
+
│ ❌ openclaw nodes invoke "Honor Magic6" --command ... │
|
|
162
|
+
│ ❌ openclaw nodes invoke "My Phone" --command ... │
|
|
163
|
+
└─────────────────────────────────────────────────────────────┘
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Anti-Hallucination Rules
|
|
167
|
+
|
|
168
|
+
**Before constructing ANY command, you MUST:**
|
|
169
|
+
|
|
170
|
+
1. ✅ **READ** the tool documentation file completely
|
|
171
|
+
2. ✅ **COPY** command name exactly from documentation
|
|
172
|
+
3. ✅ **VERIFY** each parameter against JSONSchema
|
|
173
|
+
4. ✅ **MATCH** enum values character-by-character
|
|
174
|
+
|
|
175
|
+
**PROHIBITED actions that cause hallucination:**
|
|
176
|
+
|
|
177
|
+
- ❌ **DO NOT** guess command names from user intent
|
|
178
|
+
- ❌ **DO NOT** infer parameter structure from similar tools
|
|
179
|
+
- ❌ **DO NOT** assume enum values without checking documentation
|
|
180
|
+
- ❌ **DO NOT** use node names from the "Node" column in status output
|
|
181
|
+
|
|
182
|
+
### Parameter Format Requirements
|
|
183
|
+
|
|
184
|
+
| Platform | Format | Example |
|
|
185
|
+
| ---------------------------- | --------------------------------------- | ----------------------- |
|
|
186
|
+
| **Bash (Linux/macOS)** | Single quotes wrapping JSON | `'{"level":50}'` |
|
|
187
|
+
| **Windows (PowerShell/CMD)** | Double quotes with escaped inner quotes | `"{\"level\":50}"` |
|
|
188
|
+
| **Complex Objects** | Create JSON file first | `--params @params.json` |
|
|
189
|
+
|
|
190
|
+
**Additional Requirements**:
|
|
191
|
+
|
|
192
|
+
- Parameters must be valid JSON
|
|
193
|
+
- Enum values must match documentation exactly (case-sensitive)
|
|
194
|
+
- Numeric values must be within defined ranges
|
|
195
|
+
|
|
196
|
+
### Examples
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# ✅ CORRECT: Execute volume control after consulting volume.md
|
|
200
|
+
# Documentation: command = "volume.operate", params = { actionType: "增加" | "减少" | "关闭", level?: number }
|
|
201
|
+
openclaw nodes invoke 192.168.1.100 --command volume.operate --params '{"actionType":"增加","level":50}'
|
|
202
|
+
|
|
203
|
+
# ❌ INCORRECT: Using node name instead of ID/IP
|
|
204
|
+
# openclaw nodes invoke "My Phone" --command volume.operate --params '{"actionType":"增加"}'
|
|
205
|
+
|
|
206
|
+
# ❌ INCORRECT: Wrong command name
|
|
207
|
+
# openclaw nodes invoke <nodeId> --command volume --params '{"action":"up"}'
|
|
208
|
+
|
|
209
|
+
# ❌ INCORRECT: Enum case mismatch
|
|
210
|
+
# openclaw nodes invoke <nodeId> --command volume.operate --params '{"actionType":"UP"}'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Error Handling
|
|
214
|
+
|
|
215
|
+
**Maximum retry limit: 3 attempts. DO NOT exceed this limit to prevent infinite loops.**
|
|
216
|
+
|
|
217
|
+
| Error Type | Diagnosis | Resolution | Retry? | Max Retries |
|
|
218
|
+
| ---------------------- | ------------------------------- | -------------------------------------------------------- | ------ | ----------- |
|
|
219
|
+
| **Invalid Parameters** | Check error message for details | Validate params against JSONSchema; fix parameter format | ✅ YES | 3 |
|
|
220
|
+
| **Node Offline** | Node not responding | Re-verify node status with `openclaw nodes status` | ❌ NO | 0 |
|
|
221
|
+
| **Permission Denied** | Command not in allowlist | Check `gateway.nodes.allowCommands` configuration | ❌ NO | 0 |
|
|
222
|
+
| **Connection Error** | Network or gateway issue | Verify gateway running; check network connectivity | ✅ YES | 3 |
|
|
223
|
+
| **Timeout** | Operation took too long | Wait 2 seconds before retry | ✅ YES | 3 |
|
|
224
|
+
| **Temporary Failure** | Transient device error | Wait 1 second before retry | ✅ YES | 3 |
|
|
225
|
+
|
|
226
|
+
### Retry Protocol
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
230
|
+
│ RETRY FLOW (Max 3 attempts) │
|
|
231
|
+
├─────────────────────────────────────────────────────────────┤
|
|
232
|
+
│ Attempt 1 → FAIL → Wait 1s → Attempt 2 → FAIL → Wait 2s │
|
|
233
|
+
│ → Attempt 3 → FAIL → STOP & REPORT ERROR │
|
|
234
|
+
│ │
|
|
235
|
+
│ ⚠️ After 3 failed attempts: │
|
|
236
|
+
│ - DO NOT retry again │
|
|
237
|
+
│ - Report error to user with diagnosis │
|
|
238
|
+
│ - Suggest manual intervention │
|
|
239
|
+
└─────────────────────────────────────────────────────────────┘
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Step 4. Report Results
|
|
243
|
+
|
|
244
|
+
**Purpose**: Present operation results to user with clear confirmation or error explanation.
|
|
245
|
+
|
|
246
|
+
### Response Structure
|
|
247
|
+
|
|
248
|
+
| Component | Success Case | Failure Case |
|
|
249
|
+
| -------------------------- | --------------------- | ------------------ |
|
|
250
|
+
| **Operation Confirmation** | What was executed | What was attempted |
|
|
251
|
+
| **State Change** | Before → After values | Expected vs Actual |
|
|
252
|
+
| **Key Information** | Relevant details | Error diagnosis |
|
|
253
|
+
| **Next Steps** | Optional suggestions | Required actions |
|
|
254
|
+
|
|
255
|
+
### Response Tone Guidelines
|
|
256
|
+
|
|
257
|
+
| Scenario | Tone | Detail Level |
|
|
258
|
+
| ---------------- | ----------------------- | ------------------------ |
|
|
259
|
+
| Simple Success | Concise, factual | Brief confirmation |
|
|
260
|
+
| Complex Success | Informative, structured | Detailed state changes |
|
|
261
|
+
| Partial Failure | Helpful, diagnostic | Error + recovery options |
|
|
262
|
+
| Complete Failure | Clear, actionable | Root cause + next steps |
|
|
263
|
+
|
|
264
|
+
### Response Templates
|
|
265
|
+
|
|
266
|
+
#### Simple Success
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
✅ [Operation] completed on [Device]
|
|
270
|
+
|
|
271
|
+
Example: "Volume set to 50% on Honor Magic6 (was 30%)"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
#### Complex Success
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
✅ [Operation] completed on [Device]
|
|
278
|
+
|
|
279
|
+
Changes:
|
|
280
|
+
- [Property 1]: [Before] → [After]
|
|
281
|
+
- [Property 2]: [Before] → [After]
|
|
282
|
+
|
|
283
|
+
Example:
|
|
284
|
+
"Bluetooth settings updated on Honor Magic6:
|
|
285
|
+
- Bluetooth: OFF → ON
|
|
286
|
+
- Connected devices: AirPods Pro, Honor Band
|
|
287
|
+
- Visibility: Visible for 2 minutes"
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
#### Failure with Guidance
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
❌ [Operation] failed on [Device]
|
|
294
|
+
|
|
295
|
+
Reason: [Error diagnosis]
|
|
296
|
+
Suggestion: [Recovery action]
|
|
297
|
+
|
|
298
|
+
Example:
|
|
299
|
+
"Unable to control device - Honor Magic6 is offline (last seen 15 minutes ago).
|
|
300
|
+
The device may need manual power-on or has lost network connection.
|
|
301
|
+
Would you like to check other nodes or retry later?"
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Response Flow
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
308
|
+
│ Parse command result │
|
|
309
|
+
└─────────────────────────────────────────────────────────────┘
|
|
310
|
+
↓
|
|
311
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
312
|
+
│ Check result.success │
|
|
313
|
+
│ - true → Build success response │
|
|
314
|
+
│ - false → Build failure response with error details │
|
|
315
|
+
└─────────────────────────────────────────────────────────────┘
|
|
316
|
+
↓
|
|
317
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
318
|
+
│ Format response based on operation complexity │
|
|
319
|
+
│ - Simple: Single line confirmation │
|
|
320
|
+
│ - Complex: Structured list with state changes │
|
|
321
|
+
└─────────────────────────────────────────────────────────────┘
|
|
322
|
+
↓
|
|
323
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
324
|
+
│ Present to user with appropriate tone │
|
|
325
|
+
└─────────────────────────────────────────────────────────────┘
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Best Practices
|
|
329
|
+
|
|
330
|
+
- ✅ **DO** include device name in response for clarity
|
|
331
|
+
- ✅ **DO** show before/after values when applicable
|
|
332
|
+
- ✅ **DO** provide actionable suggestions on failure
|
|
333
|
+
- ✅ **DO** ask before attempting alternative actions
|
|
334
|
+
- ❌ **DO NOT** expose raw error codes to users
|
|
335
|
+
- ❌ **DO NOT** assume user knows technical details
|
|
336
|
+
- ❌ **DO NOT** leave user without next steps on failure
|
|
337
|
+
|
|
338
|
+
## 快速参考命令
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
# 获取所有节点状态
|
|
342
|
+
openclaw nodes status
|
|
343
|
+
|
|
344
|
+
# 调用工具
|
|
345
|
+
openclaw nodes invoke --node <id|name|ip> --command <command> --params <json>
|
|
346
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# capture_screenshot 截屏工具使用说明
|
|
2
|
+
|
|
3
|
+
## Tool Command
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
capture.shot
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Tool Parameters and Examples
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"name": "capture_screenshot",
|
|
14
|
+
"description": "该工具提供对截屏功能(将当前手机屏幕内容以图片的形式保存)的管理与触发能力,支持截屏和滚动截屏等操作。",
|
|
15
|
+
"parameters": {
|
|
16
|
+
"actionType": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"enum": ["截屏", "滚动截屏"],
|
|
19
|
+
"description": "截屏相关操作的动作类型,用于明确本次指令的主要行为。当需要对当前屏幕内容进行一次性截图保存时使用截屏;当需要对可上下滚动的长页面内容进行连续截图并合成为长图时使用滚动截屏。"
|
|
20
|
+
},
|
|
21
|
+
"app": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "指定需要进行截屏操作的应用名称。当明确要求对某个特定应用界面进行截图时填写,用于限定截屏作用范围。"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": [],
|
|
27
|
+
"examples": [
|
|
28
|
+
{
|
|
29
|
+
"query": "截屏",
|
|
30
|
+
"arguments": {
|
|
31
|
+
"actionType": "截屏"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"query": "滚动截屏",
|
|
36
|
+
"arguments": {
|
|
37
|
+
"actionType": "滚动截屏"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"query": "立刻保存手机屏幕",
|
|
42
|
+
"arguments": {
|
|
43
|
+
"actionType": "截屏"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"query": "我想要滚动截屏",
|
|
48
|
+
"arguments": {
|
|
49
|
+
"actionType": "滚动截屏"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"query": "请将屏幕内容保存为图片",
|
|
54
|
+
"arguments": {
|
|
55
|
+
"actionType": "截屏"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"query": "我需要当前手机屏幕的图片",
|
|
60
|
+
"arguments": {
|
|
61
|
+
"actionType": "截屏"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# local_search 本地搜索工具使用说明
|
|
2
|
+
|
|
3
|
+
## Tool Command
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
local.search
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Tool Parameters and Examples
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"name": "local_search",
|
|
14
|
+
"description": "用户手机内容RAG系统,用户使用自然语言,统一查询本地数据, 信源包括(文档、笔记、日程、图库、yoyo记忆、钱包),用于直接回答用户问题或生成概览性内容。\n【数据范围】\n- 本地数据:\n - 文档:本地存储的文档(如 Word、PDF、PPT 等),通过文本抽取和向量化建立索引。\n - 笔记:便签、备忘录、记事类应用中的文本内容。\n - 日程:日历和日程条目(会议、活动、提醒等),含时间、地点、参与人等结构化信息。",
|
|
15
|
+
"parameters": {
|
|
16
|
+
"query": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "用户原始query,不需要进行任何改写"
|
|
19
|
+
},
|
|
20
|
+
"isSearchImage": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"description": "是否搜索图片"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|
|
27
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# open_app 打开应用工具使用说明
|
|
2
|
+
|
|
3
|
+
## Tool Command
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
app.open
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Tool Parameters and Examples
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"name": "open_app",
|
|
14
|
+
"description": "该工具用于帮助用户打开指定的 APP 应用,且不涉及任何具体 App 内部操作。",
|
|
15
|
+
"parameters": {
|
|
16
|
+
"app": {
|
|
17
|
+
"description": "需要打开的应用名称,若用户指定具体应用,则填写应用名称,若用户明确表示“所有应用”,则参数值为 all",
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"pkgName": {
|
|
21
|
+
"description": "应用包名",
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"app_description": {
|
|
25
|
+
"description": "类型描述。对 app 的补充描述,无论是否为空,都可以有这个参数,当且仅当 app 为空时才调用 description。示例:办公应用、聊天软件、音乐类应用。",
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": [],
|
|
30
|
+
"examples": [
|
|
31
|
+
{
|
|
32
|
+
"query": "打开小红书",
|
|
33
|
+
"arguments": {
|
|
34
|
+
"app": "网易云音乐",
|
|
35
|
+
"pkgName": "com.xingin.xhs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"query": "打开淘宝",
|
|
40
|
+
"arguments": {
|
|
41
|
+
"app": "微信",
|
|
42
|
+
"pkgName": "com.taobao.taobao"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"query": "打开生活类软件",
|
|
47
|
+
"arguments": {
|
|
48
|
+
"app": "支付宝",
|
|
49
|
+
"app_description": "生活"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
```
|