@cloud411716/fancy-webnovel 1.0.43 → 1.0.45

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.
@@ -13,7 +13,7 @@ import { initProject } from './init-project.js';
13
13
  // inject is declared in the root index.js; only apply() is imported by index.js
14
14
 
15
15
  /** UserQuestionError codes that indicate user cancellation */
16
- const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED']);
16
+ const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED', 'NO_PROVIDER']);
17
17
 
18
18
  function isValidPath(p) {
19
19
  return (
@@ -52,6 +52,8 @@ const bootstrap = {
52
52
  return `❓ 确认将以下路径作为项目根?\n${projectRoot}`;
53
53
  case 'cancelled':
54
54
  return '🚫 已取消';
55
+ case 'no_provider':
56
+ return '⚠️ 当前环境不支持交互式提问。请在 dsh-tui 中运行此命令,或确保 web UI 已正确加载交互组件。';
55
57
  case 'initializing':
56
58
  return `⏳ 正在初始化 ${projectRoot}...`;
57
59
  case 'success':
@@ -82,12 +84,15 @@ export function apply(ctx) {
82
84
  if (!projectRoot) {
83
85
  let result;
84
86
  try {
87
+ // Note: not passing agent parameter to avoid scopeTarget issues in dsh-web
85
88
  result = await ctx.userQuestions.ask({
86
89
  questions: [bootstrap.askPath()],
87
- agent: invocation.agent,
88
90
  signal,
89
91
  });
90
92
  } catch (err) {
93
+ if (err?.code === 'NO_PROVIDER') {
94
+ return notify(session, 'error', bootstrap.notify({ type: 'no_provider' }));
95
+ }
91
96
  if (err?.code && USER_CANCEL_CODES.has(err.code)) {
92
97
  return notify(session, 'error', bootstrap.notify({ type: 'cancelled' }));
93
98
  }
@@ -116,6 +121,7 @@ export function apply(ctx) {
116
121
  // ---------- confirm ----------
117
122
  let confirm;
118
123
  try {
124
+ // Note: not passing agent parameter to avoid scopeTarget issues in dsh-web
119
125
  confirm = await ctx.userQuestions.ask({
120
126
  questions: [{
121
127
  id: 'confirm',
@@ -124,10 +130,12 @@ export function apply(ctx) {
124
130
  hideCustomInput: true,
125
131
  options: bootstrap.confirmOptions(),
126
132
  }],
127
- agent: invocation.agent,
128
133
  signal,
129
134
  });
130
135
  } catch (err) {
136
+ if (err?.code === 'NO_PROVIDER') {
137
+ return notify(session, 'error', bootstrap.notify({ type: 'no_provider' }));
138
+ }
131
139
  if (err?.code && USER_CANCEL_CODES.has(err.code)) {
132
140
  return notify(session, 'error', bootstrap.notify({ type: 'cancelled' }));
133
141
  }
@@ -14,8 +14,8 @@ import * as fanqie from './platforms/fanqie.js';
14
14
  import * as jinjiang from './platforms/jinjiang.js';
15
15
  import * as qimao from './platforms/qimao.js';
16
16
 
17
- /** UserQuestionError codes that indicate user cancellation */
18
- const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED']);
17
+ /** UserQuestionError codes that indicate user cancellation or unavailability */
18
+ const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED', 'NO_PROVIDER']);
19
19
 
20
20
  // inject is declared in the root index.js; only apply() is imported by index.js
21
21
 
@@ -69,6 +69,8 @@ const scan = {
69
69
  return '❌ 无效选择,请输入 1-4 的编号。';
70
70
  case 'cancelled':
71
71
  return '🚫 已取消。';
72
+ case 'no_provider':
73
+ return '⚠️ 当前环境不支持交互式提问。请在 dsh-tui 中运行此命令,或确保 web UI 已正确加载交互组件。';
72
74
  case 'handover':
73
75
  return (
74
76
  `📊 采集完成,正在将数据交给 LLM 进行分析...\n` +
@@ -138,17 +140,20 @@ export function apply(ctx) {
138
140
  // ---------- platform selection ----------
139
141
  let platformResult;
140
142
  try {
143
+ // Note: not passing agent parameter to avoid scopeTarget issues in dsh-web
141
144
  platformResult = await ctx.userQuestions.ask({
142
145
  questions: [{
143
146
  id: 'platform',
144
147
  ...scan.askPlatform(),
145
148
  question: `${scan.platformList()}\n\n请选择要扫的平台(输入编号 1-4):`,
146
149
  }],
147
- agent: invocation.agent,
148
150
  signal,
149
151
  });
150
152
  } catch (err) {
151
- // Handle user cancellation (ASK_CANCELLED, ASK_ABORTED, or any cancellation)
153
+ // Handle user cancellation or no provider
154
+ if (err?.code === 'NO_PROVIDER') {
155
+ return notify(session, 'error', scan.notify({ type: 'no_provider' }));
156
+ }
152
157
  if (err?.code && USER_CANCEL_CODES.has(err.code)) {
153
158
  return notify(session, 'error', scan.notify({ type: 'cancelled' }));
154
159
  }
@@ -169,12 +174,15 @@ export function apply(ctx) {
169
174
  // ---------- rank selection (multi-select) ----------
170
175
  let rankResult;
171
176
  try {
177
+ // Note: not passing agent parameter to avoid scopeTarget issues in dsh-web
172
178
  rankResult = await ctx.userQuestions.ask({
173
179
  questions: [scan.askRankList(platform)],
174
- agent: invocation.agent,
175
180
  signal,
176
181
  });
177
182
  } catch (err) {
183
+ if (err?.code === 'NO_PROVIDER') {
184
+ return notify(session, 'error', scan.notify({ type: 'no_provider' }));
185
+ }
178
186
  if (err?.code && USER_CANCEL_CODES.has(err.code)) {
179
187
  return notify(session, 'error', scan.notify({ type: 'cancelled' }));
180
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {