dshgo-connect-madao 0.1.0 → 0.1.1

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
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 — 2026-11-27
4
+
5
+ - 修复:保存凭证后,凭证页的「当前 AK / 状态」不刷新(面板数据只推一次且不会被重取)
6
+
3
7
  ## 0.1.0 — 2026-11-27
4
8
 
5
9
  首个公开版本:把华为云码道(CodeArts Agent)接入 dsh-go。
package/README.md CHANGED
@@ -5,6 +5,9 @@
5
5
  ## 安装
6
6
 
7
7
  ```sh
8
+ # 从 npm 安装
9
+ dsh plugin --profile web add dshgo-connect-madao
10
+
8
11
  # 从 GitHub 安装(固定版本)
9
12
  dsh plugin --profile web add "git+https://github.com/wsdzwx2001/dshgo-connect-madao.git#730054f437103f4597d18a94413bd36e372fc2d3"
10
13
 
@@ -57,11 +57,9 @@
57
57
  "versions": [
58
58
  {
59
59
  "version": "0.1.0",
60
- "publishTimestamp": 1795715900,
60
+ "publishTimestamp": 1795716995,
61
61
  "source": {
62
- "type": "git",
63
- "url": "https://github.com/wsdzwx2001/dshgo-connect-madao",
64
- "commit": "730054f437103f4597d18a94413bd36e372fc2d3"
62
+ "type": "npm"
65
63
  },
66
64
  "engines": {
67
65
  "dsh": ">=0.2.1-rc.2 <0.3.0-0"
package/lib/index.js CHANGED
@@ -226,6 +226,7 @@ export function apply(ctx, config = {}) {
226
226
  // dshGo 就绪后由它接管:主动重取两个面板的数据(凭证页平时不推送)
227
227
  let refreshPanels = () => {}
228
228
  const listeners = new Set()
229
+ const credsListeners = new Set()
229
230
  const notify = () => {
230
231
  for (const fn of listeners) {
231
232
  try {
@@ -281,13 +282,15 @@ export function apply(ctx, config = {}) {
281
282
  /** 保存凭证 → 重连 → 拉模型 → 注册 provider → 自检。 */
282
283
  const saveCreds = async (ak, sk) => {
283
284
  await saveCredentials(ak, sk)
284
- void bridge.reload().then(async (ok) => {
285
- if (!ok) return
286
- await bridge.syncModels()
287
- ensureProvider(bridge.state.models, bridge.status().port)
288
- await bridge.test()
289
- refreshPanels()
290
- })
285
+ void bridge
286
+ .reload()
287
+ .then(async (ok) => {
288
+ if (!ok) return
289
+ await bridge.syncModels()
290
+ ensureProvider(bridge.state.models, bridge.status().port)
291
+ await bridge.test()
292
+ })
293
+ .finally(() => refreshPanels())
291
294
  }
292
295
 
293
296
  /** 从表单提交的 value 里尽量捞出 AK / SK(不同 App 版本可能包一层)。 */
@@ -315,11 +318,16 @@ export function apply(ctx, config = {}) {
315
318
 
316
319
  ctx.inject(['dshGo'], (ctx) => {
317
320
  refreshPanels = () => {
318
- for (const id of ['madao', 'creds']) {
321
+ // 主面板本来就订阅了 listeners;凭证页只在保存/连接完成后推一次,
322
+ // 这样既能更新「当前 AK / 状态」,又不会在输入途中把内容刷掉。
323
+ for (const fn of credsListeners) {
319
324
  try {
320
- ctx.dshGo.refresh?.(id)
325
+ fn()
321
326
  } catch {}
322
327
  }
328
+ try {
329
+ ctx.dshGo.refresh?.('madao')
330
+ } catch {}
323
331
  }
324
332
  const snapshot = (locale) => {
325
333
  const s = bridge.status()
@@ -510,9 +518,12 @@ export function apply(ctx, config = {}) {
510
518
  ],
511
519
  },
512
520
  data: (scope, emit, caps) => {
513
- // 只推一次:这里没有定时刷新,避免打断输入。
514
- emit({ akInput: '', skInput: '', ...snapshot(caps?.locale) })
515
- return () => {}
521
+ // 打开时推一次;之后只在保存凭证 / 连接完成时由 refreshPanels 再推。
522
+ // 这里没有定时刷新,避免输入到一半被刷掉。
523
+ const push = () => emit({ akInput: '', skInput: '', ...snapshot(caps?.locale) })
524
+ push()
525
+ credsListeners.add(push)
526
+ return () => credsListeners.delete(push)
516
527
  },
517
528
  actions: {
518
529
  save: async (scope, event) => {
@@ -526,7 +537,7 @@ export function apply(ctx, config = {}) {
526
537
  } catch (err) {
527
538
  return { toast: `保存失败:${String(err?.message ?? err).slice(0, 24)}` }
528
539
  }
529
- return { toast: '已保存,正在验证…', patch: { akInput: '', skInput: '' }, refresh: 'creds' }
540
+ return { toast: '已保存,正在验证…', patch: { akInput: '', skInput: '' } }
530
541
  },
531
542
  },
532
543
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dshgo-connect-madao",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "华为云码道(CodeArts Agent)接入 dsh-go:本机 OpenAI 兼容桥 + 原生状态条与面板",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",