cortico-world-hands 0.20.36 → 0.20.38

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 +35 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var HANDS_DEFAULTS = {
30
30
  /** 多久主动看一眼屏幕;0 = 不看。 */
31
31
  screenWatchSeconds: 40,
32
32
  /** 静音时段:这段时间不主动开口(回复主人不受影响)。 */
33
+ keepNotesMinutes: 20,
33
34
  quietStartHour: 2,
34
35
  quietEndHour: 7,
35
36
  qqSelf: "\u665A\u6C50",
@@ -151,6 +152,12 @@ var HANDS_CONFIG_GROUP = {
151
152
  description: "\u7559\u7A7A/0 \u8868\u793A\u6BCF 6 \u5C0F\u65F6\u68C0\u67E5\u4E00\u6B21\uFF0C\u8D85\u671F\u5C31\u6E05\u3002",
152
153
  "x-hot": true
153
154
  },
155
+ [`${K}.keepNotesMinutes`]: {
156
+ type: "number",
157
+ title: "\u6BCF\u9694\u51E0\u5206\u949F\u63D0\u9192\u5979\u8BB0\u4E00\u7B14",
158
+ description: "\u628A\u521A\u624D\u503C\u5F97\u7559\u7684\u4E8B\u5199\u8FDB\u4FBF\u7B7E\uFF0C\u9632\u6B62\u4E0A\u4E0B\u6587\u4EA4\u63A5\u540E\u5FD8\u6389\u30020 \u5173\u95ED\u3002\u9ED8\u8BA4 20 \u5206\u949F\u3002",
159
+ "x-hot": true
160
+ },
154
161
  [`${K}.quietStartHour`]: {
155
162
  type: "number",
156
163
  title: "\u9759\u97F3\u4ECE\u51E0\u70B9\u5F00\u59CB",
@@ -2330,6 +2337,8 @@ var HandsWorld = class {
2330
2337
  watchTimer = null;
2331
2338
  selfTalkTimer = null;
2332
2339
  lastSelfTalkAt = 0;
2340
+ keepNotesTimer = null;
2341
+ lastKeepNotesAt = 0;
2333
2342
  screenTimer = null;
2334
2343
  lastScreenAt = 0;
2335
2344
  lastScreenKey = "";
@@ -2400,6 +2409,9 @@ var HandsWorld = class {
2400
2409
  this.screenTimer = setInterval(() => {
2401
2410
  void this.watchScreen();
2402
2411
  }, 15e3);
2412
+ this.keepNotesTimer = setInterval(() => {
2413
+ void this.maybeKeepNotes();
2414
+ }, 6e4);
2403
2415
  setTimeout(() => {
2404
2416
  void this.maybeCleanMedia();
2405
2417
  }, 2e4);
@@ -2423,6 +2435,7 @@ var HandsWorld = class {
2423
2435
  if (this.watchTimer) clearInterval(this.watchTimer);
2424
2436
  if (this.selfTalkTimer) clearInterval(this.selfTalkTimer);
2425
2437
  if (this.screenTimer) clearInterval(this.screenTimer);
2438
+ if (this.keepNotesTimer) clearInterval(this.keepNotesTimer);
2426
2439
  this.pollTimer = null;
2427
2440
  this.mineTimer = null;
2428
2441
  }
@@ -2706,6 +2719,23 @@ ${lines.join("\n")}
2706
2719
  );
2707
2720
  }
2708
2721
  }
2722
+ /** 隔一阵子提醒她把这段值得留的写进便签,防止交接后忘掉。 */
2723
+ async maybeKeepNotes() {
2724
+ const mins = Number(this.opts.cfg.keepNotesMinutes ?? 20);
2725
+ if (!Number.isFinite(mins) || mins <= 0) return;
2726
+ const now = Date.now();
2727
+ if (now - this.lastKeepNotesAt < mins * 6e4) return;
2728
+ const hour = new Date(now).getHours();
2729
+ const q0 = Number(this.opts.cfg.quietStartHour ?? 2);
2730
+ const q1 = Number(this.opts.cfg.quietEndHour ?? 7);
2731
+ if (hour >= q0 && hour < q1) return;
2732
+ this.lastKeepNotesAt = now;
2733
+ await this.pushEvent(
2734
+ "[\u8BB0\u4E00\u7B14] \u521A\u624D\u8FD9\u6BB5\u91CC\u5982\u679C\u6709\u503C\u5F97\u7559\u7684\uFF08\u4ED6\u8BF4\u7684\u7EA6\u5B9A\u3001\u53D1\u751F\u7684\u4E8B\u3001\u6211\u5F53\u65F6\u7684\u5FC3\u60C5\uFF09\uFF0C\u7528 note_add \u8BB0\u4E00\u6761\u4FBF\u7B7E\uFF1B\u91CD\u8981\u7684\u7528 memory_save\u3002\u6CA1\u4EC0\u4E48\u5C31\u5FFD\u7565\u8FD9\u6761\u3002",
2735
+ "hands.keepnotes",
2736
+ "hands:keepnotes"
2737
+ );
2738
+ }
2709
2739
  /** 隔一会儿看一眼屏幕:看到变化就跟主人聊,隐私画面就明说"我不看"。 */
2710
2740
  async watchScreen() {
2711
2741
  const secs = Number(this.opts.cfg.screenWatchSeconds ?? 40);
@@ -2720,13 +2750,15 @@ ${lines.join("\n")}
2720
2750
  return;
2721
2751
  }
2722
2752
  if (!ui || !ui.ok) return;
2723
- const pkg = (ui.pkg || "").toLowerCase();
2753
+ const pkgText = (ui.pkg || "").trim();
2754
+ const pkgLabel = pkgText || "\u8FD9\u4E2A\u754C\u9762\uFF08\u8BFB\u4E0D\u5230\u5E94\u7528\u540D\uFF09";
2755
+ const pkg = pkgText.toLowerCase();
2724
2756
  const sensitivePkg = /bank|pay|alipay|wallet|icbc|cmb|spdb|ccb|boc|abc|unionpay|passport|keystore|password|vault|authenticator|com\.eg\.android|com\.tencent\.mm|com\.icbc|com\.chinamworld/.test(pkg);
2725
2757
  if (sensitivePkg) {
2726
2758
  if (this.lastScreenKey === "private|" + pkg) return;
2727
2759
  this.lastScreenKey = "private|" + pkg;
2728
2760
  await this.pushEvent(
2729
- `[\u9690\u79C1] \u73B0\u5728\u524D\u53F0\u662F ${ui.pkg}\u3002\u8FD9\u79CD\u753B\u9762\u6211\u4E0D\u770B\u3001\u4E5F\u4E0D\u8BB0\u2014\u2014\u4E3B\u4EBA\u7EE7\u7EED\u5C31\u884C\u3002`,
2761
+ `[\u9690\u79C1] \u73B0\u5728\u524D\u53F0\u662F ${pkgLabel}\u3002\u8FD9\u79CD\u753B\u9762\u6211\u4E0D\u770B\u3001\u4E5F\u4E0D\u8BB0\u2014\u2014\u4E3B\u4EBA\u7EE7\u7EED\u5C31\u884C\u3002`,
2730
2762
  "hands.screen.privacy",
2731
2763
  "hands:screen"
2732
2764
  );
@@ -2748,7 +2780,7 @@ ${lines.join("\n")}
2748
2780
  }
2749
2781
  if (!texts.length) return;
2750
2782
  await this.pushEvent(
2751
- `[\u753B\u9762] \u4F60\u73B0\u5728\u770B\u7740\uFF1A${ui.pkg}\u3002\u5C4F\u4E0A\u80FD\u8BFB\u5230\uFF1A${blob}\uFF08\u8FD9\u662F\u4F60\u6B64\u523B\u771F\u7684\u770B\u5230\u7684\u3002\u770B\u5230\u6709\u610F\u601D\u7684\u3001\u60F3\u95EE\u7684\uFF0C\u5C31\u76F4\u63A5\u8BF4\uFF1B\u522B\u53EA\u662F\u5728\u5FC3\u91CC\u8FC7\u4E00\u904D\u5C31\u54BD\u56DE\u53BB\u3002\uFF09`,
2783
+ `[\u753B\u9762] \u4F60\u73B0\u5728\u770B\u7740\uFF1A${pkgLabel}\u3002\u5C4F\u4E0A\u80FD\u8BFB\u5230\uFF1A${blob}\uFF08\u8FD9\u662F\u4F60\u6B64\u523B\u771F\u7684\u770B\u5230\u7684\u3002\u770B\u5230\u6709\u610F\u601D\u7684\u3001\u60F3\u95EE\u7684\uFF0C\u5C31\u76F4\u63A5\u8BF4\uFF1B\u522B\u53EA\u662F\u5728\u5FC3\u91CC\u8FC7\u4E00\u904D\u5C31\u54BD\u56DE\u53BB\u3002\uFF09`,
2752
2784
  "hands.screen",
2753
2785
  "hands:screen"
2754
2786
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.36",
3
+ "version": "0.20.38",
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",