@instaclaw/dispatch 0.3.0 → 0.3.1
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/executor.js +3 -0
- package/dist/index.js +23 -2
- package/package.json +1 -1
package/dist/executor.js
CHANGED
|
@@ -62,6 +62,9 @@ async function doClick(params) {
|
|
|
62
62
|
const usecomputer = await getUC();
|
|
63
63
|
const x = Number(params.x);
|
|
64
64
|
const y = Number(params.y);
|
|
65
|
+
if (isNaN(x) || isNaN(y) || x < 0 || y < 0) {
|
|
66
|
+
return { success: false, error: `Invalid coordinates: (${params.x}, ${params.y}). Must be non-negative numbers.` };
|
|
67
|
+
}
|
|
65
68
|
const coordMap = params.coordMap ? String(params.coordMap) : lastCoordMap;
|
|
66
69
|
let point = { x, y };
|
|
67
70
|
if (coordMap) {
|
package/dist/index.js
CHANGED
|
@@ -133,8 +133,29 @@ async function interactiveSetup(existing) {
|
|
|
133
133
|
rl.question(` ${prompt}`, (ans) => resolve(ans.trim() || def || ""));
|
|
134
134
|
});
|
|
135
135
|
console.log(" First-time setup:\n");
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
let token = await ask("Gateway token", existing?.gatewayToken);
|
|
137
|
+
let vm = await ask("VM address (IP or hostname)", existing?.vmAddress);
|
|
138
|
+
// Input validation: detect swapped fields
|
|
139
|
+
const isHexLong = (s) => /^[0-9a-f]{32,}$/i.test(s);
|
|
140
|
+
const isIPish = (s) => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(s);
|
|
141
|
+
if (isHexLong(vm)) {
|
|
142
|
+
console.log(chalk.yellow("\n That VM address looks like a gateway token (long hex string)."));
|
|
143
|
+
console.log(chalk.yellow(" The VM address should be an IP like 104.237.145.128"));
|
|
144
|
+
const swap = await ask("Did you swap the fields? Enter your VM IP now");
|
|
145
|
+
if (swap) {
|
|
146
|
+
token = vm;
|
|
147
|
+
vm = swap;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else if (isIPish(token)) {
|
|
151
|
+
console.log(chalk.yellow("\n That gateway token looks like an IP address."));
|
|
152
|
+
console.log(chalk.yellow(" The gateway token should be a long hex string."));
|
|
153
|
+
const swap = await ask("Did you swap the fields? Enter your gateway token now");
|
|
154
|
+
if (swap) {
|
|
155
|
+
vm = token;
|
|
156
|
+
token = swap;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
138
159
|
const portStr = await ask("Port", String(existing?.port || 8765));
|
|
139
160
|
rl.close();
|
|
140
161
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instaclaw/dispatch",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Let your InstaClaw AI agent control your computer — screenshots, clicks, typing, and more via a secure WebSocket relay",
|
|
5
5
|
"bin": {
|
|
6
6
|
"instaclaw-dispatch": "./dist/index.js"
|