@clawos-dev/clawd 0.2.63-beta.102.0d36b31 → 0.2.64-beta.103.774930b
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 +39 -4
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -21953,6 +21953,16 @@ function nowIso2(deps) {
|
|
|
21953
21953
|
function newSessionId() {
|
|
21954
21954
|
return v4_default().replace(/-/g, "").slice(0, 16);
|
|
21955
21955
|
}
|
|
21956
|
+
function derivePersonaSpawnCwd(file, personaRoot) {
|
|
21957
|
+
const personaId = file.ownerPersonaId;
|
|
21958
|
+
if (!personaId) return file.cwd;
|
|
21959
|
+
if (!personaRoot) {
|
|
21960
|
+
throw new Error(
|
|
21961
|
+
`derivePersonaSpawnCwd: personaRoot missing for owner session ${file.sessionId} (ownerPersonaId=${personaId})`
|
|
21962
|
+
);
|
|
21963
|
+
}
|
|
21964
|
+
return import_node_path6.default.join(personaRoot, safeFileName(personaId));
|
|
21965
|
+
}
|
|
21956
21966
|
function makeInitialState(file, subSessionMeta) {
|
|
21957
21967
|
return {
|
|
21958
21968
|
file,
|
|
@@ -22111,6 +22121,24 @@ var SessionManager = class {
|
|
|
22111
22121
|
const adapter = this.deps.getAdapter(file.tool ?? "claude");
|
|
22112
22122
|
const store = this.storeFor(scope);
|
|
22113
22123
|
const subSessionMeta = metaFromScope(scope, this.deps.personaRoot ?? "");
|
|
22124
|
+
const correctedCwd = derivePersonaSpawnCwd(file, this.deps.personaRoot);
|
|
22125
|
+
if (correctedCwd !== file.cwd) {
|
|
22126
|
+
this.deps.logger?.warn("owner session cwd drifted from persona dir; auto-correcting", {
|
|
22127
|
+
sessionId: file.sessionId,
|
|
22128
|
+
ownerPersonaId: file.ownerPersonaId,
|
|
22129
|
+
stale: file.cwd,
|
|
22130
|
+
corrected: correctedCwd
|
|
22131
|
+
});
|
|
22132
|
+
file = { ...file, cwd: correctedCwd, updatedAt: nowIso2(this.deps) };
|
|
22133
|
+
try {
|
|
22134
|
+
store.write(file);
|
|
22135
|
+
} catch (err) {
|
|
22136
|
+
this.deps.logger?.warn("failed to persist auto-corrected owner cwd", {
|
|
22137
|
+
sessionId: file.sessionId,
|
|
22138
|
+
error: err.message
|
|
22139
|
+
});
|
|
22140
|
+
}
|
|
22141
|
+
}
|
|
22114
22142
|
const runner = new SessionRunner(makeInitialState(file, subSessionMeta), {
|
|
22115
22143
|
broadcastFrame: (frame, target) => this.routeFromRunner(frame, target),
|
|
22116
22144
|
store,
|
|
@@ -22213,10 +22241,17 @@ var SessionManager = class {
|
|
|
22213
22241
|
create(args) {
|
|
22214
22242
|
let cwd;
|
|
22215
22243
|
if (args.ownerPersonaId) {
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
|
|
22219
|
-
|
|
22244
|
+
cwd = derivePersonaSpawnCwd(
|
|
22245
|
+
{
|
|
22246
|
+
sessionId: "",
|
|
22247
|
+
cwd: args.cwd ?? "",
|
|
22248
|
+
tool: "claude",
|
|
22249
|
+
ownerPersonaId: args.ownerPersonaId,
|
|
22250
|
+
createdAt: "",
|
|
22251
|
+
updatedAt: ""
|
|
22252
|
+
},
|
|
22253
|
+
this.deps.personaRoot
|
|
22254
|
+
);
|
|
22220
22255
|
} else if (args.cwd) {
|
|
22221
22256
|
cwd = args.cwd;
|
|
22222
22257
|
} else {
|
package/package.json
CHANGED