@mcviseron/dsh-qq-bridge 0.3.5 → 0.3.8

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
@@ -2,21 +2,24 @@
2
2
 
3
3
  ## 安装
4
4
 
5
- 从 npm 装(**包名带 scope**,profile 里的 `name` 必须写同一个名字,否则
6
- `Cannot find package 'dsh-qq-bridge'`):
5
+ **规则只有一条:profile 里的 `name` 永远是裸名 `dsh-qq-bridge`,profile 的
6
+ node_modules 里必须有同名包可解析。** 名字解析不到时 DSH 不会报错,而是让
7
+ `id: qq-bridge` 的配置静默落空(插件用默认配置跑:statePath / cwd / token 全丢)。
8
+
9
+ npm 上的包名是 scoped 的 `@mcviseron/dsh-qq-bridge`,所以用**别名**安装把裸名造出来:
7
10
 
8
11
  ```bash
9
- npm i @mcviseron/dsh-qq-bridge
12
+ npm i dsh-qq-bridge@npm:@mcviseron/dsh-qq-bridge@<版本>
10
13
  ```
11
14
 
12
15
  ```yaml
13
16
  # profile 的 cordis.patch.yml
14
17
  - insert:
15
18
  - id: qq-bridge
16
- name: '@mcviseron/dsh-qq-bridge'
19
+ name: 'dsh-qq-bridge'
17
20
  ```
18
21
 
19
- 本地开发用 link 时保留裸名:
22
+ 本地开发直接 link:
20
23
 
