@nicmeriano/spool-server 0.0.3 → 0.0.5

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/bin.js CHANGED
@@ -59,6 +59,8 @@ function updateAnnotationInState(state, annotationId, updates) {
59
59
  // src/orchestrator/routes/events.ts
60
60
  import { Hono } from "hono";
61
61
  import { streamSSE } from "hono/streaming";
62
+ import { execFile } from "child_process";
63
+ import { platform } from "os";
62
64
  var sseClients = /* @__PURE__ */ new Map();
63
65
  var clientIdCounter = 0;
64
66
  function broadcast(message) {
@@ -113,6 +115,11 @@ function createEventsRoutes(ctx) {
113
115
  app.post("/app-url", async (c) => {
114
116
  const body = await c.req.json();
115
117
  console.error(`[spool] Received app URL: ${body.url}`);
118
+ const host = c.req.header("host") || "localhost:3142";
119
+ const shellUrl = `http://${host}`;
120
+ console.error(`[spool] Opening ${shellUrl}`);
121
+ const cmd = platform() === "darwin" ? "open" : platform() === "win32" ? "start" : "xdg-open";
122
+ execFile(cmd, [shellUrl]);
116
123
  let state = ctx.getState();
117
124
  state = { ...state, appUrl: body.url };
118
125
  ctx.setState(state);