@michengai/dsh-btw 0.1.23 → 1.0.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.
package/lib/index.js CHANGED
@@ -42,6 +42,7 @@ var zh = {
42
42
  "error.attachments": "\u65C1\u95EE\u53EA\u63A5\u53D7\u6587\u5B57\uFF0C\u56FE\u7247\u548C\u6587\u4EF6\u4ECD\u4FDD\u7559\u5728\u8F93\u5165\u6846\u4E2D\u3002",
43
43
  "error.removeAttachments": "\u65C1\u95EE\u53EA\u63A5\u53D7\u6587\u5B57\uFF0C\u8BF7\u5148\u79FB\u9664\u56FE\u7247\u548C\u6587\u4EF6\u3002",
44
44
  "error.backend": "BTW \u540E\u7AEF\u5C1A\u672A\u542F\u7528\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u3002",
45
+ "error.subagent": "\u5B50\u4EE3\u7406\u4F1A\u8BDD\u6682\u4E0D\u652F\u6301\u65C1\u95EE\uFF0C\u8BF7\u8FD4\u56DE\u4E3B\u4F1A\u8BDD\u4F7F\u7528 /btw\u3002",
45
46
  "error.empty": "\u8BF7\u8F93\u5165\u65C1\u95EE\u5185\u5BB9\u3002",
46
47
  "error.length": `\u65C1\u95EE\u6700\u591A\u652F\u6301 ${MAX_QUESTION_LENGTH} \u4E2A\u5B57\u7B26\u3002`,
47
48
  "error.capacity": "\u6B63\u5728\u5904\u7406\u7684\u65C1\u95EE\u8F83\u591A\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
@@ -95,6 +96,7 @@ var en = {
95
96
  "error.attachments": "Side questions accept text only. Your images and files remain in the input.",
96
97
  "error.removeAttachments": "Side questions accept text only. Remove the images and files first.",
97
98
  "error.backend": "The BTW backend is unavailable. Check the plugin configuration.",
99
+ "error.subagent": "Side questions are not supported in subagent sessions. Use /btw in the main session.",
98
100
  "error.empty": "Enter a side question.",
99
101
  "error.length": `Side questions are limited to ${MAX_QUESTION_LENGTH.toLocaleString("en-US")} characters.`,
100
102
  "error.capacity": "Too many side questions are running. Try again shortly.",
@@ -452,7 +454,8 @@ function apply(ctx) {
452
454
  }
453
455
  const label = `michengai-btw:${globalThis.crypto.randomUUID()}`;
454
456
  labels.add(label);
455
- if (typeof ctx.subagents.startActivation === "function") {
457
+ const subagents = ctx.subagents;
458
+ if (typeof subagents.startActivation === "function") {
456
459
  const childId = SessionId(globalThis.crypto.randomUUID());
457
460
  let childAgent;
458
461
  try {
@@ -473,7 +476,7 @@ function apply(ctx) {
473
476
  });
474
477
  let activation;
475
478
  try {
476
- activation = await ctx.subagents.startActivation({
479
+ activation = await subagents.startActivation({
477
480
  provider: "fork",
478
481
  label,
479
482
  childId,
@@ -505,13 +508,12 @@ ${request.question}` }]
505
508
  throw error;
506
509
  }
507
510
  }
508
- const legacySubagents = ctx.subagents;
509
- if (typeof legacySubagents.start !== "function") {
511
+ if (typeof subagents.start !== "function") {
510
512
  labels.delete(label);
511
513
  throw new Error(translate(request.locale)("error.provider"));
512
514
  }
513
515
  try {
514
- const run = await legacySubagents.start("fork", {
516
+ const run = await subagents.start("fork", {
515
517
  parent: request.context,
516
518
  label,
517
519
  signal: request.signal,
@@ -14,6 +14,9 @@ export interface SideTransport {
14
14
  run(session: string, id: string, question: string, signal: AbortSignal, reference?: string): Promise<SideResult>;
15
15
  close(session: string, id: string): Promise<SideResult>;
16
16
  }
17
+ /** 宿主在进入 handler 前明确拒绝启动;没有后台任务需要清理。 */
18
+ export declare class SideRequestNotStartedError extends Error {
19
+ }
17
20
  /** 仅内存 UI 状态;关闭请求与答案返回按请求身份分别收敛。 */
18
21
  export declare class BubbleStore {
19
22
  private readonly transport;
@@ -22,6 +25,9 @@ export declare class BubbleStore {
22
25
  private readonly listeners;
23
26
  private readonly active;
24
27
  private readonly closing;
28
+ private readonly notStarted;
29
+ private readonly runEnd;
30
+ private readonly closeFenced;
25
31
  private readonly admitting;
26
32
  private disposed;
27
33
  constructor(transport: SideTransport, t?: BtwTranslate);
@@ -31,6 +37,8 @@ export declare class BubbleStore {
31
37
  ask(sessionId: string, question: string, reference?: string): Promise<string>;
32
38
  close(id: string): Promise<void>;
33
39
  dispose(): Promise<void>;
40
+ private dropIfCloseCannotFinish;
41
+ private remove;
34
42
  private update;
35
43
  private publish;
36
44
  }
@@ -12,5 +12,5 @@ export type HostMarkdownText = ComponentType<{
12
12
  labels: HostMarkdownLabels;
13
13
  variant?: 'body' | 'compact';
14
14
  }>;
15
- /** 宿主基座模块。旧宿主没有它时返回 null,调用方改用自带 Markdown。 */
15
+ /** 宿主基座模块。未导出 MarkdownText 时返回 null,调用方改用自带 Markdown。 */
16
16
  export declare function loadHostMarkdownText(): HostMarkdownText | null;
@@ -35,6 +35,7 @@ export declare const zh: {
35
35
  'error.attachments': string;
36
36
  'error.removeAttachments': string;
37
37
  'error.backend': string;
38
+ 'error.subagent': string;
38
39
  'error.empty': string;
39
40
  'error.length': string;
40
41
  'error.capacity': string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-btw",
3
- "version": "0.1.23",
3
+ "version": "1.0.0",
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",
@@ -64,45 +64,45 @@
64
64
  "license": "Apache-2.0",
65
65
  "peerDependencies": {
66
66
  "@deepseek-ai/cordis": "^4.0.2",
67
- "@deepseek-ai/dsh-commands": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-alpha.3",
68
- "@deepseek-ai/dsh-subagent": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-alpha.3",
69
- "@deepseek-ai/dsh-tools": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-alpha.3",
67
+ "@deepseek-ai/dsh-commands": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
68
+ "@deepseek-ai/dsh-subagent": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
69
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
70
70
  "react": "^18.3.1",
71
- "@deepseek-ai/dsh-session": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-alpha.3",
72
- "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-alpha.3"
71
+ "@deepseek-ai/dsh-session": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
72
+ "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2"
73
73
  },
74
74
  "devDependencies": {
75
- "@deepseek-ai/cordis": "4.0.5-alpha.2",
76
- "@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
77
- "@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.3",
78
- "@deepseek-ai/dsh-api-gateway": "0.2.1-alpha.3",
79
- "@deepseek-ai/dsh-api-session-controller": "0.2.1-alpha.3",
80
- "@deepseek-ai/dsh-attachment": "0.2.1-alpha.3",
81
- "@deepseek-ai/dsh-client-connection": "0.2.1-alpha.3",
82
- "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.3",
83
- "@deepseek-ai/dsh-client-ui-chat": "0.2.1-alpha.3",
84
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-alpha.3",
85
- "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.1-alpha.3",
86
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.3",
87
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.3",
88
- "@deepseek-ai/dsh-client-ui-theme": "0.2.1-alpha.3",
89
- "@deepseek-ai/dsh-commands": "0.2.1-alpha.3",
90
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
91
- "@deepseek-ai/dsh-ptc-runtime": "0.2.1-alpha.3",
92
- "@deepseek-ai/dsh-sandbox": "0.2.1-alpha.3",
93
- "@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.3",
94
- "@deepseek-ai/dsh-scope": "0.2.1-alpha.3",
95
- "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
96
- "@deepseek-ai/dsh-session-persistence": "0.2.1-alpha.3",
97
- "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3",
98
- "@deepseek-ai/dsh-subagent": "0.2.1-alpha.3",
99
- "@deepseek-ai/dsh-subagent-fork-in-process": "0.2.1-alpha.3",
100
- "@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.3",
101
- "@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
102
- "@deepseek-ai/dsh-user-approval": "0.2.1-alpha.3",
103
- "@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.3",
104
- "@deepseek-ai/dsh-typert-registry": "0.2.1-alpha.3",
105
- "@deepseek-ai/dsh-util-time": "0.2.1-alpha.3",
75
+ "@deepseek-ai/cordis": "4.0.5",
76
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.2",
77
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.2",
78
+ "@deepseek-ai/dsh-api-gateway": "0.2.1-rc.2",
79
+ "@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.2",
80
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.2",
81
+ "@deepseek-ai/dsh-client-connection": "0.2.1-rc.2",
82
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
83
+ "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.2",
84
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
85
+ "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.1-rc.2",
86
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
87
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
88
+ "@deepseek-ai/dsh-client-ui-theme": "0.2.1-rc.2",
89
+ "@deepseek-ai/dsh-commands": "0.2.1-rc.2",
90
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
91
+ "@deepseek-ai/dsh-ptc-runtime": "0.2.1-rc.2",
92
+ "@deepseek-ai/dsh-sandbox": "0.2.1-rc.2",
93
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.2",
94
+ "@deepseek-ai/dsh-scope": "0.2.1-rc.2",
95
+ "@deepseek-ai/dsh-session": "0.2.1-rc.2",
96
+ "@deepseek-ai/dsh-session-persistence": "0.2.1-rc.2",
97
+ "@deepseek-ai/dsh-session-projection": "0.2.1-rc.2",
98
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.2",
99
+ "@deepseek-ai/dsh-subagent-fork-in-process": "0.2.1-rc.2",
100
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
101
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
102
+ "@deepseek-ai/dsh-user-approval": "0.2.1-rc.2",
103
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.2",
104
+ "@deepseek-ai/dsh-typert-registry": "0.2.1-rc.2",
105
+ "@deepseek-ai/dsh-util-time": "0.2.1-rc.2",
106
106
  "@types/node": "^22.0.0",
107
107
  "@types/react": "^18.3.1",
108
108
  "@types/react-dom": "^18.3.7",
@@ -115,5 +115,9 @@
115
115
  "remark-gfm": "^4.0.1",
116
116
  "typescript": "~5.7.2",
117
117
  "vitest": "^3.2.0"
118
+ },
119
+ "allowScripts": {
120
+ "esbuild@0.25.12": true,
121
+ "esbuild@0.28.2": true
118
122
  }
119
123
  }