cortico-world-hands 0.20.20 → 0.20.22
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.
- package/dist/index.js +60 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1090,6 +1090,29 @@ var describeCommand = (command) => {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
};
|
|
1092
1092
|
var Hands = class {
|
|
1093
|
+
/** 「我们的日子」:新增一条。 */
|
|
1094
|
+
async dayAdd(date, title, note, kind) {
|
|
1095
|
+
const t = this.readToken() ? `&t=${encodeURIComponent(this.readToken())}` : "";
|
|
1096
|
+
const path = `/hand/day/add?date=${encodeURIComponent(date)}&title=${encodeURIComponent(title)}` + (note ? `¬e=${encodeURIComponent(note)}` : "") + (kind ? `&kind=${encodeURIComponent(kind)}` : "") + t;
|
|
1097
|
+
const res = await get(this.handPort(), path, ACTION_TIMEOUT_MS);
|
|
1098
|
+
let body = {};
|
|
1099
|
+
try {
|
|
1100
|
+
body = JSON.parse(res.body.toString("utf8"));
|
|
1101
|
+
} catch {
|
|
1102
|
+
}
|
|
1103
|
+
return { ok: res.status === 200 && body.ok !== false, detail: flat(body.detail || body.error || "", 80) };
|
|
1104
|
+
}
|
|
1105
|
+
/** 「我们的日子」:列全部。 */
|
|
1106
|
+
async dayList() {
|
|
1107
|
+
const t = this.readToken() ? `?t=${encodeURIComponent(this.readToken())}` : "";
|
|
1108
|
+
const res = await get(this.handPort(), `/hand/days${t}`, ACTION_TIMEOUT_MS);
|
|
1109
|
+
try {
|
|
1110
|
+
const body = JSON.parse(res.body.toString("utf8"));
|
|
1111
|
+
return body.days ?? [];
|
|
1112
|
+
} catch {
|
|
1113
|
+
return [];
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1093
1116
|
/** 读屏幕上的字(转发给眼睛客户端)。 */
|
|
1094
1117
|
async uiSnapshot() {
|
|
1095
1118
|
return this.eyes.ui();
|
|
@@ -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);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-hands",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.22",
|
|
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",
|