dsh-sun-space 0.3.2 → 0.3.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/package.json +1 -1
- package/src/client.js +13 -3
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -23,7 +23,7 @@ window.__ModuleLoader__.load({
|
|
|
23
23
|
// vault 解析链(server 端 vault-path.ts 为唯一事实源):config/分桶映射(workspaces[本工作区])→
|
|
24
24
|
// 约定布局发现;当前工作区无骨架时引导以工作区为根初始化(服务端登记仅放行空目录/已含骨架)。
|
|
25
25
|
// 写回:① 创建会话后经 session/prompt 引导自登记(含 vault 字段);② 晨报自检发现缺失/不一致自动修正。
|
|
26
|
-
const WB_REV = '
|
|
26
|
+
const WB_REV = 'v21' // 根节点 data-wb-rev 版本标记:判别浏览器是否吃到旧 client.js(immutable 缓存坑,HANDOFF 踩坑 1)
|
|
27
27
|
|
|
28
28
|
const STATUS_META = {
|
|
29
29
|
proposed: { label: '待确认派发', color: '#9e9e9e' },
|
|
@@ -85,6 +85,7 @@ window.__ModuleLoader__.load({
|
|
|
85
85
|
'session/list': a => ({ _request: a ?? {} }),
|
|
86
86
|
'session/create': a => ({ request: a }),
|
|
87
87
|
'session/prompt': a => ({ request: a }),
|
|
88
|
+
'workspace/create': a => ({ request: a }),
|
|
88
89
|
'schedule/list': a => ({ request: a ?? {} }),
|
|
89
90
|
'schedule/create': a => ({ request: a }),
|
|
90
91
|
'schedule/edit': a => ({ request: a }),
|
|
@@ -229,8 +230,17 @@ window.__ModuleLoader__.load({
|
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
async function createRouterSession(cwd) {
|
|
232
|
-
// cwd 可选:一键初始化时传当前会话的工作区目录——Router
|
|
233
|
-
|
|
233
|
+
// cwd 可选:一键初始化时传当前会话的工作区目录——Router 会话落在用户选的工作区。
|
|
234
|
+
// 落位两步(踩坑 12:session/create 只传 cwd 只设会话目录、不入工作区 sessionIds → 未分组):
|
|
235
|
+
// ① workspace/create 幂等解析目录 → workspaceId(工作区不存在则注册)
|
|
236
|
+
// ② session/create 传 workspaceId(宿主只在 workspaceId 路径上 attachSession 入组)
|
|
237
|
+
if (cwd && cwd.startsWith('/')) {
|
|
238
|
+
try {
|
|
239
|
+
const w = await gw('workspace/create', { path: cwd })
|
|
240
|
+
const wid = w?.workspace?.workspaceId
|
|
241
|
+
if (wid) return gw('session/create', { workspaceId: wid, agentPreset: 'sun-router' })
|
|
242
|
+
} catch (e) { D.errors.push('workspace/create: ' + String(e?.message ?? e)) } // 解析失败 → 落回 cwd 路径
|
|
243
|
+
}
|
|
234
244
|
return gw('session/create', cwd ? { cwd, agentPreset: 'sun-router' } : { agentPreset: 'sun-router' })
|
|
235
245
|
}
|
|
236
246
|
|