@michengai/dsh-btw 0.1.17 → 0.1.18

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.1.18] - 2026-10-10
6
+
7
+ - Side questions start again when dsh-tui is installed. The plugin no longer fails to activate, so `/btw` stays available on hosts that use the command registry. Side questions still only answer and do not run tools. A side question that is still cleaning up after the plugin is removed cannot suddenly run tools.
8
+
5
9
  ## [0.1.17] - 2026-10-07
6
10
 
7
11
  - Side-question answers use the host Markdown renderer, so `$...$`, `$$...$$`, and TeX delimiters render as formulas, matching the main conversation. Hosts without that renderer still show the original text. Copy keeps the raw Markdown, and answers do not load remote images.
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## 未发布
4
4
 
5
+ ## [0.1.18] - 2026-10-10
6
+
7
+ - 安装了 dsh-tui 时,旁问插件可以正常启动,不再因为激活失败而缺少 `/btw`。旁问仍然只回答、不执行工具。插件卸载后,尚未清理完的旁问也不会突然获得工具。
8
+
5
9
  ## [0.1.17] - 2026-10-07
6
10
 
7
11
  - 旁问答案使用宿主 Markdown 渲染,`$...$`、`$$...$$` 和 TeX 分隔符与主会话一样显示为公式。宿主没有该渲染器时仍显示原文本。复制仍保留原始 Markdown,答案不加载远程图片。
package/lib/index.js CHANGED
@@ -423,10 +423,21 @@ var PERSONA = `\u4F60\u662F\u5F53\u524D\u4E3B\u4EFB\u52A1\u4E4B\u5916\u7684\u4E0
423
423
  function apply(ctx) {
424
424
  ctx.effect(() => hideInternalCommands(ctx.commands));
425
425
  const labels = /* @__PURE__ */ new Set();
426
- const host = ctx.extend({ fiber: ctx.root.fiber });
427
- const protection = createAnswerOnlyGuard(labels, identityOfFromContext(host));
428
- const releaseGuard = host.tools.guard(protection);
429
- const stopWatch = host.on("session/event", (session, event) => protection.recognize(session, event));
426
+ const protection = createAnswerOnlyGuard(labels, identityOfFromContext(ctx));
427
+ const releasePluginGuard = ctx.tools.guard(protection);
428
+ const childGuards = /* @__PURE__ */ new WeakMap();
429
+ const arm = (agent) => {
430
+ protection.own(agent);
431
+ if (!agent.ctx || childGuards.has(agent)) return;
432
+ childGuards.set(agent, agent.ctx.tools.guard(protection));
433
+ };
434
+ const releaseChild = async (agent) => {
435
+ if (!agent) return;
436
+ const release = childGuards.get(agent);
437
+ childGuards.delete(agent);
438
+ await release?.();
439
+ };
440
+ const stopWatch = ctx.on("session/event", (session, event) => protection.recognize(session, event));
430
441
  const jobs = new SideJobs(async (request) => {
431
442
  const provider = ctx.subagents.getProvider("fork");
432
443
  if (!provider?.inheritsParentContext || !provider.capabilities.toolFilter || !provider.capabilities.persona) {
@@ -445,12 +456,16 @@ function apply(ctx) {
445
456
 
446
457
  ${request.question}` }]
447
458
  });
448
- if (run.localAgent) protection.own(run.localAgent);
459
+ if (run.localAgent) arm(run.localAgent);
449
460
  return {
450
461
  result: run.result,
451
462
  dispose: async () => {
452
- await run.dispose();
453
- labels.delete(label);
463
+ try {
464
+ await run.dispose();
465
+ } finally {
466
+ await releaseChild(run.localAgent);
467
+ labels.delete(label);
468
+ }
454
469
  }
455
470
  };
456
471
  } catch (error) {
@@ -461,7 +476,7 @@ ${request.question}` }]
461
476
  onError: (error) => ctx.logger.warn(error),
462
477
  onIdle: async () => {
463
478
  stopWatch();
464
- await releaseGuard();
479
+ await releasePluginGuard();
465
480
  }
466
481
  });
467
482
  ctx.effect(() => () => jobs.dispose());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-btw",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "DSH 一次性只读旁问插件:基于当前上下文回答,独立气泡,不执行工具 · One-shot read-only side-ask plugin: answers from current context in an independent bubble, no tool execution",
5
5
  "repository": {
6
6
  "type": "git",