dsh-remote-plugin 0.8.7 → 0.8.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.
Files changed (39) hide show
  1. package/apk/dsh-remote.apk +0 -0
  2. package/gateway.cjs +134 -54
  3. package/index.mjs +32 -1
  4. package/package.json +1 -1
  5. package/public/activity.js +144 -49
  6. package/public/admin.html +33 -32
  7. package/public/admin.js +2 -1
  8. package/public/app.js +139 -51
  9. package/public/build.json +2 -2
  10. package/public/desktop/desktop.html +83 -74
  11. package/public/desktop/desktop.js +39 -26
  12. package/public/diagnostics.js +30 -4
  13. package/public/e2ee-transport.js +154 -7
  14. package/public/history.js +15 -2
  15. package/public/index.html +93 -76
  16. package/public/operations.js +22 -9
  17. package/public/plugin.html +27 -26
  18. package/public/skins/blue-fish/preview.html +3 -3
  19. package/public/skins/bocchi/preview.html +5 -5
  20. package/public/skins/kita/preview.html +6 -6
  21. package/public/skins/nijika/preview.html +6 -6
  22. package/public/skins/penguin/preview.html +3 -3
  23. package/public/skins/penguin-logistics/cargo.svg +4 -0
  24. package/public/skins/penguin-logistics/console.svg +4 -0
  25. package/public/skins/penguin-logistics/mark.svg +4 -0
  26. package/public/skins/penguin-logistics/radio.svg +4 -0
  27. package/public/skins/penguin-logistics/skin.css +292 -0
  28. package/public/skins/penguin-logistics/standing.png +0 -0
  29. package/public/skins/ryo/preview.html +6 -6
  30. package/public/slash-suggestions.css +43 -0
  31. package/public/slash-suggestions.js +184 -0
  32. package/public/subagents.css +2 -0
  33. package/public/subagents.js +31 -10
  34. package/public/theme-vars.css +37 -2
  35. package/public/theme.js +4 -2
  36. package/public/update.json +8 -8
  37. package/public/version.json +1 -1
  38. package/public/workflow.css +17 -9
  39. package/public/workflow.js +7 -3
