dsh-remote-plugin 0.8.0-rc.9 → 0.8.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/README.en.md +4 -2
- package/README.md +4 -2
- package/apk/dsh-remote.apk +0 -0
- package/client.js +96 -115
- package/file-delivery.mjs +84 -0
- package/gateway.cjs +248 -3
- package/index.mjs +594 -52
- package/insights.mjs +33 -2
- package/package.json +4 -2
- package/plugin-center.mjs +14 -1
- package/public/activity.js +8 -3
- package/public/announcements.json +10 -0
- package/public/app.js +65 -20
- package/public/approval-records.js +75 -3
- package/public/build.json +2 -2
- package/public/desktop/desktop.css +10 -2
- package/public/desktop/desktop.html +24 -4
- package/public/desktop/desktop.js +32 -13
- package/public/extensions.css +109 -1
- package/public/extensions.js +116 -7
- package/public/file-inbox.css +66 -0
- package/public/file-inbox.js +289 -0
- package/public/index.html +26 -9
- package/public/insights.css +5 -0
- package/public/insights.js +40 -11
- package/public/md.js +7 -1
- package/public/plugin-center.css +3 -0
- package/public/plugin-center.js +58 -9
- package/public/plugin.js +21 -6
- package/public/session-deck.css +73 -0
- package/public/session-deck.js +180 -0
- package/public/skills.js +16 -5
- package/public/skins/blue-fish/skin.css +39 -0
- package/public/styles.css +22 -2
- package/public/task-board.js +109 -0
- package/public/teams.js +35 -13
- package/public/update.json +12 -12
- package/public/version.json +1 -1
- package/public/workflow.css +6 -12
- package/skills/dsh-remote-doctor/SKILL.md +16 -0
- package/skills/dsh-remote-doctor/references/wiki/README.md +40 -0
- package/skills/dsh-remote-doctor/references/wiki/ai-guide.md +61 -0
- package/skills/dsh-remote-doctor/references/wiki/connection.md +74 -0
- package/skills/dsh-remote-doctor/references/wiki/errors.md +26 -0
- package/skills/dsh-remote-doctor/references/wiki/evidence.md +44 -0
- package/skills/dsh-remote-doctor/references/wiki/files.md +31 -0
- package/skills/dsh-remote-doctor/references/wiki/maintenance.md +30 -0
- package/skills/dsh-remote-doctor/references/wiki/notifications.md +29 -0
- package/skills/dsh-remote-doctor/references/wiki/operations.md +32 -0
- package/skills/dsh-remote-doctor/references/wiki/plugins.md +90 -0
- package/skills/dsh-remote-doctor/references/wiki/sessions.md +45 -0
- package/skills/dsh-remote-doctor/references/wiki/sources.md +27 -0
- package/task-board.mjs +57 -0
|
@@ -121,7 +121,12 @@
|
|
|
121
121
|
<div class="ds-top-right">
|
|
122
122
|
<button id="btn-subagents" class="subagents-entry hidden" type="button" aria-haspopup="dialog" aria-controls="subagent-page" data-i18n="subagent.title">子代理</button>
|
|
123
123
|
<button id="btn-session-more" class="ds-icon-btn" type="button" aria-haspopup="dialog" aria-controls="session-actions" data-i18n-aria="ds.sessionMore" aria-label="更多操作">⋯</button>
|
|
124
|
-
<
|
|
124
|
+
<div class="ext-shortcuts">
|
|
125
|
+
<button id="btn-plugin-shortcuts" class="ds-btn" type="button" aria-haspopup="menu" aria-controls="plugin-shortcuts-menu" aria-expanded="false" data-i18n="ds.plugins">插件</button>
|
|
126
|
+
<div id="plugin-shortcuts-menu" class="ext-shortcuts-menu hidden" role="menu" data-i18n-aria="ds.plugins"></div>
|
|
127
|
+
</div>
|
|
128
|
+
<button class="ds-conn" id="conn-badge" type="button" aria-describedby="conn-refresh-hint" data-i18n-title="ds.connRefresh" data-i18n-aria="ds.connRefresh">●</button>
|
|
129
|
+
<span id="conn-refresh-hint" class="ext-sr-only" data-i18n="ds.connRefresh">点击刷新连接与数据</span>
|
|
125
130
|
<span class="ds-server" id="server-badge"></span>
|
|
126
131
|
</div>
|
|
127
132
|
</header>
|
|
@@ -179,9 +184,16 @@
|
|
|
179
184
|
|
|
180
185
|
<!-- 会话详情 -->
|
|
181
186
|
<section id="view-chat" class="ds-view">
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
<section id="session-deck" class="session-deck">
|
|
188
|
+
<div id="session-deck-stage" class="session-deck-stage">
|
|
189
|
+
<div id="session-cards" class="ds-session-cards"></div>
|
|
190
|
+
<div id="queue-dock" class="ds-queue-dock hidden" aria-live="polite"></div>
|
|
191
|
+
<div class="session-attention">
|
|
192
|
+
<section id="session-pending" class="ds-session-pending hidden" aria-live="polite"></section>
|
|
193
|
+
<section id="file-inbox-session" class="file-inbox-session" aria-label="待接收文件" aria-live="polite" hidden></section>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
</section>
|
|
185
197
|
<div id="history-source" class="history-source" role="status" aria-live="polite"></div>
|
|
186
198
|
<div class="ds-history-wrap"><div id="history" class="ds-history"></div><button id="btn-history-latest" class="history-latest hidden" type="button" data-i18n="ds.historyLatest">回到最新</button></div>
|
|
187
199
|
<div class="ds-composer">
|
|
@@ -221,6 +233,7 @@
|
|
|
221
233
|
<!-- 文件传输 -->
|
|
222
234
|
<section id="view-files" class="ds-view hidden">
|
|
223
235
|
<div class="ds-section-label" data-i18n="ds.files">文件传输</div>
|
|
236
|
+
<section id="file-inbox-files" class="file-inbox-files" aria-label="文件收件箱"></section>
|
|
224
237
|
<div class="ds-fs-bar">
|
|
225
238
|
<button id="fs-up" class="ds-btn" data-i18n="ds.fsUp">上级</button>
|
|
226
239
|
<select id="fs-root" class="ds-fs-root hidden" data-i18n-aria="ds.fsRoot" aria-label="允许根目录"></select>
|
|
@@ -567,6 +580,7 @@
|
|
|
567
580
|
'ds.attention': '需要你处理', 'ds.runtime': '运行指标', 'ds.recentActivity': '近期活动', 'ds.dshVersion': 'DSH 版本', 'ds.gatewayStatus': '网关状态', 'ds.activeSessions': '活跃会话', 'ds.connectionMode': '连接模式', 'ds.liveWs': '实时 WS', 'ds.poll': '降级轮询', 'ds.running': '运行中', 'ds.noReason': '无说明', 'ds.noActivity': '暂无后台活动', 'ds.noSessions': '暂无会话', 'ds.refreshOverview': '刷新总览', 'ds.pendingCount': '{n} 项待处理', 'ds.activeCount': '{n} 个活跃会话', 'ds.nothingPending': '暂无事项', 'ds.action.openSession': '打开最近会话', 'ds.action.newSession': '新建会话', 'ds.action.attention': '处理待办', 'ds.action.connect': '去设置连接', 'ds.action.refresh': '重新检查连接',
|
|
568
581
|
'ds.sortLabel': '会话排序', 'ds.sortTime': '按时间', 'ds.sortWorkspace': '按工作区', 'ds.workspace': '工作区', 'ds.workspaceUnknown': '未指定工作区', 'ds.wbOrderSaved': '顺序已保存到当前设备',
|
|
569
582
|
'ds.insights': '上下文与费用',
|
|
583
|
+
'ds.connRefresh': '点击刷新连接与数据',
|
|
570
584
|
'ds.insightsContext': '上下文分析',
|
|
571
585
|
'ds.insightsCost': '费用与额度',
|
|
572
586
|
'ds.files': '文件传输', 'ds.plugins': '插件', 'ds.settings': '设置', 'ds.stats': '统计', 'ds.menu': '导航',
|
|
@@ -696,6 +710,7 @@
|
|
|
696
710
|
'ds.attention': 'Needs attention', 'ds.runtime': 'Runtime metrics', 'ds.recentActivity': 'Recent activity', 'ds.dshVersion': 'DSH version', 'ds.gatewayStatus': 'Gateway status', 'ds.activeSessions': 'Active sessions', 'ds.connectionMode': 'Connection mode', 'ds.liveWs': 'Live WS', 'ds.poll': 'Degraded polling', 'ds.running': 'Running', 'ds.noReason': 'No reason given', 'ds.noActivity': 'No background activity', 'ds.noSessions': 'No sessions yet', 'ds.refreshOverview': 'Refresh overview', 'ds.pendingCount': '{n} pending', 'ds.activeCount': '{n} active sessions', 'ds.nothingPending': 'Nothing pending', 'ds.action.openSession': 'Open recent session', 'ds.action.newSession': 'New session', 'ds.action.attention': 'Review pending', 'ds.action.connect': 'Set up connection', 'ds.action.refresh': 'Check connection',
|
|
697
711
|
'ds.sortLabel': 'Session sort', 'ds.sortTime': 'By time', 'ds.sortWorkspace': 'By workspace', 'ds.workspace': 'Workspace', 'ds.workspaceUnknown': 'No workspace', 'ds.wbOrderSaved': 'Order saved on this device',
|
|
698
712
|
'ds.insights': 'Context & costs',
|
|
713
|
+
'ds.connRefresh': 'Click to refresh connection and data',
|
|
699
714
|
'ds.insightsContext': 'Context analysis',
|
|
700
715
|
'ds.insightsCost': 'Cost & quotas',
|
|
701
716
|
'ds.files': 'Files', 'ds.plugins': 'Plugins', 'ds.settings': 'Settings', 'ds.stats': 'Stats', 'ds.menu': 'Menu',
|
|
@@ -839,6 +854,7 @@
|
|
|
839
854
|
<script src="../skills.js"></script>
|
|
840
855
|
<script src="../insights.js"></script>
|
|
841
856
|
<script src="../teams.js"></script>
|
|
857
|
+
<script src="../task-board.js"></script>
|
|
842
858
|
<script src="../extensions.js"></script>
|
|
843
859
|
<script src="../sha256.js"></script>
|
|
844
860
|
<script src="../diagnostics.js"></script>
|
|
@@ -857,6 +873,10 @@
|
|
|
857
873
|
<script src="../permission-presets.js"></script>
|
|
858
874
|
<script src="../approval-records.js"></script>
|
|
859
875
|
<script src="../doctor-entry.js"></script>
|
|
876
|
+
<link rel="stylesheet" href="../file-inbox.css">
|
|
877
|
+
<script src="../file-inbox.js"></script>
|
|
878
|
+
<link rel="stylesheet" href="../session-deck.css">
|
|
879
|
+
<script src="../session-deck.js"></script>
|
|
860
880
|
<script src="desktop.js"></script>
|
|
861
881
|
</body>
|
|
862
882
|
</html>
|
|
@@ -132,6 +132,8 @@ for (const key of ['server', 'token']) {
|
|
|
132
132
|
window.DshInsights?.close()
|
|
133
133
|
window.DshExtensions?.close()
|
|
134
134
|
window.DshExtensions?.invalidateCapabilities()
|
|
135
|
+
window.DshFileInbox?.reset()
|
|
136
|
+
window.DshSessionDeck?.reset()
|
|
135
137
|
if (typeof document !== 'undefined') document.getElementById('btn-insights')?.classList.add('hidden')
|
|
136
138
|
if(typeof document!=='undefined') {
|
|
137
139
|
const identityGeneration=connectionGeneration
|
|
@@ -2412,7 +2414,7 @@ function blockHtml(b,index=0,context={}) {
|
|
|
2412
2414
|
if (b.type==='thinking'||b.type==='reasoning') return window.DshActivity.reasoning({text:b.text??b.content??'',key:window.DshActivity.reasoningKey(context,index,key)})
|
|
2413
2415
|
if (b.type==='tool-call'||b.type==='tool-result') return window.DshActivity.tool({key,name:b.name||b.toolName,...(b.type==='tool-call'?{args:b.arguments??b.args??b.input}:{result:b.result??b.output??b.content??b,error:!!(b.error||b.ok===false||b.isError)})})
|
|
2414
2416
|
}
|
|
2415
|
-
if (b.type === 'text') return `<div class="md">${window.mdToHtml ? window.mdToHtml(b.text ?? '', { fileLinks: true, imageLabel: t('block.image') }) : esc(b.text ?? '')}</div>`
|
|
2417
|
+
if (b.type === 'text') return window.DshActivity.hasVisibleText(b.text) ? `<div class="md">${window.mdToHtml ? window.mdToHtml(b.text ?? '', { fileLinks: true, imageLabel: t('block.image') }) : esc(b.text ?? '')}</div>` : ''
|
|
2416
2418
|
if (b.type === 'file' && typeof window !== 'undefined' && window.DshChatFiles) return window.DshChatFiles.render(b)
|
|
2417
2419
|
if (b.type === 'file') return `<div class="ds-tool">📎 ${esc(b.attachment?.name || b.name || 'file')} <small>${esc(b.attachment?.bytes ?? b.bytes ?? '')} bytes</small></div>`
|
|
2418
2420
|
if (b.type === 'thinking' || b.type === 'reasoning') return `<details><summary>${esc(t('block.thinking'))}</summary><div style="opacity:.82">${esc(b.text ?? b.content ?? '')}</div></details>`
|
|
@@ -2585,27 +2587,25 @@ async function renderSessionCards() {
|
|
|
2585
2587
|
let html = ''
|
|
2586
2588
|
if (goal && !isGoalTerminal(goal)) {
|
|
2587
2589
|
const collapsed = isGoalCollapsed(sessionId, goal)
|
|
2588
|
-
html += `<div class="ds-goal-disclosure${collapsed ? ' is-collapsed' : ''}">
|
|
2590
|
+
html += `<div data-deck-kind="goal" class="ds-goal-disclosure${collapsed ? ' is-collapsed' : ''}">
|
|
2589
2591
|
<div id="goal-panel-desktop" class="ds-card ds-goal-card${collapsed ? ' hidden' : ''}">
|
|
2590
|
-
<div class="ds-goal-card-head"><div class="ds-card-title">${t('goal.title')}</div>
|
|
2592
|
+
<div class="ds-goal-card-head"><div class="ds-card-title">${esc(window.DshSessionDeck?.goalState(goal.phase) || goal.phase || t('goal.title'))}</div>
|
|
2591
2593
|
<button type="button" class="ds-goal-collapse-btn" data-goal-collapse="1" aria-expanded="true" aria-controls="goal-panel-desktop" title="${esc(t('goal.collapse'))}"><span aria-hidden="true">›</span>${t('goal.collapseShort')}</button>
|
|
2592
2594
|
</div>
|
|
2593
2595
|
<div class="ds-goal-obj">${esc(goal.objective || '')}</div>
|
|
2594
|
-
<div class="ds-goal-phase">phase: ${esc(goal.phase || '?')} · revision ${goal.revision ?? '?'}</div>
|
|
2595
2596
|
<div class="ds-goal-actions">
|
|
2596
2597
|
${goal.phase === 'active' ? `<button class="ds-mini-btn" data-goal="pause">${t('goal.pause')}</button>` : `<button class="ds-mini-btn" data-goal="resume">${t('goal.resume')}</button>`}
|
|
2597
2598
|
<button class="ds-mini-btn" data-goal="complete">${t('goal.complete')}</button>
|
|
2598
|
-
<button class="ds-mini-btn" data-goal="edit">${t('goal.edit')}</button>
|
|
2599
|
-
<button class="ds-mini-btn" data-goal="clear">${t('goal.clear')}</button>
|
|
2599
|
+
<details class="deck-more" data-deck-details="goal-${esc(goal.id || '')}"><summary>${I18N.lang === 'en' ? 'More' : '更多'}</summary><div class="deck-full-content">${esc(goal.objective || '')}<p>revision ${esc(goal.revision ?? '?')}</p></div><div class="ds-goal-actions"><button class="ds-mini-btn" data-goal="edit">${t('goal.edit')}</button><button class="ds-mini-btn" data-goal="clear">${t('goal.clear')}</button></div></details>
|
|
2600
2600
|
</div>
|
|
2601
2601
|
</div>
|
|
2602
2602
|
<button type="button" class="ds-goal-side-tab${collapsed ? '' : ' hidden'}" data-goal-collapse="0" aria-expanded="false" aria-controls="goal-panel-desktop" aria-label="${esc(t('goal.expand'))}" title="${esc(t('goal.expand'))}"><span aria-hidden="true">‹</span><span>${t('goal.title')}</span><small>${t('goal.collapsedHint')}</small></button>
|
|
2603
2603
|
</div>`
|
|
2604
2604
|
}
|
|
2605
2605
|
if (todos?.items?.length) {
|
|
2606
|
-
html += `<div class="ds-card"
|
|
2606
|
+
html += `<div data-deck-kind="todos" class="ds-card">${window.DshSessionDeck?.taskHtml(todos.items) || `<div class="ds-card-title">${t('todos.title')}</div>${todos.items.map(item =>
|
|
2607
2607
|
`<div class="ds-todo-row"><span class="ds-pill ${item.status === 'completed' ? 'done' : item.status === 'in_progress' ? 'active' : ''}">${esc(item.status || 'pending')}</span><span>${esc(item.content || '')}</span></div>`
|
|
2608
|
-
).join('')}</div>`
|
|
2608
|
+
).join('')}`}</div>`
|
|
2609
2609
|
}
|
|
2610
2610
|
box.innerHTML = html
|
|
2611
2611
|
box.querySelectorAll('[data-goal]').forEach(btn =>
|
|
@@ -2942,12 +2942,13 @@ function serverLabel() {
|
|
|
2942
2942
|
}
|
|
2943
2943
|
function desktopApprovalDetail(a) {
|
|
2944
2944
|
const lines = []
|
|
2945
|
-
if (a?.reason) lines.push(String(a.reason))
|
|
2945
|
+
if (a?.reason) lines.push(window.DshApprovalRecords?.displayReason(a.reason) || String(a.reason))
|
|
2946
2946
|
if (a?.arguments !== undefined) lines.push(safeJson(a.arguments))
|
|
2947
2947
|
if (a?.callId) lines.push(`callId: ${a.callId}`)
|
|
2948
2948
|
return lines.join('\n') || t('ds.approvalReason', { reason: '' })
|
|
2949
2949
|
}
|
|
2950
2950
|
function renderSessionPendingDesktop() {
|
|
2951
|
+
window.DshFileInbox?.render()
|
|
2951
2952
|
const box = $('session-pending')
|
|
2952
2953
|
if (!box) return
|
|
2953
2954
|
const sessionId = state.current
|
|
@@ -2958,12 +2959,12 @@ function renderSessionPendingDesktop() {
|
|
|
2958
2959
|
box.classList.toggle('hidden', !sessionId || !items.length)
|
|
2959
2960
|
if (!sessionId || !items.length) { box.innerHTML = ''; return }
|
|
2960
2961
|
box.innerHTML = `<div class="ds-session-pending-head"><span>${esc(t('ds.attention'))}</span><span>${items.length}</span></div><div class="ds-session-pending-list">${items.map(({ kind, item }) => {
|
|
2961
|
-
if (kind === 'approval') return `<article class="ds-notif-card" data-session-approval="${esc(item.approvalId)}"
|
|
2962
|
+
if (kind === 'approval') return `<article class="ds-notif-card" data-session-approval="${esc(item.approvalId)}">${window.DshSessionDeck?.approvalHtml(item, desktopApprovalDetail(item)) || `
|
|
2962
2963
|
<div class="ds-notif-head">🔐 ${t('ds.approvalTitle')}</div>
|
|
2963
2964
|
<div class="ds-notif-title">${esc(item.toolName || t('ds.toolDefault'))}</div>
|
|
2964
2965
|
<div class="ds-notif-body">${esc(desktopApprovalDetail(item))}</div>
|
|
2965
2966
|
<div class="ds-notif-actions"><button type="button" class="ds-btn allow" data-session-approve="1">${t('ds.allow')}</button><button type="button" class="ds-btn reject" data-session-approve="0">${t('ds.reject')}</button></div>
|
|
2966
|
-
</article>`
|
|
2967
|
+
`}</article>`
|
|
2967
2968
|
return `<button type="button" class="ds-notif-card question" data-session-question="${esc(item.rpcId)}" aria-haspopup="dialog">
|
|
2968
2969
|
<span class="ds-question-card-head"><span class="ds-notif-head">❓ ${esc(item.questions?.[0]?.header || t('ds.questionNotify'))}</span><span class="ds-btn">${t('ds.submit')}</span></span>
|
|
2969
2970
|
<span class="ds-question-summary">${esc(questionSummary(item))}</span>
|
|
@@ -4008,6 +4009,11 @@ function openDesktopPlugins(route = 'manage') {
|
|
|
4008
4009
|
window.DshExtensions.mount({connection,getWorkspaces: () => state.workspaces || [],
|
|
4009
4010
|
getWorkspaceId: () => (state.workspaces || []).find(w => (w.sessionIds || []).includes(state.current))?.workspaceId || '',
|
|
4010
4011
|
openTeamCaptain: async id => { if (!connection.valid()) return; await openSession(id) },
|
|
4012
|
+
openTaskSession: async (id, workspaceId) => {
|
|
4013
|
+
if (!connection.valid() || state.view !== 'view-plugins') return
|
|
4014
|
+
if (!(state.workspaces || []).some(row => row.workspaceId === workspaceId)) throw Error('unavailable')
|
|
4015
|
+
await openSession(id)
|
|
4016
|
+
},
|
|
4011
4017
|
openTeamMember: async (id, parentId) => {
|
|
4012
4018
|
const selected = state.current
|
|
4013
4019
|
const catalog = await loadSessionSubagents(parentId)
|
|
@@ -4020,7 +4026,8 @@ function openDesktopPlugins(route = 'manage') {
|
|
|
4020
4026
|
back:()=>showView('view-settings'),getSession:()=>state.byId.get(state.current),getTitle:()=>titleOf(state.byId.get(state.current)),openContext:()=>void openInsights('context',true),scrollTop:()=>{$('view-plugins').scrollTop=0},url:path=>connection.server+path,headers:{authorization:'Bearer '+connection.token,'x-dsh-remote-client':'web',...clientIdHeaders()},valid:connection.valid},$('desktop-plugin-page'),route)
|
|
4021
4027
|
}
|
|
4022
4028
|
|
|
4023
|
-
function showView(id) {
|
|
4029
|
+
function showView(id, pluginRoute = 'manage') {
|
|
4030
|
+
window.DshExtensions?.closeShortcuts()
|
|
4024
4031
|
if (id !== 'view-chat') window.DshSubagents?.close()
|
|
4025
4032
|
document.body?.classList.toggle('viewing-subagent', id === 'view-chat' && state.byId.get(state.current)?.origin === 'subagent')
|
|
4026
4033
|
window.DshWorkflow?.close()
|
|
@@ -4028,6 +4035,8 @@ function showView(id) {
|
|
|
4028
4035
|
if (id !== 'view-chat') conversationView?.pause()
|
|
4029
4036
|
if (state.view === 'view-chat' && id !== 'view-chat' && state.current) void archiveEmptySessionOnLeave(state.current)
|
|
4030
4037
|
state.view = id
|
|
4038
|
+
window.DshFileInbox?.render()
|
|
4039
|
+
window.DshSessionDeck?.refresh()
|
|
4031
4040
|
document.body?.classList.toggle('workflow-at-start', !!window.DshWorkflow?.isMounted() && id === 'view-sessions')
|
|
4032
4041
|
for (const v of ['view-overview', 'view-sessions', 'view-chat', 'view-files', 'view-plugins', 'view-settings']) $(v).classList.toggle('hidden', v !== id)
|
|
4033
4042
|
if (id === 'view-chat') conversationView?.resume()
|
|
@@ -4041,7 +4050,7 @@ function showView(id) {
|
|
|
4041
4050
|
else {overviewDetector?.pause();overviewPulse?.pause()}
|
|
4042
4051
|
if (id === 'view-files' && !state.fs.loaded) loadFs(null, true)
|
|
4043
4052
|
if (id === 'view-settings') showSettingsHome()
|
|
4044
|
-
if (id === 'view-plugins') openDesktopPlugins()
|
|
4053
|
+
if (id === 'view-plugins') openDesktopPlugins(pluginRoute)
|
|
4045
4054
|
else window.DshExtensions?.close()
|
|
4046
4055
|
updateSessionActions()
|
|
4047
4056
|
}
|
|
@@ -4141,6 +4150,11 @@ function bindSessionDialogs() {
|
|
|
4141
4150
|
}
|
|
4142
4151
|
|
|
4143
4152
|
function bindUi() {
|
|
4153
|
+
$('conn-badge').addEventListener('click', () => { toast(t('ds.connRefresh')); openStreams(); void refreshSessions(); startOverviewDetection(true) })
|
|
4154
|
+
window.DshExtensions?.bindShortcuts({ trigger: $('btn-plugin-shortcuts'), menu: $('plugin-shortcuts-menu'),
|
|
4155
|
+
config: () => optionalPluginConfig(), connected: () => !!state.token, hasSession: () => !!state.current,
|
|
4156
|
+
beforeOpen: () => setMobileSidebar(false),
|
|
4157
|
+
open: route => { if (route === 'context') void openInsights('context', true); else showView('view-plugins', route) } })
|
|
4144
4158
|
bindSessionDialogs()
|
|
4145
4159
|
getConversationView()
|
|
4146
4160
|
$('btn-history-latest').addEventListener('click',()=>{getConversationView().latest();if(state.history.tailEvicted)void loadHistory(true)})
|
|
@@ -4466,3 +4480,8 @@ function mountWorkflowDesktop() {
|
|
|
4466
4480
|
|
|
4467
4481
|
// Operation logs stay on this device; users can copy or export them.
|
|
4468
4482
|
globalThis.DshDiagnostics?.configure({surface:"desktop",copy:copyText,snapshot:()=>({sessionId:state.current,server:state.server,loading:!!state.history.loading,loaded:!!state.history.loaded,count:state.history.visible.length,...globalThis.DshDiagnostics.nativeSnapshot()})})
|
|
4483
|
+
globalThis.DshFileInbox?.mount({ capture: captureConnection, url: apiUrl,
|
|
4484
|
+
context: () => ({ sessionId: state.current, inChat: state.view === 'view-chat' }),
|
|
4485
|
+
sessionTitle: id => state.byId.has(id) ? titleOf(state.byId.get(id)) : '', openFiles: () => showView('view-files'),
|
|
4486
|
+
headers: connection => ({ authorization: 'Bearer ' + connection.token, 'x-dsh-remote-client': 'web', ...clientIdHeaders() }), native: () => null })
|
|
4487
|
+
globalThis.DshSessionDeck?.mount({ context: () => ({ sessionId: state.current, inChat: state.view === 'view-chat' }) })
|
package/public/extensions.css
CHANGED
|
@@ -1 +1,109 @@
|
|
|
1
|
-
|
|
1
|
+
/* Optional plugin views share the host theme and adapt to their container. */
|
|
2
|
+
.ext-page{min-width:0;width:100%;padding:16px;color:var(--dsr-text)}
|
|
3
|
+
.ext-page.is-manage{padding:0}
|
|
4
|
+
.ext-page,.ext-page *{box-sizing:border-box}
|
|
5
|
+
.ext-page [hidden]{display:none!important}
|
|
6
|
+
.ext-header{display:flex;gap:14px;align-items:center;justify-content:space-between;margin-bottom:28px;flex-wrap:wrap}
|
|
7
|
+
.ext-host{min-width:0;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--dsr-muted);font-size:13px;line-height:1.7}
|
|
8
|
+
.ext-header button,.ext-button{display:inline-flex;gap:12px;align-items:center;justify-content:center;flex-shrink:0;min-height:44px;max-width:100%;padding:10px 15px;border:1px solid var(--dsr-line);border-radius:12px;color:var(--dsr-text);background:var(--dsr-panel);font:inherit;font-size:13px;line-height:1.5;text-align:center;text-decoration:none;cursor:pointer}
|
|
9
|
+
.ext-button:hover,.ext-header button:hover{background:var(--dsr-panel-2);border-color:var(--dsr-muted)}
|
|
10
|
+
.ext-button-primary{background:var(--dsr-accent-soft);border-color:var(--dsr-accent-line);color:var(--dsr-accent-strong)}
|
|
11
|
+
.ext-button-primary:hover{background:var(--dsr-accent-soft);border-color:var(--dsr-accent)}
|
|
12
|
+
.ext-button:disabled{opacity:.6;cursor:wait}
|
|
13
|
+
.ext-page :is(button,input,select,summary):focus-visible{outline:2px solid var(--dsr-accent);outline-offset:3px}
|
|
14
|
+
.teams-page,.task-board{container-type:inline-size;min-width:0;max-width:1080px;margin:0 auto;line-height:1.6}
|
|
15
|
+
.ext-heading{margin-bottom:24px;max-width:70ch}
|
|
16
|
+
.ext-eyebrow{display:block;color:var(--dsr-accent-strong);font-size:11px;font-weight:650;letter-spacing:.1em;margin-bottom:7px}
|
|
17
|
+
.ext-heading h2{font-size:clamp(24px,4vw,30px);line-height:1.3;letter-spacing:-.025em;margin:0;font-weight:700}
|
|
18
|
+
.ext-heading p{margin:10px 0 0;color:var(--dsr-muted);font-size:14px;line-height:1.8;text-wrap:pretty}
|
|
19
|
+
.ext-toolbar{display:flex;gap:16px;flex-wrap:wrap;align-items:end;padding:18px;background:var(--dsr-panel);border:1px solid var(--dsr-line);border-radius:16px}
|
|
20
|
+
.ext-field{display:flex;flex:1 1 130px;min-width:0;flex-direction:column;gap:7px;color:var(--dsr-muted);font-size:12px;font-weight:500}
|
|
21
|
+
.ext-workspace{flex-basis:200px}.ext-search{flex-basis:180px}
|
|
22
|
+
.ext-field :is(select,input){width:100%;min-width:0;max-width:100%;min-height:44px;border:1px solid var(--dsr-line);border-radius:10px;padding:10px 12px;font:inherit;font-size:14px;line-height:1.5;color:var(--dsr-text);background:var(--dsr-bg);text-overflow:ellipsis}
|
|
23
|
+
.ext-check{display:flex;gap:9px;align-items:center;min-height:44px;color:var(--dsr-muted);font-size:13px;line-height:1.5;cursor:pointer}
|
|
24
|
+
.ext-check input{width:17px;height:17px;flex-shrink:0;margin:0;accent-color:var(--dsr-accent)}
|
|
25
|
+
.ext-note{font-size:12px;line-height:1.8;color:var(--dsr-muted);margin:14px 2px;overflow-wrap:break-word;word-break:normal}
|
|
26
|
+
.task-scope{margin-bottom:0}.task-scope+.ext-note{margin-top:5px}
|
|
27
|
+
.task-summary{display:flex;gap:4px 16px;flex-wrap:wrap;align-items:baseline;justify-content:space-between;margin:5px 2px 14px}
|
|
28
|
+
.task-summary .ext-note{margin:0}
|
|
29
|
+
.teams-list,.task-list{display:grid;gap:20px;min-width:0}
|
|
30
|
+
.task-list{grid-template-columns:repeat(auto-fill,minmax(min(100%,360px),1fr));align-items:start}
|
|
31
|
+
.teams-card,.task-card{min-width:0;border:1px solid var(--dsr-line);background:var(--dsr-panel);border-radius:18px;padding:24px;overflow-wrap:break-word;word-break:normal}
|
|
32
|
+
.ext-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;min-width:0}
|
|
33
|
+
.ext-panel-head>h3,.ext-panel-head>strong{min-width:0;margin:0;font-size:18px;line-height:1.5;font-weight:650;overflow-wrap:anywhere}
|
|
34
|
+
.ext-badge{display:inline-flex;flex-shrink:0;max-width:50%;border:1px solid var(--dsr-line);border-radius:8px;background:var(--dsr-panel-2);padding:4px 9px;font-size:11px;font-weight:600;line-height:1.6;color:var(--dsr-muted);text-align:center}
|
|
35
|
+
.ext-badge[data-tone=active]{border-color:var(--dsr-accent-line);background:var(--dsr-accent-soft);color:var(--dsr-accent-strong)}
|
|
36
|
+
.ext-badge[data-tone=attention]{border-color:var(--dsr-warning-line);background:var(--dsr-warning-soft);color:var(--dsr-warning)}
|
|
37
|
+
.ext-copy{white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal;line-height:1.8;font-size:13px}
|
|
38
|
+
.team-description,.task-description{color:var(--dsr-muted);margin:12px 0 20px}
|
|
39
|
+
.ext-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:18px 0}
|
|
40
|
+
.ext-facts>div{min-width:0}.ext-facts dt{margin:0 0 5px;font-size:11px;line-height:1.7;color:var(--dsr-muted)}
|
|
41
|
+
.ext-facts dd{margin:0;font-size:13px;line-height:1.8;overflow-wrap:anywhere}
|
|
42
|
+
.ext-facts small{display:block;font-size:11px;line-height:1.8;color:var(--dsr-muted);margin-top:3px}
|
|
43
|
+
.ext-identifier{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;overflow-wrap:anywhere}
|
|
44
|
+
.ext-alert{border:1px solid var(--dsr-warning-line);border-left:3px solid var(--dsr-warning);border-radius:10px;background:var(--dsr-warning-soft);padding:13px 15px;margin:18px 0;font-size:13px;line-height:1.8;overflow-wrap:anywhere}
|
|
45
|
+
.ext-alert>strong{display:block;font-size:12px;color:var(--dsr-warning)}.ext-alert>p{margin:7px 0 0}
|
|
46
|
+
.ext-alert ul{padding-left:18px;margin:8px 0 0}.ext-alert li+li{margin-top:6px}
|
|
47
|
+
.ext-disclosure{border-top:1px solid var(--dsr-line);margin-top:16px}
|
|
48
|
+
.ext-disclosure>summary{list-style:none;display:flex;align-items:center;gap:10px;min-height:50px;padding:12px 0;color:var(--dsr-text);font-size:13px;font-weight:600;cursor:pointer}
|
|
49
|
+
.ext-disclosure>summary::-webkit-details-marker{display:none}
|
|
50
|
+
.ext-disclosure>summary:after{content:'›';font-size:20px;line-height:1;margin-left:auto;color:var(--dsr-muted);transition:transform .15s ease}
|
|
51
|
+
.ext-disclosure[open]>summary:after{transform:rotate(90deg)}
|
|
52
|
+
.ext-count{color:var(--dsr-muted);font-size:11px;font-weight:400;font-variant-numeric:tabular-nums}
|
|
53
|
+
.ext-detail-body{padding:3px 0 8px;min-width:0}
|
|
54
|
+
.ext-alert .ext-disclosure{margin-top:8px;border-color:var(--dsr-warning-line)}
|
|
55
|
+
.ext-alert .ext-disclosure>summary{min-height:44px;padding-bottom:4px}
|
|
56
|
+
.ext-empty{grid-column:1/-1;padding:28px 16px;margin:0;color:var(--dsr-muted);font-size:13px;text-align:center;line-height:1.8}
|
|
57
|
+
.team-overview{display:flex;gap:28px;padding:14px 0;margin:16px 0;border-top:1px solid var(--dsr-line);border-bottom:1px solid var(--dsr-line)}
|
|
58
|
+
.team-overview>span{display:flex;gap:10px;align-items:baseline;color:var(--dsr-muted);font-size:12px}
|
|
59
|
+
.team-overview b{font-size:19px;line-height:1.3;color:var(--dsr-text);font-weight:650;font-variant-numeric:tabular-nums}
|
|
60
|
+
.team-checks{margin:18px 0}.team-captain-action{display:flex;justify-content:flex-end;margin:20px 0 8px}
|
|
61
|
+
.team-members,.team-tasks,.team-messages{list-style:none;padding:0;margin:0}
|
|
62
|
+
.team-members{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:12px}
|
|
63
|
+
.team-member,.team-task{min-width:0;padding:16px;border:1px solid var(--dsr-line);border-radius:12px;background:var(--dsr-bg)}
|
|
64
|
+
.team-member{display:flex;flex-direction:column}
|
|
65
|
+
.team-member .ext-panel-head>strong,.team-task .ext-panel-head>strong{font-size:14px}
|
|
66
|
+
.team-member-state{max-width:50%;font-size:11px;line-height:1.8;color:var(--dsr-muted);text-align:right}
|
|
67
|
+
.team-role{margin:8px 0 0;color:var(--dsr-muted)}
|
|
68
|
+
.team-member-facts{grid-template-columns:minmax(0,1fr);gap:10px;margin:12px 0 16px}
|
|
69
|
+
.team-member-action{margin-top:auto}.team-member-action .ext-button{width:100%;background:var(--dsr-panel)}
|
|
70
|
+
.team-tasks{display:grid;gap:10px}.team-task-id{display:block;margin-top:4px;color:var(--dsr-muted);font-size:11px}
|
|
71
|
+
.team-task .ext-facts{margin-bottom:0}
|
|
72
|
+
.team-messages>li{padding:12px 0;border-bottom:1px solid var(--dsr-line);font-size:13px}.team-messages>li:last-child{border-bottom:0}.team-messages p{margin:6px 0 0}
|
|
73
|
+
.task-outcomes{padding:15px;border-radius:10px;background:var(--dsr-bg);margin:18px 0}
|
|
74
|
+
.task-schedule{padding:14px 0;margin:18px 0;border-top:1px solid var(--dsr-line);border-bottom:1px solid var(--dsr-line)}
|
|
75
|
+
.task-schedule-head{display:flex;gap:12px;justify-content:space-between;align-items:baseline;font-size:11px;color:var(--dsr-muted)}
|
|
76
|
+
.task-schedule-rule{margin:5px 0;font-size:13px;line-height:1.8;overflow-wrap:anywhere}
|
|
77
|
+
.task-schedule .ext-facts{grid-template-columns:minmax(0,1fr);margin:12px 0 0}
|
|
78
|
+
.task-schedule:has(+.ext-disclosure){border-bottom:0;padding-bottom:0;margin-bottom:0}
|
|
79
|
+
.task-parent{grid-template-columns:minmax(0,1fr);margin:16px 0}
|
|
80
|
+
.task-footer{display:flex;gap:14px;align-items:center;justify-content:space-between;border-top:1px solid var(--dsr-line);padding-top:16px;margin-top:20px}
|
|
81
|
+
.task-footer>span{min-width:0;font-size:10px;line-height:1.8;color:var(--dsr-muted)}.task-footer time{display:block;font-size:11px;font-variant-numeric:tabular-nums}
|
|
82
|
+
.task-footer .ext-button{font-size:12px;padding:10px 12px}
|
|
83
|
+
.pc-adaptation{font-size:13px;line-height:1.7;color:var(--dsr-muted);overflow-wrap:anywhere}.pc-adaptation a{color:var(--dsr-accent)}
|
|
84
|
+
@container(max-width:540px){
|
|
85
|
+
.ext-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:16px}
|
|
86
|
+
.ext-workspace{grid-column:1/-1}
|
|
87
|
+
.ext-toolbar>.ext-check{grid-column:1;font-size:12px}.ext-toolbar>.ext-button{grid-column:2;align-self:end;justify-self:end}
|
|
88
|
+
.teams-card,.task-card{padding:18px}.ext-panel-head{gap:10px}.ext-panel-head>h3{font-size:17px}.ext-badge{max-width:45%}
|
|
89
|
+
.team-overview{gap:22px}.team-overview>span{gap:7px}.team-captain-action .ext-button{width:100%}
|
|
90
|
+
.task-footer{flex-direction:column;align-items:stretch;gap:12px}.task-footer>span{display:flex;gap:8px;flex-wrap:wrap;align-items:baseline}.task-footer .ext-button{width:100%}
|
|
91
|
+
}
|
|
92
|
+
@container(max-width:320px){
|
|
93
|
+
.ext-facts{grid-template-columns:minmax(0,1fr);gap:12px}.team-overview{gap:14px;flex-wrap:wrap}.ext-panel-head{flex-wrap:wrap}.ext-badge{max-width:100%}
|
|
94
|
+
}
|
|
95
|
+
@media(max-width:620px){.ext-page{padding:8px 0}.ext-header{margin-bottom:22px}}
|
|
96
|
+
@media(prefers-reduced-motion:reduce){.ext-disclosure>summary:after{transition:none}}
|
|
97
|
+
.ext-shortcuts { display:flex; align-items:center; }
|
|
98
|
+
.ext-shortcuts-menu { position:absolute; right:10px; top:calc(100% + 4px); z-index:80; width:min(300px,calc(100vw - 20px)); max-height:min(70vh,460px); overflow-y:auto; box-sizing:border-box; padding:8px; border:1px solid var(--dsr-line); border-radius:16px; color:var(--dsr-text); background:var(--dsr-panel); box-shadow:0 14px 40px var(--dsr-shadow); text-align:left; }
|
|
99
|
+
.ext-shortcut-title { margin:4px 8px 8px; color:var(--dsr-muted); font-size:11px; font-weight:600; }
|
|
100
|
+
.ext-shortcut-item,.ext-shortcut-manage { width:100%; min-height:44px; box-sizing:border-box; padding:10px 12px; border:0; border-radius:10px; background:transparent; color:var(--dsr-text); font:inherit; font-size:14px; text-align:left; cursor:pointer; }
|
|
101
|
+
.ext-shortcut-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; align-items:center; }
|
|
102
|
+
.ext-shortcut-arrow { color:var(--dsr-muted); }
|
|
103
|
+
.ext-shortcut-item small { grid-column:1/-1; color:var(--dsr-muted); font-size:11px; }
|
|
104
|
+
.ext-shortcut-item:disabled { cursor:default; opacity:.55; }
|
|
105
|
+
.ext-shortcut-item:not(:disabled):hover,.ext-shortcut-manage:hover { background:var(--dsr-accent-soft); }
|
|
106
|
+
.ext-shortcut-manage { margin-top:6px; border-top:1px solid var(--dsr-line); border-radius:0 0 10px 10px; color:var(--dsr-accent-strong); }
|
|
107
|
+
.ext-shortcut-empty { margin:8px; padding:10px 4px; font-size:13px; line-height:1.6; color:var(--dsr-muted); }
|
|
108
|
+
.ext-shortcuts :is(button):focus-visible { outline:2px solid var(--dsr-accent); outline-offset:2px; }
|
|
109
|
+
.ext-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
|
package/public/extensions.js
CHANGED
|
@@ -2,19 +2,55 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
window.DshExtensions = (() => {
|
|
4
4
|
let current, cache
|
|
5
|
+
let shortcuts
|
|
5
6
|
const catalog = [
|
|
6
7
|
{ id: 'skills', name: '@linxin666/dsh-client-ui-skill-explorer', label: '打开技能中心', summary: '浏览、搜索和阅读主机上的技能', verified: '0.4.6' },
|
|
7
8
|
{ id: 'teams', name: '@nanmicoder/dsh-agent-teams', label: '查看智能体团队', summary: '查看智能体团队、任务与成员状态', verified: '0.1.24-rc.1' },
|
|
8
9
|
{ id: 'cost', name: 'dsh-cost-meter', label: '查看费用与额度', summary: '查看费用、套餐额度与峰谷提醒', verified: '1.8.17' },
|
|
9
10
|
{ id: 'context', name: 'dsh-context', label: '查看当前会话上下文', session: true, summary: '查看会话上下文用量与构成', verified: '0.64.0' },
|
|
11
|
+
{ id: 'tasks', name: '@linxin666/dsh-client-ui-task-board', label: '查看任务看板', summary: '只读查看任务、执行结果与计划时间', verified: '0.4.8' },
|
|
10
12
|
]
|
|
11
|
-
const empty = () => ({ known: false, skills: false, cost: false, context: false, teams: false })
|
|
13
|
+
const empty = () => ({ known: false, skills: false, cost: false, context: false, teams: false, tasks: false })
|
|
14
|
+
const helpUrl = 'https://github.com/Blank-not-black/dsh-Remote/blob/main/docs/wiki/plugins.md'
|
|
15
|
+
const reasons = {
|
|
16
|
+
'not-installed': ['未安装', 'Not installed'], disabled: ['配置未启用', 'Disabled in configuration'],
|
|
17
|
+
'runtime-unknown': ['运行状态未知', 'Runtime status unknown'], waiting: ['等待启动或依赖', 'Waiting for startup or dependencies'],
|
|
18
|
+
'runtime-failed': ['插件启动失败', 'Plugin startup failed'], 'restart-required': ['配置已更新,待重启 DSH', 'Configuration updated; restart DSH'],
|
|
19
|
+
unverified: ['运行中,接口待读取验证', 'Running; interface not verified yet'], available: ['接口读取成功', 'Interface read succeeded'],
|
|
20
|
+
unsupported: ['接口不兼容', 'Unsupported interface'], 'endpoint-missing': ['主机未提供适配接口', 'Adapter endpoint unavailable on host'], 'read-failed': ['接口读取失败,可重试', 'Interface read failed; retry available'],
|
|
21
|
+
timeout: ['接口读取超时,可重试', 'Interface read timed out; retry available'], 'host-denied': ['主机拒绝读取,请检查认证', 'Host denied access; check authentication'],
|
|
22
|
+
}
|
|
23
|
+
function diagnosticsFor(snapshot, item, config) {
|
|
24
|
+
return catalog.filter(feature => feature.name === item.name).map(feature => {
|
|
25
|
+
const installed = snapshot?.items?.find(row => row?.name === feature.name)
|
|
26
|
+
const runtime = [...(Array.isArray(installed?.runtime) ? installed.runtime : []), ...(snapshot?.runtime || []).filter(row => row?.name === feature.name)]
|
|
27
|
+
const changed = snapshot?.pendingRestart && snapshot.operations?.some(job => job.name === feature.name && job.restartRequired && ['complete','failed','interrupted'].includes(job.phase))
|
|
28
|
+
const observed = config && same(config) ? cache.observations?.[feature.id] : null
|
|
29
|
+
const fresh = observed && observed.version === installed?.version && Date.now() - observed.at < 300000
|
|
30
|
+
const code = !installed ? 'not-installed' : changed ? 'restart-required' : installed.enabled !== true ? 'disabled'
|
|
31
|
+
: snapshot.runtimeAvailable !== true ? 'runtime-unknown' : runtime.some(row => row?.phase === 'failed') ? 'runtime-failed'
|
|
32
|
+
: !runtime.length || runtime.some(row => row?.enabled === false || row?.phase !== 'active') ? 'waiting'
|
|
33
|
+
: snapshot.adaptations?.[feature.id]?.supported === false ? 'unsupported' : fresh ? observed.code : 'unverified'
|
|
34
|
+
return { id: feature.id, code, label: reasons[code][window.I18N?.lang === 'en' ? 1 : 0], helpUrl, checkedAt: fresh ? observed.at : null }
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
function reportAvailability(config, id, result) {
|
|
38
|
+
if (!config || !catalog.some(row => row.id === id) || !same(config)) return
|
|
39
|
+
const native = identity(config)
|
|
40
|
+
if (!native.valid() || config.valid && !config.valid()) return
|
|
41
|
+
const code = result?.ok === true && result.available !== false ? 'available'
|
|
42
|
+
: result?.code === 'unsupported' ? 'unsupported' : result?.code === 'not-installed' ? 'endpoint-missing'
|
|
43
|
+
: result?.code === 'host-denied' ? 'host-denied' : result?.code === 'timeout' ? 'timeout' : 'read-failed'
|
|
44
|
+
cache.observations ||= {}
|
|
45
|
+
cache.observations[id] = { code, at: Date.now(), version: cache.snapshot?.items?.find(row => row.name === catalog.find(feature => feature.id === id).name)?.version }
|
|
46
|
+
}
|
|
12
47
|
function capabilitiesOf(snapshot) {
|
|
13
48
|
if (snapshot?.ok !== true || !Array.isArray(snapshot.items) || !Array.isArray(snapshot.runtime)) return empty()
|
|
14
49
|
const result = { ...empty(), known: true }
|
|
15
50
|
for (const feature of catalog) {
|
|
16
51
|
const item = snapshot.items.find(row => row?.name === feature.name)
|
|
17
52
|
if (item?.enabled !== true || snapshot.runtimeAvailable !== true) continue
|
|
53
|
+
if (snapshot.adaptations?.[feature.id]?.supported === false) continue
|
|
18
54
|
if (item.runtime != null && !Array.isArray(item.runtime)) continue
|
|
19
55
|
const runtime = [...(item.runtime || []), ...snapshot.runtime.filter(row => row?.name === feature.name)]
|
|
20
56
|
result[feature.id] = runtime.length > 0 && runtime.every(row => row && row.enabled !== false && row.phase === 'active')
|
|
@@ -28,12 +64,14 @@ window.DshExtensions = (() => {
|
|
|
28
64
|
function identity(config) { return config.connection || config }
|
|
29
65
|
function same(config) {
|
|
30
66
|
const next = identity(config)
|
|
31
|
-
return cache && cache.connection.valid() && next.valid() &&
|
|
67
|
+
return cache && cache.connection.valid() && next.valid() && (typeof next.server === 'string'
|
|
68
|
+
? cache.connection.server === next.server && cache.connection.token === next.token : cache.connection === next)
|
|
32
69
|
}
|
|
33
70
|
function remember(config, snapshot) {
|
|
34
71
|
if (!config.valid()) return
|
|
35
72
|
if (!same(config)) { cache?.controller?.abort(); cache = { connection: identity(config) } }
|
|
36
73
|
cache.value = capabilitiesOf(snapshot); cache.at = Date.now()
|
|
74
|
+
cache.snapshot = snapshot
|
|
37
75
|
cache.serial = (cache.serial || 0) + 1
|
|
38
76
|
}
|
|
39
77
|
function invalidateCapabilities() { cache?.controller?.abort(); cache = null }
|
|
@@ -54,7 +92,7 @@ window.DshExtensions = (() => {
|
|
|
54
92
|
const snapshot = JSON.parse(body)
|
|
55
93
|
if (!response.ok || !config.valid() || cache !== record || snapshot?.ok !== true) return empty()
|
|
56
94
|
if ((record.serial || 0) !== serial) return record.value || empty()
|
|
57
|
-
record.value = capabilitiesOf(snapshot); record.at = Date.now(); return record.value
|
|
95
|
+
record.snapshot = snapshot; record.value = capabilitiesOf(snapshot); record.at = Date.now(); return record.value
|
|
58
96
|
} catch {
|
|
59
97
|
if (cache === record && config.valid() && (record.serial || 0) !== serial) return record.value || empty()
|
|
60
98
|
if (cache === record) { record.value = empty(); record.at = Date.now() }
|
|
@@ -65,8 +103,78 @@ window.DshExtensions = (() => {
|
|
|
65
103
|
return record.task
|
|
66
104
|
}
|
|
67
105
|
const node=(tag,text,cls)=>{const el=document.createElement(tag);if(text!=null)el.textContent=text;if(cls)el.className=cls;return el}
|
|
68
|
-
const
|
|
69
|
-
|
|
106
|
+
const shortcutNames = { skills: ['技能中心', 'Skills'], teams: ['智能体团队', 'Agent teams'], cost: ['费用与额度', 'Costs & quotas'], context: ['上下文分析', 'Context analysis'], tasks: ['任务看板', 'Task board'] }
|
|
107
|
+
const shortcutText = (zh, en) => window.I18N?.lang === 'en' ? en : zh
|
|
108
|
+
function closeShortcuts(restoreFocus = false) {
|
|
109
|
+
if (!shortcuts) return
|
|
110
|
+
const s = shortcuts
|
|
111
|
+
shortcuts = null
|
|
112
|
+
s.menu.classList.add('hidden'); s.trigger.setAttribute('aria-expanded', 'false')
|
|
113
|
+
if (restoreFocus) s.trigger.focus()
|
|
114
|
+
return true
|
|
115
|
+
}
|
|
116
|
+
function bindShortcuts({ trigger, menu, config, connected, hasSession, open, beforeOpen }) {
|
|
117
|
+
if (!trigger || !menu) return
|
|
118
|
+
const items = () => Array.from(menu.querySelectorAll('button[role="menuitem"]:not(:disabled)'))
|
|
119
|
+
async function show() {
|
|
120
|
+
closeShortcuts(); beforeOpen?.()
|
|
121
|
+
const connectionConfig = config(), s = { trigger, menu, config: connectionConfig }
|
|
122
|
+
shortcuts = s
|
|
123
|
+
const valid = () => shortcuts === s && connectionConfig.valid()
|
|
124
|
+
const title = node('p', shortcutText('插件快捷打开', 'Plugin shortcuts'), 'ext-shortcut-title')
|
|
125
|
+
const list = node('div', null, 'ext-shortcut-list')
|
|
126
|
+
const message = text => { const p = node('p', text, 'ext-shortcut-empty'); p.setAttribute('role', 'status'); list.replaceChildren(p) }
|
|
127
|
+
const manage = node('button', shortcutText('插件管理', 'Manage plugins'), 'ext-shortcut-manage')
|
|
128
|
+
manage.type = 'button'; manage.setAttribute('role', 'menuitem')
|
|
129
|
+
manage.addEventListener('click', () => { if (valid()) { closeShortcuts(); open('manage') } })
|
|
130
|
+
menu.replaceChildren(title, list, manage)
|
|
131
|
+
menu.classList.remove('hidden'); trigger.setAttribute('aria-expanded', 'true')
|
|
132
|
+
message(connected() ? shortcutText('正在读取插件…', 'Loading plugins…') : shortcutText('请先连接 DSH 主机', 'Connect to a DSH host first'))
|
|
133
|
+
manage.focus()
|
|
134
|
+
if (!connected()) return
|
|
135
|
+
const available = await getCapabilities(connectionConfig)
|
|
136
|
+
if (!valid()) return
|
|
137
|
+
const features = catalog.filter(feature => available[feature.id])
|
|
138
|
+
if (!features.length) {
|
|
139
|
+
message(available.known ? shortcutText('暂无可快捷打开的插件', 'No plugin views available') : shortcutText('暂时无法读取插件,请稍后重试', 'Could not read plugins; try again'))
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
const focusInside = menu.contains(document.activeElement)
|
|
143
|
+
list.replaceChildren()
|
|
144
|
+
for (const feature of features) {
|
|
145
|
+
const button = node('button', null, 'ext-shortcut-item')
|
|
146
|
+
button.type = 'button'; button.setAttribute('role', 'menuitem'); button.dataset.pluginShortcut = feature.id
|
|
147
|
+
const label = shortcutNames[feature.id]
|
|
148
|
+
button.append(node('span', shortcutText(...label)), node('span', '›', 'ext-shortcut-arrow'))
|
|
149
|
+
if (feature.session && !hasSession()) {
|
|
150
|
+
button.disabled = true
|
|
151
|
+
button.append(node('small', shortcutText('请先打开一个会话', 'Open a session first')))
|
|
152
|
+
}
|
|
153
|
+
button.addEventListener('click', () => {
|
|
154
|
+
if (!valid() || (feature.session && !hasSession())) return
|
|
155
|
+
closeShortcuts(); open(feature.id)
|
|
156
|
+
})
|
|
157
|
+
list.append(button)
|
|
158
|
+
}
|
|
159
|
+
if (focusInside) items()[0]?.focus()
|
|
160
|
+
}
|
|
161
|
+
trigger.addEventListener('click', () => { if (shortcuts?.trigger === trigger) closeShortcuts(); else void show() })
|
|
162
|
+
trigger.addEventListener('keydown', event => {
|
|
163
|
+
if (event.key === 'ArrowDown') { event.preventDefault(); if (shortcuts?.trigger !== trigger) void show(); else items()[0]?.focus() }
|
|
164
|
+
})
|
|
165
|
+
menu.addEventListener('keydown', event => {
|
|
166
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); closeShortcuts(true); return }
|
|
167
|
+
const buttons = items(), index = buttons.indexOf(document.activeElement)
|
|
168
|
+
const next = event.key === 'ArrowDown' ? (index + 1) % buttons.length : event.key === 'ArrowUp' ? (index - 1 + buttons.length) % buttons.length
|
|
169
|
+
: event.key === 'Home' ? 0 : event.key === 'End' ? buttons.length - 1 : -1
|
|
170
|
+
if (next >= 0) { event.preventDefault(); buttons[next]?.focus() }
|
|
171
|
+
})
|
|
172
|
+
document.addEventListener('click', event => { if (shortcuts?.trigger === trigger && !trigger.contains(event.target) && !menu.contains(event.target)) closeShortcuts() })
|
|
173
|
+
document.addEventListener('focusin', event => { if (shortcuts?.trigger === trigger && !trigger.contains(event.target) && !menu.contains(event.target)) closeShortcuts() })
|
|
174
|
+
document.addEventListener('keydown', event => { if (shortcuts?.trigger === trigger && event.key === 'Escape') { event.preventDefault(); closeShortcuts(true) } })
|
|
175
|
+
}
|
|
176
|
+
const stopViews=()=>{window.DshSkillsCenter?.close();window.DshInsights?.close();window.DshTeams?.close();window.DshTasks?.close()}
|
|
177
|
+
function close(){closeShortcuts();if(current){const old=current;current=null;stopViews();window.DshPluginCenter?.close();old.target.replaceChildren()}}
|
|
70
178
|
function mount(config,target,initial='manage') {
|
|
71
179
|
close()
|
|
72
180
|
const s={config,target,route:'manage',navigation:0};current=s
|
|
@@ -92,15 +200,16 @@ window.DshExtensions = (() => {
|
|
|
92
200
|
else {if(s.scroller)s.scroller.scrollTop=s.scroll;void window.DshPluginCenter.resume()}
|
|
93
201
|
}else if(route==='skills')await window.DshSkillsCenter.mount(config,view,{dedicated:true})
|
|
94
202
|
else if(route==='teams')await window.DshTeams.mount(config,view)
|
|
203
|
+
else if(route==='tasks')await window.DshTasks.mount(config,view)
|
|
95
204
|
else window.DshInsights.mount({tab:'cost',hostOverview:true,allowedTabs:['cost'],connection:config.connection,url:config.url},view)
|
|
96
205
|
if(valid()&&route!=='manage')config.scrollTop?.()
|
|
97
206
|
}
|
|
98
207
|
back.addEventListener('click',()=>{if(valid()){if(s.route==='manage')config.back?.();else void navigate('manage')}})
|
|
99
|
-
void navigate('
|
|
208
|
+
void navigate(initial === 'home' ? 'manage' : initial)
|
|
100
209
|
}
|
|
101
210
|
function scrollParent(el) {
|
|
102
211
|
for(let parent=el.parentElement;parent;parent=parent.parentElement)if(parent.scrollHeight>parent.clientHeight&&/auto|scroll/.test(getComputedStyle(parent).overflowY))return parent
|
|
103
212
|
return document.scrollingElement
|
|
104
213
|
}
|
|
105
|
-
return {mount,close,capabilitiesOf,featuresFor,getCapabilities,remember,invalidateCapabilities,catalog:catalog.map(row=>Object.freeze({...row}))}
|
|
214
|
+
return {mount,close,bindShortcuts,closeShortcuts,capabilitiesOf,featuresFor,diagnosticsFor,reportAvailability,getCapabilities,remember,invalidateCapabilities,catalog:catalog.map(row=>Object.freeze({...row}))}
|
|
106
215
|
})()
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* File requests share the conversation approval area. */
|
|
2
|
+
.session-attention { flex:0 1 auto; min-height:0; max-height:36vh; max-height:36dvh; overflow-y:auto; overscroll-behavior:contain; }
|
|
3
|
+
.session-attention > .session-pending,.session-attention > .ds-session-pending { max-height:none; flex:none; }
|
|
4
|
+
.session-attention .session-pending-list,.session-attention .ds-session-pending-list { overflow:visible; }
|
|
5
|
+
.file-inbox-session { margin:0 0 10px; padding:10px; border:1px solid var(--dsr-warning-line); border-radius:13px; background:var(--dsr-warning-soft); }
|
|
6
|
+
.file-inbox-session[hidden] { display:none !important; }
|
|
7
|
+
.file-inbox-files { flex:none; margin:0 0 16px; padding:14px; border:1px solid var(--dsr-line); border-radius:14px; background:var(--dsr-panel); color:var(--dsr-text); }
|
|
8
|
+
.file-inbox-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
|
|
9
|
+
.file-inbox-head h2,.file-inbox-head h3 { flex:1; min-width:0; margin:0; color:var(--dsr-text); font-size:14px; font-weight:750; }
|
|
10
|
+
.file-inbox-head h3 { font-size:12px; }
|
|
11
|
+
.file-inbox-count { flex:none; min-width:22px; padding:2px 7px; border-radius:999px; color:var(--dsr-warning); background:var(--dsr-warning-soft); text-align:center; font-size:11px; font-weight:700; }
|
|
12
|
+
.file-inbox-list { display:flex; flex-direction:column; gap:8px; }
|
|
13
|
+
.file-inbox-card { min-width:0; padding:12px; border:1px solid var(--dsr-line); border-radius:11px; color:var(--dsr-text); background:var(--dsr-panel); overflow-wrap:anywhere; }
|
|
14
|
+
.file-inbox-card.needs-action { border-left:3px solid var(--dsr-warning); }
|
|
15
|
+
.file-inbox-files .file-inbox-card { background:var(--dsr-bg-2); }
|
|
16
|
+
.file-inbox-card-head { display:flex; align-items:flex-start; gap:9px; }
|
|
17
|
+
.file-inbox-icon { flex:none; display:grid; place-items:center; width:30px; height:34px; border:1px solid var(--dsr-warning-line); border-radius:8px; background:var(--dsr-warning-soft); color:var(--dsr-warning); font-size:20px; }
|
|
18
|
+
.file-inbox-names { flex:1; min-width:0; }
|
|
19
|
+
.file-inbox-eyebrow { display:block; margin-bottom:3px; font-size:10px; line-height:1.2; color:var(--dsr-muted); }
|
|
20
|
+
.file-inbox-filename { display:block; font-size:13px; line-height:1.45; font-weight:700; overflow-wrap:anywhere; }
|
|
21
|
+
.file-inbox-phase { flex:none; max-width:44%; margin-top:2px; padding:2px 6px; border:1px solid var(--dsr-line); border-radius:6px; color:var(--dsr-muted); font-size:10px; line-height:1.5; text-align:right; }
|
|
22
|
+
.file-inbox-phase.pending,.file-inbox-phase.failed { color:var(--dsr-warning); border-color:var(--dsr-warning-line); }
|
|
23
|
+
.file-inbox-phase.complete { color:var(--dsr-success); }
|
|
24
|
+
.file-inbox-meta,.file-inbox-intro,.file-inbox-empty { margin:7px 0; font-size:12px; line-height:1.5; color:var(--dsr-muted); }
|
|
25
|
+
.file-inbox-message { margin:6px 0; font-size:13px; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
|
|
26
|
+
.file-inbox-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
|
|
27
|
+
.file-inbox-button { min-height:40px; padding:6px 13px; border:1px solid var(--dsr-line); border-radius:9px; background:var(--dsr-panel); color:var(--dsr-text); font:inherit; font-size:12px; cursor:pointer; }
|
|
28
|
+
.file-inbox-button.primary { background:var(--dsr-accent-soft); border-color:var(--dsr-accent-line); color:var(--dsr-accent-strong); font-weight:700; }
|
|
29
|
+
.file-inbox-button:focus-visible,.file-inbox-device input:focus-visible,.file-inbox-head h2:focus-visible { outline:2px solid var(--dsr-accent); outline-offset:2px; }
|
|
30
|
+
.file-inbox-button:disabled { opacity:.55; cursor:wait; }
|
|
31
|
+
.file-inbox-details { margin-top:6px; font-size:11px; line-height:1.5; color:var(--dsr-muted); }
|
|
32
|
+
.file-inbox-details summary,.file-inbox-history summary,.file-inbox-device summary { cursor:pointer; min-height:32px; align-content:center; }
|
|
33
|
+
.file-inbox-details p { margin:4px 0; }
|
|
34
|
+
.file-inbox-history,.file-inbox-device { margin-top:12px; padding-top:8px; border-top:1px solid var(--dsr-line); font-size:12px; color:var(--dsr-muted); }
|
|
35
|
+
.file-inbox-device input { box-sizing:border-box; max-width:100%; width:180px; min-height:40px; margin:8px 4px 8px 0; padding:6px 9px; border:1px solid var(--dsr-line); border-radius:8px; background:var(--dsr-bg-2); color:var(--dsr-text); }
|
|
36
|
+
.file-inbox-device small { display:block; margin-top:8px; overflow-wrap:anywhere; }
|
|
37
|
+
.file-inbox-note { margin:8px 0 0; color:var(--dsr-warning); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
|
|
38
|
+
.ds-view .file-inbox-files { margin:0 0 16px; }
|
|
39
|
+
.ds-view .file-inbox-session { margin:10px 22px 0; }
|
|
40
|
+
#view-files.ds-view { overflow-y:auto; }
|
|
41
|
+
@media(min-width:700px) {
|
|
42
|
+
.ds-view .file-inbox-card { display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:18px; }
|
|
43
|
+
.ds-view .file-inbox-card-head,.ds-view .file-inbox-meta,.ds-view .file-inbox-message,.ds-view .file-inbox-details { grid-column:1; }
|
|
44
|
+
.ds-view .file-inbox-actions { grid-column:2; grid-row:1 / 6; align-self:center; margin:0; }
|
|
45
|
+
.ds-view .file-inbox-note { grid-column:1 / -1; }
|
|
46
|
+
}
|
|
47
|
+
@media(max-width:360px) { .file-inbox-card { padding:10px; } .file-inbox-icon { display:none; } }
|
|
48
|
+
.file-inbox-card.is-compact { display:block; padding:9px 10px; }
|
|
49
|
+
.file-inbox-card.is-compact .file-inbox-card-head { align-items:center; gap:8px; }
|
|
50
|
+
.file-inbox-card.is-compact .file-inbox-filename { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; line-height:1.4; }
|
|
51
|
+
.file-inbox-inline-meta { display:flex; flex:none; flex-direction:column; align-items:flex-end; gap:2px; max-width:45%; font-size:11px; color:var(--dsr-muted); }
|
|
52
|
+
.file-inbox-inline-meta .file-inbox-phase { max-width:none; padding:0; margin:0; border:0; font-size:10px; }
|
|
53
|
+
.file-inbox-card.is-compact .file-inbox-message { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; margin:5px 0; line-height:1.45; font-size:12px; }
|
|
54
|
+
.file-inbox-card.is-compact .file-inbox-actions { margin-top:6px; gap:6px; align-items:flex-start; }
|
|
55
|
+
.file-inbox-card.is-compact .file-inbox-button { min-height:36px; padding:5px 11px; }
|
|
56
|
+
.file-inbox-card.is-compact .file-inbox-details { margin:0 0 0 auto; }
|
|
57
|
+
.file-inbox-card.is-compact .file-inbox-details > summary { display:flex; align-items:center; min-height:36px; padding:0 6px; list-style:none; cursor:pointer; }
|
|
58
|
+
.file-inbox-card.is-compact .file-inbox-details > summary::-webkit-details-marker { display:none; }
|
|
59
|
+
.file-inbox-card.is-compact .file-inbox-details > summary::after { content:'⌄'; margin-left:5px; }
|
|
60
|
+
.file-inbox-card.is-compact .file-inbox-details[open] { flex-basis:100%; order:3; }
|
|
61
|
+
.file-inbox-card.is-compact .file-inbox-details[open] > summary::after { content:'⌃'; }
|
|
62
|
+
.file-inbox-card.is-compact .file-inbox-details p { white-space:pre-wrap; }
|
|
63
|
+
@media(min-width:900px) {
|
|
64
|
+
.ds-view .session-deck[data-mounted] .file-inbox-card.is-compact[data-deck-active]:not(:has(details[open])) { display:grid !important; grid-template-columns:minmax(0,1fr) auto; column-gap:18px; }
|
|
65
|
+
.ds-view .file-inbox-card.is-compact .file-inbox-actions { grid-column:2; grid-row:1 / 3; align-self:center; margin:0; }
|
|
66
|
+
}
|