cortico-world-hands 0.9.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/index.js +28 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1071,6 +1071,14 @@ var Hands = class {
1071
1071
  const res = await post(this.port(cfg.handPort), `/hand/wake?${t}`, "", 15e3);
1072
1072
  return res.body.toString("utf8");
1073
1073
  }
1074
+ /** 解锁锁屏:密码由主人放在本机文件里,这里只触发,不接触密码。 */
1075
+ async unlockScreen() {
1076
+ const cfg = this.cfg();
1077
+ const credential = this.readToken();
1078
+ const t = credential ? `t=${encodeURIComponent(credential)}` : "";
1079
+ const res = await post(this.port(cfg.handPort), `/hand/unlock?${t}`, "", 3e4);
1080
+ return res.body.toString("utf8");
1081
+ }
1074
1082
  /** 息屏(可选,用来自己测唤醒)。 */
1075
1083
  async sleepScreen() {
1076
1084
  const cfg = this.cfg();
@@ -1464,6 +1472,12 @@ var HANDS_TOOL_DECLS = [
1464
1472
  description: "\u70B9\u4EAE\u5C4F\u5E55\uFF1A\u5C4F\u5E55\u9ED1\u7740\u4E5F\u80FD\u5524\u9192\uFF08\u7528 Shizuku \u7684\u7CFB\u7EDF\u6309\u952E\uFF0Croot/Shizuku \u4EFB\u4E00\u901A\u9053\uFF09\u3002\u4E3B\u4EBA\u8BF4\u300C\u4EAE\u4E00\u4E0B\u5C4F\u300D\u300C\u5E2E\u6211\u628A\u5C4F\u5E55\u70B9\u4EAE\u300D\u65F6\u7528\u5B83\uFF1B\u5931\u8D25\u4F1A\u8FD4\u56DE\u539F\u56E0\u3002",
1465
1473
  parameters: { type: "object", properties: {} }
1466
1474
  },
1475
+ {
1476
+ name: "screen_unlock",
1477
+ tags: ["act"],
1478
+ description: "\u89E3\u9501\u9501\u5C4F\uFF1A\u53EA\u5728\u5C4F\u5E55\u9501\u7740\u65F6\u7528\u3002\u5BC6\u7801\u7531\u4E3B\u4EBA\u81EA\u5DF1\u586B\u5728\u672C\u673A\u6587\u4EF6\u91CC\uFF08/sdcard/Download/DSHA/\u9501\u5C4F\u5BC6\u7801.txt\uFF09\uFF0C\u8FD9\u4E2A\u5DE5\u5177\u53EA\u8D1F\u8D23\u89E6\u53D1\uFF0C\u8BFB\u4E0D\u5230\u5BC6\u7801\u4F1A\u544A\u8BC9\u4F60\u6587\u4EF6\u5728\u54EA\u3002\u5931\u8D25\u4F1A\u8FD4\u56DE\u539F\u56E0\u3002",
1479
+ parameters: { type: "object", properties: {} }
1480
+ },
1467
1481
  {
1468
1482
  name: "screen_sleep",
1469
1483
  tags: ["act"],
@@ -1931,6 +1945,8 @@ ${lines.join("\n")}
1931
1945
  return await this.skinInstall(args);
1932
1946
  case "screen_wake":
1933
1947
  return await this.screenWake();
1948
+ case "screen_unlock":
1949
+ return await this.screenUnlock();
1934
1950
  case "screen_sleep":
1935
1951
  return await this.screenSleep();
1936
1952
  case "canvas_new":
@@ -2070,6 +2086,18 @@ ${lines.join("\n")}
2070
2086
  return failed(raw.slice(0, 120));
2071
2087
  }
2072
2088
  }
2089
+ /** 解锁:成功/没锁/失败都给人话。 */
2090
+ async screenUnlock() {
2091
+ const raw = await this.hands.unlockScreen();
2092
+ try {
2093
+ const r = JSON.parse(raw);
2094
+ if (r.ok) return r.detail || "\u89E3\u5F00\u4E86";
2095
+ if (r.needFile) return failed(`${r.error}\uFF08\u6587\u4EF6\uFF1A${r.file}\uFF09`);
2096
+ return failed(r.error || "\u6CA1\u89E3\u5F00\uFF0C\u539F\u56E0\u4E0D\u660E");
2097
+ } catch {
2098
+ return failed(raw.slice(0, 120));
2099
+ }
2100
+ }
2073
2101
  async screenSleep() {
2074
2102
  const raw = await this.hands.sleepScreen();
2075
2103
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Cortico World: hands for the desktop pet — looks at the phone screen, then taps, swipes, pinches, drags, types and presses keys through whatever actuator the device actually has",
6
6
  "license": "MIT",