muuuuse 1.4.0 → 1.4.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/src/util.js CHANGED
@@ -6,6 +6,7 @@ const path = require("node:path");
6
6
  const BRAND = "🔌Muuuuse";
7
7
  const POLL_MS = 220;
8
8
  const MAX_RELAY_CHARS = 4000;
9
+ const SESSION_MATCH_WINDOW_MS = 5 * 60 * 1000;
9
10
 
10
11
  function createId(length = 10) {
11
12
  return randomBytes(Math.ceil(length / 2)).toString("hex").slice(0, length);
@@ -144,6 +145,15 @@ function getSessionDir(sessionName) {
144
145
  return ensureDir(path.join(getStateRoot(), "sessions", slugifySegment(sessionName)));
145
146
  }
146
147
 
148
+ function getSessionPaths(sessionName) {
149
+ const dir = getSessionDir(sessionName);
150
+ return {
151
+ dir,
152
+ controllerPath: path.join(dir, "controller.json"),
153
+ stopPath: path.join(dir, "stop.json"),
154
+ };
155
+ }
156
+
147
157
  function getSeatDir(sessionName, seatId) {
148
158
  return ensureDir(path.join(getSessionDir(sessionName), `seat-${seatId}`));
149
159
  }
@@ -152,6 +162,7 @@ function getSeatPaths(sessionName, seatId) {
152
162
  const dir = getSeatDir(sessionName, seatId);
153
163
  return {
154
164
  dir,
165
+ daemonPath: path.join(dir, "daemon.json"),
155
166
  eventsPath: path.join(dir, "events.jsonl"),
156
167
  metaPath: path.join(dir, "meta.json"),
157
168
  pipePath: path.join(dir, "pipe.log"),
@@ -173,31 +184,39 @@ function listSessionNames() {
173
184
 
174
185
  function usage() {
175
186
  return [
176
- `${BRAND} arms two raw terminals and bounces BEL-marked final output between them.`,
187
+ `${BRAND} arms two regular terminals and relays final answers between them.`,
177
188
  "",
178
189
  "Usage:",
179
190
  " muuuuse 1",
180
191
  " muuuuse 2",
181
192
  " muuuuse stop",
193
+ " muuuuse status",
182
194
  "",
183
195
  "Flow:",
184
196
  " 1. Run `muuuuse 1` in terminal one.",
185
197
  " 2. Run `muuuuse 2` in terminal two.",
186
198
  " 3. Use those armed shells normally.",
187
- " 4. When a program rings the terminal bell, that final block relays to the other seat.",
188
- " 5. Run `muuuuse stop` from any other shell to stop every armed seat.",
199
+ " 4. Codex, Claude, and Gemini final answers relay automatically from their local session logs.",
200
+ " 5. Run `muuuuse status` or `muuuuse stop` from any shell.",
201
+ "",
202
+ "Notes:",
203
+ " - No tmux.",
204
+ " - `muuuuse stop` and `muuuuse status` work from another terminal or the same one.",
205
+ " - State lives under `~/.muuuuse`.",
189
206
  ].join("\n");
190
207
  }
191
208
 
192
209
  module.exports = {
193
210
  BRAND,
194
211
  POLL_MS,
212
+ SESSION_MATCH_WINDOW_MS,
195
213
  appendJsonl,
196
214
  createId,
197
215
  ensureDir,
198
216
  getDefaultSessionName,
199
217
  getFileSize,
200
218
  getSeatPaths,
219
+ getSessionPaths,
201
220
  getStateRoot,
202
221
  hashText,
203
222
  isPidAlive,