@clawos-dev/clawd 0.2.68 → 0.2.69-beta.121.dbda41c
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/dist/cli.cjs +27 -11
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -22106,9 +22106,19 @@ var SessionManager = class {
|
|
|
22106
22106
|
return entries.filter((e) => e.isDirectory() && e.name !== "default").map((e) => e.name);
|
|
22107
22107
|
}
|
|
22108
22108
|
// owner / default 两个分类下按 sessionId 找文件——前端只传 sessionId 不带 scope,
|
|
22109
|
-
// SessionManager
|
|
22109
|
+
// SessionManager 在这里定位。三层快慢路径:
|
|
22110
|
+
// 1) active runner(用户当前在用的 session):runner.state.file 是 SessionFile 内存权威副本,
|
|
22111
|
+
// 直接返回,零磁盘 I/O。覆盖 attachment / file-sharing 等"用户操作 → 紧接着 RPC"的
|
|
22112
|
+
// 绝大多数场景
|
|
22113
|
+
// 2) default scope 磁盘:inactive default session 命中
|
|
22114
|
+
// 3) 所有 persona owner 目录扫盘:inactive persona owner session 命中
|
|
22110
22115
|
// listener sub-session 不走这条——transport 始终明确传 (personaId, sessionId)。
|
|
22116
|
+
//
|
|
22117
|
+
// 公开方法:attachment / file-sharing handler 通过 deps 闭包消费,不应直接持 SessionStore
|
|
22118
|
+
// (持 default-only store 是 file-sharing v1 的预存 bug 根因——见 fix #703)
|
|
22111
22119
|
findOwnedSession(sessionId) {
|
|
22120
|
+
const runner = this.runners.get(sessionId);
|
|
22121
|
+
if (runner) return runner.getState().file;
|
|
22112
22122
|
const dflt = this.deps.store.read(sessionId);
|
|
22113
22123
|
if (dflt) return dflt;
|
|
22114
22124
|
for (const personaId of this.listPersonaIdsOnDisk()) {
|
|
@@ -22118,6 +22128,13 @@ var SessionManager = class {
|
|
|
22118
22128
|
}
|
|
22119
22129
|
return null;
|
|
22120
22130
|
}
|
|
22131
|
+
// findOwnedSession + scopeForFile 收口。把"sessionId → SessionScope"的派生
|
|
22132
|
+
// 集中到 manager(scope 单一来源),调用方拿 scope 不再自己拼 object 也不依赖
|
|
22133
|
+
// ownerPersonaId 字段语义。给 attachment handler 通过 deps.getSessionScope 闭包消费。
|
|
22134
|
+
findOwnedSessionScope(sessionId) {
|
|
22135
|
+
const file = this.findOwnedSession(sessionId);
|
|
22136
|
+
return file ? this.scopeForFile(file) : null;
|
|
22137
|
+
}
|
|
22121
22138
|
// 合并 default + 所有 persona owner 的 SessionFile —— 桌面 App 主 session 列表入口。
|
|
22122
22139
|
// 同样不含 listener sub-session(listener 走 persona:listSubSessions RPC 单独入口)。
|
|
22123
22140
|
listAllOwned() {
|
|
@@ -27909,23 +27926,22 @@ async function startDaemon(config) {
|
|
|
27909
27926
|
httpToken: resolvedAuthToken,
|
|
27910
27927
|
// file-sharing attachment.* RPC。signUrl 用 owner token 做 HMAC secret;group RPC
|
|
27911
27928
|
// 根据 sessionId 反查 scope 写盘。
|
|
27929
|
+
//
|
|
27930
|
+
// sessionStore / getSessionScope 都走 manager 的跨 scope 公开 API(findOwnedSession /
|
|
27931
|
+
// findOwnedSessionScope)—— 否则 default-only SessionStore 找不到 persona owner-mode
|
|
27932
|
+
// session,attachment 整套 RPC 对 persona session 都会报 "session not found"。
|
|
27933
|
+
// 详见 fix(daemon) #703:file-sharing v1 预存 wiring bug,#701 把 desktop 默认 --tunnel
|
|
27934
|
+
// 后首次让 desktop 用户用上 file-sharing 才被暴露。
|
|
27912
27935
|
attachment: {
|
|
27913
27936
|
groupFileStore,
|
|
27914
|
-
sessionStore:
|
|
27937
|
+
sessionStore: { read: (sid) => manager.findOwnedSession(sid) },
|
|
27915
27938
|
getHttpBaseUrl,
|
|
27916
27939
|
// HMAC sign secret:~/.clawd/auth.json signSecret 字段(与 WS Bearer token 独立)。
|
|
27917
27940
|
// --auth-token CLI 模式 / noAuth 模式 authFile 为 null → handler 自己返 NOT_IMPLEMENTED。
|
|
27918
27941
|
getSignSecret: () => authFile?.signSecret ?? "",
|
|
27919
|
-
// group RPC + sign 都用:根据 sessionId 反查 scope
|
|
27942
|
+
// group RPC + sign 都用:根据 sessionId 反查 scope。owner-mode persona session 走
|
|
27920
27943
|
// 'persona/<pid>/owner',default 走 'default'。
|
|
27921
|
-
getSessionScope: (
|
|
27922
|
-
const file = store.read(sessionId);
|
|
27923
|
-
if (!file) return null;
|
|
27924
|
-
if (file.ownerPersonaId) {
|
|
27925
|
-
return { kind: "persona", personaId: file.ownerPersonaId, mode: "owner" };
|
|
27926
|
-
}
|
|
27927
|
-
return { kind: "default" };
|
|
27928
|
-
}
|
|
27944
|
+
getSessionScope: (sid) => manager.findOwnedSessionScope(sid)
|
|
27929
27945
|
}
|
|
27930
27946
|
});
|
|
27931
27947
|
const authResolver = new AuthContextResolver({
|
package/package.json
CHANGED