tmux-agent-monitor 0.0.3 → 0.0.4

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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as resolveLogPaths, c as isDangerousCommand, i as decodePaneId, l as allowedKeys, n as configSchema, o as resolveServerKey, r as wsClientMessageSchema, s as compileDangerPatterns, t as claudeHookEventSchema, u as defaultConfig } from "./src-C_y43gN3.mjs";
2
+ import { a as resolveServerKey, c as allowedKeys, i as resolveLogPaths, l as defaultConfig, n as configSchema, o as compileDangerPatterns, r as wsClientMessageSchema, s as isDangerousCommand, t as claudeHookEventSchema } from "./src-CFxYk-pF.mjs";
3
3
  import { serve } from "@hono/node-server";
4
4
  import { execa } from "execa";
5
5
  import qrcode from "qrcode-terminal";
@@ -1288,23 +1288,15 @@ const createApp = ({ config, monitor, tmuxActions }) => {
1288
1288
  });
1289
1289
  });
1290
1290
  app.get("/api/sessions/:paneId", (c) => {
1291
- let paneId;
1292
- try {
1293
- paneId = decodePaneId(c.req.param("paneId"));
1294
- } catch {
1295
- return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1296
- }
1291
+ const paneId = c.req.param("paneId");
1292
+ if (!paneId) return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1297
1293
  const detail = monitor.registry.getDetail(paneId);
1298
1294
  if (!detail) return c.json({ error: buildError$1("NOT_FOUND", "pane not found") }, 404);
1299
1295
  return c.json({ session: detail });
1300
1296
  });
1301
1297
  app.get("/api/sessions/:paneId/diff", async (c) => {
1302
- let paneId;
1303
- try {
1304
- paneId = decodePaneId(c.req.param("paneId"));
1305
- } catch {
1306
- return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1307
- }
1298
+ const paneId = c.req.param("paneId");
1299
+ if (!paneId) return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1308
1300
  const detail = monitor.registry.getDetail(paneId);
1309
1301
  if (!detail) return c.json({ error: buildError$1("NOT_FOUND", "pane not found") }, 404);
1310
1302
  const force = c.req.query("force") === "1";
@@ -1312,12 +1304,8 @@ const createApp = ({ config, monitor, tmuxActions }) => {
1312
1304
  return c.json({ summary });
1313
1305
  });
1314
1306
  app.get("/api/sessions/:paneId/diff/file", async (c) => {
1315
- let paneId;
1316
- try {
1317
- paneId = decodePaneId(c.req.param("paneId"));
1318
- } catch {
1319
- return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1320
- }
1307
+ const paneId = c.req.param("paneId");
1308
+ if (!paneId) return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1321
1309
  const detail = monitor.registry.getDetail(paneId);
1322
1310
  if (!detail) return c.json({ error: buildError$1("NOT_FOUND", "pane not found") }, 404);
1323
1311
  const pathParam = c.req.query("path");
@@ -1331,12 +1319,8 @@ const createApp = ({ config, monitor, tmuxActions }) => {
1331
1319
  return c.json({ file });
1332
1320
  });
1333
1321
  app.get("/api/sessions/:paneId/commits", async (c) => {
1334
- let paneId;
1335
- try {
1336
- paneId = decodePaneId(c.req.param("paneId"));
1337
- } catch {
1338
- return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1339
- }
1322
+ const paneId = c.req.param("paneId");
1323
+ if (!paneId) return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1340
1324
  const detail = monitor.registry.getDetail(paneId);
1341
1325
  if (!detail) return c.json({ error: buildError$1("NOT_FOUND", "pane not found") }, 404);
1342
1326
  const limit = Number.parseInt(c.req.query("limit") ?? "10", 10);
@@ -1350,12 +1334,8 @@ const createApp = ({ config, monitor, tmuxActions }) => {
1350
1334
  return c.json({ log });
1351
1335
  });
1352
1336
  app.get("/api/sessions/:paneId/commits/:hash", async (c) => {
1353
- let paneId;
1354
- try {
1355
- paneId = decodePaneId(c.req.param("paneId"));
1356
- } catch {
1357
- return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1358
- }
1337
+ const paneId = c.req.param("paneId");
1338
+ if (!paneId) return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1359
1339
  const detail = monitor.registry.getDetail(paneId);
1360
1340
  if (!detail) return c.json({ error: buildError$1("NOT_FOUND", "pane not found") }, 404);
1361
1341
  const hash = c.req.param("hash");
@@ -1370,12 +1350,8 @@ const createApp = ({ config, monitor, tmuxActions }) => {
1370
1350
  return c.json({ commit });
1371
1351
  });
1372
1352
  app.get("/api/sessions/:paneId/commits/:hash/file", async (c) => {
1373
- let paneId;
1374
- try {
1375
- paneId = decodePaneId(c.req.param("paneId"));
1376
- } catch {
1377
- return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1378
- }
1353
+ const paneId = c.req.param("paneId");
1354
+ if (!paneId) return c.json({ error: buildError$1("INVALID_PAYLOAD", "invalid pane id") }, 400);
1379
1355
  const detail = monitor.registry.getDetail(paneId);
1380
1356
  if (!detail) return c.json({ error: buildError$1("NOT_FOUND", "pane not found") }, 404);
1381
1357
  const hash = c.req.param("hash");
@@ -139,18 +139,6 @@ const isDangerousCommand = (text, patterns) => {
139
139
  const encodePaneId = (paneId) => {
140
140
  return encodeURIComponent(paneId);
141
141
  };
142
- const decodePaneId = (paneIdEncoded) => {
143
- try {
144
- const decoded = decodeURIComponent(paneIdEncoded);
145
- for (let i = 0; i < decoded.length; i += 1) {
146
- const code = decoded.charCodeAt(i);
147
- if (code < 32 || code === 127) return paneIdEncoded;
148
- }
149
- return decoded;
150
- } catch {
151
- return paneIdEncoded;
152
- }
153
- };
154
142
  const sanitizeServerKey = (value) => {
155
143
  return value.replace(/\//g, "_").replace(/[^a-zA-Z0-9_-]/g, "-");
156
144
  };
@@ -366,4 +354,4 @@ const configSchema = z.object({
366
354
  });
367
355
 
368
356
  //#endregion
369
- export { resolveLogPaths as a, isDangerousCommand as c, decodePaneId as i, allowedKeys as l, configSchema as n, resolveServerKey as o, wsClientMessageSchema as r, compileDangerPatterns as s, claudeHookEventSchema as t, defaultConfig as u };
357
+ export { resolveServerKey as a, allowedKeys as c, resolveLogPaths as i, defaultConfig as l, configSchema as n, compileDangerPatterns as o, wsClientMessageSchema as r, isDangerousCommand as s, claudeHookEventSchema as t };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { o as resolveServerKey } from "./src-C_y43gN3.mjs";
2
+ import { a as resolveServerKey } from "./src-CFxYk-pF.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import os from "node:os";
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "type": "git",
8
8
  "url": "https://github.com/yuki-yano/tmux-agent-monitor.git"
9
9
  },
10
- "version": "0.0.3",
10
+ "version": "0.0.4",
11
11
  "type": "module",
12
12
  "packageManager": "pnpm@10.28.2",
13
13
  "engines": {