paseo-room 0.15.0 → 0.15.2

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/index.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "paseo-room",
18
- version: "0.15.0",
18
+ version: "0.15.2",
19
19
  description: "One CLI that configures Codex, Claude Code, and Pi role homes in $HOME and registers them with your local Paseo daemon.",
20
20
  keywords: [
21
21
  "paseo",
@@ -3899,6 +3899,29 @@ async function readJsonFiles(directory, names) {
3899
3899
  await Promise.all(Array.from({ length: Math.min(REPLAY_READS_IN_FLIGHT, names.length) }, reader));
3900
3900
  return files;
3901
3901
  }
3902
+ async function readEventFiles(directory, names) {
3903
+ let known = READS.get(directory);
3904
+ if (known === void 0) {
3905
+ known = /* @__PURE__ */ new Map();
3906
+ READS.set(directory, known);
3907
+ }
3908
+ const present = new Set(names);
3909
+ for (const name of known.keys()) if (!present.has(name)) known.delete(name);
3910
+ const missing = names.filter((name) => !known.has(name));
3911
+ if (missing.length > 0) {
3912
+ const read = readJsonFiles(directory, missing);
3913
+ for (const name of missing) {
3914
+ const file = read.then((files2) => files2.get(name) ?? { error: "The event file was not read." });
3915
+ known.set(name, file);
3916
+ void file.then((result) => {
3917
+ if ("error" in result && known.get(name) === file) known.delete(name);
3918
+ });
3919
+ }
3920
+ }
3921
+ const files = /* @__PURE__ */ new Map();
3922
+ for (const name of names) files.set(name, await (known.get(name) ?? Promise.resolve({ error: "The event file was not read." })));
3923
+ return files;
3924
+ }
3902
3925
  function eventName(sequence) {
3903
3926
  return `${String(sequence).padStart(12, "0")}.json`;
3904
3927
  }
@@ -3906,7 +3929,7 @@ function slug(root) {
3906
3929
  const name = basename2(root).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
3907
3930
  return name === "" ? "project" : name;
3908
3931
  }
3909
- var RUNTIME_LAYOUT_VERSION, EVENT_FILE, MAX_SEQUENCE_ATTEMPTS, REPLAY_READS_IN_FLIGHT, metaSchema, ProjectStore;
3932
+ var RUNTIME_LAYOUT_VERSION, EVENT_FILE, MAX_SEQUENCE_ATTEMPTS, REPLAY_READS_IN_FLIGHT, metaSchema, READS, ProjectStore;
3910
3933
  var init_project = __esm({
3911
3934
  "src/runtime-plugin/server/store/project.ts"() {
3912
3935
  "use strict";
@@ -3923,6 +3946,7 @@ var init_project = __esm({
3923
3946
  canonicalRoot: z12.string().min(1),
3924
3947
  gitCommonDir: z12.string().min(1)
3925
3948
  });
3949
+ READS = /* @__PURE__ */ new Map();
3926
3950
  ProjectStore = class _ProjectStore {
3927
3951
  constructor(directory, meta, now) {
3928
3952
  this.directory = directory;
@@ -3995,7 +4019,7 @@ var init_project = __esm({
3995
4019
  /** Reads every event strictly. Any unreadable file pauses the project; nothing is moved. */
3996
4020
  async replay() {
3997
4021
  const names = (await readdir4(this.eventsDirectory)).sort();
3998
- const files = await readJsonFiles(this.eventsDirectory, names.filter((name) => EVENT_FILE.test(name)));
4022
+ const files = await readEventFiles(this.eventsDirectory, names.filter((name) => EVENT_FILE.test(name)));
3999
4023
  const problems = [];
4000
4024
  const events = [];
4001
4025
  const ids = /* @__PURE__ */ new Map();