cortico-world-hands 0.20.38 → 0.20.40

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 +16 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1654,7 +1654,18 @@ var Hands = class {
1654
1654
  throw new HandError(`\u773C\u775B\u6CA1\u5F00\uFF1A${health?.error ?? "\u65E0\u969C\u788D\u670D\u52A1\u6CA1\u5728\u8DD1\uFF08\u7CFB\u7EDF\u8BBE\u7F6E \u2192 \u65E0\u969C\u788D\uFF09"}\u3002`);
1655
1655
  }
1656
1656
  const state = await this.eyes.state(this.port(cfg.sensePort));
1657
- const where = state?.appLabel && state.appPkg ? `${state.appLabel}\uFF08${state.appPkg}\uFF09` : state?.appPkg || "\u672A\u77E5\u5E94\u7528";
1657
+ let uiPkg = "";
1658
+ let uiItems = [];
1659
+ try {
1660
+ const u = await this.eyes.ui();
1661
+ if (u && u.ok) {
1662
+ uiPkg = (u.pkg || "").trim();
1663
+ uiItems = u.items || [];
1664
+ }
1665
+ } catch {
1666
+ }
1667
+ const pkgNow = (state?.appPkg || "").trim() || uiPkg;
1668
+ const where = state?.appLabel && state.appPkg ? `${state.appLabel}\uFF08${state.appPkg}\uFF09` : pkgNow || "\u8FD9\u4E2A\u754C\u9762\uFF08\u8BFB\u4E0D\u5230\u5E94\u7528\u540D\uFF09";
1658
1669
  const parts = [`\u73B0\u5728\u524D\u53F0\u662F ${where}\u3002`];
1659
1670
  if (state) {
1660
1671
  parts.push(`${state.screenOn ? "\u5C4F\u5E55\u4EAE\u7740" : "\u5C4F\u5E55\u9ED1\u7740"}\u3001${state.locked ? "\u9501\u7740" : "\u6CA1\u9501"}${typeof state.battery === "number" ? `\u3001\u7535\u91CF ${state.battery}%` : ""}\u3002`);
@@ -1674,9 +1685,9 @@ var Hands = class {
1674
1685
  }
1675
1686
  }
1676
1687
  if (detail !== "screen") {
1677
- const ui = await this.eyes.ui();
1678
- if (ui.ok && ui.items.length) {
1679
- const lines = ui.items.slice(0, 40).map((item) => {
1688
+ const items = uiItems;
1689
+ if (items.length) {
1690
+ const lines = items.slice(0, 40).map((item) => {
1680
1691
  const spot = item.center ? `@(${item.center.x},${item.center.y})` : "";
1681
1692
  return `- \u300C${item.text}\u300D${spot}`;
1682
1693
  });
@@ -3260,7 +3271,7 @@ ${text.slice(0, 2200)}`;
3260
3271
  if (/人格|我是谁|人设|设定原文/.test(key)) {
3261
3272
  return "\u8FD9\u4E2A\u4E0D\u7528\u8BB0\u2014\u2014\u4EBA\u683C\uFF08\u6211\u662F\u8C01\u3001\u6027\u683C\u3001\u8BF4\u8BDD\u65B9\u5F0F\uFF09\u672C\u6765\u5C31\u5728\u6211\u7684\u63D0\u793A\u8BCD\u91CC\uFF0C\u6539\u4E86\u4F1A\u7ACB\u523B\u751F\u6548\uFF1B\u8BB0\u5FC6\u5E93\u53EA\u653E\u4EBA\u548C\u4E8B\u3002";
3262
3273
  }
3263
- const trivial = value.length < 16 && !/[0-9]{4}|主人|他|约定|答应|纪念|生日|我们|第一次|以后/.test(key + value);
3274
+ const trivial = value.length < 8 && !/[0-9]{4}|主人|他|约定|答应|纪念|生日|我们|第一次|以后/.test(key + value);
3264
3275
  if (trivial) {
3265
3276
  const note = await this.hands.noteAdd(`${key}\uFF1A${value}`, "think");
3266
3277
  return note.ok ? `\u8FD9\u6761\u66F4\u50CF\u4FBF\u7B7E\uFF08\u7410\u4E8B\uFF09\uFF0C\u5DF2\u7ECF\u8BB0\u5230\u4FBF\u7B7E\u677F\u4E0A\u4E86\uFF1A\u300C${key}\u300D` : failed(`\u6CA1\u8BB0\u6210\u4FBF\u7B7E\uFF1A${note.detail || "\u6CA1\u54CD\u5E94"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.38",
3
+ "version": "0.20.40",
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",