dsh-sessions-manager 3.7.2 → 3.7.3

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/lib/index.js CHANGED
@@ -1985,7 +1985,7 @@ function emptyScanCandidate(sizeBytes) {
1985
1985
  }
1986
1986
 
1987
1987
  // src/index.js
1988
- var BUILD_STAMP = true ? "3.7.2+71b956b8" : "dev";
1988
+ var BUILD_STAMP = true ? "3.7.3+5958fd65" : "dev";
1989
1989
  var name = "dsh-sessions-manager";
1990
1990
  var inject = ["webServer", "workspaceRegistry", "sessionPersistence", "sessionQuery", "storageDomain"];
1991
1991
  var MAX_TITLE = 80;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-sessions-manager",
3
3
  "description": "DSH 设置面板会话管理器:归档 / 恢复 / 彻底删除 / 移动到其他工作区,带工作区标签与会话日期;统一「会话管理」面板。Session manager for the DeepSeek Harness settings panel — archive / restore / permanently delete / move sessions across workspaces, with workspace tags & session dates in one unified panel.",
4
- "version": "3.7.2",
4
+ "version": "3.7.3",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -58,14 +58,14 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@deepseek-ai/cordis": "^4.0.1",
61
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6",
62
- "@deepseek-ai/dsh-workspace": "^0.1.0-rc.6",
63
- "@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.0-rc.6",
64
- "@deepseek-ai/dsh-session-query": "^0.1.0-rc.6",
65
- "@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.6",
66
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
67
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
68
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6",
61
+ "@deepseek-ai/dsh-host-webserver": ">=0.1.0-rc.6",
62
+ "@deepseek-ai/dsh-workspace": ">=0.1.0-rc.6",
63
+ "@deepseek-ai/dsh-session-persistence-jsonl": ">=0.1.0-rc.6",
64
+ "@deepseek-ai/dsh-session-query": ">=0.1.0-rc.6",
65
+ "@deepseek-ai/dsh-storage-domain": ">=0.1.0-rc.6",
66
+ "@deepseek-ai/dsh-client-runtime": ">=0.1.0-rc.6",
67
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.6",
68
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.6",
69
69
  "react": "^18.2.0"
70
70
  },
71
71
  "allowScripts": {
@@ -244,15 +244,58 @@ async function postJSON(path, body) {
244
244
 
245
245
  // 打开一个会话(尤其是侧栏不渲染的子代理会话)。
246
246
  //
247
- // 只走官方公开契约(runtime 的 client api-catalog):
248
- // sessions.open(id) —— 选中会话为当前
249
- // sessions.refreshSubagents(parent) —— 刷新某父会话的直接子代理目录
250
- // sessions.openSubagent(address) —— 用「直接父 + 子」地址打开目录里的子代理
251
- // 拿不到 sessions 服务(老 runtime)时返回 false,由调用方给出降级提示,绝不
252
- // 触碰任何私有内部状态。
247
+ // 只走官方公开契约,按方法存在性分支、不写死核心版本:
248
+ // 旧核心(≤0.1.6) ctx.get('sessions') 自带
249
+ // sessions.open(id) —— 选中会话为当前
250
+ // sessions.refreshSubagents(parent) —— 刷新某父会话的直接子代理目录
251
+ // sessions.openSubagent(address) —— 用「直接父 + 子」地址打开目录里的子代理
252
+ // 新核心(0.1.7+ / 0.2.0+)sessions 退化为会话数据流服务(retain/release/
253
+ // readPage…,没有 open),切换会话的公开入口是 uiWorkspace.openSession(target):
254
+ // target 为会话 id 字符串,或 {parentSessionId, childSessionId, mode} 子代理
255
+ // 地址(与旧 openSubagent 契约同形,replaceMain 经 sessions.retain 原生支持;
256
+ // id 命中已加载目录的子代理时核心会自动解析地址)。核心侧栏点会话走的就是
257
+ // 这条路径(dsh-workspace-kit 0.1.12 起同样从 ctx.sessions.open 迁移过来)。
258
+ // 拿不到任何服务时返回 null,由调用方给出降级提示,绝不触碰私有内部状态。
253
259
  let dsmClientCtx = null
254
260
  function dsmSessionsService() {
255
- try { return dsmClientCtx && typeof dsmClientCtx.get === 'function' ? dsmClientCtx.get('sessions') : null } catch (e) { return null }
261
+ try {
262
+ if (!dsmClientCtx || typeof dsmClientCtx.get !== 'function') return null
263
+ const native = dsmClientCtx.get('sessions')
264
+ if (native && (typeof native.open === 'function' || typeof native.openSubagent === 'function')) return native
265
+ const ui = dsmClientCtx.get('uiWorkspace')
266
+ if (!ui || typeof ui.openSession !== 'function') return native
267
+ let lastOpened = null
268
+ const bridge = {
269
+ open(id) {
270
+ if (id === null || id === undefined) return
271
+ const target = String(id)
272
+ // 地址未加载的子代理会在这里被核心拒绝(unknown session),调用方
273
+ // 依赖抛错落回 openSubagent 地址路径,因此不吞异常。
274
+ ui.openSession(target)
275
+ lastOpened = target
276
+ },
277
+ openSubagent(address) {
278
+ if (address === null || address === undefined) return
279
+ if (typeof address === 'object') {
280
+ // 逐字段原样透传(parentSessionId / childSessionId / mode),新核心
281
+ // 的 retain 直接以该地址解析历史路由。
282
+ ui.openSession(address)
283
+ lastOpened = String(address.childSessionId)
284
+ } else {
285
+ bridge.open(address)
286
+ }
287
+ },
288
+ // 新核心的子代理目录由投影自动维护,无需手动刷新。
289
+ refreshSubagents() {},
290
+ }
291
+ // dsmCurrentSessionId 走 list.getSnapshot().current 校验切换结果;桥接下
292
+ // 核心未公开等价快照,以自己最近一次成功提交的目标为准。
293
+ Object.defineProperty(bridge, 'list', {
294
+ configurable: true,
295
+ get() { return { getSnapshot: () => ({ current: lastOpened }) } },
296
+ })
297
+ return bridge
298
+ } catch (e) { return null }
256
299
  }
257
300
  function dsmCurrentSessionId(svc) {
258
301
  try {