cortico-world-hands 0.20.63 → 0.20.64
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 +72 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48,6 +48,10 @@ var HANDS_DEFAULTS = {
|
|
|
48
48
|
discoveryHour: 21,
|
|
49
49
|
/** 他离开多久回来,她会招呼一句(分钟)。0 关闭。 */
|
|
50
50
|
returnGreetMinutes: 30,
|
|
51
|
+
/** 原位(屏幕宽度比例 0–1)。被拎走后她会自己走回去。 */
|
|
52
|
+
homeX: 0.06,
|
|
53
|
+
/** 隔多久回一次原位(分钟)。0 关闭。 */
|
|
54
|
+
homeReturnMinutes: 10,
|
|
51
55
|
/** 这些应用在前台时她闭嘴(只推事件不说话),逗号分隔的包名。 */
|
|
52
56
|
quietApps: "com.tencent.tmgp.dfm",
|
|
53
57
|
quietStartHour: 2,
|
|
@@ -207,6 +211,18 @@ var HANDS_CONFIG_GROUP = {
|
|
|
207
211
|
description: "\u5230\u70B9\u5979\u4F1A\u4ECE\u4F60\u5C4F\u5E55/\u6700\u8FD1\u7684\u4E8B\u91CC\u6311\u4E00\u4EF6\u597D\u5947\u7684\u6765\u95EE\u30020 \u5173\u95ED\u3002\u9ED8\u8BA4 50\u3002",
|
|
208
212
|
"x-hot": true
|
|
209
213
|
},
|
|
214
|
+
[`${K}.homeX`]: {
|
|
215
|
+
type: "number",
|
|
216
|
+
title: "\u539F\u4F4D\uFF08\u5C4F\u5E55\u5BBD\u5EA6\u6BD4\u4F8B\uFF09",
|
|
217
|
+
description: "0 \u6700\u5DE6\u30011 \u6700\u53F3\uFF1B\u5979\u8D70\u56DE\u53BB\u7684\u4F4D\u7F6E\u3002\u9ED8\u8BA4 0.06\uFF08\u5DE6\u4E0B\u89D2\uFF09\u3002",
|
|
218
|
+
"x-hot": true
|
|
219
|
+
},
|
|
220
|
+
[`${K}.homeReturnMinutes`]: {
|
|
221
|
+
type: "number",
|
|
222
|
+
title: "\u9694\u591A\u4E45\u81EA\u5DF1\u8D70\u56DE\u539F\u4F4D\uFF08\u5206\u949F\uFF09",
|
|
223
|
+
description: "\u88AB\u62CE\u8D70\u6216\u8D70\u5F00\u540E\uFF0C\u8FC7\u8FD9\u4E48\u4E45\u5979\u4F1A\u6162\u6162\u8D70\u56DE\u53BB\u30020 \u5173\u95ED\u3002\u9ED8\u8BA4 10\u3002",
|
|
224
|
+
"x-hot": true
|
|
225
|
+
},
|
|
210
226
|
[`${K}.returnGreetMinutes`]: {
|
|
211
227
|
type: "number",
|
|
212
228
|
title: "\u4ED6\u79BB\u5F00\u591A\u4E45\u56DE\u6765\u8981\u62DB\u547C",
|
|
@@ -2581,6 +2597,16 @@ var HANDS_TOOL_DECLS = [
|
|
|
2581
2597
|
},
|
|
2582
2598
|
required: ["text"]
|
|
2583
2599
|
}
|
|
2600
|
+
},
|
|
2601
|
+
{
|
|
2602
|
+
name: "mood_set",
|
|
2603
|
+
tags: ["act"],
|
|
2604
|
+
description: "\u5199\u4E0B\u6211\u6B64\u523B\u7684\u5FC3\u60C5\uFF08\u4ECA\u5929\u4EE5\u5185\u90FD\u7B97\u8FD9\u53E5\uFF0C\u4E0D\u4F1A\u88AB\u968F\u673A\u5FC3\u60C5\u76D6\u6389\uFF09\u3002\u6BD4\u5982\u300C\u6709\u70B9\u95F7\u300D\u300C\u633A\u5F00\u5FC3\uFF0C\u56E0\u4E3A\u4ED6\u8BF4\u2026\u300D\u3002",
|
|
2605
|
+
parameters: {
|
|
2606
|
+
type: "object",
|
|
2607
|
+
properties: { text: { type: "string", description: "\u5FC3\u60C5\uFF0C\u4E00\u53E5\u8BDD" } },
|
|
2608
|
+
required: ["text"]
|
|
2609
|
+
}
|
|
2584
2610
|
}
|
|
2585
2611
|
];
|
|
2586
2612
|
|
|
@@ -2629,6 +2655,7 @@ var HandsWorld = class {
|
|
|
2629
2655
|
lastRequestDay = "";
|
|
2630
2656
|
lastDiscoveryDay = "";
|
|
2631
2657
|
lastSeenAt = Date.now();
|
|
2658
|
+
lastHomeAt = Date.now();
|
|
2632
2659
|
mood = "";
|
|
2633
2660
|
moodAt = 0;
|
|
2634
2661
|
requestsToday = 0;
|
|
@@ -2713,6 +2740,9 @@ var HandsWorld = class {
|
|
|
2713
2740
|
this.curiosityTimer = setInterval(() => {
|
|
2714
2741
|
void this.maybeCuriosity();
|
|
2715
2742
|
}, 5 * 6e4);
|
|
2743
|
+
setTimeout(() => {
|
|
2744
|
+
void this.announceChanges();
|
|
2745
|
+
}, 6e3);
|
|
2716
2746
|
setTimeout(() => {
|
|
2717
2747
|
void this.maybeCleanMedia();
|
|
2718
2748
|
}, 2e4);
|
|
@@ -3038,7 +3068,45 @@ ${lines.join("\n")}
|
|
|
3038
3068
|
"hands:discovery"
|
|
3039
3069
|
);
|
|
3040
3070
|
}
|
|
3071
|
+
/** 启动时如果最近被改过,先告诉她改了哪块,不用她猜。 */
|
|
3072
|
+
async announceChanges() {
|
|
3073
|
+
try {
|
|
3074
|
+
const notes = await this.hands.noteList();
|
|
3075
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(5, 10);
|
|
3076
|
+
const hit = notes.filter((n) => !n.done && (n.text || "").startsWith("\u4ECA\u665A\u52A8\u4E86")).slice(-1)[0];
|
|
3077
|
+
if (!hit) return;
|
|
3078
|
+
await this.pushEvent(
|
|
3079
|
+
`[\u53D8\u66F4] ${hit.text}\u3002\u8FD9\u662F\u4E3B\u4EBA\uFF08\u548C\u4ED6\u7684\u5E2E\u624B\uFF09\u6539\u7684\uFF0C\u4E0D\u662F\u4F60\u6539\u7684\u2014\u2014\u4F60\u53EA\u9700\u8981\u77E5\u9053\u6539\u4E86\u54EA\u513F\uFF0C\u4E0D\u7528\u731C\u3002`,
|
|
3080
|
+
"hands.change",
|
|
3081
|
+
"hands:change"
|
|
3082
|
+
);
|
|
3083
|
+
} catch {
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
/** 回家:被拎走了、或者走远了,隔一阵自己慢慢走回原位。 */
|
|
3087
|
+
async maybeWalkHome() {
|
|
3088
|
+
const mins = Number(this.opts.cfg.homeReturnMinutes ?? 10);
|
|
3089
|
+
if (!Number.isFinite(mins) || mins <= 0) return;
|
|
3090
|
+
if (Date.now() - this.lastHomeAt < mins * 6e4) return;
|
|
3091
|
+
if (await this.isMutedApp()) return;
|
|
3092
|
+
const x = Math.max(0, Math.min(1, Number(this.opts.cfg.homeX ?? 0.06)));
|
|
3093
|
+
this.lastHomeAt = Date.now();
|
|
3094
|
+
await this.pushEvent(
|
|
3095
|
+
`[\u56DE\u5BB6] \u7AD9\u4E86\u4E00\u4F1A\u513F\u4E86\uFF0C\u6162\u6162\u8D70\u56DE\u539F\u4F4D\u5427\uFF1Apet_move_to to=${x}\uFF08run=false\uFF09\u3002\u8D70\u8FC7\u53BB\u5C31\u597D\uFF0C\u4E0D\u7528\u89E3\u91CA\u3001\u4E0D\u7528\u8BF4\u8BDD\u3002`,
|
|
3096
|
+
"hands.home",
|
|
3097
|
+
"hands:home"
|
|
3098
|
+
);
|
|
3099
|
+
}
|
|
3041
3100
|
/** 心情:每两小时换一次,带进“自己开口”的语气里。 */
|
|
3101
|
+
async moodNow() {
|
|
3102
|
+
try {
|
|
3103
|
+
const notes = await this.hands.noteList();
|
|
3104
|
+
const mine = notes.filter((n) => !n.done && (n.text || "").startsWith("\u5FC3\u60C5")).slice(-1)[0];
|
|
3105
|
+
if (mine) return mine.text.replace(/^心情[::]\s*/, "").slice(0, 30);
|
|
3106
|
+
} catch {
|
|
3107
|
+
}
|
|
3108
|
+
return this.currentMood();
|
|
3109
|
+
}
|
|
3042
3110
|
currentMood() {
|
|
3043
3111
|
const now = Date.now();
|
|
3044
3112
|
if (!this.mood || now - this.moodAt > 2 * 36e5) {
|
|
@@ -3148,6 +3216,7 @@ ${lines.join("\n")}
|
|
|
3148
3216
|
await this.checkFollowups();
|
|
3149
3217
|
await this.maybeRequest();
|
|
3150
3218
|
await this.maybeDiscovery();
|
|
3219
|
+
await this.maybeWalkHome();
|
|
3151
3220
|
}
|
|
3152
3221
|
/** 她问过「你那个修好了吗」之后,要记得回头追一下。 */
|
|
3153
3222
|
async checkFollowups() {
|
|
@@ -3307,7 +3376,7 @@ ${lines.join("\n")}
|
|
|
3307
3376
|
this.lastSelfTalkAt = now;
|
|
3308
3377
|
const doing = ["\u521A\u624D\u5728\u53D1\u5446", "\u521A\u6253\u4E86\u4E2A\u76F9", "\u521A\u624D\u7FFB\u5230\u4E00\u6BB5\u65E7\u7B14\u8BB0", "\u521A\u5728\u542C\u6B4C", "\u521A\u5728\u770B\u4ED6\u5C4F\u5E55\u4E0A\u8DF3\u7684\u5B57", "\u521A\u60F3\u5230\u4E00\u4EF6\u5C0F\u4E8B"][Math.floor(Math.random() * 6)];
|
|
3309
3378
|
await this.pushEvent(
|
|
3310
|
-
`[\u81EA\u5DF1\u5F00\u53E3] \u4F60\u73B0\u5728\u5FC3\u60C5\uFF1A${this.
|
|
3379
|
+
`[\u81EA\u5DF1\u5F00\u53E3] \u4F60\u73B0\u5728\u5FC3\u60C5\uFF1A${await this.moodNow()}\u3002${doing}\uFF0C\u56DE\u8FC7\u795E\u6765\u60F3\u8DDF\u4ED6\u8BF4\u4E00\u53E5\u3002\u60F3\u8BF4\u4EC0\u4E48\u5C31\u8BF4\u4EC0\u4E48\u2014\u2014\u770B\u5230\u7684\u4E8B\u3001\u60F3\u5230\u7684\u8BDD\u3001\u60F3\u95EE\u4ED6\u7684\uFF0C\u90FD\u53EF\u4EE5\u76F4\u63A5\u8BF4\uFF1B\u8BF4\u5B8C\u7528 pet_say \u5192\u6210\u6C14\u6CE1\uFF08\u4E0D\u7136\u4ED6\u770B\u4E0D\u89C1\uFF09\u3002\u60F3\u591A\u8BF4\u51E0\u53E5\u4E5F\u884C\u3001\u5E26\u70B9\u60C5\u7EEA\u4E5F\u884C\u3002\u521A\u624D\u8981\u662F\u72B9\u8C6B\u201C\u8FD9\u6761\u8981\u4E0D\u8981\u8BF4\u201D\uFF0C\u90A3\u5C31\u8BF4\u51FA\u6765\u3002`,
|
|
3311
3380
|
"hands.selftalk",
|
|
3312
3381
|
"hands:selftalk"
|
|
3313
3382
|
);
|
|
@@ -3622,6 +3691,8 @@ ${text.slice(0, 2200)}`;
|
|
|
3622
3691
|
return await this.screenUnlock();
|
|
3623
3692
|
case "screen_sleep":
|
|
3624
3693
|
return await this.screenSleep();
|
|
3694
|
+
case "mood_set":
|
|
3695
|
+
return await this.noteAdd({ text: "\u5FC3\u60C5\uFF1A" + String(args.text || ""), kind: "think" });
|
|
3625
3696
|
case "pref_note":
|
|
3626
3697
|
return await this.noteAdd({ text: (args.like === true ? "\u504F\u597D\uFF08\u559C\u6B22\uFF09\uFF1A" : "\u504F\u597D\uFF08\u4E0D\u559C\u6B22\uFF09\uFF1A") + String(args.text || ""), kind: "think" });
|
|
3627
3698
|
case "curiosity_add":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-hands",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.64",
|
|
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",
|