wechat-clawbot 1.2.0 → 1.3.0

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 (65) hide show
  1. package/assets/icon.svg +7 -0
  2. package/cordis.patch.yml +4 -0
  3. package/lib/backlog.d.ts +14 -0
  4. package/lib/backlog.d.ts.map +1 -1
  5. package/lib/backlog.js +65 -4
  6. package/lib/backlog.js.map +1 -1
  7. package/lib/bridge.d.ts +6 -3
  8. package/lib/bridge.d.ts.map +1 -1
  9. package/lib/bridge.js +44 -11
  10. package/lib/bridge.js.map +1 -1
  11. package/lib/claude-peer.js +11 -11
  12. package/lib/claude-peer.js.map +1 -1
  13. package/lib/client.js +197 -75
  14. package/lib/config.d.ts +30 -7
  15. package/lib/config.d.ts.map +1 -1
  16. package/lib/config.js +17 -3
  17. package/lib/config.js.map +1 -1
  18. package/lib/idle-compact.d.ts +5 -0
  19. package/lib/idle-compact.d.ts.map +1 -1
  20. package/lib/idle-compact.js +10 -8
  21. package/lib/idle-compact.js.map +1 -1
  22. package/lib/index.d.ts.map +1 -1
  23. package/lib/index.js +75 -28
  24. package/lib/index.js.map +1 -1
  25. package/lib/localtime.d.ts +4 -3
  26. package/lib/localtime.d.ts.map +1 -1
  27. package/lib/localtime.js +7 -6
  28. package/lib/localtime.js.map +1 -1
  29. package/lib/mac-alarms.d.ts +168 -0
  30. package/lib/mac-alarms.d.ts.map +1 -0
  31. package/lib/mac-alarms.js +610 -0
  32. package/lib/mac-alarms.js.map +1 -0
  33. package/lib/mac-calendar.d.ts +126 -11
  34. package/lib/mac-calendar.d.ts.map +1 -1
  35. package/lib/mac-calendar.js +415 -97
  36. package/lib/mac-calendar.js.map +1 -1
  37. package/lib/mcp-route.d.ts.map +1 -1
  38. package/lib/mcp-route.js +8 -2
  39. package/lib/mcp-route.js.map +1 -1
  40. package/lib/memory-auto.js +4 -4
  41. package/lib/memory-auto.js.map +1 -1
  42. package/lib/models-route.d.ts +1 -1
  43. package/lib/pending.d.ts +9 -1
  44. package/lib/pending.d.ts.map +1 -1
  45. package/lib/pending.js +18 -1
  46. package/lib/pending.js.map +1 -1
  47. package/lib/prompt.d.ts.map +1 -1
  48. package/lib/prompt.js +12 -11
  49. package/lib/prompt.js.map +1 -1
  50. package/lib/secretary.d.ts +42 -9
  51. package/lib/secretary.d.ts.map +1 -1
  52. package/lib/secretary.js +142 -36
  53. package/lib/secretary.js.map +1 -1
  54. package/lib/time-context.d.ts +57 -0
  55. package/lib/time-context.d.ts.map +1 -0
  56. package/lib/time-context.js +90 -0
  57. package/lib/time-context.js.map +1 -0
  58. package/lib/tool.js +1 -1
  59. package/lib/typing.d.ts +0 -1
  60. package/lib/typing.d.ts.map +1 -1
  61. package/lib/typing.js +7 -1
  62. package/lib/typing.js.map +1 -1
  63. package/native/macos-calendar/main.swift +476 -13
  64. package/package.json +3 -1
  65. package/wechat-clawbot-INSTALL.md +52 -32
