@revealui/harnesses 0.1.7 → 0.1.9

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.
@@ -77,7 +77,8 @@ async function withLockAsync(lockPath, fn, timeoutMs) {
77
77
  }
78
78
  }
79
79
  function atomicWriteSync(filePath, content) {
80
- const tmpPath = `${filePath}.tmp.${process.pid}`;
80
+ const suffix = `${process.pid}.${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
81
+ const tmpPath = `${filePath}.tmp.${suffix}`;
81
82
  writeFileSync(tmpPath, content, "utf8");
82
83
  renameSync(tmpPath, filePath);
83
84
  }
@@ -88,11 +89,31 @@ function lockPathFor(workboardPath) {
88
89
  // src/workboard/session-identity.ts
89
90
  import { readFileSync as readFileSync2 } from "fs";
90
91
  function detectSessionType() {
92
+ const vaughnId = process.env.VAUGHN_AGENT_ID;
93
+ if (vaughnId) {
94
+ const tool = vaughnId.split("-")[0]?.toLowerCase();
95
+ if (tool === "claude") return "claude";
96
+ if (tool === "codex") return "codex";
97
+ if (tool === "cursor") return "cursor";
98
+ if (tool === "zed") return "zed";
99
+ return "terminal";
100
+ }
101
+ if (process.env.CLAUDE_AGENT_ROLE) return "claude";
102
+ try {
103
+ const cachePath = `/tmp/vaughn-session-${process.ppid}.id`;
104
+ const cached = readFileSync2(cachePath, "utf8").trim();
105
+ if (cached === "claude" || cached === "codex" || cached === "zed" || cached === "cursor") {
106
+ return cached;
107
+ }
108
+ } catch {
109
+ }
91
110
  try {
92
111
  let pid = process.ppid;
93
112
  for (let depth = 0; depth < 8; depth++) {
94
113
  if (!pid || pid <= 1) break;
95
114
  const cmdline = readFileSync2(`/proc/${pid}/cmdline`, "utf8").replace(/\0/g, " ").toLowerCase();
115
+ if (cmdline.includes("claude")) return "claude";
116
+ if (cmdline.includes("codex")) return "codex";
96
117
  if (cmdline.includes("zed")) return "zed";
97
118
  if (cmdline.includes("cursor")) return "cursor";
98
119
  const status = readFileSync2(`/proc/${pid}/status`, "utf8");
@@ -157,7 +178,7 @@ function parseTable(lines) {
157
178
  for (let j = 0; j < columns.length; j++) {
158
179
  const col = columns[j];
159
180
  const raw = (cells[j] || "").trim();
160
- row[col] = raw === "\u2014" ? "" : raw;
181
+ row[col] = raw === "-" ? "" : raw;
161
182
  }
162
183
  rows.push(row);
163
184
  }
@@ -203,13 +224,13 @@ function parseWorkboard(content) {
203
224
  return state;
204
225
  }
205
226
  function padCell(value, width) {
206
- const str = String(value || "\u2014");
227
+ const str = String(value || " - ");
207
228
  return str.length >= width ? str : str + " ".repeat(width - str.length);
208
229
  }
209
230
  function serializeTable(headers, rows) {
210
231
  if (headers.length === 0) return "(none)";
211
232
  const widths = headers.map((h) => {
212
- const dataMax = rows.reduce((max, row) => Math.max(max, String(row[h] || "\u2014").length), 0);
233
+ const dataMax = rows.reduce((max, row) => Math.max(max, String(row[h] || " - ").length), 0);
213
234
  return Math.max(h.length, dataMax, 3);
214
235
  });
215
236
  const headerLine = `| ${headers.map((h, i) => padCell(h, widths[i])).join(" | ")} |`;
@@ -286,6 +307,7 @@ var WorkboardManager = class {
286
307
  }
287
308
  this.lockPath = lockPathFor(resolved);
288
309
  }
310
+ workboardPath;
289
311
  lockPath;
290
312
  // ---- Read/Write ----
291
313
  read() {
@@ -525,6 +547,8 @@ var registerSession = WorkboardManager.prototype.registerAgent;
525
547
  var unregisterSession = WorkboardManager.prototype.unregisterAgent;
526
548
 
527
549
  export {
550
+ detectSessionType,
551
+ deriveSessionId,
528
552
  acquireLock,
529
553
  releaseLock,
530
554
  withLock,
@@ -533,8 +557,5 @@ export {
533
557
  lockPathFor,
534
558
  WorkboardManager,
535
559
  registerSession,
536
- unregisterSession,
537
- detectSessionType,
538
- deriveSessionId
560
+ unregisterSession
539
561
  };
540
- //# sourceMappingURL=chunk-JG6CAG4A.js.map