@clawos-dev/clawd 0.2.38-beta.54.cac95f0 → 0.2.38-beta.56.1631c13
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 +5 -43
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -15523,52 +15523,20 @@ var SessionStore = class {
|
|
|
15523
15523
|
if (code === "ENOENT") return [];
|
|
15524
15524
|
throw err;
|
|
15525
15525
|
}
|
|
15526
|
-
const
|
|
15526
|
+
const out = [];
|
|
15527
15527
|
for (const name of entries) {
|
|
15528
15528
|
if (!name.endsWith(".json")) continue;
|
|
15529
15529
|
if (name.includes(".tmp-")) continue;
|
|
15530
15530
|
const full = import_node_path3.default.join(this.root, name);
|
|
15531
15531
|
try {
|
|
15532
|
-
const
|
|
15533
|
-
const parsed = JSON.parse(
|
|
15534
|
-
|
|
15532
|
+
const raw = import_node_fs3.default.readFileSync(full, "utf8");
|
|
15533
|
+
const parsed = JSON.parse(raw);
|
|
15534
|
+
const validated = SessionFileSchema.parse(parsed);
|
|
15535
|
+
out.push(validated);
|
|
15535
15536
|
} catch {
|
|
15536
15537
|
continue;
|
|
15537
15538
|
}
|
|
15538
15539
|
}
|
|
15539
|
-
const byToolId = /* @__PURE__ */ new Map();
|
|
15540
|
-
for (const { raw } of raws) {
|
|
15541
|
-
const sid = raw["sessionId"];
|
|
15542
|
-
const tsid = raw["toolSessionId"];
|
|
15543
|
-
if (typeof sid === "string" && typeof tsid === "string") byToolId.set(tsid, sid);
|
|
15544
|
-
}
|
|
15545
|
-
const out = [];
|
|
15546
|
-
for (const { raw, path: full } of raws) {
|
|
15547
|
-
const legacy = raw["forkedFromToolSessionId"];
|
|
15548
|
-
const dirty = typeof legacy === "string";
|
|
15549
|
-
if (dirty) {
|
|
15550
|
-
if (raw["forkedFromSessionId"] === void 0) {
|
|
15551
|
-
const parentSid = byToolId.get(legacy);
|
|
15552
|
-
if (typeof parentSid === "string") raw["forkedFromSessionId"] = parentSid;
|
|
15553
|
-
}
|
|
15554
|
-
delete raw["forkedFromToolSessionId"];
|
|
15555
|
-
}
|
|
15556
|
-
let validated;
|
|
15557
|
-
try {
|
|
15558
|
-
validated = SessionFileSchema.parse(raw);
|
|
15559
|
-
} catch {
|
|
15560
|
-
continue;
|
|
15561
|
-
}
|
|
15562
|
-
if (dirty) {
|
|
15563
|
-
try {
|
|
15564
|
-
const tmp = `${full}.tmp-${process.pid}-${Date.now()}`;
|
|
15565
|
-
import_node_fs3.default.writeFileSync(tmp, JSON.stringify(validated, null, 2), { encoding: "utf8", mode: 384 });
|
|
15566
|
-
import_node_fs3.default.renameSync(tmp, full);
|
|
15567
|
-
} catch {
|
|
15568
|
-
}
|
|
15569
|
-
}
|
|
15570
|
-
out.push(validated);
|
|
15571
|
-
}
|
|
15572
15540
|
return out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
|
|
15573
15541
|
}
|
|
15574
15542
|
};
|
|
@@ -16792,12 +16760,6 @@ var SessionManager = class {
|
|
|
16792
16760
|
}
|
|
16793
16761
|
// ---- 命令方法:均返回 { response, broadcast[] },由 dispatcher 聚合 ----
|
|
16794
16762
|
create(args) {
|
|
16795
|
-
if (args.ownerPersonaId) {
|
|
16796
|
-
const existing = this.deps.store.list().find((s) => s.ownerPersonaId === args.ownerPersonaId);
|
|
16797
|
-
if (existing) {
|
|
16798
|
-
return { response: existing, broadcast: [] };
|
|
16799
|
-
}
|
|
16800
|
-
}
|
|
16801
16763
|
let cwd = args.cwd;
|
|
16802
16764
|
if (args.ownerPersonaId && !cwd) {
|
|
16803
16765
|
if (!this.deps.personaRoot) {
|
package/package.json
CHANGED