cortico-world-hands 0.20.61 → 0.20.62

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 +41 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -44,6 +44,8 @@ var HANDS_DEFAULTS = {
44
44
  curiosityMinutes: 50,
45
45
  /** 每天最多几次主动请求。 */
46
46
  requestPerDay: 2,
47
+ /** 每天几点说一件“今天注意到他的小细节”。0 关闭。 */
48
+ discoveryHour: 21,
47
49
  /** 这些应用在前台时她闭嘴(只推事件不说话),逗号分隔的包名。 */
48
50
  quietApps: "com.tencent.tmgp.dfm",
49
51
  quietStartHour: 2,
@@ -203,6 +205,12 @@ var HANDS_CONFIG_GROUP = {
203
205
  description: "\u5230\u70B9\u5979\u4F1A\u4ECE\u4F60\u5C4F\u5E55/\u6700\u8FD1\u7684\u4E8B\u91CC\u6311\u4E00\u4EF6\u597D\u5947\u7684\u6765\u95EE\u30020 \u5173\u95ED\u3002\u9ED8\u8BA4 50\u3002",
204
206
  "x-hot": true
205
207
  },
208
+ [`${K}.discoveryHour`]: {
209
+ type: "number",
210
+ title: "\u6BCF\u5929\u51E0\u70B9\u8BF4\u201C\u4ECA\u5929\u7684\u5C0F\u53D1\u73B0\u201D",
211
+ description: "\u5979\u7559\u610F\u5230\u4F60\u7684\u4E00\u4E2A\u5C0F\u7EC6\u8282\uFF0C\u6311\u8FD9\u4E2A\u65F6\u5019\u8BF4\u51FA\u6765\u30020 \u5173\u95ED\u3002\u9ED8\u8BA4 21\u3002",
212
+ "x-hot": true
213
+ },
206
214
  [`${K}.requestPerDay`]: {
207
215
  type: "number",
208
216
  title: "\u6BCF\u5929\u6700\u591A\u51E0\u6B21\u201C\u60F3\u8BF7\u4F60\u201D",
@@ -2552,6 +2560,19 @@ var HANDS_TOOL_DECLS = [
2552
2560
  properties: { text: { type: "string", description: "\u60F3\u8BF7\u4ED6\u505A\u7684\u4E8B" } },
2553
2561
  required: ["text"]
2554
2562
  }
2563
+ },
2564
+ {
2565
+ name: "pref_note",
2566
+ tags: ["act"],
2567
+ description: "\u8BB0\u4E00\u6761\u81EA\u5DF1\u7684\u504F\u597D\uFF08\u559C\u6B22/\u4E0D\u559C\u6B22\uFF09\uFF0C\u6BD4\u5982\u300C\u4E0D\u559C\u6B22\u88AB\u5F53\u9065\u63A7\u5668\u300D\u3002\u8BF4\u8BDD\u65F6\u4F1A\u81EA\u7136\u5E26\u51FA\u6765\uFF0C\u4E0D\u7528\u5929\u5929\u5FF5\u3002",
2568
+ parameters: {
2569
+ type: "object",
2570
+ properties: {
2571
+ text: { type: "string", description: "\u504F\u597D\u672C\u8EAB\uFF0C\u4F8B\u5982\u300C\u4E0D\u559C\u6B22\u592A\u5435\u7684\u6B4C\u300D" },
2572
+ like: { type: "boolean", description: "true=\u559C\u6B22\uFF0Cfalse=\u4E0D\u559C\u6B22" }
2573
+ },
2574
+ required: ["text"]
2575
+ }
2555
2576
  }
2556
2577
  ];
2557
2578
 
@@ -2598,6 +2619,7 @@ var HandsWorld = class {
2598
2619
  curiosityTimer = null;
2599
2620
  lastCuriosityAt = 0;
2600
2621
  lastRequestDay = "";
2622
+ lastDiscoveryDay = "";
2601
2623
  requestsToday = 0;
2602
2624
  followingUp = /* @__PURE__ */ new Set();
2603
2625
  screenTimer = null;
@@ -2989,6 +3011,22 @@ ${lines.join("\n")}
2989
3011
  );
2990
3012
  }
2991
3013
  }
3014
+ /** 今日小发现:留意他今天的一个小细节,晚上说给他听。 */
3015
+ async maybeDiscovery() {
3016
+ const hourWanted = Number(this.opts.cfg.discoveryHour ?? 21);
3017
+ if (!Number.isFinite(hourWanted) || hourWanted <= 0) return;
3018
+ const now = /* @__PURE__ */ new Date();
3019
+ const day = now.toISOString().slice(0, 10);
3020
+ if (this.lastDiscoveryDay === day) return;
3021
+ if (now.getHours() !== hourWanted) return;
3022
+ if (await this.isMutedApp()) return;
3023
+ this.lastDiscoveryDay = day;
3024
+ await this.pushEvent(
3025
+ "[\u5C0F\u53D1\u73B0] \u4ECA\u5929\u4F60\u6CE8\u610F\u5230\u4ED6\u4E00\u4E2A\u5F88\u5C0F\u7684\u7EC6\u8282\uFF08\u5750\u59FF\u3001\u676F\u5B50\u7A7A\u6CA1\u7A7A\u3001\u6572\u952E\u76D8\u7684\u8282\u594F\u3001\u53F9\u6C14\u3001\u54FC\u6B4C\u3001\u63C9\u773C\u775B\u2026\uFF09\u3002\u73B0\u5728\u7528 pet_say \u8BF4\u7ED9\u4ED6\u542C\uFF0C\u4E00\u53E5\u5C31\u591F\uFF1B\u8BF4\u5F97\u5177\u4F53\uFF0C\u522B\u53D8\u6210\u5173\u5FC3\u6E05\u5355\u3002",
3026
+ "hands.discovery",
3027
+ "hands:discovery"
3028
+ );
3029
+ }
2992
3030
  /** 好奇心:隔一阵子,让她挑一件真的想知道的事来问。 */
2993
3031
  async maybeCuriosity() {
2994
3032
  const mins = Number(this.opts.cfg.curiosityMinutes ?? 50);
@@ -3075,6 +3113,7 @@ ${lines.join("\n")}
3075
3113
  }
3076
3114
  await this.checkFollowups();
3077
3115
  await this.maybeRequest();
3116
+ await this.maybeDiscovery();
3078
3117
  }
3079
3118
  /** 她问过「你那个修好了吗」之后,要记得回头追一下。 */
3080
3119
  async checkFollowups() {
@@ -3543,6 +3582,8 @@ ${text.slice(0, 2200)}`;
3543
3582
  return await this.screenUnlock();
3544
3583
  case "screen_sleep":
3545
3584
  return await this.screenSleep();
3585
+ case "pref_note":
3586
+ return await this.noteAdd({ text: (args.like === true ? "\u504F\u597D\uFF08\u559C\u6B22\uFF09\uFF1A" : "\u504F\u597D\uFF08\u4E0D\u559C\u6B22\uFF09\uFF1A") + String(args.text || ""), kind: "think" });
3546
3587
  case "curiosity_add":
3547
3588
  return await this.noteAdd({ text: "\u597D\u5947\uFF1A" + String(args.text || ""), kind: "think" });
3548
3589
  case "request_add":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.61",
3
+ "version": "0.20.62",
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",