cortico-world-hands 0.1.3 → 0.1.4
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 +26 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -671,10 +671,11 @@ var Hands = class {
|
|
|
671
671
|
return this.perform({ kind: "drag", x1: a, y1: b, x2: c, y2: d, ms });
|
|
672
672
|
}
|
|
673
673
|
/** 留言板:写一条。 */
|
|
674
|
-
async noteAdd(text) {
|
|
674
|
+
async noteAdd(text, kind) {
|
|
675
675
|
const cfg = this.cfg();
|
|
676
676
|
const token = cfg.handToken ? `&t=${encodeURIComponent(cfg.handToken)}` : "";
|
|
677
|
-
const
|
|
677
|
+
const k = kind ? `&kind=${encodeURIComponent(kind)}` : "";
|
|
678
|
+
const path = `/hand/note?text=${encodeURIComponent(text)}${k}${token}`;
|
|
678
679
|
const res = await get(this.port(cfg.handPort), path, ACTION_TIMEOUT_MS);
|
|
679
680
|
let body = {};
|
|
680
681
|
try {
|
|
@@ -954,7 +955,12 @@ var HANDS_TOOL_DECLS = [
|
|
|
954
955
|
parameters: {
|
|
955
956
|
type: "object",
|
|
956
957
|
properties: {
|
|
957
|
-
text: { type: "string", description: "\u8981\u5199\u4E0B\u7684\u5185\u5BB9\u3002" }
|
|
958
|
+
text: { type: "string", description: "\u8981\u5199\u4E0B\u7684\u5185\u5BB9\u3002" },
|
|
959
|
+
kind: {
|
|
960
|
+
type: "string",
|
|
961
|
+
enum: ["todo", "say", "think"],
|
|
962
|
+
description: "\u5206\u7C7B\uFF1Atodo=\u5F85\u529E\uFF08\u8981\u505A\u7684\u4E8B\uFF0C\u4F1A\u88AB\u6BCF\u5929\u63D0\u9192\uFF09\u3001say=\u60F3\u5BF9\u4E3B\u4EBA\u8BF4\u7684\u8BDD\u3001think=\u788E\u788E\u5FF5\u3002\u9ED8\u8BA4 todo\u3002"
|
|
963
|
+
}
|
|
958
964
|
},
|
|
959
965
|
required: ["text"]
|
|
960
966
|
}
|
|
@@ -963,7 +969,13 @@ var HANDS_TOOL_DECLS = [
|
|
|
963
969
|
name: "note_list",
|
|
964
970
|
tags: ["read"],
|
|
965
971
|
description: "\u770B\u7559\u8A00\u677F\uFF1A\u6709\u54EA\u4E9B\u6CA1\u5212\u6389\u7684\u3001\u90FD\u5199\u4E86\u4EC0\u4E48\u3002\u5BF9\u65B9\u95EE\u300C\u4F60\u8BB0\u4E86\u4EC0\u4E48\u300D\u300C\u7559\u8A00\u677F\u4E0A\u6709\u5565\u300D\u65F6\u7528\u5B83\u3002",
|
|
966
|
-
parameters: {
|
|
972
|
+
parameters: {
|
|
973
|
+
type: "object",
|
|
974
|
+
properties: {
|
|
975
|
+
kind: { type: "string", enum: ["todo", "say", "think"], description: "\u53EA\u770B\u67D0\u4E00\u7C7B\uFF08\u53EF\u7701\u7565\uFF09\u3002" }
|
|
976
|
+
},
|
|
977
|
+
required: []
|
|
978
|
+
}
|
|
967
979
|
},
|
|
968
980
|
{
|
|
969
981
|
name: "note_done",
|
|
@@ -1066,7 +1078,7 @@ var HandsWorld = class {
|
|
|
1066
1078
|
case "note_add":
|
|
1067
1079
|
return await this.noteAdd(args);
|
|
1068
1080
|
case "note_list":
|
|
1069
|
-
return await this.noteList();
|
|
1081
|
+
return await this.noteList(args);
|
|
1070
1082
|
case "note_done":
|
|
1071
1083
|
return await this.noteDone(args);
|
|
1072
1084
|
case "hand_stop":
|
|
@@ -1102,15 +1114,19 @@ var HandsWorld = class {
|
|
|
1102
1114
|
async noteAdd(args) {
|
|
1103
1115
|
const text = typeof args.text === "string" ? args.text.trim() : "";
|
|
1104
1116
|
if (!text) return failed("\u8981\u5199\u4EC0\u4E48\uFF1F\u7ED9 text\u3002");
|
|
1105
|
-
const
|
|
1117
|
+
const kind = typeof args.kind === "string" ? args.kind : void 0;
|
|
1118
|
+
const result = await this.hands.noteAdd(text, kind);
|
|
1106
1119
|
if (!result.ok) return failed(`\u6CA1\u5199\u8FDB\u7559\u8A00\u677F\uFF1A${result.detail || "\u624B\u6CA1\u54CD\u5E94"}`);
|
|
1107
1120
|
return `\u5199\u5728\u7559\u8A00\u677F\u4E0A\u4E86\uFF1A\u300C${text}\u300D`;
|
|
1108
1121
|
}
|
|
1109
|
-
async noteList() {
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1122
|
+
async noteList(args = {}) {
|
|
1123
|
+
const all = await this.hands.noteList();
|
|
1124
|
+
const kind = typeof args.kind === "string" ? args.kind : "";
|
|
1125
|
+
const notes = kind ? all.filter((n) => (n.kind || "todo") === kind) : all;
|
|
1126
|
+
if (notes.length === 0) return "\u7559\u8A00\u677F\u662F\u7A7A\u7684\uFF1B\u8981\u4E0D\u518D\u8BB0\u70B9\u4EC0\u4E48\u3002";
|
|
1112
1127
|
const open = notes.filter((n) => !n.done);
|
|
1113
|
-
const
|
|
1128
|
+
const label = (k) => k === "say" ? "\u60F3\u8BF4\u7684" : k === "think" ? "\u788E\u788E\u5FF5" : "\u5F85\u529E";
|
|
1129
|
+
const lines = open.map((n) => `- [${n.id}] ${label(n.kind || "todo")} ${n.ts} ${n.text}`).join("\n");
|
|
1114
1130
|
return `\u7559\u8A00\u677F\u4E0A\u6709 ${notes.length} \u6761\uFF0C\u672A\u5B8C ${open.length} \u6761\uFF1A
|
|
1115
1131
|
${lines || "\uFF08\u90FD\u5212\u6389\u4E86\uFF09"}`;
|
|
1116
1132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-hands",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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",
|