cortico-world-hands 0.20.44 → 0.20.45

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 +14 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1637,9 +1637,21 @@ var Hands = class {
1637
1637
  this.log?.info(`\u624B\uFF08\u6F14\u7EC3\uFF09\uFF1A${described}`, { actuator: state.kind });
1638
1638
  return { text: `\u6F14\u7EC3\uFF1A\u672C\u6765\u8981${described}${where ? `\uFF08\u5728 ${where} \u4E0A\uFF09` : ""}\uFF0C\u4E00\u4E2A\u52A8\u4F5C\u90FD\u6CA1\u53D1\u3002`, performed: false };
1639
1639
  }
1640
- const actuator = await this.actuator();
1640
+ let actuator = await this.actuator();
1641
1641
  try {
1642
- const result = await actuator.apply(command);
1642
+ let result;
1643
+ try {
1644
+ result = await actuator.apply(command);
1645
+ } catch (firstErr) {
1646
+ this.actuatorState = { ...this.actuatorState, ok: false, detail: firstErr instanceof Error ? firstErr.message : String(firstErr) };
1647
+ const again = await this.probe(true);
1648
+ if (!again.ok) throw firstErr;
1649
+ const other = await this.actuator();
1650
+ if (other === actuator) throw firstErr;
1651
+ this.log?.warn(`\u624B\u6362\u901A\u9053\u91CD\u8BD5\uFF1A${this.actuatorState.kind || "?"} \u2192 ${again.kind}`);
1652
+ actuator = other;
1653
+ result = await other.apply(command);
1654
+ }
1643
1655
  this.stamps.push(Date.now());
1644
1656
  this.acts += 1;
1645
1657
  this.log?.info(`\u624B\uFF1A${described}`, { actuator: state.kind, where });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.44",
3
+ "version": "0.20.45",
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",