dsh-remote-plugin 0.8.0-rc.8 → 0.8.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.
Files changed (58) hide show
  1. package/README.en.md +12 -5
  2. package/README.md +12 -5
  3. package/apk/dsh-remote.apk +0 -0
  4. package/gateway.cjs +402 -165
  5. package/index.mjs +49 -20
  6. package/insights.mjs +33 -2
  7. package/package.json +2 -1
  8. package/plugin-center.mjs +12 -3
  9. package/plugin-transaction.mjs +18 -2
  10. package/public/admin.html +1 -1
  11. package/public/admin.js +2 -1
  12. package/public/app.js +296 -97
  13. package/public/approval-records.js +229 -0
  14. package/public/build.json +2 -2
  15. package/public/desktop/desktop.css +53 -1
  16. package/public/desktop/desktop.html +40 -2
  17. package/public/desktop/desktop.js +197 -60
  18. package/public/doctor-entry.js +33 -4
  19. package/public/doctor.js +41 -13
  20. package/public/extensions.css +96 -1
  21. package/public/extensions.js +43 -5
  22. package/public/index.html +45 -9
  23. package/public/insights.css +5 -0
  24. package/public/insights.js +40 -11
  25. package/public/md.js +7 -1
  26. package/public/onboarding.css +36 -0
  27. package/public/onboarding.js +253 -0
  28. package/public/operations.js +1 -1
  29. package/public/permission-presets.js +159 -0
  30. package/public/plugin-center.css +3 -0
  31. package/public/plugin-center.js +58 -9
  32. package/public/plugin.html +1 -1
  33. package/public/plugin.js +5 -1
  34. package/public/skills.js +16 -5
  35. package/public/skins/blue-fish/skin.css +51 -0
  36. package/public/styles.css +43 -1
  37. package/public/task-board.js +109 -0
  38. package/public/teams.js +35 -13
  39. package/public/theme.js +5 -11
  40. package/public/turn-results.js +2 -0
  41. package/public/update.json +8 -8
  42. package/public/version.json +1 -1
  43. package/public/workflow.css +6 -12
  44. package/public/workflow.js +13 -4
  45. package/skills/dsh-remote-doctor/SKILL.md +16 -0
  46. package/skills/dsh-remote-doctor/references/wiki/README.md +40 -0
  47. package/skills/dsh-remote-doctor/references/wiki/ai-guide.md +61 -0
  48. package/skills/dsh-remote-doctor/references/wiki/connection.md +74 -0
  49. package/skills/dsh-remote-doctor/references/wiki/errors.md +26 -0
  50. package/skills/dsh-remote-doctor/references/wiki/evidence.md +44 -0
  51. package/skills/dsh-remote-doctor/references/wiki/files.md +31 -0
  52. package/skills/dsh-remote-doctor/references/wiki/maintenance.md +30 -0
  53. package/skills/dsh-remote-doctor/references/wiki/notifications.md +29 -0
  54. package/skills/dsh-remote-doctor/references/wiki/operations.md +32 -0
  55. package/skills/dsh-remote-doctor/references/wiki/plugins.md +69 -0
  56. package/skills/dsh-remote-doctor/references/wiki/sessions.md +45 -0
  57. package/skills/dsh-remote-doctor/references/wiki/sources.md +27 -0
  58. package/task-board.mjs +57 -0
