0agent 1.0.70 → 1.0.71
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/daemon.mjs +57 -16
- package/package.json +1 -1
package/dist/daemon.mjs
CHANGED
|
@@ -3303,24 +3303,58 @@ print("Typed successfully")
|
|
|
3303
3303
|
const pyKeys = JSON.stringify(parts);
|
|
3304
3304
|
if (targetApp && platform2() === "darwin") {
|
|
3305
3305
|
const safeApp = targetApp.replace(/'/g, "\\'");
|
|
3306
|
-
const
|
|
3307
|
-
const
|
|
3306
|
+
const mainKey = parts[parts.length - 1] ?? "";
|
|
3307
|
+
const modParts = parts.slice(0, -1);
|
|
3308
|
+
const KEY_CODES = {
|
|
3309
|
+
down: 125,
|
|
3310
|
+
up: 126,
|
|
3311
|
+
left: 123,
|
|
3312
|
+
right: 124,
|
|
3313
|
+
enter: 36,
|
|
3314
|
+
return: 36,
|
|
3315
|
+
escape: 53,
|
|
3316
|
+
esc: 53,
|
|
3317
|
+
tab: 48,
|
|
3318
|
+
delete: 51,
|
|
3319
|
+
backspace: 51,
|
|
3320
|
+
"delete-forward": 117,
|
|
3321
|
+
space: 49,
|
|
3322
|
+
home: 115,
|
|
3323
|
+
end: 119,
|
|
3324
|
+
pageup: 116,
|
|
3325
|
+
pagedown: 121,
|
|
3326
|
+
f1: 122,
|
|
3327
|
+
f2: 120,
|
|
3328
|
+
f3: 99,
|
|
3329
|
+
f4: 118,
|
|
3330
|
+
f5: 96,
|
|
3331
|
+
f6: 97,
|
|
3332
|
+
f7: 98,
|
|
3333
|
+
f8: 100,
|
|
3334
|
+
f9: 101,
|
|
3335
|
+
f10: 109,
|
|
3336
|
+
f11: 103,
|
|
3337
|
+
f12: 111
|
|
3338
|
+
};
|
|
3339
|
+
const keyCode = KEY_CODES[mainKey];
|
|
3340
|
+
const modifiers = modParts.map((k) => {
|
|
3308
3341
|
if (k === "command") return "command down";
|
|
3309
3342
|
if (k === "ctrl") return "control down";
|
|
3310
3343
|
if (k === "shift") return "shift down";
|
|
3311
3344
|
if (k === "option") return "option down";
|
|
3312
3345
|
return "";
|
|
3313
3346
|
}).filter(Boolean).join(", ");
|
|
3314
|
-
const
|
|
3347
|
+
const usingClause = modifiers ? ` using {${modifiers}}` : "";
|
|
3348
|
+
const keyStatement = keyCode !== void 0 ? `key code ${keyCode}${usingClause}` : `keystroke "${mainKey}"${usingClause}`;
|
|
3315
3349
|
return header + `
|
|
3316
3350
|
import subprocess, time
|
|
3317
|
-
# Focus target app first
|
|
3318
3351
|
subprocess.run(['osascript', '-e', 'tell application "${safeApp}" to activate'], capture_output=True)
|
|
3319
3352
|
time.sleep(0.3)
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
end tell
|
|
3353
|
+
as_script = """tell application "System Events"
|
|
3354
|
+
tell process "${safeApp}"
|
|
3355
|
+
${keyStatement}
|
|
3356
|
+
end tell
|
|
3357
|
+
end tell"""
|
|
3324
3358
|
r = subprocess.run(['osascript', '-e', as_script], capture_output=True, text=True)
|
|
3325
3359
|
if r.returncode == 0:
|
|
3326
3360
|
print(f"Sent ${parts.join("+")} to ${safeApp}")
|
|
@@ -4759,16 +4793,23 @@ content = element.text if element else page.get_all_text()` : `content = page.ge
|
|
|
4759
4793
|
` regardless of OS keyboard focus. ALWAYS use this for native app text input.`,
|
|
4760
4794
|
` accessibility_click {app:"WhatsApp", element:"Send"} \u2014 click button via Accessibility API.`,
|
|
4761
4795
|
` hotkey {keys:"cmd+f", app:"WhatsApp"} \u2014 send hotkey to specific app (not Terminal).`,
|
|
4762
|
-
`
|
|
4796
|
+
`NATIVE APP SEARCH NAVIGATION (generalised \u2014 works for WhatsApp, Spotlight, file dialogs, any search):`,
|
|
4797
|
+
` After typing in a search box, results appear in a dropdown/list.`,
|
|
4798
|
+
` Navigate them with: hotkey {keys:"down", app:"AppName"} to move to first result,`,
|
|
4799
|
+
` then hotkey {keys:"enter", app:"AppName"} to select/open it.`,
|
|
4800
|
+
` If first down+enter doesn't work, try: down, down, enter (some apps skip a header row).`,
|
|
4801
|
+
` Use wait {seconds:1} after typing to give results time to load before navigating.`,
|
|
4802
|
+
`WHATSAPP EXACT WORKFLOW:`,
|
|
4763
4803
|
` 1. open_app {app:"WhatsApp"}`,
|
|
4764
|
-
` 2. hotkey {keys:"cmd+f", app:"WhatsApp"} \u2014 open search`,
|
|
4765
|
-
` 3. app_type {app:"WhatsApp", text:"ContactName"} \u2014
|
|
4766
|
-
` 4.
|
|
4767
|
-
` 5.
|
|
4768
|
-
` 6. hotkey {keys:"enter", app:"WhatsApp"} \u2014
|
|
4769
|
-
` 7.
|
|
4804
|
+
` 2. hotkey {keys:"cmd+f", app:"WhatsApp"} \u2014 open search bar`,
|
|
4805
|
+
` 3. app_type {app:"WhatsApp", text:"ContactName"} \u2014 type contact name`,
|
|
4806
|
+
` 4. wait {seconds:1} \u2014 wait for search results to load`,
|
|
4807
|
+
` 5. hotkey {keys:"down", app:"WhatsApp"} \u2014 move focus to first result`,
|
|
4808
|
+
` 6. hotkey {keys:"enter", app:"WhatsApp"} \u2014 open the conversation`,
|
|
4809
|
+
` 7. app_type {app:"WhatsApp", text:"your message"} \u2014 type message`,
|
|
4810
|
+
` 8. hotkey {keys:"enter", app:"WhatsApp"} \u2014 send`,
|
|
4770
4811
|
`NEVER use bare 'type' action for native apps \u2014 it goes to Terminal not the app.`,
|
|
4771
|
-
`ALWAYS verify: browser_state after web nav, get_media_state after play/pause
|
|
4812
|
+
`ALWAYS verify: browser_state after web nav, get_media_state after play/pause.`
|
|
4772
4813
|
);
|
|
4773
4814
|
}
|
|
4774
4815
|
if (isSelfMod && this.agentRoot) {
|