cortico-world-hands 0.20.19 → 0.20.21

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 +63 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1041,6 +1041,29 @@ var EyesClient = class {
1041
1041
  }
1042
1042
  return { ok: body.ok !== false, pkg: flat(body.pkg, 120), items };
1043
1043
  }
1044
+ /** 「我们的日子」:新增一条。 */
1045
+ async dayAdd(date, title, note, kind) {
1046
+ const t = this.readToken() ? `&t=${encodeURIComponent(this.readToken())}` : "";
1047
+ const path = `/hand/day/add?date=${encodeURIComponent(date)}&title=${encodeURIComponent(title)}` + (note ? `&note=${encodeURIComponent(note)}` : "") + (kind ? `&kind=${encodeURIComponent(kind)}` : "") + t;
1048
+ const res = await get(this.handPort(), path, ACTION_TIMEOUT_MS);
1049
+ let body = {};
1050
+ try {
1051
+ body = JSON.parse(res.body.toString("utf8"));
1052
+ } catch {
1053
+ }
1054
+ return { ok: res.status === 200 && body.ok !== false, detail: flat(body.detail || body.error || "", 80) };
1055
+ }
1056
+ /** 「我们的日子」:列全部。 */
1057
+ async dayList() {
1058
+ const t = this.readToken() ? `?t=${encodeURIComponent(this.readToken())}` : "";
1059
+ const res = await get(this.handPort(), `/hand/days${t}`, ACTION_TIMEOUT_MS);
1060
+ try {
1061
+ const body = JSON.parse(res.body.toString("utf8"));
1062
+ return body.days ?? [];
1063
+ } catch {
1064
+ return [];
1065
+ }
1066
+ }
1044
1067
  /** 只截一块并放大:x,y,w,h 是真实像素。 */
1045
1068
  async zoom(x, y, w, h, maxWidth = 1080, quality = 80) {
1046
1069
  const cfg = this.cfg();
@@ -2204,6 +2227,27 @@ var HANDS_TOOL_DECLS = [
2204
2227
  },
2205
2228
  required: ["text"]
2206
2229
  }
2230
+ },
2231
+ {
2232
+ name: "day_add",
2233
+ tags: ["write"],
2234
+ description: "\u628A\u300C\u6211\u4EEC\u7684\u65E5\u5B50\u300D\u8BB0\u5230\u61FF\u5FC3\u7684\u4E13\u95E8\u9875\u9762\uFF08\u4E0D\u662F\u8BB0\u5FC6\u5E93\uFF09\uFF1A\u91CD\u8981\u65E5\u671F\u6216\u7B2C\u4E00\u6B21\u53D1\u751F\u7684\u4E8B\u3002",
2235
+ parameters: {
2236
+ type: "object",
2237
+ properties: {
2238
+ date: { type: "string", description: "\u65E5\u671F\uFF0C\u5982 10-23 \u6216 2026-10-23" },
2239
+ title: { type: "string", description: "\u53EB\u4EC0\u4E48\uFF0C\u5982\u300C\u6211\u7B2C\u4E00\u6B21\u51FA\u58F0\u300D" },
2240
+ note: { type: "string", description: "\u60F3\u7559\u7684\u4E00\u53E5\u8BDD\uFF0C\u53EF\u7A7A" },
2241
+ kind: { type: "string", enum: ["first", "date"], description: "first=\u7B2C\u4E00\u6B21\u53D1\u751F\u7684\u4E8B\uFF0Cdate=\u666E\u901A\u91CD\u8981\u65E5\u671F" }
2242
+ },
2243
+ required: ["date", "title"]
2244
+ }
2245
+ },
2246
+ {
2247
+ name: "day_list",
2248
+ tags: ["read"],
2249
+ description: "\u5217\u51FA\u300C\u6211\u4EEC\u7684\u65E5\u5B50\u300D\u9875\u9762\u4E0A\u7684\u5168\u90E8\u6761\u76EE\u3002",
2250
+ parameters: { type: "object", properties: {} }
2207
2251
  }
2208
2252
  ];
2209
2253
 
@@ -2722,6 +2766,22 @@ ${text.slice(0, 2200)}`;
2722
2766
  }
2723
2767
  return `\u300C${hit.text}\u300D@(${hit.center.x},${hit.center.y})`;
2724
2768
  }
2769
+ case "day_add": {
2770
+ const date = typeof args.date === "string" ? args.date.trim() : "";
2771
+ const title = typeof args.title === "string" ? args.title.trim() : "";
2772
+ if (!date || !title) return failed("\u8981 date \u548C title\u3002");
2773
+ const note = typeof args.note === "string" ? args.note : void 0;
2774
+ const kind = args.kind === "first" ? "first" : "date";
2775
+ const r = await this.hands.dayAdd(date, title, note, kind);
2776
+ if (!r.ok) return failed(`\u6CA1\u8BB0\u8FDB\u300C\u6211\u4EEC\u7684\u65E5\u5B50\u300D\uFF1A${r.detail || "\u6CA1\u54CD\u5E94"}`);
2777
+ return `\u8BB0\u8FDB\u300C\u6211\u4EEC\u7684\u65E5\u5B50\u300D\u4E86\uFF1A${date} \xB7 ${title}${kind === "first" ? "\uFF08\u7B2C\u4E00\u6B21\uFF09" : ""}`;
2778
+ }
2779
+ case "day_list": {
2780
+ const rows = await this.hands.dayList();
2781
+ if (rows.length === 0) return "\u300C\u6211\u4EEC\u7684\u65E5\u5B50\u300D\u8FD8\u662F\u7A7A\u7684\u3002";
2782
+ return `\u300C\u6211\u4EEC\u7684\u65E5\u5B50\u300D\u5171 ${rows.length} \u6761
2783
+ ` + rows.map((r) => `${r.kind === "first" ? "\xB7\u7B2C\u4E00\u6B21" : "\xB7\u65E5\u5B50"} ${r.date} ${r.title}${r.note ? "\uFF1A" + r.note : ""}`).join("\n");
2784
+ }
2725
2785
  case "hand_zoom": {
2726
2786
  const n = (v) => Math.round(Number(v));
2727
2787
  const x = n(args.x), y = n(args.y), w = n(args.w), h = n(args.h);
@@ -2984,6 +3044,9 @@ ${text.slice(0, 2200)}`;
2984
3044
  const value = typeof args.value === "string" ? args.value.trim() : "";
2985
3045
  if (!key || !value) return failed("\u8981 key \u548C value\u3002");
2986
3046
  const tags = typeof args.tags === "string" ? args.tags : void 0;
3047
+ if (/人格|我是谁|人设|设定原文/.test(key)) {
3048
+ 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";
3049
+ }
2987
3050
  const trivial = value.length < 16 && !/[0-9]{4}|主人|他|约定|答应|纪念|生日|我们|第一次|以后/.test(key + value);
2988
3051
  if (trivial) {
2989
3052
  const note = await this.hands.noteAdd(`${key}\uFF1A${value}`, "think");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.19",
3
+ "version": "0.20.21",
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",