dsh-better-ask-user 0.3.4 → 0.3.6

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/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <p align="center">
13
13
  <a href="https://www.npmjs.com/package/dsh-better-ask-user"><img src="https://img.shields.io/npm/v/dsh-better-ask-user.svg" alt="npm 版本"></a>
14
14
  <a href="LICENSE"><img alt="Apache-2.0" src="https://img.shields.io/github/license/omdsh-dev/dsh-better-ask-user?color=blue"></a>
15
- <a href="package.json"><img alt="DSH 0.2.2-rc.2" src="https://img.shields.io/badge/DSH-0.2.2--rc.2-4B32C3"></a>
15
+ <a href="package.json"><img alt="DSH 0.2.2-rc.3" src="https://img.shields.io/badge/DSH-0.2.2--rc.3-4B32C3"></a>
16
16
  <a href="https://github.com/omdsh-dev/dsh-better-dsh"><img alt="Part of Better DSH" src="https://img.shields.io/badge/part%20of-dsh--better--dsh-2F80B7"></a>
17
17
  </p>
18
18
 
@@ -42,13 +42,19 @@
42
42
 
43
43
  ```sh
44
44
  # 只安装这个插件
45
- dsh plugin --profile <profile> add dsh-better-ask-user@0.3.4 dsh-better-ptc@0.2.1
45
+ dsh plugin --profile <profile> add dsh-better-ask-user@0.3.6 dsh-better-ptc@0.2.2
46
46
 
47
47
  # 或安装 Better DSH(会自动带上所有独立插件)
48
- dsh plugin --profile <profile> add dsh-better-dsh@0.10.0
48
+ dsh plugin --profile <profile> add dsh-better-dsh@0.11.7
49
49
  ```
50
50
 
51
- > 安装 / 升级 / 换包后必须重启对应 profile;只刷新网页不够。
51
+ > 安装 / 升级 / 换包后必须重启对应 profile;Desktop 必须完全退出后重新打开,只刷新网页不够。
52
+
53
+ ### 提问卡片不出现
54
+
55
+ - 先完整重启 Desktop;刷新页面、HMR 或只重装客户端 bundle 不会重建客户端模块图。
56
+ - 在 WebView devtools 检查 `globalThis.__DSH_BOOT__.entries` 是否包含 `dsh-better-ask-user`。若没有,客户端半没有加载,优先检查 client-modules 依赖/安装日志并重启。
57
+ - 若客户端半已加载,PTC 嵌套提问在等待期间仍需要客户端实时认领;超时转 pending 后由 `userQuestions` 投影恢复 continued 卡片。两种路径都失败时,工具行会显示“等待提问界面/已中断”,不会再提供必然失败的“打开”。
52
58
 
53
59
  ## 它拥有什么
54
60
 
@@ -57,7 +63,7 @@ dsh plugin --profile <profile> add dsh-better-dsh@0.10.0
57
63
  | 稳定行 id | `dsh-better-ask-user` |
58
64
  | 入口 / 工具 | `ask_user_question` · 问题卡片 / 等待时间线 · 提问设置页 |
59
65
  | 设置 | 等待时长、输入续期、普通 / Goal 超时行为 |
60
- | npm 包 | `dsh-better-ask-user@0.3.4` |
66
+ | npm 包 | `dsh-better-ask-user@0.3.6` |
61
67
  | 仓库 | https://github.com/omdsh-dev/dsh-better-ask-user |
62
68
 
63
69
  ## 设置