@@ -0,0 +1,27 @@
1
+ # 源码、契约与验证依据
2
+
3
+ [首页](README.md)
4
+
5
+ 下表是本库结论的本地检索入口。源码仓库中按这些相对路径阅读;插件安装包中网关名为 `gateway.cjs`,不携带整个测试目录。找不到文件时标注缺失,不搜索用户无关目录。
6
+
7
+ | 范围 | 实现位置 | 主要回归/专题 |
8
+ | --- | --- | --- |
9
+ | 网关 health、鉴权、文件、WS、supervisor | `gateway.js`;包内 `gateway.cjs` | `tests/gateway.test.js`、`tests/crash-recovery.test.js`、`tests/supervisor-endpoint.test.js` |
10
+ | 插件启动、端口、上游 Cookie | `packages/plugin/index.mjs` | `tests/plugin-autostart.test.js`、`tests/restart-connectivity.test.js`、`docs/configuration.md` |
11
+ | 会话迁移和按需订阅 | `gateway.js` 的 `translateModernRpc`、`handleModernStreamFailure`、现代 collector | `tests/dsh-021-compat.test.js`、`tests/session-observation.test.js`、`tests/session-observation-installed.test.js` |
12
+ | 历史、错误归属、发送回执 | `public/history.js`、`public/app.js`、`public/desktop/desktop.js`、`public/operations.js` | `tests/history-ui.test.js`、`tests/history-load-recovery.test.js`、`tests/receipt-errors.test.js` |
13
+ | 插件清单与事务 | `packages/plugin/plugin-center.mjs`、`plugin-transaction.mjs`、`market.mjs`,`public/plugin-center.js` | `tests/plugin-center.test.js`、`tests/plugin-center-ui.test.js`、`tests/plugin-transaction.test.js`、`docs/plugin-center.md` |
14
+ | 文件与上传 | `gateway.js`、`public/app.js`、`public/chat-files.js` | `tests/windows-files.test.js`、`tests/windows-gateway.test.js`、`tests/upload-ui.test.js` |
15
+ | 模型、权限、审批、子代理 | `public/permission-presets.js`、`approval-records.js`、`subagents.js`,网关协议适配 | `tests/permission-presets-ui.test.js`、`tests/approval-records-ui.test.js`、`docs/subagent-viewing.md` |
16
+ | Android 后台与峰谷 | `android/app/src/main/java/com/dshremote/app/`,`packages/plugin/peak-reminders.mjs` | `tests/android-background.test.js`、`tests/peak-reminders.test.js`、`docs/peak-reminders-and-issue18.md` |
17
+ | 诊断入口与本地日志 | `public/doctor.js`、`diagnostics.js`,`packages/plugin/doctor-target.mjs`、`doctor-skill.mjs` | `tests/doctor.test.js`、`tests/doctor-entry.test.js`、`tests/client-diagnostics.test.js` |
18
+ | 版本、构建与分发 | `scripts/android-version.mjs`、`scripts/release.mjs`、`scripts/sync-plugin.mjs` | `tests/android-version.test.js`、`tests/release.test.js`、`docs/release.md` |
19
+
20
+ ## 如何判断证据强度
21
+
22
+ 1. 文档说明设计与操作方法;源码说明该快照的实现;测试说明具体断言通过。
23
+ 2. 真实 DSH 联调需确认安装版本、隔离环境和覆盖路径,不能套用到所有 DSH 版本。
24
+ 3. 运行实例、真实渲染与原设备操作才能证明对应用户路径;构建成功或模拟数据截图不能替代。
25
+ 4. 分发还需核对 GitHub 资产、精确 npm 版本/tag/tarball 与实际安装;Gitee 单独核验。
26
+
27
+ 本库未声称包含个人配置或完整故障样本。历史证据在仓库 `docs/archive/` 及各 RC 报告中保留原日期,不能当作实时状态。
package/task-board.mjs ADDED
@@ -0,0 +1,57 @@
1
+ /* Read-only taskBoard service adapter, pinned to the published schema 6. */
2
+ const text = (value, max = 200) => typeof value === 'string' ? value.slice(0, max) : ''
3
+ const number = value => typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : null
4
+ const record = value => value && typeof value === 'object' && !Array.isArray(value) ? value : {}
5
+ const id = value => typeof value === 'string' && value.length > 0 && value.length <= 200 && !/[\x00-\x20]/.test(value) ? value : ''
6
+ const statuses = new Set(['backlog','todo','running','done','failed'])
7
+ export function summarizeTaskBoard(raw, workspace) {
8
+ if (raw?.schemaVersion !== 6 || !Array.isArray(raw.tasks) || raw.tasks.length > 10000 || !Number.isSafeInteger(raw.revision) || raw.revision < 0) throw Error('unsupported')
9
+ const members = new Set(workspace.sessionIds || [])
10
+ const matching = raw.tasks.filter(task => task && task.workspaceId === workspace.id && task.hidden !== true)
11
+ .sort((a,b) => Number(number(a.archivedAt) > 0) - Number(number(b.archivedAt) > 0)
12
+ || Number(b.status === 'running') - Number(a.status === 'running') || (number(b.updatedAt) || 0) - (number(a.updatedAt) || 0))
13
+ const taskIds = new Set(matching.map(task => task.id))
14
+ const seen = new Set()
15
+ const tasks = matching.slice(0, 200).map(task => {
16
+ if (!id(task.id) || seen.has(task.id) || !statuses.has(task.status) || !Array.isArray(task.executions)) throw Error('unsupported')
17
+ seen.add(task.id)
18
+ const executions = task.executions.slice(-3).map(value => {
19
+ const run = record(value), verification = record(run.verification), attempts = Array.isArray(verification.attempts) ? verification.attempts : []
20
+ const attempt = record(attempts.at(-1))
21
+ return { id: text(run.id), sessionId: run.external !== true && members.has(run.sessionId) ? id(run.sessionId) : '', external: run.external === true,
22
+ startedAt: number(run.startedAt), endedAt: number(run.endedAt), result: ['succeeded','failed','cancelled'].includes(run.result) ? run.result : null,
23
+ error: text(run.error, 1000), summary: text(run.summary?.text, 1000),
24
+ verification: run.verification ? { applicability: text(verification.applicability, 40), inFlight: verification.inFlight === true,
25
+ stage: text(attempt.stage, 40), passed: typeof attempt.passed === 'boolean' ? attempt.passed : null,
26
+ failedReason: text(verification.failedReason, 1000) } : null }
27
+ })
28
+ const schedule = record(task.schedule)
29
+ return { id: task.id, title: text(task.title, 300), description: text(task.description, 1500), status: task.status,
30
+ parentId: taskIds.has(task.parentId) ? text(task.parentId) : '',
31
+ updatedAt: number(task.updatedAt), archivedAt: number(task.archivedAt), executions,
32
+ schedule: task.schedule ? { enabled: schedule.enabled === true, mode: ['cron','once'].includes(schedule.mode) ? schedule.mode : 'unknown',
33
+ cron: text(schedule.cron, 100), timeZone: text(schedule.timeZone || raw.scheduler?.timeZone, 100),
34
+ nextRunAt: number(schedule.nextRunAt), at: number(schedule.at), runCount: number(schedule.runCount) } : null }
35
+ })
36
+ return { ok: true, schema: 1, available: true, source: 'task-board', workspaceId: workspace.id, revision: raw.revision,
37
+ generatedAt: Date.now(), timeZone: text(raw.scheduler?.timeZone, 100), truncated: matching.length > 200,
38
+ tasks }
39
+ }
40
+ export async function readTaskBoard(ctx, query, timeoutMs = 20000) {
41
+ if ([...query.keys()].some(key => key !== 'workspaceId') || query.getAll('workspaceId').length !== 1 || !id(query.get('workspaceId'))) return { status: 400, body: { ok: false, code: 'invalid-query' } }
42
+ let timer
43
+ try {
44
+ const registry = ctx.get?.('workspaceRegistry') ?? ctx.get?.('workspace')
45
+ if (typeof registry?.list !== 'function') return { status: 503, body: { ok: false, code: 'workspace-unavailable' } }
46
+ const workspaces = await registry.list(), workspace = Array.isArray(workspaces) && workspaces.find(row => row.id === query.get('workspaceId'))
47
+ if (!workspace) return { status: 404, body: { ok: false, code: 'workspace-not-found' } }
48
+ const service = ctx.get?.('taskBoard')
49
+ if (!service) return { status: 200, body: { ok: true, schema: 1, available: false, code: 'not-installed' } }
50
+ if (typeof service.snapshot !== 'function') return { status: 200, body: { ok: true, schema: 1, available: false, code: 'unsupported' } }
51
+ const raw = await Promise.race([Promise.resolve().then(() => service.snapshot()), new Promise((_, reject) => { timer = setTimeout(() => reject(Error('timeout')), timeoutMs) })])
52
+ return { status: 200, body: summarizeTaskBoard(raw, workspace) }
53
+ } catch (error) {
54
+ return { status: error.message === 'unsupported' ? 200 : 502, body: error.message === 'unsupported'
55
+ ? { ok: true, schema: 1, available: false, code: 'unsupported' } : { ok: false, code: error.message === 'timeout' ? 'timeout' : 'task-board-unavailable' } }
56
+ } finally { clearTimeout(timer) }
57
+ }