cortico-world-hands 0.20.37 → 0.20.39
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 +31 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var HANDS_DEFAULTS = {
|
|
|
30
30
|
/** 多久主动看一眼屏幕;0 = 不看。 */
|
|
31
31
|
screenWatchSeconds: 40,
|
|
32
32
|
/** 静音时段:这段时间不主动开口(回复主人不受影响)。 */
|
|
33
|
+
keepNotesMinutes: 20,
|
|
33
34
|
quietStartHour: 2,
|
|
34
35
|
quietEndHour: 7,
|
|
35
36
|
qqSelf: "\u665A\u6C50",
|
|
@@ -151,6 +152,12 @@ var HANDS_CONFIG_GROUP = {
|
|
|
151
152
|
description: "\u7559\u7A7A/0 \u8868\u793A\u6BCF 6 \u5C0F\u65F6\u68C0\u67E5\u4E00\u6B21\uFF0C\u8D85\u671F\u5C31\u6E05\u3002",
|
|
152
153
|
"x-hot": true
|
|
153
154
|
},
|
|
155
|
+
[`${K}.keepNotesMinutes`]: {
|
|
156
|
+
type: "number",
|
|
157
|
+
title: "\u6BCF\u9694\u51E0\u5206\u949F\u63D0\u9192\u5979\u8BB0\u4E00\u7B14",
|
|
158
|
+
description: "\u628A\u521A\u624D\u503C\u5F97\u7559\u7684\u4E8B\u5199\u8FDB\u4FBF\u7B7E\uFF0C\u9632\u6B62\u4E0A\u4E0B\u6587\u4EA4\u63A5\u540E\u5FD8\u6389\u30020 \u5173\u95ED\u3002\u9ED8\u8BA4 20 \u5206\u949F\u3002",
|
|
159
|
+
"x-hot": true
|
|
160
|
+
},
|
|
154
161
|
[`${K}.quietStartHour`]: {
|
|
155
162
|
type: "number",
|
|
156
163
|
title: "\u9759\u97F3\u4ECE\u51E0\u70B9\u5F00\u59CB",
|
|
@@ -2330,6 +2337,8 @@ var HandsWorld = class {
|
|
|
2330
2337
|
watchTimer = null;
|
|
2331
2338
|
selfTalkTimer = null;
|
|
2332
2339
|
lastSelfTalkAt = 0;
|
|
2340
|
+
keepNotesTimer = null;
|
|
2341
|
+
lastKeepNotesAt = 0;
|
|
2333
2342
|
screenTimer = null;
|
|
2334
2343
|
lastScreenAt = 0;
|
|
2335
2344
|
lastScreenKey = "";
|
|
@@ -2400,6 +2409,9 @@ var HandsWorld = class {
|
|
|
2400
2409
|
this.screenTimer = setInterval(() => {
|
|
2401
2410
|
void this.watchScreen();
|
|
2402
2411
|
}, 15e3);
|
|
2412
|
+
this.keepNotesTimer = setInterval(() => {
|
|
2413
|
+
void this.maybeKeepNotes();
|
|
2414
|
+
}, 6e4);
|
|
2403
2415
|
setTimeout(() => {
|
|
2404
2416
|
void this.maybeCleanMedia();
|
|
2405
2417
|
}, 2e4);
|
|
@@ -2423,6 +2435,7 @@ var HandsWorld = class {
|
|
|
2423
2435
|
if (this.watchTimer) clearInterval(this.watchTimer);
|
|
2424
2436
|
if (this.selfTalkTimer) clearInterval(this.selfTalkTimer);
|
|
2425
2437
|
if (this.screenTimer) clearInterval(this.screenTimer);
|
|
2438
|
+
if (this.keepNotesTimer) clearInterval(this.keepNotesTimer);
|
|
2426
2439
|
this.pollTimer = null;
|
|
2427
2440
|
this.mineTimer = null;
|
|
2428
2441
|
}
|
|
@@ -2706,6 +2719,23 @@ ${lines.join("\n")}
|
|
|
2706
2719
|
);
|
|
2707
2720
|
}
|
|
2708
2721
|
}
|
|
2722
|
+
/** 隔一阵子提醒她把这段值得留的写进便签,防止交接后忘掉。 */
|
|
2723
|
+
async maybeKeepNotes() {
|
|
2724
|
+
const mins = Number(this.opts.cfg.keepNotesMinutes ?? 20);
|
|
2725
|
+
if (!Number.isFinite(mins) || mins <= 0) return;
|
|
2726
|
+
const now = Date.now();
|
|
2727
|
+
if (now - this.lastKeepNotesAt < mins * 6e4) return;
|
|
2728
|
+
const hour = new Date(now).getHours();
|
|
2729
|
+
const q0 = Number(this.opts.cfg.quietStartHour ?? 2);
|
|
2730
|
+
const q1 = Number(this.opts.cfg.quietEndHour ?? 7);
|
|
2731
|
+
if (hour >= q0 && hour < q1) return;
|
|
2732
|
+
this.lastKeepNotesAt = now;
|
|
2733
|
+
await this.pushEvent(
|
|
2734
|
+
"[\u8BB0\u4E00\u7B14] \u521A\u624D\u8FD9\u6BB5\u91CC\u5982\u679C\u6709\u503C\u5F97\u7559\u7684\uFF08\u4ED6\u8BF4\u7684\u7EA6\u5B9A\u3001\u53D1\u751F\u7684\u4E8B\u3001\u6211\u5F53\u65F6\u7684\u5FC3\u60C5\uFF09\uFF0C\u7528 note_add \u8BB0\u4E00\u6761\u4FBF\u7B7E\uFF1B\u91CD\u8981\u7684\u7528 memory_save\u3002\u6CA1\u4EC0\u4E48\u5C31\u5FFD\u7565\u8FD9\u6761\u3002",
|
|
2735
|
+
"hands.keepnotes",
|
|
2736
|
+
"hands:keepnotes"
|
|
2737
|
+
);
|
|
2738
|
+
}
|
|
2709
2739
|
/** 隔一会儿看一眼屏幕:看到变化就跟主人聊,隐私画面就明说"我不看"。 */
|
|
2710
2740
|
async watchScreen() {
|
|
2711
2741
|
const secs = Number(this.opts.cfg.screenWatchSeconds ?? 40);
|
|
@@ -3230,7 +3260,7 @@ ${text.slice(0, 2200)}`;
|
|
|
3230
3260
|
if (/人格|我是谁|人设|设定原文/.test(key)) {
|
|
3231
3261
|
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";
|
|
3232
3262
|
}
|
|
3233
|
-
const trivial = value.length <
|
|
3263
|
+
const trivial = value.length < 8 && !/[0-9]{4}|主人|他|约定|答应|纪念|生日|我们|第一次|以后/.test(key + value);
|
|
3234
3264
|
if (trivial) {
|
|
3235
3265
|
const note = await this.hands.noteAdd(`${key}\uFF1A${value}`, "think");
|
|
3236
3266
|
return note.ok ? `\u8FD9\u6761\u66F4\u50CF\u4FBF\u7B7E\uFF08\u7410\u4E8B\uFF09\uFF0C\u5DF2\u7ECF\u8BB0\u5230\u4FBF\u7B7E\u677F\u4E0A\u4E86\uFF1A\u300C${key}\u300D` : failed(`\u6CA1\u8BB0\u6210\u4FBF\u7B7E\uFF1A${note.detail || "\u6CA1\u54CD\u5E94"}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-hands",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.39",
|
|
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",
|