21
24
  ```bash
22
25
  npm i dsh-qq-bridge@link:/path/to/plugin
package/cordis.patch.yml CHANGED
@@ -4,9 +4,10 @@
4
4
  # assistant reply plus every pending tool approval back to the bot.
5
5
  - insert:
6
6
  - id: qq-bridge
7
- # 必须和 npm 上发布的包名一致(发布时 CI 会改成 scoped 名)。
8
- # 本地开发用 link 时,改成你自己的 "dsh-qq-bridge": "link:<path>" 条目名即可。
9
- name: '@mcviseron/dsh-qq-bridge'
7
+ # 条目名固定为裸名 dsh-qq-bridge:link 安装与本机 profile 都用这个名字。
8
+ # 从 npm 装(包名是 scoped 的 @mcviseron/dsh-qq-bridge)时用别名让裸名可解析:
9
+ # pnpm add "dsh-qq-bridge@npm:@mcviseron/dsh-qq-bridge@<版本>"
10
+ name: 'dsh-qq-bridge'
10
11
  config:
11
12
  enabled: true
12
13
  host: '127.0.0.1'
package/lib/client.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * 全部改用内联样式:宿主 main 槽位不在同一个样式作用域,注入 <style> 不可靠。
4
4
  */
5
5
  window.__ModuleLoader__.load({
6
- id: "@mcviseron/dsh-qq-bridge",
6
+ id: "dsh-qq-bridge",
7
7
  factory: (require) => {
8
8
  var module = { exports: {} }
9
9
  var exports = module.exports
@@ -301,11 +301,56 @@ window.__ModuleLoader__.load({
301
301
  }, [call, paused])
302
302
 
303
303
  if (state !== null && state.offline) {
304
+ // 面板还没起来(新机器上根本没装机器人)时也必须能一键安装,否则鸡生蛋死循环
305
+ const setField = function (key, next) { const copy = Object.assign({}, draft); copy[key] = next; setDraft(copy) }
306
+ const secretNow = String(draft.appsecret === undefined ? "" : draft.appsecret)
307
+ const runInstall = async function () {
308
+ setInstallNote("")
309
+ try {
310
+ const started = await installCall({
311
+ action: "start",
312
+ appid: draft.appid === undefined ? "" : draft.appid,
313
+ appsecret: secretNow.indexOf("****") >= 0 ? "" : secretNow,
314
+ })
315
+ if (started.ok !== true) { setInstallNote("启动安装失败:" + (started.error || "未知错误")); return }
316
+ setInstall(started.state || null)
317
+ } catch (error) {
318
+ setInstallNote("连不上宿主插件(39061),确认插件已加载")
319
+ }
320
+ }
304
321
  return h("div", { style: T.page },
305
322
  h("div", { style: T.inner },
306
- h("div", { style: T.title }, "机器人的设置服务没有运行"),
307
- h("div", { style: T.hint }, "用 bot\\run-bot.bat 启动一次(或 python -u main.py --supervise),再点重试。"),
308
- h("div", { style: T.actions }, h("button", { style: T.btn, onClick: load }, "重试"))))
323
+ h("div", { style: T.title }, "机器人还没装,或者面板没起来"),
324
+ h("div", { style: T.hint }, "新机器直接点下面的「下载 / 配置机器人」一次装好(找 Python → 建 venv → 装依赖 → 放机器人代码 → 拉起守护进程);已经装过只是没起来,点重试。"),
325
+ h(Row, { title: "APPID(开放平台的机器人 AppID)" },
326
+ h("input", {
327
+ style: Object.assign({}, T.input, T.inputWide),
328
+ value: draft.appid === undefined ? "" : draft.appid,
329
+ onChange: function (event) { setField("appid", event.target.value) },
330
+ })),
331
+ h(Row, { title: "APPSECRET" },
332
+ h("input", {
333
+ type: "password",
334
+ placeholder: "安装时会写进 bot/.env",
335
+ style: Object.assign({}, T.input, T.inputWide),
336
+ value: secretNow,
337
+ onChange: function (event) { setField("appsecret", event.target.value) },
338
+ })),
339
+ h("div", { style: T.actions },
340
+ h("button", {
341
+ style: Object.assign({}, T.btn, T.btnPrimary),
342
+ disabled: busy || (install !== null && install.running === true),
343
+ onClick: function () { void runInstall() },
344
+ }, install && install.running ? "正在配置…" : "下载 / 配置机器人"),
345
+ h("button", { style: T.btn, onClick: load }, "重试")),
346
+ install && install.running && Array.isArray(install.steps)
347
+ ? h("div", { style: T.hint }, "第 " + (install.step + 1) + "/" + install.steps.length + " 步:" + install.steps[install.step])
348
+ : null,
349
+ install && install.error ? h("div", { style: T.hint }, "失败:" + install.error) : null,
350
+ installNote ? h("div", { style: T.hint }, installNote) : null,
351
+ install && Array.isArray(install.lines) && install.lines.length
352
+ ? h("pre", { style: T.log }, install.lines.slice(-60).join("\n"))
353
+ : null))
309
354
  }
310
355
  if (state === null) return h("div", { style: T.page }, h("div", { style: T.inner }, h("div", { style: T.hint }, "读取中…")))
311
356
 
@@ -329,7 +374,7 @@ window.__ModuleLoader__.load({
329
374
  const startInstall = async function () {
330
375
  setInstallNote("")
331
376
  try {
332
- // 面板回传的 AppSecret 是打码值(pHjC****N6),别把它当真的传下去
377
+ // 面板回传的 AppSecret 是打码值(ab12****yz),别把它当真的传下去
333
378
  const rawSecret = String(value("appsecret") === undefined ? "" : value("appsecret"))
334
379
  const started = await installCall({
335
380
  action: "start",
package/lib/install.js CHANGED
@@ -250,7 +250,7 @@ export class Installer {
250
250
 
251
251
  /** 写 bot/config.json 与 bot/.env:面板可改的进 json,启动时读的进 .env。 */
252
252
  async #writeConfig({ appid, appsecret, autoGroupRoot, bridgeUrl, bridgeToken }) {
253
- // 面板回传的密钥是打码值(pHjC****N6),写进去等于没有,必须跳过
253
+ // 面板回传的密钥是打码值(ab12****yz),写进去等于没有,必须跳过
254
254
  const clean = (value) => {
255
255
  const text = typeof value === 'string' ? value.trim() : ''
256
256
  return text.includes('****') ? '' : text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcviseron/dsh-qq-bridge",
3
- "version": "0.3.5",
3
+ "version": "0.3.8",
4
4
  "description": "DeepSeek Harness plugin: bridge QQ conversations (driven by an external viseron-botpy bot) to DSH sessions — injects user messages, captures assistant replies, streams C2C answers, and relays tool approvals to the bot owner.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",