package/public/app.js CHANGED
@@ -120,6 +120,7 @@ for (const key of ['server', 'token']) {
120
120
  if (next === value) return
121
121
  cancelHistoryLoad()
122
122
  value = next; connectionGeneration++
123
+ window.DshSlashSuggestions?.close()
123
124
  window.DshImagePreview?.reset?.()
124
125
  clearTimeout(state.refreshTimer); state.refreshTimer = null
125
126
  state.sessions = []; state.byId.clear(); state.pendingProjections.clear(); state.runtimeErrors = new Map()
@@ -1436,10 +1437,10 @@ function openStream(kind, handler, refreshOnOpen, isRestore, ticket = null) {
1436
1437
  state.approvals = []
1437
1438
  state.questions = []
1438
1439
  renderPending()
1440
+ resyncAfterStreamOpen()
1439
1441
  }
1440
1442
  if (refreshOnOpen) refreshAll()
1441
1443
  if (allStreamsOpen()) {
1442
- resyncAfterStreamOpen()
1443
1444
  void pingServer(state.server || location.origin)
1444
1445
  void refreshHostDescription()
1445
1446
  }
@@ -1469,6 +1470,7 @@ function openStream(kind, handler, refreshOnOpen, isRestore, ticket = null) {
1469
1470
  aggregateStreamFailures()
1470
1471
  updateConn()
1471
1472
  if (!navigator.onLine) { clearReconnect(); return }
1473
+ if (kind === 'mux') scheduleSessionSync()
1472
1474
  // 任一通道连续失败 3 次就降级轮询;另一个通道不会清零它的失败计数。
1473
1475
  if (state.streamMode !== 'poll' && meta.failures >= 3) { enterPollMode(); return }
1474
1476
  // 多服务器: 连续掉线若干次就重测速, 自动换到当前可达的最快地址
@@ -2052,7 +2054,7 @@ function rememberRuntimeError(sessionId, message) {
2052
2054
  function resyncAfterStreamOpen() {
2053
2055
  if (!state.current || Date.now() - state.lastStreamResyncAt < 1200) return
2054
2056
  state.lastStreamResyncAt = Date.now()
2055
- void refreshAll().then(() => resyncCurrentSession())
2057
+ scheduleSessionSync(state.current, 0)
2056
2058
  }
2057
2059
  function sessionTitleValue(s) {
2058
2060
  const value = proj(s, 'title', '')
@@ -2670,6 +2672,7 @@ function bindNativeBack() {
2670
2672
  try {
2671
2673
  CAP.Plugins?.App?.addListener?.('appStateChange',({isActive})=>{if(isActive)onResume()})
2672
2674
  CAP.Plugins?.App?.addListener?.('backButton', () => {
2675
+ if (typeof window !== 'undefined' && window.DshSlashSuggestions?.close()) return
2673
2676
  if ($('composer-wrap')?.classList.contains('fs')) { setComposerFullscreen(false); return }
2674
2677
  if (customSelectCurrent) { closeCustomSelect(); return }
2675
2678
  if (groupDrawerOpen()) { closeGroupDrawer(); return }
@@ -3049,20 +3052,7 @@ function insertLiveEvent(event) {
3049
3052
  scheduleHistoryCacheSave()
3050
3053
  }
3051
3054
 
3052
- function isToolEvent(type) { return type === 'tool/call' || type === 'tool/result' }
3053
-
3054
- /** One collapsed row for a turn's tools and reasoning, matching the desktop conversation rhythm. */
3055
- function activityGroupHtml(group, ctx) {
3056
- const items = group.items || []
3057
- if (!items.length) return ''
3058
- const tools = items.filter(item => item.kind === 'tool').map(item => item.entry)
3059
- const running = !!group.running
3060
- const failed = tools.some(entry => entry.view?.toolActivity?.error || entry.event?.data?.error)
3061
- const body = items.map(item => item.kind === 'reasoning'
3062
- ? window.DshActivity.reasoning({ text: item.text, key: item.key })
3063
- : eventHtml(item.entry, ctx)).join('')
3064
- return `<details class="chat-activity-group${failed ? ' is-error' : ''}${running ? ' is-running' : ''}" data-activity-key="activity-group:${items[0]?.seq ?? ''}"><summary><span class="activity-group-title">${esc(t('activity.group', { n: items.length }))}</span>${running ? `<span class="activity-group-live"><i aria-hidden="true"></i>${esc(t('activity.groupRunning'))}</span>` : ''}<span class="activity-chevron" aria-hidden="true"></span></summary><div class="activity-group-body">${body}</div></details>`
3065
- }
3055
+ function isToolEvent(type) { return window.DshActivity?.isToolEvent?.(type) ?? (type === 'tool/call' || type === 'tool/result') }
3066
3056
 
3067
3057
  function filteredEntries() {
3068
3058
  const showTools = LS.get('showTools', '1') !== '0'
@@ -3115,14 +3105,14 @@ function renderHistory(reset=false,mode='auto') {
3115
3105
  if(weakStreamTrim())prepared=prepared.filter(entry=>entry.event?.type!=='tool/call'||entry.view?.toolActivity)
3116
3106
  // DSH 0.2.1 also embeds tool blocks in messages; the separated events own the grouped rows.
3117
3107
  state.history.suppressBlockTools = state.history.visible.some(entry => entry.event?.type === 'tool/call')
3118
- if(window.DshActivity?.group)prepared=window.DshActivity.group(prepared)
3119
- // Running is a property of the session's current turn, not of an unpaired call:
3120
- // a finished turn may keep an unmatched call after an interrupt, and the model may be
3121
- // thinking between tools while the last group is still the active one.
3122
- const sessionRunning = !!state.byId.get(state.current)?.running
3123
- const groups = prepared.filter(entry => entry.view?.activityGroup)
3124
- const activeGroup = groups.at(-1)
3125
- if (activeGroup) activeGroup.view.activityGroup.running = sessionRunning
3108
+ const activity = window.DshActivity
3109
+ const groupLive = activity?.group && !weakStreamTrim()
3110
+ if(activity?.group)prepared=activity.group(prepared, {
3111
+ liveReasoning: groupLive ? [...state.history.partialReasoning.values()] : [],
3112
+ running: !!state.byId.get(state.current)?.running,
3113
+ suppressBlockTools: state.history.suppressBlockTools,
3114
+ showTools: LS.get('showTools', '1') !== '0',
3115
+ })
3126
3116
  if (window.DshTurnResults) {
3127
3117
  prepared = window.DshTurnResults.decorate(prepared, state.history.visible, { sessionId: state.current, canFork: canForkTurnResult() })
3128
3118
  bindTurnResultActions()
@@ -3131,7 +3121,7 @@ function renderHistory(reset=false,mode='auto') {
3131
3121
  const hostError = state.runtimeErrors?.get(state.current)
3132
3122
  const recordedError = state.history.visible.some(entry => window.DshActivity?.failure?.(entry.event)?.message === hostError)
3133
3123
  const runtimeHtml = hostError && !recordedError ? window.DshActivity?.failureHtml?.(hostError) || '' : ''
3134
- getConversationView().set(prepared,{reset,follow:mode==='bottom',live:partialReasoningHtml()+runtimeHtml,hasMore:state.history.hasMore,loading:state.history.loading,emptyLabel:t('history.empty')})
3124
+ getConversationView().set(prepared,{reset,follow:mode==='bottom',live:(groupLive?'':partialReasoningHtml())+runtimeHtml,hasMore:state.history.hasMore,loading:state.history.loading,emptyLabel:t('history.empty')})
3135
3125
  window.DshImagePreview?.hydrate?.($('history'))
3136
3126
  }
3137
3127
  window.applyStreamPreference=()=>{if(state.current)renderHistory(false,'auto')}
@@ -3191,7 +3181,7 @@ function bindRail() {
3191
3181
  const INTERESTING_EVENTS = new Set([
3192
3182
  'turn/start', 'turn/end',
3193
3183
  'user/message', 'assistant/message', 'assistant/attempt',
3194
- 'tool/call', 'tool/result',
3184
+ 'tool/call', 'tool/result', 'tool/ptc-dispatch-start', 'tool/ptc-dispatch',
3195
3185
  'agent/status',
3196
3186
  'checkpoint/created', 'compaction/complete', 'compaction/summary',
3197
3187
  'goal/created', 'goal/updated', 'goal/completed', 'goal/cleared',
@@ -3236,7 +3226,8 @@ function eventHtml(entry, ctx = {}) {
3236
3226
  // Successful boundaries stay quiet; failed turns keep their durable explanation.
3237
3227
  if (type === 'turn/start' || type === 'turn/end') return failure
3238
3228
  if (type === 'assistant/attempt') return window.DshActivity?.attemptHtml?.(ev) || ''
3239
- if (entry.view?.activityGroup) return activityGroupHtml(entry.view.activityGroup, ctx)
3229
+ if (entry.view?.activityTurn) return window.DshActivity.turnHtml(entry.view.activityTurn)
3230
+ if (entry.view?.activityGroup) return window.DshActivity.groupHtml(entry.view.activityGroup, item => eventHtml(item, ctx))
3240
3231
  if (!shouldShowEvent(type, ev)) return ''
3241
3232
  if (window.DshActivity && isToolEvent(type)) return window.DshActivity.toolEvent(entry)
3242
3233
  let inner = ''
@@ -3467,7 +3458,7 @@ async function interruptSubagent(childId, parentId = state.current) {
3467
3458
  const result = await safeRpc('subagent.interrupt', { parentSessionId: parentId, childSessionId: childId, mode: 'continuable' }, t('subagent.interruptFailed'))
3468
3459
  if (result == null || !connection.valid() || state.current !== rootId) return
3469
3460
  toast(t('subagent.interruptSubmitted'), 'ok')
3470
- setTimeout(renderSessionCards, 600)
3461
+ return true
3471
3462
  }
3472
3463
 
3473
3464
  /* ---------------- 发送 / 取消 / 快捷菜单 ---------------- */
@@ -3753,7 +3744,9 @@ async function sendPrompt(payload, context) {
3753
3744
  if (error.operationPending) {
3754
3745
  // Keep the warning on screen instead of a 3-second toast while the
3755
3746
  // connection is unchanged; otherwise attribute it to the old connection.
3756
- if (connection.valid() && composerContext() === context) setComposerSendFeedback(context, 'send.resultUnconfirmed', 'unknown')
3747
+ if (connection.valid() && composerContext() === context) {
3748
+ setComposerSendFeedback(context, error.receiptMissing ? 'send.receiptMissing' : 'send.resultUnconfirmed', 'unknown')
3749
+ }
3757
3750
  else notifyPendingOperation(error, connection)
3758
3751
  return null
3759
3752
  }
@@ -3912,6 +3905,7 @@ async function encodeComposerImagesFor(images) {
3912
3905
 
3913
3906
  async function sendMessage(requestedMode) {
3914
3907
  const input = $('composer-input')
3908
+ if (typeof window !== 'undefined') window.DshSlashSuggestions?.close()
3915
3909
  const originalText = input.value
3916
3910
  const text = originalText.trim()
3917
3911
  const context = composerContext()
@@ -3968,6 +3962,7 @@ function toggleComposerMenu() {
3968
3962
  menu.classList.toggle('hidden', !show)
3969
3963
  $('btn-plus').classList.toggle('active', show)
3970
3964
  if (show) refreshPermissionPresets()
3965
+ if (show) void window.DshSlashSuggestions?.openPanel()
3971
3966
  if (show && !state.models.loaded && !state.models.loading) loadSessionModels()
3972
3967
  }
3973
3968
 
@@ -5640,6 +5635,9 @@ async function loadLocalVersion() {
5640
5635
  const res = await fetch('version.json?t=' + Date.now())
5641
5636
  if (res.ok) state.localVersion = (await res.json())?.version || ''
5642
5637
  } catch {}
5638
+ if (!state.localVersion && CAP?.isNativePlatform?.()) {
5639
+ state.localVersion = (window.NativeUpdate?.getInstalledVersion?.() || '').replace(/\.rc\.(\d+)$/, '-rc.$1')
5640
+ }
5643
5641
  $('update-desc').textContent = state.localVersion ? t('update.currentV', { version: state.localVersion }) : t('update.noVersion')
5644
5642
  }
5645
5643
 
@@ -6196,7 +6194,10 @@ function closeNotesModal() {
6196
6194
  if (notesVersion) { LS.set(NOTES_KEY, notesVersion); notesVersion = '' }
6197
6195
  }
6198
6196
 
6197
+ let activeUpdateCheck
6198
+
6199
6199
  async function checkUpdate(silent) {
6200
+ if (silent && activeUpdateCheck && !activeUpdateCheck.silent) return
6200
6201
  if (!state.localVersion) {
6201
6202
  $('update-desc').textContent = t('update.noVersion')
6202
6203
  resetUpdateExpand()
@@ -6204,27 +6205,54 @@ async function checkUpdate(silent) {
6204
6205
  return
6205
6206
  }
6206
6207
  const base = updateBase()
6207
- if (!base) {
6208
+ const connection = captureConnection()
6209
+ const native = window.NativeUpdate
6210
+ const canCheckOfficial = !silent && CAP?.isNativePlatform?.() && native?.checkOfficialRelease
6211
+ && native.getOfficialReleaseStatus && native.downloadOfficialRelease && native.getDownloadStatus
6212
+ if (!base && !canCheckOfficial) {
6208
6213
  if (!silent) toast(t('update.needServer'), 'err')
6209
6214
  $('update-desc').textContent = state.localVersion ? `${t('update.currentV', { version: state.localVersion })} · ${t('update.needServer')}` : t('update.needServer')
6210
6215
  resetUpdateExpand()
6211
6216
  return
6212
6217
  }
6218
+ const request = { silent }
6219
+ activeUpdateCheck = request
6220
+ const valid = () => activeUpdateCheck === request && connection.valid()
6213
6221
  if (!silent) toast(t('update.checking'))
6214
6222
  try {
6215
- const res = await fetch(base + '/update.json?t=' + Date.now() + '&local=' + encodeURIComponent(state.localVersion))
6216
- if (!res.ok) throw new Error('HTTP ' + res.status)
6217
- const info = await res.json()
6223
+ let info
6224
+ if (base) {
6225
+ try {
6226
+ const res = await fetch(base + '/update.json?t=' + Date.now() + '&local=' + encodeURIComponent(state.localVersion),
6227
+ { signal: AbortSignal.timeout(8000), cache: 'no-store' })
6228
+ if (!res.ok) throw new Error('HTTP ' + res.status)
6229
+ const host = await res.json()
6230
+ if (typeof host?.version !== 'string' || !host.version) throw new Error(t('update.noVersion'))
6231
+ if (canCheckOfficial && cmpVersion(host.version, state.localVersion) > 0 && !/^[a-f0-9]{64}$/i.test(host.sha256 || '')) {
6232
+ throw new Error(t('update.hashMissing'))
6233
+ }
6234
+ info = { ...host, source: 'host', base }
6235
+ } catch (error) {
6236
+ if (!canCheckOfficial) throw error
6237
+ }
6238
+ }
6239
+ if (!valid()) return
6240
+ if (canCheckOfficial && (!info || cmpVersion(info.version, state.localVersion) <= 0)) {
6241
+ info = await checkOfficialAndroidRelease(native, valid)
6242
+ if (!valid()) return
6243
+ }
6218
6244
  if (!silent || !window.DshWorkflow?.isMounted()) openNotesModal(info)
6219
6245
  if (info.version && cmpVersion(info.version, state.localVersion) > 0) {
6220
6246
  state.updateInfo = info
6221
6247
  const hasNotes = !!(info.notes && String(info.notes).trim())
6222
- $('update-desc').textContent = t('update.found', { version: info.version, notes: hasNotes ? ':' + info.notes : '' })
6248
+ $('update-desc').textContent = info.source === 'official'
6249
+ ? t('update.foundOfficial', { version: info.version })
6250
+ : t('update.found', { version: info.version, notes: hasNotes ? ':' + info.notes : '' })
6223
6251
  $('update-desc').classList.remove('expanded')
6224
6252
  $('btn-update-expand').classList.toggle('hidden', !hasNotes)
6225
6253
  renderUpdateExpandBtn()
6226
6254
  $('btn-download-update').classList.remove('hidden')
6227
- if (!silent) toast(t('update.found', { version: info.version }), 'ok')
6255
+ if (!silent) toast(t(info.source === 'official' ? 'update.foundOfficial' : 'update.found', { version: info.version }), 'ok')
6228
6256
  else notify(t('update.foundTitle'), t('update.foundBody', { version: info.version }))
6229
6257
  } else {
6230
6258
  state.updateInfo = null
@@ -6234,9 +6262,16 @@ async function checkUpdate(silent) {
6234
6262
  if (!silent) toast(t('update.latestToast'), 'ok')
6235
6263
  }
6236
6264
  } catch (e) {
6265
+ if (!valid()) return
6266
+ if (!silent) {
6267
+ state.updateInfo = null
6268
+ $('btn-download-update').classList.add('hidden')
6269
+ }
6237
6270
  $('update-desc').textContent = t('update.checkFailedDesc', { msg: e.message || t('fs.networkError') })
6238
6271
  resetUpdateExpand()
6239
6272
  if (!silent) toast(t('update.checkFailed', { msg: e.message }), 'err')
6273
+ } finally {
6274
+ if (activeUpdateCheck === request) activeUpdateCheck = null
6240
6275
  }
6241
6276
  }
6242
6277
 
@@ -6249,6 +6284,21 @@ let updateDownloadBusy = false
6249
6284
  let updateDownloadTimer = null
6250
6285
  let updateDownloadSample = null
6251
6286
 
6287
+ async function checkOfficialAndroidRelease(native, valid) {
6288
+ $('update-desc').textContent = t('update.checkingOfficial')
6289
+ native.checkOfficialRelease()
6290
+ const deadline = Date.now() + 24000
6291
+ while (valid() && Date.now() < deadline) {
6292
+ const status = JSON.parse(native.getOfficialReleaseStatus())
6293
+ if (status.phase === 'complete' && /^\d+\.\d+\.\d+$/.test(status.version) && /^[a-f0-9]{64}$/i.test(status.sha256)) {
6294
+ return { source: 'official', version: status.version, sha256: status.sha256 }
6295
+ }
6296
+ if (status.phase !== 'checking') break
6297
+ await new Promise(resolve => setTimeout(resolve, 250))
6298
+ }
6299
+ throw new Error(t('update.officialUnavailable'))
6300
+ }
6301
+
6252
6302
  function updateDownloadProgress(value) {
6253
6303
  const box = $('update-download-progress')
6254
6304
  if (!box) return
@@ -6264,8 +6314,14 @@ function updateDownloadProgress(value) {
6264
6314
  if (total > 0) bar.value = Math.min(100, received * 100 / total)
6265
6315
  else bar.removeAttribute('value')
6266
6316
  const phase = value.phase || 'downloading'
6267
- $('update-download-status').textContent = phase === 'error' ? t('update.downloadFailed', { msg: value.error || t('fs.networkError') }) : t(`update.phase.${phase}`)
6268
- $('update-download-detail').textContent = `${total > 0 ? `${Math.min(100, received * 100 / total).toFixed(0)}% · ` : ''}${format(received)}${total > 0 ? ` / ${format(total)}` : ''} · ${format(phase === 'downloading' ? updateDownloadSample.speed : 0)}/s`
6317
+ let status
6318
+ if (phase !== 'error') status = t(`update.phase.${phase}`)
6319
+ else if (value.code === 'installer') status = t('update.installerFailed')
6320
+ else if (value.code === 'verify') status = t(value.patch ? 'update.patchMismatch' : 'update.corrupted')
6321
+ else if (value.code === 'storage') status = t('update.storageFailed')
6322
+ else status = t('update.downloadFailed', { msg: value.error || t('fs.networkError') })
6323
+ $('update-download-status').textContent = status
6324
+ $('update-download-detail').textContent = `${total > 0 ? `${Math.min(100, received * 100 / total).toFixed(0)}% · ` : ''}${format(received)}${total > 0 ? ` / ${format(total)}` : ''} · ${format(phase === 'downloading' || phase === 'official' ? updateDownloadSample.speed : 0)}/s`
6269
6325
  }
6270
6326
 
6271
6327
  function finishUpdateDownload() {
@@ -6317,9 +6373,10 @@ async function verifyUpdateApk(info, url) {
6317
6373
 
6318
6374
  async function downloadUpdate(force = false) {
6319
6375
  if (updateDownloadBusy || (force !== true && !state.updateInfo)) return
6320
- const base=updateBase()
6321
- if(!base){toast(t('update.needServer'),'err');return}
6322
- const connection=captureConnection()
6376
+ const base = updateBase()
6377
+ const official = !force && state.updateInfo?.source === 'official'
6378
+ if (!official && !base) { toast(t('update.needServer'), 'err'); return }
6379
+ const connection = captureConnection()
6323
6380
  updateDownloadBusy = true
6324
6381
  updateDownloadSample = null
6325
6382
  $('btn-download-update').disabled = true
@@ -6338,24 +6395,39 @@ async function downloadUpdate(force = false) {
6338
6395
  if(!connection.valid())return
6339
6396
  const sha256=String(info?.sha256||'').trim().toLowerCase()
6340
6397
  if(!/^[0-9a-f]{64}$/.test(sha256))throw new Error(t('update.hashMissing'))
6341
- const target=new URL(info.apkUrl||'dsh-remote.apk',base+'/')
6342
- if(force===true)target.searchParams.set('dshPatch',Date.now().toString(36)+'-'+sha256.slice(0,16))
6343
- const url=target.href
6344
- updateDownloadProgress({ phase: 'downloading', received: 0, total: 0 })
6345
- if (CAP?.isNativePlatform?.() && window.NativeUpdate?.downloadVerifiedAndInstall && window.NativeUpdate?.getDownloadStatus) {
6346
- if (!window.NativeUpdate.downloadVerifiedAndInstall(url, sha256)) throw new Error(t('update.busy'))
6398
+ if (!official && info.base && info.base !== base) throw new Error(t('update.checkAgain'))
6399
+ const target = official ? null : new URL(info.apkUrl || 'dsh-remote.apk', base + '/')
6400
+ if (force) target.searchParams.set('dshPatch', Date.now().toString(36) + '-' + sha256.slice(0, 16))
6401
+ const url = target?.href
6402
+ updateDownloadProgress({ phase: official ? 'official' : 'downloading' })
6403
+ const native = window.NativeUpdate
6404
+ if (CAP?.isNativePlatform?.() && native?.downloadVerifiedAndInstall && native.getDownloadStatus) {
6405
+ const started = official ? native.downloadOfficialRelease(info.version, sha256) : native.downloadVerifiedAndInstall(url, sha256)
6406
+ if (!started) throw new Error(t('update.busy'))
6407
+ let usingOfficial = official
6347
6408
  nativePending=true
6348
6409
  const poll = () => {
6349
6410
  try {
6350
- const value = JSON.parse(window.NativeUpdate.getDownloadStatus())
6351
- updateDownloadProgress(value)
6352
- if (['complete', 'error'].includes(value.phase)) finishUpdateDownload()
6411
+ const value = JSON.parse(native.getDownloadStatus())
6412
+ if (value.phase === 'error' && value.code === 'unavailable' && !force && !usingOfficial
6413
+ && connection.valid() && /^\d+\.\d+\.\d+$/.test(info.version) && native.downloadOfficialRelease) {
6414
+ // The host and GitHub may serve different builds with the same version.
6415
+ if (native.downloadOfficialRelease(info.version, sha256)) {
6416
+ usingOfficial = true
6417
+ updateDownloadProgress({ phase: 'official' })
6418
+ return
6419
+ }
6420
+ }
6421
+ if (usingOfficial && value.phase === 'downloading') value.phase = 'official'
6422
+ updateDownloadProgress({ ...value, patch: force })
6423
+ if (['complete', 'installer', 'error'].includes(value.phase)) finishUpdateDownload()
6353
6424
  } catch (error) { updateDownloadProgress({ phase: 'error', error: error.message }); finishUpdateDownload() }
6354
6425
  }
6355
6426
  updateDownloadTimer = setInterval(poll, 500)
6356
6427
  poll()
6357
6428
  return
6358
6429
  }
6430
+ if (official) throw new Error(t('update.officialUnavailable'))
6359
6431
  const result = await verifyUpdateApk(info, url)
6360
6432
  if(!connection.valid())return
6361
6433
  if (!result.ok) throw new Error(result.corrupted ? t(force===true?'update.patchMismatch':'update.corrupted') : result.status ? t('update.serverFileMissing') : result.msg || t('fs.networkError'))
@@ -7246,6 +7318,7 @@ async function openModelConfigDocument() {
7246
7318
  }
7247
7319
  /* ---------------- 视图切换 ---------------- */
7248
7320
  function showView(id, pluginRoute = 'manage') {
7321
+ window.DshSlashSuggestions?.close()
7249
7322
  window.DshExtensions?.closeShortcuts()
7250
7323
  if (id !== 'view-session') window.DshSubagents?.close()
7251
7324
  document.body?.classList.toggle('viewing-subagent', id === 'view-session' && state.byId.get(state.current)?.origin === 'subagent')
@@ -8028,7 +8101,8 @@ const THEME_META = [
8028
8101
  { id: 'bocchi', sw: ['#FFD9E8', '#FFFFFF', '#D0105A'] },
8029
8102
  { id: 'nijika', sw: ['#FFF3D5', '#FFFFFF', '#94600C'] },
8030
8103
  { id: 'ryo', sw: ['#E9F1FA', '#FFFFFF', '#315D91'] },
8031
- { id: 'kita', sw: ['#FFE9E5', '#FFFFFF', '#B6373C'] }
8104
+ { id: 'kita', sw: ['#FFE9E5', '#FFFFFF', '#B6373C'] },
8105
+ { id: 'penguin-logistics', sw: ['#12161B', '#1D252E', '#E9B66F'] }
8032
8106
  ]
8033
8107
 
8034
8108
  function renderThemeBtn() {
@@ -8317,11 +8391,25 @@ function bindUi() {
8317
8391
  $('btn-model-refresh').addEventListener('click', loadSessionModels)
8318
8392
  const input = $('composer-input')
8319
8393
  input.addEventListener('input', () => autosize(input))
8394
+ window.DshSlashSuggestions?.mount({
8395
+ input, t,
8396
+ panel: $('composer-command-list'), chipClass: 'menu-chip', chipAttribute: 'data-cmd',
8397
+ context() {
8398
+ const connection = captureConnection(), sessionId = state.current, history = state.history
8399
+ if (!sessionId || state.byId.get(sessionId)?.origin === 'subagent') return null
8400
+ return {
8401
+ sessionId, url: path => connection.server + path,
8402
+ headers: { authorization: 'Bearer ' + connection.token, ...clientIdHeaders() },
8403
+ valid: () => connection.valid() && state.current === sessionId && state.history === history,
8404
+ }
8405
+ },
8406
+ readSkills: sessionId => rpc('skills.list', { sessionId }, 5000),
8407
+ })
8320
8408
  $('btn-fs-toggle').addEventListener('click', () => setComposerFullscreen(!$('composer-wrap').classList.contains('fs')))
8321
8409
  bindComposerFullscreenGesture()
8322
8410
  updateComposerFullscreenButton()
8323
8411
  input.addEventListener('keydown', (e) => {
8324
- if (e.key !== 'Enter' || e.isComposing) return
8412
+ if (e.defaultPrevented || e.key !== 'Enter' || e.isComposing) return
8325
8413
  if (isMobileDevice() && mobileEnterAction() !== 'send') return
8326
8414
  if (!e.shiftKey) { e.preventDefault(); sendMessage() }
8327
8415
  })
package/public/build.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "schema": 1,
3
- "version": "0.8.7",
4
- "buildId": "7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"
3
+ "version": "0.8.8",
4
+ "buildId": "84d998ae3a1302b3e1d02d3cdde5d8f3ad3f8bd963ec0323fd18a675015e1184"
5
5
  }