@clawos-dev/clawd 0.2.38-beta.55.d2c72b2 → 0.2.38
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 -37
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -15523,51 +15523,19 @@ 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
|
-
|
|
15535
|
-
|
|
15536
|
-
continue;
|
|
15537
|
-
}
|
|
15538
|
-
}
|
|
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);
|
|
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);
|
|
15559
15536
|
} catch {
|
|
15560
15537
|
continue;
|
|
15561
15538
|
}
|
|
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
15539
|
}
|
|
15572
15540
|
return out.sort((a, b) => a.updatedAt > b.updatedAt ? -1 : a.updatedAt < b.updatedAt ? 1 : 0);
|
|
15573
15541
|
}
|
package/package.json
CHANGED