cortico-world-hands 0.20.18 → 0.20.20

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 +18 -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,9 @@ ${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
+ if (/人格|我是谁|人设|设定原文/.test(key)) {
2988
+ return "\u8FD9\u4E2A\u4E0D\u7528\u8BB0\u2014\u2014\u4EBA\u683C\uFF08\u6211\u662F\u8C01\u3001\u6027\u683C\u3001\u8BF4\u8BDD\u65B9\u5F0F\uFF09\u672C\u6765\u5C31\u5728\u6211\u7684\u63D0\u793A\u8BCD\u91CC\uFF0C\u6539\u4E86\u4F1A\u7ACB\u523B\u751F\u6548\uFF1B\u8BB0\u5FC6\u5E93\u53EA\u653E\u4EBA\u548C\u4E8B\u3002";
2989
+ }
2987
2990
  const trivial = value.length < 16 && !/[0-9]{4}|主人|他|约定|答应|纪念|生日|我们|第一次|以后/.test(key + value);
2988
2991
  if (trivial) {
2989
2992
  const note = await this.hands.noteAdd(`${key}\uFF1A${value}`, "think");
@@ -3220,6 +3223,20 @@ ${cloudHits.join("\n")}` : "");
3220
3223
  const text = typeof args.text === "string" ? args.text.trim() : "";
3221
3224
  if (!text) return failed("\u8981\u5199\u4EC0\u4E48\uFF1F\u7ED9 text\u3002");
3222
3225
  const kind = typeof args.kind === "string" ? args.kind : void 0;
3226
+ try {
3227
+ const rows = await this.hands.noteList();
3228
+ const norm = (v) => v.replace(/[\s,。!?、,.!?~~…]/g, "");
3229
+ const mine = norm(text);
3230
+ for (const row of rows.slice(-60)) {
3231
+ const old = norm(String(row.text || ""));
3232
+ if (!old || !mine) continue;
3233
+ const same = old === mine || old.includes(mine) || mine.includes(old);
3234
+ if (same && Math.min(old.length, mine.length) >= 8) {
3235
+ 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`;
3236
+ }
3237
+ }
3238
+ } catch {
3239
+ }
3223
3240
  const result = await this.hands.noteAdd(text, kind);
3224
3241
  if (!result.ok) return failed(`\u6CA1\u5199\u8FDB\u7559\u8A00\u677F\uFF1A${result.detail || "\u624B\u6CA1\u54CD\u5E94"}`);
3225
3242
  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.18",
3
+ "version": "0.20.20",
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",