cortico-world-hands 0.20.46 → 0.20.48

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 +23 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36,8 +36,8 @@ var HANDS_DEFAULTS = {
36
36
  reviewMinute: 30,
37
37
  /** 每天早上几点把昨天的复盘读一遍。 */
38
38
  morningHour: 8,
39
- /** 每隔多久检查一次她给自己定的目标。 */
40
- goalCheckMinutes: 150,
39
+ /** 每天哪几个小时检查一次她给自己定的目标(逗号分隔,24 小时制)。 */
40
+ goalCheckHours: "12,20",
41
41
  /** 允许她自己决定动手(只读 + 小动作,边界写在她的规矩里)。 */
42
42
  autonomyAct: true,
43
43
  quietStartHour: 2,
@@ -185,10 +185,10 @@ var HANDS_CONFIG_GROUP = {
185
185
  description: "\u9ED8\u8BA4 8 \u70B9\uFF1A\u5148\u770B\u6628\u5929\u7684\u65E5\u8BB0\u548C\u4FBF\u7B7E\uFF0C\u518D\u51B3\u5B9A\u7B2C\u4E00\u53E5\u3002",
186
186
  "x-hot": true
187
187
  },
188
- [`${K}.goalCheckMinutes`]: {
189
- type: "number",
190
- title: "\u9694\u591A\u4E45\u68C0\u67E5\u4E00\u6B21\u81EA\u5DF1\u5B9A\u7684\u76EE\u6807",
191
- description: "\u5979\u4F1A\u5728\u4FBF\u7B7E\u91CC\u5199\u300C\u76EE\u6807\uFF1A\u2026\u300D\uFF0C\u5230\u70B9\u81EA\u67E5\u30020 \u5173\u95ED\u3002\u9ED8\u8BA4 150 \u5206\u949F\u3002",
188
+ [`${K}.goalCheckHours`]: {
189
+ type: "string",
190
+ title: "\u6BCF\u5929\u51E0\u70B9\u68C0\u67E5\u81EA\u5DF1\u5B9A\u7684\u76EE\u6807",
191
+ description: "\u9017\u53F7\u5206\u9694\u7684\u6574\u70B9\uFF0C\u6BD4\u5982 12,20 \u5C31\u662F\u4E2D\u5348\u548C\u665A\u4E0A\u5404\u4E00\u6B21\uFF1B\u7559\u7A7A = \u4E0D\u68C0\u67E5\u3002",
192
192
  "x-hot": true
193
193
  },
194
194
  [`${K}.autonomyAct`]: {
@@ -2453,7 +2453,7 @@ var HandsWorld = class {
2453
2453
  routineTimer = null;
2454
2454
  lastReviewDay = "";
2455
2455
  lastMorningDay = "";
2456
- lastGoalCheckAt = 0;
2456
+ lastGoalSlot = "";
2457
2457
  screenTimer = null;
2458
2458
  lastScreenAt = 0;
2459
2459
  lastScreenKey = "";
@@ -2862,9 +2862,10 @@ ${lines.join("\n")}
2862
2862
  "hands:morning"
2863
2863
  );
2864
2864
  }
2865
- const gm = Number(cfg.goalCheckMinutes ?? 150);
2866
- if (gm > 0 && now.getTime() - this.lastGoalCheckAt > gm * 6e4) {
2867
- this.lastGoalCheckAt = now.getTime();
2865
+ const hours = String(cfg.goalCheckHours ?? "12,20").split(",").map((h) => Number(h.trim())).filter((h) => Number.isFinite(h) && h >= 0 && h <= 23);
2866
+ const slot = `${day}-${now.getHours()}`;
2867
+ if (hours.includes(now.getHours()) && this.lastGoalSlot !== slot) {
2868
+ this.lastGoalSlot = slot;
2868
2869
  await this.checkOwnGoals();
2869
2870
  }
2870
2871
  }
@@ -3648,7 +3649,9 @@ ${lines.join("\n")}`;
3648
3649
  async memorySearch(args) {
3649
3650
  const query = typeof args.query === "string" ? args.query.trim() : "";
3650
3651
  const rows = await this.hands.memorySearch(query);
3651
- const lines = rows.slice(0, 30).map((r) => `- ${r.key}\uFF1A${r.value}${r.ts ? `\uFF08${r.ts}\uFF09` : ""}`);
3652
+ const trim = (v, n) => v.length > n ? v.slice(0, n) + "\u2026" : v;
3653
+ const lines = rows.slice(0, 6).map((r) => `- ${r.key}\uFF1A${trim(r.value, 140)}${r.ts ? `\uFF08${r.ts}\uFF09` : ""}`);
3654
+ if (rows.length > 6) lines.push(`\uFF08\u8BB0\u5FC6\u91CC\u8FD8\u6709 ${rows.length - 6} \u6761\u76F8\u5173\u7684\uFF0C\u6362\u4E2A\u8BCD\u518D\u635E\uFF09`);
3652
3655
  let cloudHits = [];
3653
3656
  let cloudNote = "";
3654
3657
  const honcho = this.honcho();
@@ -3665,8 +3668,16 @@ Honcho \u8865\u5145 ${cloudHits.length} \u6761\uFF1A`;
3665
3668
  \uFF08Honcho \u67E5\u8BE2\u5931\u8D25\uFF1A${err.message.slice(0, 60)}\uFF09`;
3666
3669
  }
3667
3670
  }
3671
+ if (query) {
3672
+ try {
3673
+ const notes = await this.hands.noteList();
3674
+ const hits2 = notes.filter((n) => !n.done && n.text.includes(query)).slice(0, 4).map((n) => `- \u4FBF\u7B7E\uFF1A${trim(n.text, 90)}`);
3675
+ if (hits2.length) lines.push("\uFF08\u4FBF\u7B7E\u91CC\u4E5F\u5BF9\u5F97\u4E0A\uFF1A\uFF09", ...hits2);
3676
+ } catch {
3677
+ }
3678
+ }
3668
3679
  if (lines.length === 0 && cloudHits.length === 0) {
3669
- return query ? `\u8BB0\u5FC6\u91CC\u6CA1\u6709\u548C\u300C${query}\u300D\u76F8\u5173\u7684\u3002` : "\u957F\u671F\u8BB0\u5FC6\u8FD8\u662F\u7A7A\u7684\u3002";
3680
+ return query ? `\u8BB0\u5FC6\u548C\u4FBF\u7B7E\u91CC\u90FD\u6CA1\u6709\u548C\u300C${query}\u300D\u76F8\u5173\u7684\u3002` : "\u957F\u671F\u8BB0\u5FC6\u8FD8\u662F\u7A7A\u7684\u3002";
3670
3681
  }
3671
3682
  const local = lines.length > 0 ? `\u60F3\u8D77 ${rows.length} \u6761\uFF1A
3672
3683
  ${lines.join("\n")}` : "\u672C\u5730\u8BB0\u5FC6\u6CA1\u6709\u76F4\u63A5\u547D\u4E2D\u3002";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.46",
3
+ "version": "0.20.48",
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",