wechat-clawbot 0.9.2 → 0.9.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/lib/client.js CHANGED
@@ -20,18 +20,23 @@
20
20
  * If the host restyles those cards, re-read their rules and update here; there
21
21
  * is no shared stylesheet to inherit from.
22
22
  *
23
- * ## Two things about this slot
23
+ * ## Where this card lives (DSH 0.1.7)
24
24
  *
25
- * 1. `settings.plugin.item` is a KEYED slot. Registering without
26
- * `options.key` throws "keyed slot requires options.key", and the client
27
- * plugin tree has no isolation — that single throw takes the whole sidebar
28
- * down with it, conversation list included.
25
+ * 1. 0.1.7 moved plugin configuration out of Settings into the **Plugins**
26
+ * sidebar page. A bundle's own card is the `plugins.bundle.config` slot,
27
+ * keyed by the bundle's PACKAGE name (`PACKAGE` below — the npm publish
28
+ * rename rewrites it along with everything else). It is a KEYED slot:
29
+ * registering without `options.key` throws, and the client plugin tree has
30
+ * no isolation — one throw takes the whole page down.
29
31
  *
30
- * 2. Everything this card writes goes through `settingsScope`, so it lands in
31
- * the settings document's `clawbot` section — an override layer over the
32
- * plugin's cordis row, never a replacement for it. `snapshot.user` is what
33
- * says whether a field is overridden, which drives the 已覆盖 badge and the
34
- * per-field 重置, exactly as the built-in cards do it.
32
+ * 2. Reads and writes go through `ctx.configForms.get(<entry id>)` — the
33
+ * Loader entry id `clawbot`, which 0.1.7 also uses as the settings form
34
+ * id. (0.1.5's `settingsScope` is gone; naming it in `inject` is exactly
35
+ * what left 0.1.7 stuck on "Failed to load plugins … waiting for service:
36
+ * settingsScope".) The snapshot keeps `status` / `value` / `user` /
37
+ * `writable`, so `snapshot.user` still says whether a field is overridden,
38
+ * which drives the 已覆盖 badge and the per-field 重置. Writes land in the
39
+ * profile's cordis patch, not a separate settings document.
35
40
  *
36
41
  * The fields shown here are the ones the running plugin adopts in place
37
42
  * (HOT_FIELDS in src/config.ts). Cold ones are deliberately absent rather than
@@ -61,7 +66,10 @@ window.__ModuleLoader__.load({
61
66
  const h = react.createElement;
62
67
  const { useState, useEffect } = react;
63
68
 
69
+ /** Loader entry id; since DSH 0.1.7 also the settings form id. */
64
70
  const NAMESPACE = "clawbot";
71
+ /** Package name: the key of this bundle's `plugins.bundle.config` card. */
72
+ const PACKAGE = "wechat-clawbot";
65
73
  const MB = 1024 * 1024;
66
74
  const MODELS_URL = "/plugins/clawbot/models";
67
75
  const BRIDGE_URL = "/plugins/clawbot/mcp/status";
@@ -580,11 +588,11 @@ window.__ModuleLoader__.load({
580
588
  }
581
589
 
582
590
  const name = "wechat-clawbot-client";
583
- const inject = ["slots", "settingsScope"];
591
+ const inject = ["slots", "configForms"];
584
592
 
585
593
  function apply(ctx) {
586
594
  ensureStyles();
587
- const scope = ctx.settingsScope.bind({ namespace: NAMESPACE });
595
+ const scope = ctx.configForms.get(NAMESPACE);
588
596
  const project = () => {
589
597
  const snap = scope.getSnapshot();
590
598
  return {
@@ -598,28 +606,32 @@ window.__ModuleLoader__.load({
598
606
  };
599
607
  };
600
608
  const store = runtime.createSnapshotStore(project());
601
- scope.subscribe(() => {
609
+ ctx.effect(() => scope.subscribe(() => {
602
610
  store.set(project());
603
- });
611
+ }), "clawbot: settings form subscription");
604
612
 
605
- ctx.slots.inject("settings.plugin.item", () =>
606
- ctx.slots.register(
607
- {
608
- name: "settings.plugin.item",
609
- // Keyed slot: omitting `key` throws, and one throw here takes the
610
- // entire sidebar down (no isolation in the client plugin tree).
611
- key: NAMESPACE,
612
- id: NAMESPACE,
613
- order: 50,
614
- inject: () => ({
615
- hooks: { clawbot: store },
616
- set: (field, value) => scope.set(field, value),
617
- clear: (field) => scope.unset(field),
618
- }),
619
- },
620
- Card,
613
+ // Only while the Host serves the entry's form — i.e. the server half is
614
+ // up and declared its volatile fields — and withdrawn if it stops.
615
+ ctx.effect(() => ctx.configForms.whileServed([NAMESPACE], () =>
616
+ ctx.slots.inject("plugins.bundle.config", () =>
617
+ ctx.slots.register(
618
+ {
619
+ name: "plugins.bundle.config",
620
+ // Keyed slot: omitting `key` throws, and one throw here takes the
621
+ // entire page down (no isolation in the client plugin tree).
622
+ key: PACKAGE,
623
+ id: NAMESPACE,
624
+ order: 50,
625
+ inject: () => ({
626
+ hooks: { clawbot: store },
627
+ set: (field, value) => scope.set(field, value),
628
+ clear: (field) => scope.unset(field),
629
+ }),
630
+ },
631
+ Card,
632
+ ),
621
633
  ),
622
- );
634
+ ), "clawbot: plugins page card");
623
635
  }
624
636
 
625
637
  exports.apply = apply;
package/lib/config.d.ts CHANGED
@@ -73,15 +73,24 @@ export interface ClawbotConfig {
73
73
  /**
74
74
  * Whether the auto-memory classifier may run.
75
75
  *
76
- * **Off by default, and the default matters.** When it is on, a message that
77
- * looks like a durable personal fact ("我住在…", "我不能喝咖啡") is sent
78
- * VERBATIM to `api.deepseek.com` to be judged worth remembering, paid for
79
- * with the `DEEPSEEK_API_KEY` this plugin reads out of
80
- * `~/.dsh/.credentials.yaml`. That is a second destination beyond whatever
81
- * model the harness itself is configured to use —— a deployment pointed at a
82
- * local model, or at a university gateway, would not expect its WeChat text
83
- * to reach DeepSeek at all. Opting in is the owner's call, so shipping it on
84
- * would be making that call for them.
76
+ * **Off by default.** When it is on, a message that looks like a durable
77
+ * personal fact ("我住在…", "我不能喝咖啡") is sent VERBATIM to a model to be
78
+ * judged worth remembering.
79
+ *
80
+ * Since 0.9.3 that model is **the one this session already routes to**: the
81
+ * classifier goes through the host `llm` service with `currentRoute()`, so
82
+ * it inherits the owner's provider, model and credentials.
83
+ *
84
+ * Up to 0.9.2 it POSTed to `api.deepseek.com` with a hardcoded
85
+ * `deepseek-chat` and the `DEEPSEEK_API_KEY` read out of
86
+ * `~/.dsh/.credentials.yaml` — a second destination beyond whatever model
87
+ * the harness was configured to use. Worse, moving the bot to another
88
+ * provider did not move the classifier, so switching *widened* the split
89
+ * instead of closing it. That hop is gone; do not reintroduce it (the
90
+ * regression suite fails on any vendor URL or key name in memory-auto).
91
+ *
92
+ * It stays off by default anyway: an extra call on the owner's own text,
93
+ * selecting precisely its most personal slice, is still their call to make.
85
94
  *
86
95
  * Turning it off does not disable memory: `remember_user_info` still works,
87
96
  * the agent just has to decide for itself rather than asking a cheap model.
@@ -149,51 +158,55 @@ export declare function normalizeConfig(raw?: Partial<ClawbotConfig> | Record<st
149
158
  * thing a form cannot infer: whether a change lands immediately or restarts the
150
159
  * WeChat monitor (see HOT_FIELDS below).
151
160
  */
152
- export declare const Config: Schema<Schemastery.ObjectS<{
153
- provider: Schema<string, string>;
154
- model: Schema<string, string>;
155
- reasoningEffort: Schema<string, string>;
156
- allowFrom: Schema<string[], string[]>;
157
- attachImages: Schema<boolean, boolean>;
158
- stripEmoji: Schema<boolean, boolean>;
159
- autoMemory: Schema<boolean, boolean>;
160
- mcpBridge: Schema<boolean, boolean>;
161
- maxImageEdge: Schema<number, number>;
162
- imageQuality: Schema<number, number>;
163
- compressThresholdBytes: Schema<number, number>;
164
- noticeMinBytes: Schema<number, number>;
165
- approvalTimeoutMs: Schema<number, number>;
166
- logLevel: Schema<"debug" | "info" | "warn" | "error", "debug" | "info" | "warn" | "error">;
167
- claudeResumePermissionMode: Schema<"acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit", "acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit">;
168
- autoStart: Schema<boolean, boolean>;
169
- sessionId: Schema<string, string>;
170
- forwardQuestions: Schema<boolean, boolean>;
171
- botAgent: Schema<string, string>;
172
- apiBaseUrl: Schema<string, string>;
173
- cwd: Schema<string, string>;
174
- }>, Schemastery.ObjectT<{
175
- provider: Schema<string, string>;
176
- model: Schema<string, string>;
177
- reasoningEffort: Schema<string, string>;
178
- allowFrom: Schema<string[], string[]>;
179
- attachImages: Schema<boolean, boolean>;
180
- stripEmoji: Schema<boolean, boolean>;
181
- autoMemory: Schema<boolean, boolean>;
182
- mcpBridge: Schema<boolean, boolean>;
183
- maxImageEdge: Schema<number, number>;
184
- imageQuality: Schema<number, number>;
185
- compressThresholdBytes: Schema<number, number>;
186
- noticeMinBytes: Schema<number, number>;
187
- approvalTimeoutMs: Schema<number, number>;
188
- logLevel: Schema<"debug" | "info" | "warn" | "error", "debug" | "info" | "warn" | "error">;
189
- claudeResumePermissionMode: Schema<"acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit", "acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit">;
190
- autoStart: Schema<boolean, boolean>;
191
- sessionId: Schema<string, string>;
192
- forwardQuestions: Schema<boolean, boolean>;
193
- botAgent: Schema<string, string>;
194
- apiBaseUrl: Schema<string, string>;
195
- cwd: Schema<string, string>;
196
- }>>;
161
+ /**
162
+ * Every field, as plain values. `normalizeConfig`, the tests and anything that
163
+ * wants a value (not a live reference) use this.
164
+ */
165
+ export declare const BaseConfig: Schema<Schemastery.ObjectS<NoInfer<{
166
+ provider: Schema<string, string, "plain">;
167
+ model: Schema<string, string, "plain">;
168
+ reasoningEffort: Schema<string, string, "plain">;
169
+ allowFrom: Schema<string[], string[], "defined">;
170
+ attachImages: Schema<boolean, boolean, "defined">;
171
+ stripEmoji: Schema<boolean, boolean, "defined">;
172
+ autoMemory: Schema<boolean, boolean, "defined">;
173
+ mcpBridge: Schema<boolean, boolean, "defined">;
174
+ maxImageEdge: Schema<number, number, "defined">;
175
+ imageQuality: Schema<number, number, "defined">;
176
+ compressThresholdBytes: Schema<number, number, "defined">;
177
+ noticeMinBytes: Schema<number, number, "defined">;
178
+ approvalTimeoutMs: Schema<number, number, "defined">;
179
+ logLevel: Schema<"debug" | "info" | "warn" | "error", "debug" | "info" | "warn" | "error", "defined">;
180
+ claudeResumePermissionMode: Schema<"acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit", "acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit", "defined">;
181
+ autoStart: Schema<boolean, boolean, "defined">;
182
+ sessionId: Schema<string, string, "defined">;
183
+ forwardQuestions: Schema<boolean, boolean, "defined">;
184
+ botAgent: Schema<string, string, "defined">;
185
+ apiBaseUrl: Schema<string, string, "defined">;
186
+ cwd: Schema<string, string, "plain">;
187
+ }>>, Schemastery.ObjectT<NoInfer<{
188
+ provider: Schema<string, string, "plain">;
189
+ model: Schema<string, string, "plain">;
190
+ reasoningEffort: Schema<string, string, "plain">;
191
+ allowFrom: Schema<string[], string[], "defined">;
192
+ attachImages: Schema<boolean, boolean, "defined">;
193
+ stripEmoji: Schema<boolean, boolean, "defined">;
194
+ autoMemory: Schema<boolean, boolean, "defined">;
195
+ mcpBridge: Schema<boolean, boolean, "defined">;
196
+ maxImageEdge: Schema<number, number, "defined">;
197
+ imageQuality: Schema<number, number, "defined">;
198
+ compressThresholdBytes: Schema<number, number, "defined">;
199
+ noticeMinBytes: Schema<number, number, "defined">;
200
+ approvalTimeoutMs: Schema<number, number, "defined">;
201
+ logLevel: Schema<"debug" | "info" | "warn" | "error", "debug" | "info" | "warn" | "error", "defined">;
202
+ claudeResumePermissionMode: Schema<"acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit", "acceptEdits" | "auto" | "bypassPermissions" | "manual" | "dontAsk" | "plan" | "inherit", "defined">;
203
+ autoStart: Schema<boolean, boolean, "defined">;
204
+ sessionId: Schema<string, string, "defined">;
205
+ forwardQuestions: Schema<boolean, boolean, "defined">;
206
+ botAgent: Schema<string, string, "defined">;
207
+ apiBaseUrl: Schema<string, string, "defined">;
208
+ cwd: Schema<string, string, "plain">;
209
+ }>>, "plain">;
197
210
  /**
198
211
  * Fields a running plugin can adopt in place, without tearing anything down.
199
212
  *
@@ -209,4 +222,30 @@ export declare const Config: Schema<Schemastery.ObjectS<{
209
222
  * fields therefore default to the safe behaviour rather than the fast one.
210
223
  */
211
224
  export declare const HOT_FIELDS: Set<keyof ClawbotConfig>;
225
+ /**
226
+ * What the host reads. Same fields as `BaseConfig`, with every HOT field marked
227
+ * `.volatile()` — derived from `HOT_FIELDS` so "is this field live?" has exactly
228
+ * one answer in this codebase.
229
+ *
230
+ * DSH 0.1.7 replaced `installSettingsSection` with this: the settings service
231
+ * edits only volatile fields (the Plugins page shows nothing else), and the
232
+ * Loader commits a volatile-only change straight into the running fiber's
233
+ * references WITHOUT restarting it, then emits `loader/volatile-update` to this
234
+ * fiber alone. A change to any other field restarts the fiber. That is the old
235
+ * hot/cold split, now enforced by the host instead of by this plugin.
236
+ *
237
+ * A volatile field does NOT resolve to its value: `Config(raw).provider` is a
238
+ * `{ get() }` reference. `index.ts` unwraps the whole row with `liveValue()`
239
+ * before normalising, so the rest of the plugin still sees plain values.
240
+ */
241
+ export declare const Config: typeof BaseConfig;
242
+ /**
243
+ * A volatile field's live value; plain values pass through. Reading through
244
+ * this at the moment of use is how a committed edit shows up with no restart.
245
+ */
246
+ export declare function liveValue<T>(v: T | {
247
+ get(): T;
248
+ } | undefined): T | undefined;
249
+ /** Snapshot a resolved cordis row whose hot fields are live references. */
250
+ export declare function snapshotConfig(raw: unknown): Partial<ClawbotConfig> | undefined;
212
251
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,oFAE1B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,+FAAmD,CAAC;AAEpF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,+FAAmD,CAAC;AACtF,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,C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CHANGED
@@ -122,7 +122,11 @@ export function normalizeConfig(raw) {
122
122
  * thing a form cannot infer: whether a change lands immediately or restarts the
123
123
  * WeChat monitor (see HOT_FIELDS below).
124
124
  */
125
- export const Config = Schema.object({
125
+ /**
126
+ * Every field, as plain values. `normalizeConfig`, the tests and anything that
127
+ * wants a value (not a live reference) use this.
128
+ */
129
+ export const BaseConfig = Schema.object({
126
130
  provider: Schema.string()
127
131
  .description("固定这个 bot 用的 provider(如 harvard)。留空 = 跟随全局默认模型"),
128
132
  model: Schema.string()
@@ -140,9 +144,11 @@ export const Config = Schema.object({
140
144
  .description("发出去的文字里去掉 Unicode emoji(改用微信原生表情代码)"),
141
145
  autoMemory: Schema.boolean()
142
146
  .default(false)
143
- .description("自动记忆:像个人信息的消息会被**原文发到 api.deepseek.com** 让它判断值不值得记住,"
144
- + "用的是 ~/.dsh/.credentials.yaml 里的 DEEPSEEK_API_KEY。默认关闭 —— "
145
- + "这是除宿主模型之外的第二个数据去向,要不要开由你决定。关掉不影响 remember_user_info。"),
147
+ .description("自动记忆:像个人信息的消息会被**原文发给模型**判断值不值得记住。"
148
+ + "0.9.3 起用的就是**这个会话正在用的模型**(走宿主 llm 服务),"
149
+ + "不再是以前那个写死的 api.deepseek.com —— 所以不再有额外的数据去向。"
150
+ + "默认仍然关闭:对你自己的文本多发一次请求,要不要开由你决定。"
151
+ + "关掉不影响 remember_user_info。"),
146
152
  mcpBridge: Schema.boolean()
147
153
  .default(true)
148
154
  .description("开放 Claude 桥(/plugins/clawbot/mcp/*):让 Claude Code 列出/读取/驱动 DSH 会话,并通过 bot 给你发微信。只监听本机,而且每个请求都要 token"),
@@ -241,4 +247,42 @@ export const HOT_FIELDS = new Set([
241
247
  // Read fresh on each send, so changing it takes effect on the next message.
242
248
  "claudeResumePermissionMode",
243
249
  ]);
250
+ /**
251
+ * What the host reads. Same fields as `BaseConfig`, with every HOT field marked
252
+ * `.volatile()` — derived from `HOT_FIELDS` so "is this field live?" has exactly
253
+ * one answer in this codebase.
254
+ *
255
+ * DSH 0.1.7 replaced `installSettingsSection` with this: the settings service
256
+ * edits only volatile fields (the Plugins page shows nothing else), and the
257
+ * Loader commits a volatile-only change straight into the running fiber's
258
+ * references WITHOUT restarting it, then emits `loader/volatile-update` to this
259
+ * fiber alone. A change to any other field restarts the fiber. That is the old
260
+ * hot/cold split, now enforced by the host instead of by this plugin.
261
+ *
262
+ * A volatile field does NOT resolve to its value: `Config(raw).provider` is a
263
+ * `{ get() }` reference. `index.ts` unwraps the whole row with `liveValue()`
264
+ * before normalising, so the rest of the plugin still sees plain values.
265
+ */
266
+ export const Config = Schema.object(Object.fromEntries(Object.entries(BaseConfig.dict ?? {}).map(([key, field]) => [
267
+ key,
268
+ HOT_FIELDS.has(key) ? field.volatile() : field,
269
+ ])));
270
+ /**
271
+ * A volatile field's live value; plain values pass through. Reading through
272
+ * this at the moment of use is how a committed edit shows up with no restart.
273
+ */
274
+ export function liveValue(v) {
275
+ return v !== null && typeof v === "object" && typeof v.get === "function"
276
+ ? v.get()
277
+ : v;
278
+ }
279
+ /** Snapshot a resolved cordis row whose hot fields are live references. */
280
+ export function snapshotConfig(raw) {
281
+ if (raw === null || typeof raw !== "object")
282
+ return raw;
283
+ const out = {};
284
+ for (const [key, value] of Object.entries(raw))
285
+ out[key] = liveValue(value);
286
+ return out;
287
+ }
244
288
  //# sourceMappingURL=config.js.map
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAI9C;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,aAAa,EAAE,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM;CAC/D,CAAC;AAGX;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,GAAG,uBAAu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AC,OAAO,CAAC,GAA8B,CAAC;QAAE,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACvG,OAAO,GAA6B,CAAC;AACvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAuBtF,qDAAqD;AACrD,eAAO,MAAM,IAAI,YAAY,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAkD,CAAC;AAKtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CA4S3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAA+C,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAuB9F,qDAAqD;AACrD,eAAO,MAAM,IAAI,YAAY,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAkD,CAAC;AAKtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CA8R3F"}
package/lib/index.js CHANGED
@@ -1,5 +1,4 @@
1
- import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
2
- import { Config, normalizeConfig, HOT_FIELDS } from "./config.js";
1
+ import { normalizeConfig, snapshotConfig, HOT_FIELDS } from "./config.js";
3
2
  import { WechatBridge } from "./bridge.js";
4
3
  import { InboundRouter } from "./inbound.js";
5
4
  import { ApprovalRelay } from "./approvals.js";
@@ -29,37 +28,22 @@ export const inject = ["agents", "sessions", "tools", "systemPrompt"];
29
28
  // update hook below ever sees it.
30
29
  export { Config } from "./config.js";
31
30
  export function apply(ctx, rawConfig) {
32
- const config = normalizeConfig(rawConfig);
31
+ // Since DSH 0.1.7 the hot fields of `rawConfig` are live `{ get() }`
32
+ // references (they are `.volatile()` in `Config`), so the row must be
33
+ // unwrapped BEFORE normalising: `normalizeConfig` checks `typeof … ===
34
+ // "string"`, and a reference would silently fall back to every default —
35
+ // the bot would boot on the harness default model with none of its settings.
36
+ const config = normalizeConfig(snapshotConfig(rawConfig));
33
37
  setLogLevel(config.logLevel);
34
38
  setBotAgent(config.botAgent);
35
- // Put this plugin's config on the settings page, and adopt what can be
36
- // adopted without tearing anything down.
37
- //
38
- // `installSettingsSection` is the sanctioned wiring for an OPTIONAL settings
39
- // service: it registers the namespace with this plugin's cordis row as the
40
- // `base` layer (so `cordis.patch.yml` stays the composition default and the
41
- // settings document only carries overrides), points a thunk at whichever of
42
- // the two is currently authoritative, and calls `onChange` after every
43
- // committed change. Where no settings service is mounted, none of it runs and
44
- // the plugin behaves exactly as composed.
45
- //
46
- // Not `internal/update`: that fires for cordis-level config edits, which
47
- // restart the fiber by design. This is the live surface.
48
- //
49
39
  // Mutating `config` in place is what makes adoption work at all: bridge,
50
40
  // inbound, approvals and the tools each hold a reference to this same object
51
41
  // and read the field at the moment they use it. Replacing the reference would
52
42
  // update nobody.
53
- // The base layer must be an IMMUTABLE snapshot of the cordis row, never the
54
- // live `config` object. Passing the live one makes hot-apply mutate the base
55
- // as a side effect: clearing an override in the UI then "resets" to whatever
56
- // was last applied instead of to what the profile composed. (Observed: set
57
- // quality to 85, clear the field, and it fell back to 85.)
58
- const composed = normalizeConfig(rawConfig);
59
- let readSettings;
43
+ // Reads the running fiber's references on every call, so it always returns
44
+ // the values the Loader last committed.
45
+ const readSettings = () => snapshotConfig(rawConfig);
60
46
  const adoptSettings = () => {
61
- if (readSettings === undefined)
62
- return;
63
47
  const incoming = normalizeConfig(readSettings());
64
48
  const changed = Object.keys(incoming)
65
49
  .filter((key) => JSON.stringify(incoming[key]) !== JSON.stringify(config[key]));
@@ -96,34 +80,28 @@ export function apply(ctx, rawConfig) {
96
80
  if (cold.length > 0)
97
81
  logger.info(`设置已保存 [${cold.join(", ")}],但要等重启才生效(/restart 或小鲸鱼的重启按钮)`);
98
82
  };
99
- // Put this plugin's config on the settings page, and adopt what can be
100
- // adopted without tearing anything down.
101
- //
102
- // `installSettingsSection` is the sanctioned wiring for an OPTIONAL settings
103
- // service: it registers the namespace with the composed cordis row as the
104
- // `base` layer (so `cordis.patch.yml` stays the default and the settings
105
- // document carries only overrides), points a thunk at whichever of the two is
106
- // authoritative, and calls `onChange` after every committed change. Where no
107
- // settings service is mounted, none of it runs and the plugin behaves exactly
108
- // as composed.
83
+ // Adopt live edits without tearing anything down.
109
84
  //
110
- // Adopting from BOTH hooks is belt-and-braces. `setSource` runs when the
111
- // authoritative source changes (scope attaches or detaches), `onChange` after
112
- // a committed change; in practice attach pairs the two, so a value already in
113
- // settings.yaml is picked up at startup either way. Nothing here depends on
114
- // that pairing holding, and adoption is idempotent — a redundant call costs
115
- // one no-op diff.
85
+ // DSH 0.1.7 removed `installSettingsSection`. The replacement is structural:
86
+ // HOT fields are `.volatile()` in `Config`, the Plugins page edits exactly
87
+ // those, and when an edit touches only volatile fields the Loader commits the
88
+ // new values into this fiber's references in place — no restart — then emits
89
+ // `loader/volatile-update` to this fiber alone. Any other field changing
90
+ // restarts the fiber, which is what cold fields always needed anyway, and
91
+ // those are not on the page at all.
116
92
  //
117
- // Not `internal/update`: that fires for cordis-level config edits, which
118
- // restart the fiber by design. This is the live surface.
119
- installSettingsSection(ctx, settingsNamespace("clawbot"), Config, composed, {
120
- setSource(current) {
121
- readSettings = current;
122
- adoptSettings();
123
- },
124
- onChange() {
125
- adoptSettings();
126
- },
93
+ // So the only job left here is the side effects: `adoptSettings` re-reads the
94
+ // references, diffs against the plain `config` every other module holds,
95
+ // copies the hot fields in place, re-points the model selection and the log
96
+ // level, and logs what took effect. Unchanged logic, new trigger. The event
97
+ // is a Loader event, absent from cordis's typed map, hence the cast.
98
+ ctx.on("loader/volatile-update", () => adoptSettings());
99
+ // This plugin ships its own card (the Plugins page, via the browser half), so
100
+ // tell the settings service not to auto-generate a competing page. Optional
101
+ // inject: naming `settings` in `inject` would make it a hard requirement, and
102
+ // a bare `ctx.settings` read throws.
103
+ ctx.inject(["settings"], (child) => {
104
+ child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
127
105
  });
128
106
  // Register the WeChat conversation guidance GLOBALLY with a dynamic text
129
107
  // provider: it yields the rules ONLY for the WeChat session (by session id),
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAqB,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;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AAiB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CA4FxE"}
1
+ {"version":3,"file":"mcp-route.d.ts","sourceRoot":"","sources":["../src/mcp-route.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAatE,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,MAAM,EAAE;QACN,SAAS,EAAE,OAAO,CAAC;QACnB,8EAA8E;QAC9E,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,qEAAqE;IACrE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,mEAAmE;IACnE,UAAU,EAAE,MAAM,qBAAqB,GAAG,IAAI,CAAC;CAChD,CAAC;AAiBF;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAiBvC;AAmWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CA4FxE"}
package/lib/mcp-route.js CHANGED
@@ -191,7 +191,9 @@ function mirrorIntoSession(ctx, sessionId, text) {
191
191
  return false;
192
192
  const message = createUserMessage({
193
193
  content: [{ type: "text", text: `[Claude 发给用户的] ${text}` }],
194
- source: { kind: "plugin", plugin: "clawbot-mcp" },
194
+ // v4 refuses the retired `plugin` wrapper; this is the kind the v3→v4
195
+ // converter assigns this producer, so migrated history matches.
196
+ source: { kind: "plugin:clawbot-mcp" },
195
197
  });
196
198
  agent.session.append("user/message", message, { surfaceOp: "append" });
197
199
  logger.info(`mcp notify: mirrored ${text.length} chars into ${sessionId}`);
@@ -313,7 +315,9 @@ function buildHandlers(ctx, deps) {
313
315
  // split — dsh_wechat_notify is the only route that reaches the phone.
314
316
  const message = createUserMessage({
315
317
  content: [{ type: "text", text }],
316
- source: { kind: "plugin", plugin: "clawbot-mcp" },
318
+ // v4 refuses the retired `plugin` wrapper; this is the kind the v3→v4
319
+ // converter assigns this producer, so migrated history matches.
320
+ source: { kind: "plugin:clawbot-mcp" },
317
321
  });
318
322
  const before = agent.session.seq;
319
323
  const wasRunning = agent.status === "running";
@@ -336,7 +340,7 @@ function buildHandlers(ctx, deps) {
336
340
  }),
337
341
  ]);
338
342
  const replies = [];
339
- for (const event of agent.session.events) {
343
+ for (const event of agent.session.snapshotEvents()) {
340
344
  if (event.seq <= before)
341
345
  continue;
342
346
  if (event.type !== "assistant/message")