agent-theatre 1.3.8 → 1.3.10

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/README.md CHANGED
@@ -47,3 +47,8 @@ await t.listen(0); // t.url → http://127.0.0.1:<port>/
47
47
  MIT · source: https://github.com/shreyassaw5394/agent-theatre
48
48
 
49
49
  Community: https://discord.gg/PPGeQWd7r
50
+
51
+ ## Other ways in
52
+
53
+ - **Claude Code plugin:** `/plugin install agent-theatre --marketplace shreyassaw5394/agent-theatre` — hooks, a `/theatre` command and a skill.
54
+ - **Homebrew:** `brew install shreyassaw5394/tap/agent-theatre`
package/dist/cli.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import { Command } from "commander";
5
5
  import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
6
6
  import { fileURLToPath } from "url";
7
+ import { homedir as homedir4 } from "os";
7
8
  import { dirname, join as join5 } from "path";
8
9
  import pc from "picocolors";
9
10
 
@@ -1221,6 +1222,7 @@ var Theatre = class {
1221
1222
  /** The most recent cwd of a Claude Code session that is NOT this repo (so an empty stage can point the person there). */
1222
1223
  elsewhere = null;
1223
1224
  openSessions = /* @__PURE__ */ new Set();
1225
+ seen = /* @__PURE__ */ new Set();
1224
1226
  timer = null;
1225
1227
  port = 0;
1226
1228
  routes() {
@@ -1247,6 +1249,15 @@ var Theatre = class {
1247
1249
  else this.openSessions.add(sid);
1248
1250
  }
1249
1251
  let { events } = hookPayloadToEvents(payload, { home: homedir2() });
1252
+ events = events.filter((e) => {
1253
+ if (this.seen.has(e.id)) return false;
1254
+ this.seen.add(e.id);
1255
+ if (this.seen.size > 5e3) {
1256
+ const first = this.seen.values().next().value;
1257
+ if (first !== void 0) this.seen.delete(first);
1258
+ }
1259
+ return true;
1260
+ });
1250
1261
  if (this.openSessions.size > 0) events = events.filter((e) => e.kind !== "session_end");
1251
1262
  if (events.length) this.ingest(events);
1252
1263
  return c.body(null, 204);
@@ -1614,7 +1625,7 @@ var program = new Command().name("agent-theatre").description("Watch your coding
1614
1625
  program.option("-p, --port <n>", "port to listen on (default: a free one)", "0").option("--no-open", "don't open the browser").option("--set <id>", "stage set: island | orbit | metropolis").action(async (o) => {
1615
1626
  const cwd = process.cwd();
1616
1627
  const st = hooksStatus();
1617
- if (!st.installed) console.log(pc.yellow("Hooks are not installed \u2014 the scene will stay empty until you run:"), pc.bold("agent-theatre hooks install"));
1628
+ if (!st.installed && !pluginInstalled()) console.log(pc.yellow("Hooks are not installed \u2014 the scene will stay empty until you run:"), pc.bold("agent-theatre hooks install"), pc.dim("(or install the Claude Code plugin)"));
1618
1629
  const files = scanRepo(cwd);
1619
1630
  const theatre = new Theatre({ cwd, repoId: repoIdFor(cwd), files, ...webDir ? { webDir } : {} });
1620
1631
  await theatre.listen(Number(o.port) || 0);
@@ -1689,4 +1700,12 @@ program.parseAsync(process.argv).catch((err) => {
1689
1700
  console.error(pc.red(String(err?.message ?? err)));
1690
1701
  process.exit(1);
1691
1702
  });
1703
+ function pluginInstalled() {
1704
+ try {
1705
+ const p = join5(process.env.CLAUDE_CONFIG_DIR || join5(homedir4(), ".claude"), "plugins", "installed_plugins.json");
1706
+ return readFileSync5(p, "utf8").includes("agent-theatre");
1707
+ } catch {
1708
+ return false;
1709
+ }
1710
+ }
1692
1711
  //# sourceMappingURL=cli.js.map