cortico-world-hands 0.20.66 → 0.20.67

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 +36 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1205,6 +1205,24 @@ var EyesClient = class {
1205
1205
  ageMs: 0
1206
1206
  };
1207
1207
  }
1208
+ /** 四块放大:把整屏切成 2×2 再拼成一张大图,凑近看细节用。 */
1209
+ async quadFrame(maxWidth = 1440, quality = 76) {
1210
+ try {
1211
+ const w = Math.max(160, Math.min(2160, Math.round(maxWidth)));
1212
+ const q = Math.max(20, Math.min(95, Math.round(quality)));
1213
+ const res = await get(this.port(), `/screen.jpg?tiles=1&max=${w}&q=${q}`, 15e3);
1214
+ if (res.status !== 200 || res.body.length === 0) return null;
1215
+ return {
1216
+ bytes: new Uint8Array(res.body),
1217
+ width: Number.parseInt(res.header("x-width"), 10) || 0,
1218
+ height: Number.parseInt(res.header("x-height"), 10) || 0,
1219
+ pkg: flat(res.header("x-pkg"), 120),
1220
+ ageMs: Number.parseInt(res.header("x-age-ms"), 10) || 0
1221
+ };
1222
+ } catch {
1223
+ return null;
1224
+ }
1225
+ }
1208
1226
  async frame(maxWidth, quality) {
1209
1227
  try {
1210
1228
  const w = Math.max(160, Math.min(2160, Math.round(maxWidth)));
@@ -2623,6 +2641,15 @@ var HANDS_TOOL_DECLS = [
2623
2641
  properties: { text: { type: "string", description: "\u5FC3\u60C5\uFF0C\u4E00\u53E5\u8BDD" } },
2624
2642
  required: ["text"]
2625
2643
  }
2644
+ },
2645
+ {
2646
+ name: "hand_quad",
2647
+ tags: ["read"],
2648
+ description: "\u56DB\u5757\u653E\u5927\uFF1A\u628A\u6574\u5C4F\u5207\u6210 2\xD72 \u518D\u62FC\u6210\u4E00\u5F20\u5927\u56FE\uFF0C\u51D1\u8FD1\u770B\u5C0F\u5B57/\u56FE\u6807/\u56FE\u8868\u7EC6\u8282\u3002\u770B\u4E0D\u6E05\u56FE\u5F62\u65F6\u7528\u5B83\uFF0C\u522B\u731C\u3002",
2649
+ parameters: {
2650
+ type: "object",
2651
+ properties: { max: { type: "integer", description: "\u8F93\u51FA\u5BBD\u5EA6\uFF0C\u9ED8\u8BA4 1440" } }
2652
+ }
2626
2653
  }
2627
2654
  ];
2628
2655
 
@@ -3577,6 +3604,8 @@ ${lines.join("\n")}
3577
3604
  return await this.runSync(true);
3578
3605
  case "sync_status":
3579
3606
  return this.lastSync ? `\u4E0A\u6B21\u540C\u6B65 ${this.lastSync.at.slice(0, 19)}\uFF0C\u8BB0\u5FC6 ${this.lastSync.lines} \u6761\uFF0C\u4EBA\u683C ${this.lastSync.persona} \u5B57` : "\u8FD8\u6CA1\u540C\u6B65\u8FC7";
3607
+ case "hand_quad":
3608
+ return await this.handQuad(args);
3580
3609
  case "hand_read_page": {
3581
3610
  const pages = Math.max(1, Math.min(8, Math.round(Number(args.pages) || 3)));
3582
3611
  const seen = /* @__PURE__ */ new Set();
@@ -4062,6 +4091,13 @@ ${text.slice(0, 2200)}`;
4062
4091
  if (!["system", "secure", "global"].includes(ns) || !key) return failed("ns \u53D6 system/secure/global\uFF0Ckey \u5FC5\u586B\u3002");
4063
4092
  return await this.hands.sysSettingsGet(ns, key);
4064
4093
  }
4094
+ async handQuad(args) {
4095
+ const max = args.max === void 0 ? 1440 : Math.max(640, Math.min(2160, Math.round(Number(args.max))));
4096
+ const f = await this.hands.quadFrame(max, 76);
4097
+ if (!f) return failed("\u6CA1\u62FF\u5230\u753B\u9762\uFF08\u5C4F\u5E55\u9ED1\u7740\u3001\u6216\u8005\u773C\u775B\u6CA1\u5F00\uFF09\u3002");
4098
+ const blobs = this.looksLikeImage(f.bytes) ? [{ bytes: f.bytes, mime: "image/jpeg", name: "quad.jpg", fallbackText: "\uFF08\u8FD9\u662F\u5C4F\u5E55\u5207\u6210\u56DB\u5757\u653E\u5927\u540E\u7684\u56FE\uFF09" }] : [];
4099
+ return { text: `\u8FD9\u662F\u5C4F\u5E55\u7684\u56DB\u5757\u653E\u5927\u56FE${f.pkg ? `\uFF08${f.pkg}\uFF09` : ""}\uFF1A\u5DE6\u4E0A\u3001\u53F3\u4E0A\u3001\u5DE6\u4E0B\u3001\u53F3\u4E0B\uFF0C\u51D1\u8FD1\u770B\u7EC6\u8282\u3002`, blobs };
4100
+ }
4065
4101
  async handChain(args) {
4066
4102
  const raw = args.steps;
4067
4103
  if (!Array.isArray(raw) || raw.length === 0) return failed('\u8981 steps\uFF0C\u50CF [{op:"look"},{op:"tapText",text:"\u53D1\u9001"},{op:"wait",ms:600}]\u3002');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.66",
3
+ "version": "0.20.67",
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",