package/lib/client.js CHANGED
@@ -75,6 +75,8 @@ window.__ModuleLoader__.load({
75
75
  const BRIDGE_URL = "/plugins/clawbot/mcp/status";
76
76
  const CALENDAR_URL = "/plugins/clawbot/calendar/status";
77
77
  const MEMORY_OPEN_URL = "/plugins/clawbot/memory/open";
78
+ const AUTHORIZE_URL = "/plugins/clawbot/secretary/authorize";
79
+ const TEST_ALARM_URL = "/plugins/clawbot/secretary/test-alarm";
78
80
 
79
81
  const cls = (n) => `clawbot-${n}`;
80
82
  const S = {
@@ -85,7 +87,7 @@ window.__ModuleLoader__.load({
85
87
  reset: cls("reset"), input: cls("input"), area: cls("area"), hint: cls("hint"),
86
88
  switch: cls("switch"), switchOn: cls("switch-on"), knob: cls("knob"),
87
89
  footer: cls("footer"), note: cls("note"), button: cls("button"),
88
- failed: cls("failed"),
90
+ failed: cls("failed"), actions: cls("actions"),
89
91
  };
90
92
 
91
93
  let stylesInjected = false;
@@ -171,6 +173,7 @@ window.__ModuleLoader__.load({
171
173
  border-color: var(--dsw-alias-label-dimmed); }
172
174
  .${S.button}:disabled { opacity: .4; cursor: default; }
173
175
  .${S.failed} { color: var(--dsw-alias-state-error-primary); font-size: 12px; line-height: 1.5; }
176
+ .${S.actions} { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
174
177
  `;
175
178
  document.head.appendChild(el);
176
179
  }
@@ -235,54 +238,104 @@ window.__ModuleLoader__.load({
235
238
  return `MCP 客户端已调用 ${bridge.calls} 次,最近一次 ${ago(bridge.lastCallAt)}(${bridge.lastRoute})${rejected}`;
236
239
  }
237
240
 
241
+ /** One Mac permission as a short phrase. */
242
+ function grant(state, what, app) {
243
+ switch (state) {
244
+ case "fullAccess": return `${what}已授权`;
245
+ case "notDetermined": return `${what}还没授权`;
246
+ case "denied": return `${what}被拒绝了(系统设置 → 隐私与安全性 → ${what} 里打开「${app}」)`;
247
+ case "writeOnly": return `${what}只有「仅添加」(系统设置 → 隐私与安全性 → ${what} 里改成完全访问)`;
248
+ case "restricted": return `${what}被这台 Mac 的管理策略限制了`;
249
+ case "outdated": return `${what}:要先更新小程序`;
250
+ default: return `${what}:${state || "读取中"}`;
251
+ }
252
+ }
253
+
238
254
  /**
239
- * What the calendar row says under its switch. The interesting states are the
240
- * ones that need the owner at the Mac: the permission prompt, or a refusal
241
- * that only System Settings can undo.
255
+ * What the 全天候秘书 row says. The states that need the owner at the Mac
256
+ * come first (a prompt on screen, an outdated helper, a refusal): that is
257
+ * what has to be done before walking away from it.
242
258
  */
243
- function calendarHint(status, name, on) {
244
- const base = "打开后 bot 能读取 Mac「日历」里所有账户的日程(含备注),在这个专用日历里自主加、改、删;"
245
- + "动别的日历会先在微信里问你。关着时不占 token。改开关会重启微信监听";
259
+ function assistantHint(status, name, on) {
260
+ const base = "打开后,bot 能读取 Mac「日历」里所有账户的日程(含备注)、在专用日历里自主安排,"
261
+ + "能设闹钟(紧急提醒:到点像闹钟一样响,不靠微信),并把排日程、定闹钟的规则写进 memory.md 的"
262
+ + "「## 全天候秘书」一节(可以直接改)。仅 macOS,关着时不占 token。打开时(或之后点「一键授权」)Mac 上会弹出"
263
+ + "「日历」和「提醒事项」两个授权,要在 Mac 前点「允许」";
246
264
  if (status === null) return base;
247
265
  if (status.unreachable === true) return "状态读不到(路由没注册?DSH 可能需要重启)";
248
266
  if (status.mac === false) return "只支持 macOS";
249
267
  if (!on) return name ? base : `先填专用日历的名字,再打开开关。${base}`;
250
- if (status.others > 0) return "白名单里还有别人:大家共用这一个对话,日历内容会被看到,所以日历工具不开放";
251
- if (status.error && status.authorization !== "fullAccess") return `还没就绪:${status.error}`;
268
+ if (!name) return "先在上面填专用日历的名字(闹钟清单第一次也按它起名),bot 才能排日程、定闹钟";
269
+ if (status.others > 0) return "白名单里还有别人:大家共用这一个对话,日历和闹钟会被看到,所以这些工具不开放";
252
270
  const app = status.helper || "Clawbot-Calendar";
253
- if (status.prompting) return `等你在 Mac 上点「允许」:屏幕上有「${app}」想要访问日历的窗口`;
254
- switch (status.authorization) {
255
- case "fullAccess": {
256
- const own = status.dedicated && status.dedicated.name === name
257
- ? `专用日历「${name}」在「${status.dedicated.account || "本机"}」`
258
- : `专用日历「${name}」第一次添加时创建(优先建在 iCloud;和已有日历重名会先在微信里问你)`;
259
- return `已授权,能看到 ${status.calendars ?? "?"} 个日历(${status.accounts ?? "?"} 个账户)。${own};`
260
- + "改名字会另用一个日历,旧的不会删";
261
- }
262
- case "notDetermined":
263
- return `等你在 Mac 上点「允许」:屏幕上应该有「${app}」想要访问日历的窗口。`
264
- + "没看到就去 系统设置 → 隐私与安全性 → 日历";
265
- case "denied":
266
- return `授权被拒绝了:在 系统设置 → 隐私与安全性 → 日历 里打开「${app}」`;
267
- case "writeOnly":
268
- return `「${app}」只有「仅添加」权限,读不到日程:在 系统设置 → 隐私与安全性 → 日历 里改成完全访问`;
269
- case "restricted":
270
- return "这台 Mac 的日历访问被管理策略限制了";
271
- default:
272
- return status.built === false ? `正在准备「${app}」(第一次要编译,约一分钟)…` : "读取状态…";
271
+ if (status.preparing && status.built === false && !status.stale) {
272
+ return `正在准备「${app}」(第一次要编译,约一分钟),之后 Mac 上会弹出授权窗口`;
273
+ }
274
+ if (status.prompting) {
275
+ const names = { calendar: "「日历」", reminders: "「提醒事项」" };
276
+ const which = (status.waitingFor || []).map((k) => names[k]).join("、");
277
+ return `等你在 Mac 上点「允许」:屏幕上有「${app}」的${which || ""}授权窗口(可能被别的窗口挡住)`;
278
+ }
279
+ if (status.preparing) return `正在准备「${app}」…`;
280
+ if (status.error && status.authorization !== "fullAccess") return `还没就绪:${status.error}`;
281
+ if (status.built === false && !status.stale) return `「${app}」还没编译:点「一键授权」`;
282
+ const unsupported = status.alarms === "unsupported";
283
+ const lines = [];
284
+ if (status.updateError) lines.push(`小程序更新没成功(旧版照常能用):${status.updateError}`);
285
+ else if (status.outdated) {
286
+ // Protocol 1 has no alarms at all; protocol 2 has them, and only misses the newer pieces.
287
+ lines.push(`${(status.protocol ?? 1) < 2 ? "小程序要更新才能用闹钟" : "小程序有更新"}:到 Mac 前点「一键授权」`
288
+ + "(更新后「日历」「提醒事项」都要在 Mac 上再点一次「允许」,不在 Mac 前就先别点,日历会停到点了「允许」为止)");
273
289
  }
290
+ lines.push(unsupported
291
+ ? `${grant(status.authorization, "日历", app)};这台 Mac 的系统没有紧急提醒(要 macOS 26 或更新),闹钟用不了`
292
+ : `${grant(status.authorization, "日历", app)};${grant(status.reminders, "提醒事项", app)}`);
293
+ if (status.authorization === "fullAccess") {
294
+ lines.push(status.dedicated && status.dedicated.name === name
295
+ ? `专用日历「${name}」在「${status.dedicated.account || "本机"}」,能看到 ${status.calendars ?? "?"} 个日历`
296
+ : `专用日历「${name}」第一次用到时创建(优先建在 iCloud)`);
297
+ }
298
+ if (status.reminders === "fullAccess" && !unsupported) {
299
+ lines.push(status.alarmList
300
+ ? `闹钟清单「${status.alarmList.name}」在「${status.alarmList.account || "iCloud"}」(改了名字也继续用它)`
301
+ : `闹钟清单「${name} 闹钟」第一次设闹钟时创建`);
302
+ }
303
+ if (status.secretaryOn === false) {
304
+ lines.push("排日程的规则没开(配置里 secretary 是关的):日历和闹钟照常能用;要那套规则,就把开关关掉再打开一次"
305
+ + (status.outdated ? "(在 Mac 前做:重新打开会顺便更新小程序、弹出授权)" : ""));
306
+ } else if (status.secretary === false) {
307
+ lines.push("memory.md 里没找到「## 全天候秘书」一节:关掉再打开一次就会放回去");
308
+ }
309
+ const undecided = status.authorization === "notDetermined" || (!unsupported && status.reminders === "notDetermined");
310
+ const ready = status.authorization === "fullAccess" && !status.outdated
311
+ && (unsupported || status.reminders === "fullAccess");
312
+ if (ready && !unsupported) {
313
+ lines.push("闹钟只在「查找」里作为“我的位置”的那台设备上像闹钟一样响(一般是 iPhone);iPhone 上还要先在「提醒事项」里"
314
+ + "手动把一条提醒设成「紧急」一次、允许弹出的授权,闹钟才会响。点「测试闹钟」试响一次");
315
+ } else if (undecided) {
316
+ lines.push("缺的授权到 Mac 前点「一键授权」补上;都允许之后点「测试闹钟」试响一次");
317
+ }
318
+ return lines.join("。");
274
319
  }
275
320
 
276
- /** What the secretary row says: what the switch does, and whether the rules are in memory now. */
277
- function secretaryHint(status, on, calendarOn) {
278
- const what = "把一套排日程的规则写进长期记忆(memory.md 里的「## 日程秘书」一节):你说待办、截止时间,"
279
- + "bot 先查日历再排进专用日历,回复只说几点做什么、挪走了什么。规则可以直接在 memory.md 里改;"
280
- + "关掉时移出记忆并留一份副本,再打开原样放回";
281
- if (!calendarOn) return on ? "Mac 日历关着,秘书暂停(规则已移出记忆);打开日历后自动恢复" : `要先打开 Mac 日历。${what}`;
282
- if (!on) return what;
283
- if (status && status.secretary === true) return "已开:规则在 memory.md 的「## 日程秘书」一节,可以直接改,下一条消息生效";
284
- if (status && status.secretary === false) return "已开,但 memory.md 里没找到「## 日程秘书」一节:关掉再打开一次就会放回去";
285
- return what;
321
+ /** What 一键授权 answered it is doing (the route's plan). */
322
+ function authorizeText(d) {
323
+ const p = (d && d.plan) || {};
324
+ const names = { calendar: "「日历」", reminders: "「提醒事项」" };
325
+ const list = (keys) => (keys || []).map((k) => names[k] || k).join("、");
326
+ const parts = [];
327
+ if (p.build === "first") parts.push("先编译小程序(第一次要一两分钟)");
328
+ if (p.build === "update") parts.push("先更新小程序(更新后两个授权都要重新点)");
329
+ if ((p.ask || []).length > 0) {
330
+ parts.push(`Mac 屏幕上会弹出${list(p.ask)}的授权窗口(可能被别的窗口挡住),都点「允许」`);
331
+ } else if (p.error) {
332
+ parts.push(`小程序这次没有回应(${p.error}):过一会儿再点一次「一键授权」`);
333
+ }
334
+ if ((p.denied || []).length > 0) {
335
+ parts.push(`${list(p.denied)}之前被拒绝了,只能在 系统设置 → 隐私与安全性 里打开「Clawbot-Calendar」`);
336
+ }
337
+ if (p.alarmsUnsupported) parts.push("这台 Mac 的系统没有紧急提醒,闹钟用不了(日历不受影响)");
338
+ return parts.length > 0 ? parts.join(";") : "都已经授权了,不用再点";
286
339
  }
287
340
 
288
341
  function Switch(props) {
@@ -313,6 +366,13 @@ window.__ModuleLoader__.load({
313
366
  const [calName, setCalName] = useState(null);
314
367
  // The "打开 memory.md" button: null, "opening", "opened", or what went wrong.
315
368
  const [memoryOpen, setMemoryOpen] = useState(null);
369
+ // 一键授权 / 测试闹钟: { busy, text, kind, at } while one runs and after it answered; cleared once stale.
370
+ const [action, setAction] = useState(null);
371
+ // Bumped to look at the calendar status again at once (after 一键授权).
372
+ const [poke, setPoke] = useState(0);
373
+ // The switch, before the early return below: flipping it looks again at once
374
+ // (the off state counts as settled, so the next look would be a minute away).
375
+ const calendarOn = Boolean(state && state.value && state.value.macCalendar === true);
316
376
 
317
377
  // The model catalogue is a server fact, fetched the first time the card is
318
378
  // opened rather than on mount: it costs one resolveModelInfo per model, and
@@ -352,18 +412,31 @@ window.__ModuleLoader__.load({
352
412
  let timer = null;
353
413
  // Fast while the permission is still being decided, slow once it has
354
414
  // settled (or the switch is off): every look launches the helper app.
415
+ const final = ["fullAccess", "denied", "restricted", "writeOnly"];
355
416
  const settled = (d) => d && (d.enabled !== true
356
- || ["fullAccess", "denied", "restricted", "writeOnly"].includes(d.authorization));
417
+ || (final.includes(d.authorization)
418
+ && (final.includes(d.reminders) || d.reminders === "outdated" || d.alarms === "unsupported")
419
+ && d.preparing !== true && d.prompting !== true));
357
420
  const next = (d) => { if (alive) timer = setTimeout(tick, settled(d) ? 60000 : 10000); };
358
421
  const tick = () => {
359
422
  fetch(CALENDAR_URL, { headers: { accept: "application/json" } })
360
423
  .then((r) => (r.ok ? r.json() : Promise.reject(new Error(`HTTP ${r.status}`))))
361
- .then((d) => { if (!alive) return; if (d && d.ok) setCalendar(d); next(d && d.ok ? d : null); })
424
+ .then((d) => {
425
+ if (!alive) return;
426
+ if (d && d.ok) {
427
+ setCalendar(d);
428
+ // 一键授权's answer describes a round: once that round is over, the live hint says the rest.
429
+ if (d.preparing !== true && d.prompting !== true) {
430
+ setAction((a) => (a && !a.busy && a.kind === "authorize" && Date.now() - a.at > 3000 ? null : a));
431
+ }
432
+ }
433
+ next(d && d.ok ? d : null);
434
+ })
362
435
  .catch(() => { if (alive) { setCalendar({ unreachable: true }); next(null); } });
363
436
  };
364
437
  tick();
365
438
  return () => { alive = false; if (timer) clearTimeout(timer); };
366
- }, [open]);
439
+ }, [open, poke, calendarOn]);
367
440
 
368
441
  // Follow the saved name again once it changes (a save landed, or 重置).
369
442
  const savedName = state && state.value ? (state.value.macCalendarName || "") : "";
@@ -409,6 +482,28 @@ window.__ModuleLoader__.load({
409
482
  }
410
483
  };
411
484
 
485
+ /** POST one of the 全天候秘书 buttons; the answer is shown under the row. */
486
+ const press = async (url, running, done, kind) => {
487
+ if (action !== null && action.busy) return;
488
+ const at = Date.now();
489
+ setAction({ busy: true, text: running, kind, at });
490
+ try {
491
+ const res = await fetch(url, { method: "POST", headers: { "content-type": "application/json" }, body: "{}" });
492
+ const d = await res.json().catch(() => null);
493
+ setAction({ busy: false, text: res.ok && d && d.ok ? done(d) : ((d && d.message) || `没成功(HTTP ${res.status})`), kind, at });
494
+ } catch {
495
+ setAction({ busy: false, text: "没成功:路由读不到,DSH 可能需要重启", kind, at });
496
+ }
497
+ // The test alarm's line is about the next few minutes only.
498
+ if (kind === "test") setTimeout(() => setAction((a) => (a && a.at === at ? null : a)), 240000);
499
+ setPoke((n) => n + 1);
500
+ };
501
+ const authorize = () => press(AUTHORIZE_URL, "正在看要做什么…", authorizeText, "authorize");
502
+ const testAlarm = () => press(TEST_ALARM_URL, "正在设测试闹钟…",
503
+ (d) => d.urgent === false
504
+ ? `设上了(${d.at}),但没能设成紧急提醒,到点只会弹通知`
505
+ : `已设:${d.at} 在「${d.list}」里响,看 iPhone 是不是像闹钟一样响(没响就看这条提醒的备注)`, "test");
506
+
412
507
  const restartNow = async () => {
413
508
  if (restarting) return;
414
509
  setRestarting(true);
@@ -517,6 +612,18 @@ window.__ModuleLoader__.load({
517
612
  onChange: (next) => set("idleCompaction", next),
518
613
  }),
519
614
  }),
615
+ Field({
616
+ label: "空闲整理阈值",
617
+ hint: "万 token。上一次请求超过这个数,空闲时就整理。留空 = 宿主压缩阈值的 85%。只管 bot,网页会话不受影响",
618
+ overridden: isSet("idleCompactionTokens"), disabled,
619
+ onReset: () => clear("idleCompactionTokens"),
620
+ control: h("input", {
621
+ type: "number", className: S.input, min: 1, step: 1, disabled,
622
+ value: v.idleCompactionTokens === undefined ? "" : v.idleCompactionTokens / 10000,
623
+ placeholder: "自动",
624
+ onChange: (e) => num("idleCompactionTokens", e.target.value, 10000),
625
+ }),
626
+ }),
520
627
  Field({
521
628
  label: "把工作目录的说明文件交给 bot",
522
629
  hint: "AGENTS.md / CLAUDE.md。关掉则微信会话里不再自动塞这些文件(DSH 每次改动都会重发整份),需要时让 bot 自己去读",
@@ -657,35 +764,56 @@ window.__ModuleLoader__.load({
657
764
  }),
658
765
  }),
659
766
  Field({
660
- label: "Mac 日历",
661
- hint: calendarHint(calendar, (calName ?? v.macCalendarName ?? "").trim(), v.macCalendar === true),
662
- overridden: isSet("macCalendar") || isSet("macCalendarName"), disabled,
663
- onReset: () => { clear("macCalendar"); clear("macCalendarName"); setCalName(null); },
767
+ label: "全天候秘书",
768
+ hint: assistantHint(calendar, (calName ?? v.macCalendarName ?? "").trim(), v.macCalendar === true)
769
+ + (action !== null && action.text ? `(${action.text})` : "")
770
+ + (memoryOpen !== null && memoryOpen !== "opening" && memoryOpen !== "opened" ? `(${memoryOpen})` : ""),
771
+ overridden: isSet("macCalendar") || isSet("macCalendarName") || isSet("secretary"), disabled,
772
+ onReset: () => { clear("macCalendar"); clear("macCalendarName"); clear("secretary"); setCalName(null); },
664
773
  inline: h(Switch, {
665
- label: "Mac 日历",
774
+ label: "全天候秘书",
666
775
  on: v.macCalendar === true,
667
- // Turning it on needs a calendar name first (the one being typed
668
- // counts); turning it off never does.
776
+ // Turning it on needs a name first (the one being typed counts);
777
+ // turning it off never does. Calendar, alarms and rules are one
778
+ // feature: the switch sets both fields.
669
779
  disabled: disabled || (v.macCalendar !== true
670
780
  && (!(calName ?? v.macCalendarName ?? "").trim() || (calendar !== null && calendar.mac === false))),
671
781
  onChange: (next) => {
672
782
  const typed = (calName ?? v.macCalendarName ?? "").trim();
673
783
  if (next && typed !== (v.macCalendarName || "").trim()) set("macCalendarName", typed);
674
784
  set("macCalendar", next);
785
+ set("secretary", next);
675
786
  },
676
787
  }),
677
- control: h("input", {
678
- type: "text", className: S.input, disabled,
679
- value: calName ?? (v.macCalendarName || ""),
680
- placeholder: "专用日历的名字,例如 规划",
681
- maxLength: 60,
682
- onChange: (e) => setCalName(String(e.target.value)),
683
- onBlur: (e) => {
684
- const name = String(e.target.value).trim();
685
- if (name === (v.macCalendarName || "").trim()) return;
686
- if (name === "") clear("macCalendarName"); else set("macCalendarName", name);
687
- },
688
- }),
788
+ control: h("div", null,
789
+ h("input", {
790
+ type: "text", className: S.input, disabled,
791
+ value: calName ?? (v.macCalendarName || ""),
792
+ placeholder: "专用日历的名字(闹钟清单第一次也用它),例如 规划",
793
+ maxLength: 60,
794
+ onChange: (e) => setCalName(String(e.target.value)),
795
+ onBlur: (e) => {
796
+ const name = String(e.target.value).trim();
797
+ if (name === (v.macCalendarName || "").trim()) return;
798
+ if (name === "") clear("macCalendarName"); else set("macCalendarName", name);
799
+ },
800
+ }),
801
+ h("div", { className: S.actions },
802
+ h("button", {
803
+ type: "button", className: S.button,
804
+ disabled: disabled || v.macCalendar !== true || (action !== null && action.busy),
805
+ onClick: authorize,
806
+ }, "一键授权"),
807
+ h("button", {
808
+ type: "button", className: S.button,
809
+ disabled: disabled || v.macCalendar !== true || (action !== null && action.busy)
810
+ || !(calendar && calendar.reminders === "fullAccess" && !calendar.outdated && calendar.alarms !== "unsupported"),
811
+ onClick: testAlarm,
812
+ }, "测试闹钟"),
813
+ h("button", {
814
+ type: "button", className: S.button, disabled: disabled || memoryOpen === "opening", onClick: openMemory,
815
+ }, memoryOpen === "opened" ? "已在 Mac 上打开" : "打开 memory.md"),
816
+ )),
689
817
  }),
690
818
  Field({
691
819
  label: "日历提醒",
@@ -705,20 +833,14 @@ window.__ModuleLoader__.load({
705
833
  }),
706
834
  }),
707
835
  Field({
708
- label: "日程秘书",
709
- hint: secretaryHint(calendar, v.secretary === true, v.macCalendar === true)
710
- + (memoryOpen !== null && memoryOpen !== "opening" && memoryOpen !== "opened" ? `(${memoryOpen})` : ""),
711
- control: h("div", null, h("button", {
712
- type: "button", className: S.button, disabled: disabled || memoryOpen === "opening", onClick: openMemory,
713
- }, memoryOpen === "opened" ? "已在 Mac 上打开" : "打开 memory.md")),
714
- overridden: isSet("secretary"), disabled,
715
- onReset: () => clear("secretary"),
836
+ label: "改别的日历前先问我",
837
+ hint: "bot 往专用日历以外的日历里加、改、删日程前,先在微信里问你、回「好」才动。"
838
+ + "关掉就直接改(只读和订阅的日历本来就改不了);会通知其他参与者的改动仍会先问",
839
+ overridden: isSet("macCalendarAsk"), disabled,
840
+ onReset: () => clear("macCalendarAsk"),
716
841
  inline: h(Switch, {
717
- label: "日程秘书",
718
- // It leans on the calendar: off (and not switchable) while the calendar is off.
719
- on: v.secretary === true && v.macCalendar === true,
720
- disabled: disabled || v.macCalendar !== true || (calendar !== null && calendar.mac === false),
721
- onChange: (next) => set("secretary", next),
842
+ label: "改别的日历前先问我", on: v.macCalendarAsk !== false, disabled,
843
+ onChange: (next) => set("macCalendarAsk", next),
722
844
  }),
723
845
  }),
724
846
  Field({
@@ -747,7 +869,7 @@ window.__ModuleLoader__.load({
747
869
  { className: S.headText },
748
870
  h("span", { className: S.name }, "微信 Bot"),
749
871
  h("span", { className: S.description },
750
- "模型、图片、白名单、Mac 日历与日程秘书。大多改完立刻生效,微信连接不中断"),
872
+ "模型、图片、白名单、全天候秘书(日历和闹钟)。大多改完立刻生效,微信连接不中断"),
751
873
  ),
752
874
  h(
753
875
  "svg",
package/lib/config.d.ts CHANGED
@@ -74,7 +74,7 @@ export interface ClawbotConfig {
74
74
  * Whether the auto-memory classifier may run.
75
75
  *
76
76
  * **On by default (since 0.9.4).** A message that looks like a durable
77
- * personal fact ("我住在…", "我不能喝咖啡") is sent VERBATIM to a model to be
77
+ * personal fact ("我住在…", "我不吃香菜") is sent VERBATIM to a model to be
78
78
  * judged worth remembering.
79
79
  *
80
80
  * Since 0.9.3 that model is **the one this session already routes to**: the
@@ -110,6 +110,14 @@ export interface ClawbotConfig {
110
110
  * session. The host's pre-step compaction stays as the fallback.
111
111
  */
112
112
  idleCompaction: boolean;
113
+ /**
114
+ * The size (tokens of the last request) at which the quiet-time compaction
115
+ * runs, instead of 85% of the host's threshold. The host's threshold comes
116
+ * from the model's window, and that window is shared with the web UI:
117
+ * shrinking it to keep the bot lean would make every web session on the same
118
+ * model compact early too. Unset = 85% of the host's threshold.
119
+ */
120
+ idleCompactionTokens?: number;
113
121
  /**
114
122
  * Whether DSH may splice workspace instruction files (AGENTS.md / CLAUDE.md)
115
123
  * into the WeChat session (see `src/workspace-instructions.ts`). On by
@@ -122,7 +130,7 @@ export interface ClawbotConfig {
122
130
  workspaceInstructions: boolean;
123
131
  /**
124
132
  * Whether the `/plugins/clawbot/mcp/*` bridge answers requests — the surface
125
- * dsh-mcp-bridge (and therefore Claude Code) calls. Off makes every route
133
+ * an MCP client (the bundled clawbot-mcp, or a Claude Code MCP server) calls. Off makes every route
126
134
  * return 403 while leaving them registered, so this is a live kill switch
127
135
  * rather than something needing a restart.
128
136
  */
@@ -139,12 +147,17 @@ export interface ClawbotConfig {
139
147
  codexPeer: boolean;
140
148
  codexTransport: "socket" | "stdio";
141
149
  /**
142
- * macOS Calendar for the bot (mac-calendar.ts): read every calendar, plan in
143
- * one dedicated calendar. Off by default and cold for the same reason as
144
- * codexPeer: while off the tools are not registered, so it costs nothing.
150
+ * 全天候秘书, the all-day secretary: the macOS Calendar (mac-calendar.ts: read
151
+ * every calendar, plan in one dedicated calendar) and alarms (mac-alarms.ts:
152
+ * urgent reminders that ring like an alarm). Off by default; while off the
153
+ * tools are not registered, so it costs nothing. The settings card's one
154
+ * switch sets this and `secretary` together.
145
155
  */
146
156
  macCalendar: boolean;
147
- /** The dedicated calendar's name, chosen by the owner (created on first use). Hot. */
157
+ /**
158
+ * The dedicated calendar's name, chosen by the owner (created on first use). Hot.
159
+ * The alarm list takes it the first time and is then kept by id through renames.
160
+ */
148
161
  macCalendarName: string;
149
162
  /**
150
163
  * Whether events the bot adds get a calendar alert by default, and how many
@@ -154,7 +167,13 @@ export interface ClawbotConfig {
154
167
  macCalendarAlert: boolean;
155
168
  macCalendarAlertMinutes: number;
156
169
  /**
157
- * The scheduling secretary (secretary.ts): planning rules written into
170
+ * Ask the owner on WeChat before adding to, changing or deleting from any
171
+ * calendar but the dedicated one. Hot. Off: the owner's writable calendars
172
+ * are changed directly; a change other attendees would be told about still asks.
173
+ */
174
+ macCalendarAsk: boolean;
175
+ /**
176
+ * The rules of 全天候秘书 (secretary.ts): planning rules written into
158
177
  * memory.md while this and macCalendar are both on, moved out (and kept)
159
178
  * when either goes off. Hot; index.ts edits the memory file on the flip.
160
179
  */
@@ -229,6 +248,7 @@ export declare const BaseConfig: Schema<Schemastery.ObjectS<NoInfer<{
229
248
  stripEmoji: Schema<boolean, boolean, "defined">;
230
249
  autoMemory: Schema<boolean, boolean, "defined">;
231
250
  idleCompaction: Schema<boolean, boolean, "defined">;
251
+ idleCompactionTokens: Schema<number, number, "plain">;
232
252
  workspaceInstructions: Schema<boolean, boolean, "defined">;
233
253
  mcpBridge: Schema<boolean, boolean, "defined">;
234
254
  codexPeer: Schema<boolean, boolean, "defined">;
@@ -238,6 +258,7 @@ export declare const BaseConfig: Schema<Schemastery.ObjectS<NoInfer<{
238
258
  macCalendarName: Schema<string, string, "defined">;
239
259
  macCalendarAlert: Schema<boolean, boolean, "defined">;
240
260
  macCalendarAlertMinutes: Schema<number, number, "defined">;
261
+ macCalendarAsk: Schema<boolean, boolean, "defined">;
241
262
  secretary: Schema<boolean, boolean, "defined">;
242
263
  codexSocket: Schema<string, string, "plain">;
243
264
  maxImageEdge: Schema<number, number, "defined">;
@@ -262,6 +283,7 @@ export declare const BaseConfig: Schema<Schemastery.ObjectS<NoInfer<{
262
283
  stripEmoji: Schema<boolean, boolean, "defined">;
263
284
  autoMemory: Schema<boolean, boolean, "defined">;
264
285
  idleCompaction: Schema<boolean, boolean, "defined">;
286
+ idleCompactionTokens: Schema<number, number, "plain">;
265
287
  workspaceInstructions: Schema<boolean, boolean, "defined">;
266
288
  mcpBridge: Schema<boolean, boolean, "defined">;
267
289
  codexPeer: Schema<boolean, boolean, "defined">;
@@ -271,6 +293,7 @@ export declare const BaseConfig: Schema<Schemastery.ObjectS<NoInfer<{
271
293
  macCalendarName: Schema<string, string, "defined">;
272
294
  macCalendarAlert: Schema<boolean, boolean, "defined">;
273
295
  macCalendarAlertMinutes: Schema<number, number, "defined">;
296
+ macCalendarAsk: Schema<boolean, boolean, "defined">;
274
297
  secretary: Schema<boolean, boolean, "defined">;
275
298
  codexSocket: Schema<string, string, "plain">;
276
299
  maxImageEdge: Schema<number, number, "defined">;
@@ -1 +1 @@
1
- {"version":3,"file":"config.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O,MAAM,cAAc,EAAE,aAiC5B,CAAC;AAOF,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CA6FrG;AAED;;;;;;;;;;;;GAYG;AACH;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA0IrB,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,0BAqCrB,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,EAOH,OAAO,UAAU,CAAC;AAElC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG;IAAE,GAAG,IAAI,CAAC,CAAA;CAAE,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAI3E;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,CAK/E"}
package/lib/config.js CHANGED
@@ -54,6 +54,7 @@ export const DEFAULT_CONFIG = {
54
54
  macCalendarName: "",
55
55
  macCalendarAlert: true,
56
56
  macCalendarAlertMinutes: 10,
57
+ macCalendarAsk: true,
57
58
  secretary: false,
58
59
  imageQuality: 80,
59
60
  compressThresholdBytes: 1024 * 1024,
@@ -107,6 +108,9 @@ export function normalizeConfig(raw) {
107
108
  stripEmoji: typeof r.stripEmoji === "boolean" ? r.stripEmoji : DEFAULT_CONFIG.stripEmoji,
108
109
  autoMemory: typeof r.autoMemory === "boolean" ? r.autoMemory : DEFAULT_CONFIG.autoMemory,
109
110
  idleCompaction: typeof r.idleCompaction === "boolean" ? r.idleCompaction : DEFAULT_CONFIG.idleCompaction,
111
+ idleCompactionTokens: typeof r.idleCompactionTokens === "number" && Number.isFinite(r.idleCompactionTokens) && r.idleCompactionTokens > 0
112
+ ? Math.round(r.idleCompactionTokens)
113
+ : undefined,
110
114
  workspaceInstructions: typeof r.workspaceInstructions === "boolean" ? r.workspaceInstructions : DEFAULT_CONFIG.workspaceInstructions,
111
115
  mcpBridge: typeof r.mcpBridge === "boolean" ? r.mcpBridge : DEFAULT_CONFIG.mcpBridge,
112
116
  codexPeer: typeof r.codexPeer === "boolean" ? r.codexPeer : DEFAULT_CONFIG.codexPeer,
@@ -117,6 +121,7 @@ export function normalizeConfig(raw) {
117
121
  macCalendarAlertMinutes: typeof r.macCalendarAlertMinutes === "number" && Number.isFinite(r.macCalendarAlertMinutes)
118
122
  ? Math.min(10_080, Math.max(0, Math.round(r.macCalendarAlertMinutes)))
119
123
  : DEFAULT_CONFIG.macCalendarAlertMinutes,
124
+ macCalendarAsk: typeof r.macCalendarAsk === "boolean" ? r.macCalendarAsk : DEFAULT_CONFIG.macCalendarAsk,
120
125
  secretary: typeof r.secretary === "boolean" ? r.secretary : DEFAULT_CONFIG.secretary,
121
126
  codexBinary: typeof r.codexBinary === "string" && r.codexBinary.trim() ? r.codexBinary.trim() : undefined,
122
127
  codexSocket: typeof r.codexSocket === "string" && r.codexSocket.trim() ? r.codexSocket.trim() : undefined,
@@ -175,6 +180,10 @@ export const BaseConfig = Schema.object({
175
180
  .default(true)
176
181
  .description("空闲时整理对话(默认开):回复结束、安静 10 分钟后,如果上一次请求已接近宿主的压缩阈值,"
177
182
  + "就趁空闲把旧对话整理成摘要。下一条消息来时不用再等压缩。关掉则只剩宿主在回复前压缩。"),
183
+ idleCompactionTokens: Schema.number()
184
+ .min(0)
185
+ .description("空闲整理阈值(token):上一次请求超过这个数,空闲时就整理。留空 = 宿主压缩阈值的 85%。"
186
+ + "只管 bot:宿主阈值跟着模型窗口走、网页会话也用同一个窗口,改窗口会让网页一起提前压缩,改这里不会。"),
178
187
  workspaceInstructions: Schema.boolean()
179
188
  .default(true)
180
189
  .description("把工作目录的说明文件(AGENTS.md / CLAUDE.md)交给 bot(默认开,DSH 原样)。"
@@ -193,10 +202,10 @@ export const BaseConfig = Schema.object({
193
202
  .description("【改动会重启微信监听】Codex CLI 路径,留空自动查找"),
194
203
  macCalendar: Schema.boolean()
195
204
  .default(false)
196
- .description("【改动会重启微信监听】让 bot 读取 Mac「日历」里所有账户的日程(含备注),并在专用日历里自主安排(仅 macOS,默认关)。关着时不占 token"),
205
+ .description("【全天候秘书】【改动会重启微信监听】让 bot 读取 Mac「日历」里所有账户的日程(含备注)、在专用日历里自主安排,并能设闹钟(紧急提醒:到点像闹钟一样响,响在「查找」里作为“我的位置”的设备上,一般是 iPhone)。仅 macOS,默认关;关着时不占 token。打开后在 Mac 前点设置卡片上的「一键授权」。设置卡片上的开关会连同 secretary 一起拨"),
197
206
  macCalendarName: Schema.string()
198
207
  .default("")
199
- .description("bot 专用日历的名字(例如「规划」)。bot 在这个日历里自主加、改、删;动别的日历会先在微信里问你。第一次添加时自动创建"),
208
+ .description("bot 专用日历的名字(例如「规划」)。bot 在这个日历里自主加、改、删;动别的日历前问不问你,看「改别的日历前先问我」。第一次用到时自动创建。闹钟清单第一次设闹钟时按它起名(「规划 闹钟」),之后改名字也继续用那个清单(已经设的闹钟不会丢)"),
200
209
  macCalendarAlert: Schema.boolean()
201
210
  .default(true)
202
211
  .description("bot 往日历里加日程时,默认带一个日历提醒(会在手机上响)。和 bot 的微信提醒重复没关系;全天日程不加"),
@@ -205,9 +214,12 @@ export const BaseConfig = Schema.object({
205
214
  .min(0)
206
215
  .max(10080)
207
216
  .description("日历提醒提前几分钟(0 = 开始时)"),
217
+ macCalendarAsk: Schema.boolean()
218
+ .default(true)
219
+ .description("bot 往专用日历以外的日历里加、改、删日程前,先在微信里问你,回「好」才动(默认开)。关掉就直接改;只读和订阅的日历本来就改不了,会通知其他参与者的改动仍会先问"),
208
220
  secretary: Schema.boolean()
209
221
  .default(false)
210
- .description("日程秘书(要先开 Mac 日历):打开时把一套排日程的规则写进长期记忆 memory.md 的「## 日程秘书」一节,可以自己改;关掉时移出记忆并留一份副本,再打开原样放回"),
222
+ .description("全天候秘书的规则(要 macCalendar 也开着):打开时把一套排日程、定闹钟的规则写进长期记忆 memory.md 的「## 全天候秘书」一节,可以自己改;关掉时移出记忆并留一份副本,再打开原样放回。设置卡片上和 macCalendar 是同一个开关"),
211
223
  codexSocket: Schema.string()
212
224
  .description("【改动会重启微信监听】共享 App Server 的 socket 路径,留空使用 Codex 默认路径"),
213
225
  maxImageEdge: Schema.number()
@@ -295,6 +307,7 @@ export const HOT_FIELDS = new Set([
295
307
  // 纯读取的开关,下一条消息生效即可,不需要重启。
296
308
  "autoMemory",
297
309
  "idleCompaction",
310
+ "idleCompactionTokens",
298
311
  "workspaceInstructions",
299
312
  "stripEmoji",
300
313
  "mcpBridge",
@@ -316,6 +329,7 @@ export const HOT_FIELDS = new Set([
316
329
  "macCalendarName",
317
330
  "macCalendarAlert",
318
331
  "macCalendarAlertMinutes",
332
+ "macCalendarAsk",
319
333
  // index.ts adds or removes the rules in memory.md when it flips.
320
334
  "secretary",
321
335
  ]);