package/lib/client.js CHANGED
@@ -595,10 +595,10 @@ function AskHistoryRow({
595
595
  const questions = questionList(argsRaw);
596
596
  const settled = useProjection("userQuestions", (view) => view?.settled.find((row) => row.callId === callId));
597
597
  const answers = settled?.answers ?? answerList(output) ?? [];
598
- const record = questions !== void 0 && phase === "result" ? { questions, answers } : void 0;
599
598
  const live = useQuestionPanelLive(callId, (present) => present === true);
600
599
  const errorCode = "kind" in block ? block.error?.code : void 0;
601
- const status = live ? void 0 : errorCode === "ASK_ABORTED" || errorCode === "interrupted" ? t("history.interrupted") : errorCode === "ASK_CANCELLED" ? t("history.cancelled") : void 0;
600
+ const record = questions !== void 0 && phase === "result" ? { questions, answers } : void 0;
601
+ const status = live ? void 0 : errorCode === "ASK_ABORTED" || errorCode === "interrupted" ? t("history.interrupted") : errorCode === "ASK_CANCELLED" ? t("history.cancelled") : phase === "start" ? t("history.waiting") : void 0;
602
602
  const summary = questions?.[0]?.question.split("\n").find((line) => line.trim() !== "")?.trim() ?? t("history.title");
603
603
  const action = live ? () => revealPanel(callId) : record === void 0 ? void 0 : () => reviewPanel(callId, record);
604
604
  const review = !live && record !== void 0;
@@ -1714,6 +1714,7 @@ var zh = {
1714
1714
  "history.reopen": "\u6253\u5F00",
1715
1715
  "history.interrupted": "\u5DF2\u4E2D\u65AD",
1716
1716
  "history.cancelled": "\u5DF2\u53D6\u6D88",
1717
+ "history.waiting": "\u7B49\u5F85\u63D0\u95EE\u754C\u9762\u2026",
1717
1718
  "history.unavailable": "\u8FD9\u4E2A\u95EE\u9898\u5DF2\u7ED3\u675F\uFF0C\u65E0\u6CD5\u6253\u5F00\u3002",
1718
1719
  "reply.copyFailed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
1719
1720
  "wait.takeTime": "\u6162\u6162\u56DE\u7B54",
@@ -1759,6 +1760,7 @@ var en = {
1759
1760
  "history.reopen": "Open",
1760
1761
  "history.interrupted": "Interrupted",
1761
1762
  "history.cancelled": "Cancelled",
1763
+ "history.waiting": "Waiting for the question UI\u2026",
1762
1764
  "history.unavailable": "This question has ended and cannot be reopened.",
1763
1765
  "reply.copyFailed": "Copy failed. Try again.",
1764
1766
  "wait.takeTime": "Take time",
@@ -2391,8 +2393,11 @@ var QuestionCards = class {
2391
2393
  }
2392
2394
  };
2393
2395
  async function answerQuestion(ctx, owner, request, next, cards) {
2394
- const sessionId = ctx.sessions.scopeOf(owner);
2395
- if (sessionId === void 0) return next();
2396
+ const sessionId = ctx.sessions.scopeOf(owner) ?? (request.agent === void 0 ? void 0 : ctx.sessions.scopeOf(request.agent));
2397
+ if (sessionId === void 0) {
2398
+ ctx.logger?.warn?.(`Better Ask User: could not resolve the Session for ${request.wait?.callId ?? "a question without a call id"}; the question card cannot be created`);
2399
+ return next();
2400
+ }
2396
2401
  const callId = request.wait?.callId;
2397
2402
  const better = request.better;
2398
2403
  const card = cards.ensure(sessionId, request.questions, callId, better);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-better-ask-user",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Independent ask_user_question plugin: configurable wait, input-extended countdown, markdown/mobile card, native or default timeout behavior, and PTC deadline exemption.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "engines": {
18
18
  "node": ">=24.9.0",
19
- "dsh": "0.2.2-rc.2"
19
+ "dsh": ">=0.2.2-rc.2 <0.3.0"
20
20
  },
21
21
  "scripts": {
22
22
  "pretest": "node scripts/build-client.mjs",
@@ -25,16 +25,16 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@deepseek-ai/schemastery": "~3.19.0",
28
- "dsh-better-ptc": "0.2.1"
28
+ "dsh-better-ptc": "0.2.2"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@deepseek-ai/cordis": "~4.1.0",
32
- "@deepseek-ai/dsh-agent": "0.2.2-rc.2",
33
- "@deepseek-ai/dsh-llm": "0.2.2-rc.2",
34
- "@deepseek-ai/dsh-session": "0.2.2-rc.2",
35
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.2",
36
- "@deepseek-ai/dsh-tools": "0.2.2-rc.2",
37
- "@deepseek-ai/dsh-user-questions": "0.2.2-rc.2",
32
+ "@deepseek-ai/dsh-agent": ">=0.2.2-rc.2 <0.3.0",
33
+ "@deepseek-ai/dsh-llm": ">=0.2.2-rc.2 <0.3.0",
34
+ "@deepseek-ai/dsh-session": ">=0.2.2-rc.2 <0.3.0",
35
+ "@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.2 <0.3.0",
36
+ "@deepseek-ai/dsh-tools": ">=0.2.2-rc.2 <0.3.0",
37
+ "@deepseek-ai/dsh-user-questions": ">=0.2.2-rc.2 <0.3.0",
38
38
  "react": "^18.2.0"
39
39
  },
40
40
  "devDependencies": {
@@ -57,8 +57,7 @@
57
57
  "@deepseek-ai/dsh-client-ui-conversation",
58
58
  "@deepseek-ai/dsh-client-ui-renderer",
59
59
  "@deepseek-ai/dsh-client-ui-session",
60
- "@deepseek-ai/dsh-client-ui-chat",
61
- "@deepseek-ai/dsh-client-ui-settings"
60
+ "@deepseek-ai/dsh-client-ui-chat"
62
61
  ]
63
62
  }
64
63
  },
@@ -112,21 +112,26 @@ export function AskHistoryRow({
112
112
  // A late reply settles through the projection, not through a second tool result.
113
113
  const settled = useProjection('userQuestions', view => view?.settled.find(row => row.callId === callId))
114
114
  const answers = settled?.answers ?? answerList(output) ?? []
115
+ const live = useQuestionPanelLive(callId, present => present === true)
116
+ const errorCode = 'kind' in block ? block.error?.code : undefined
115
117
  // Every settled call with readable questions can be reviewed; an empty answer
116
- // batch still shows the question and its "no answer recorded" state.
118
+ // batch still shows the question and its "no answer recorded" state. The
119
+ // review is read-only, so an interrupted call must never expose "Open".
117
120
  const record: UserQuestionRecord | undefined = questions !== undefined && phase === 'result'
118
121
  ? { questions, answers }
119
122
  : undefined
120
- const live = useQuestionPanelLive(callId, present => present === true)
121
- const errorCode = 'kind' in block ? block.error?.code : undefined
122
123
  // A live card is the truth; a terminal label belongs only to the settled view.
124
+ // Before the client card arrives, keep the row honest: it is waiting for the
125
+ // question UI rather than silently offering nothing.
123
126
  const status = live
124
127
  ? undefined
125
128
  : errorCode === 'ASK_ABORTED' || errorCode === 'interrupted'
126
129
  ? t('history.interrupted')
127
130
  : errorCode === 'ASK_CANCELLED'
128
131
  ? t('history.cancelled')
129
- : undefined
132
+ : phase === 'start'
133
+ ? t('history.waiting')
134
+ : undefined
130
135
  const summary = questions?.[0]?.question.split('\n').find(line => line.trim() !== '')?.trim() ?? t('history.title')
131
136
  const action = live
132
137
  ? () => revealPanel(callId)
@@ -257,7 +257,11 @@ async function answerQuestion(
257
257
  cards: QuestionCards,
258
258
  ): Promise<ClientQuestionAnswer> {
259
259
  const sessionId = ctx.sessions.scopeOf(owner)
260
- if (sessionId === undefined) return next()
260
+ ?? (request.agent === undefined ? undefined : ctx.sessions.scopeOf(request.agent as unknown as ClientContext))
261
+ if (sessionId === undefined) {
262
+ ctx.logger?.warn?.(`Better Ask User: could not resolve the Session for ${request.wait?.callId ?? 'a question without a call id'}; the question card cannot be created`)
263
+ return next()
264
+ }
261
265
  const callId = request.wait?.callId
262
266
  const better = (request as { better?: BetterAskConfig }).better
263
267
  const card = cards.ensure(sessionId, request.questions, callId, better)
@@ -12,6 +12,7 @@ export const zh = {
12
12
  'history.reopen': '打开',
13
13
  'history.interrupted': '已中断',
14
14
  'history.cancelled': '已取消',
15
+ 'history.waiting': '等待提问界面…',
15
16
  'history.unavailable': '这个问题已结束,无法打开。',
16
17
  'reply.copyFailed': '复制失败,请重试。',
17
18
  'wait.takeTime': '慢慢回答',
@@ -62,6 +63,7 @@ export const en = {
62
63
  'history.reopen': 'Open',
63
64
  'history.interrupted': 'Interrupted',
64
65
  'history.cancelled': 'Cancelled',
66
+ 'history.waiting': 'Waiting for the question UI…',
65
67
  'history.unavailable': 'This question has ended and cannot be reopened.',
66
68
  'reply.copyFailed': 'Copy failed. Try again.',
67
69
  'wait.takeTime': 'Take time',