Prettier had never been run in --check mode here before, so this had drifted across most files (markdown tables, long option() chains, line wrapping). Purely formatting, no logic changes - needed so a CI format:check gate can actually pass. Adds .prettierignore for pnpm-lock.yaml specifically: prettier's YAML formatter rewrites every quoted key (single -> double quotes) producing an ~8700-line diff of pure noise on a file pnpm itself owns the formatting of. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
20 lines
819 B
TypeScript
20 lines
819 B
TypeScript
import { EventEmitter } from "node:events";
|
|
import type { ServerMessage } from "../ws/protocol";
|
|
|
|
declare global {
|
|
var __triggershellRunEvents: EventEmitter | undefined;
|
|
}
|
|
|
|
/** Decouples the run engine from the WS transport: the engine emits, ws/server.ts broadcasts.
|
|
* Anchored on `globalThis` because Next compiles Route Handlers through its own module graph,
|
|
* separate from the modules `server.ts` requires directly via tsx - a plain module-level
|
|
* singleton would silently end up duplicated (one copy per graph) instead of shared. */
|
|
export const runEvents: EventEmitter =
|
|
globalThis.__triggershellRunEvents ?? new EventEmitter();
|
|
globalThis.__triggershellRunEvents = runEvents;
|
|
runEvents.setMaxListeners(0);
|
|
|
|
export function emitRunMessage(message: ServerMessage) {
|
|
runEvents.emit("message", message);
|
|
}
|