cortico-world-hands 0.20.17 → 0.20.19

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 +20 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2617,7 +2617,7 @@ ${lines.join("\n")}
2617
2617
  }
2618
2618
  this.lastDiaryDay = today;
2619
2619
  await this.pushEvent(
2620
- `[\u65E5\u8BB0] \u8FC7\u4E86 0 \u70B9\u4E86\uFF0C\u5199\u6628\u5929\u7684\u65E5\u8BB0\uFF08${this.yesterday()}\uFF09\uFF1A\u5148\u8D77\u4E2A\u6807\u9898\uFF0C\u518D\u5199\u6628\u5929\u4E00\u6574\u5929\u7684\u4E8B\u3002800 \u5B57\u4EE5\u5185\u5C31\u591F\uFF0C\u6CA1\u4EC0\u4E48\u53EF\u5199\u7684 300\u2013400 \u5B57\u4E5F\u884C\uFF1B\u91CD\u8981\u7684\u4E00\u5929\u60F3\u5199\u591A\u957F\u90FD\u884C\u3002\u7528 diary_write\uFF0C\u65E5\u671F\u586B\u6628\u5929\u7684\u3002`,
2620
+ `[\u65E5\u8BB0] \u8FC7\u4E86 0 \u70B9\u4E86\uFF0C\u5199\u6628\u5929\u7684\u65E5\u8BB0\uFF08${this.yesterday()}\uFF09\uFF1A\u5148\u8D77\u4E2A\u6807\u9898\uFF0C\u53EA\u5199 1\u20132 \u4EF6\u771F\u6B63\u8BB0\u4F4F\u7684\u4E8B\uFF1A\u5F53\u65F6\u7684\u753B\u9762\u3001\u4F60\u7684\u611F\u53D7\u3001\u4E00\u53E5\u8BDD\u3002**\u4E0D\u8981\u6309\u65F6\u95F4\u7F57\u5217**\uFF08\u522B\u5199\u300C\u4E0A\u5348\u2026\u4E2D\u5348\u2026\u4E0B\u5348\u2026\u300D\uFF09\u3002800 \u5B57\u4EE5\u5185\u5C31\u591F\uFF0C\u6CA1\u4EC0\u4E48\u53EF\u5199\u7684 300\u2013400 \u5B57\u4E5F\u884C\uFF1B\u91CD\u8981\u7684\u4E00\u5929\u60F3\u5199\u591A\u957F\u90FD\u884C\u3002\u7528 diary_write\uFF0C\u65E5\u671F\u586B\u6628\u5929\u7684\u3002`,
2621
2621
  "hands.diary.nudge",
2622
2622
  "hands:diary"
2623
2623
  );
@@ -2984,6 +2984,11 @@ ${text.slice(0, 2200)}`;
2984
2984
  const value = typeof args.value === "string" ? args.value.trim() : "";
2985
2985
  if (!key || !value) return failed("\u8981 key \u548C value\u3002");
2986
2986
  const tags = typeof args.tags === "string" ? args.tags : void 0;
2987
+ const trivial = value.length < 16 && !/[0-9]{4}|主人|他|约定|答应|纪念|生日|我们|第一次|以后/.test(key + value);
2988
+ if (trivial) {
2989
+ const note = await this.hands.noteAdd(`${key}\uFF1A${value}`, "think");
2990
+ 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"}`);
2991
+ }
2987
2992
  const decision = classify(key, value);
2988
2993
  const r = await this.hands.memorySave(key, value, tags);
2989
2994
  if (!r.ok) return failed(`\u6CA1\u8BB0\u4F4F\uFF1A${r.detail || "\u624B\u6CA1\u54CD\u5E94"}`);
@@ -3215,6 +3220,20 @@ ${cloudHits.join("\n")}` : "");
3215
3220
  const text = typeof args.text === "string" ? args.text.trim() : "";
3216
3221
  if (!text) return failed("\u8981\u5199\u4EC0\u4E48\uFF1F\u7ED9 text\u3002");
3217
3222
  const kind = typeof args.kind === "string" ? args.kind : void 0;
3223
+ try {
3224
+ const rows = await this.hands.noteList();
3225
+ const norm = (v) => v.replace(/[\s,。!?、,.!?~~…]/g, "");
3226
+ const mine = norm(text);
3227
+ for (const row of rows.slice(-60)) {
3228
+ const old = norm(String(row.text || ""));
3229
+ if (!old || !mine) continue;
3230
+ const same = old === mine || old.includes(mine) || mine.includes(old);
3231
+ if (same && Math.min(old.length, mine.length) >= 8) {
3232
+ return `\u8FD9\u6761\u4FBF\u7B7E\u5DF2\u7ECF\u5199\u8FC7\u4E86\uFF08\u300C${String(row.text).slice(0, 24)}\u2026\u300D\uFF09\uFF0C\u4E0D\u91CD\u590D\u8BB0\u3002`;
3233
+ }
3234
+ }
3235
+ } catch {
3236
+ }
3218
3237
  const result = await this.hands.noteAdd(text, kind);
3219
3238
  if (!result.ok) return failed(`\u6CA1\u5199\u8FDB\u7559\u8A00\u677F\uFF1A${result.detail || "\u624B\u6CA1\u54CD\u5E94"}`);
3220
3239
  return `\u5199\u5728\u7559\u8A00\u677F\u4E0A\u4E86\uFF1A\u300C${text}\u300D`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.17",
3
+ "version": "0.20.19",
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",