@telepath-computer/television 0.1.182 → 0.1.184

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/cli.cjs CHANGED
@@ -49808,8 +49808,12 @@ function installBridge(win = window, options = {}) {
49808
49808
  }
49809
49809
  };
49810
49810
  if (isTvArtifactURL(capturedURL) && typeof win.fetch === "function") {
49811
- const NORMAL_POLL_MS = 5e3;
49812
- const SLOW_POLL_MS = 15e3;
49811
+ const PRODUCTION_NORMAL_POLL_MS = 5e3;
49812
+ const PRODUCTION_SLOW_POLL_MS = 15e3;
49813
+ const cadence = options.pollCadence;
49814
+ const validCadence = cadence !== void 0 && Number.isFinite(cadence.normalMs) && cadence.normalMs > 0 && Number.isFinite(cadence.slowMs) && cadence.slowMs >= cadence.normalMs ? cadence : null;
49815
+ const NORMAL_POLL_MS = validCadence?.normalMs ?? PRODUCTION_NORMAL_POLL_MS;
49816
+ const SLOW_POLL_MS = validCadence?.slowMs ?? PRODUCTION_SLOW_POLL_MS;
49813
49817
  let baselineETag = null;
49814
49818
  let delayMs = NORMAL_POLL_MS;
49815
49819
  let stopped = false;
@@ -50122,8 +50126,8 @@ function installBridge(win = window, options = {}) {
50122
50126
  });
50123
50127
  postBridgeReady();
50124
50128
  }
50125
- function bridgeScriptSource() {
50126
- return `(function(){const __name=(target)=>target;(${installBridge.toString()})(window);})();`;
50129
+ function bridgeScriptSource(options = {}) {
50130
+ return `(function(){const __name=(target)=>target;(${installBridge.toString()})(window,${JSON.stringify(options)});})();`;
50127
50131
  }
50128
50132
 
50129
50133
  // ../server/src/markdown-doc-style.ts
@@ -50400,11 +50404,10 @@ ${bridgeSource}
50400
50404
  </script>
50401
50405
  `)]);
50402
50406
  }
50403
- function sendInjectedHTML(req, res, stream, resolvedPath, stat) {
50407
+ function sendInjectedHTML(req, res, stream, resolvedPath, stat, bridgeSource) {
50404
50408
  void (async () => {
50405
50409
  try {
50406
50410
  const source = await (0, import_promises2.readFile)(resolvedPath);
50407
- const bridgeSource = bridgeScriptSource();
50408
50411
  const body = appendBridge(source, bridgeSource);
50409
50412
  const etag = injectedETag(stat, body, bridgeSource);
50410
50413
  stream.setHeader(resolvedPath, stat);
@@ -50440,11 +50443,10 @@ ${renderedHTML}
50440
50443
  </body>
50441
50444
  </html>`;
50442
50445
  }
50443
- function sendRenderedMarkdown(req, res, resolvedPath, stat) {
50446
+ function sendRenderedMarkdown(req, res, resolvedPath, stat, bridgeSource) {
50444
50447
  void (async () => {
50445
50448
  try {
50446
50449
  const source = await (0, import_promises2.readFile)(resolvedPath, "utf8");
50447
- const bridgeSource = bridgeScriptSource();
50448
50450
  const etag = injectedETag(stat, Buffer.from(source + markdownDocument("")), bridgeSource);
50449
50451
  applyProxyHeaders(res);
50450
50452
  res.status(HTTP_OK2).type("text/html; charset=utf-8");
@@ -50467,7 +50469,7 @@ function sendRenderedMarkdown(req, res, resolvedPath, stat) {
50467
50469
  }
50468
50470
  })();
50469
50471
  }
50470
- function pipeWithInjection(req, res, subpath, options, notFound) {
50472
+ function pipeWithInjection(req, res, subpath, options, bridgeSource, notFound) {
50471
50473
  applyProxyHeaders(res);
50472
50474
  const stream = (0, import_send.default)(req, subpath, { ...options, etag: true });
50473
50475
  const sendOriginal = stream.send.bind(stream);
@@ -50484,7 +50486,7 @@ function pipeWithInjection(req, res, subpath, options, notFound) {
50484
50486
  return;
50485
50487
  }
50486
50488
  res.removeHeader("ETag");
50487
- sendInjectedHTML(req, res, stream, resolvedPath, stat);
50489
+ sendInjectedHTML(req, res, stream, resolvedPath, stat, bridgeSource);
50488
50490
  };
50489
50491
  stream.on("error", (error48) => {
50490
50492
  if ((error48.status ?? HTTP_NOT_FOUND) === HTTP_NOT_FOUND && notFound) {
@@ -50496,15 +50498,15 @@ function pipeWithInjection(req, res, subpath, options, notFound) {
50496
50498
  });
50497
50499
  stream.pipe(res);
50498
50500
  }
50499
- function serveDirectoryArtifact(req, res, store, artifact, subpath) {
50501
+ function serveDirectoryArtifact(req, res, store, artifact, subpath, bridgeSource) {
50500
50502
  if (subpath === "") {
50501
50503
  applyProxyHeaders(res);
50502
50504
  res.redirect(HTTP_MOVED_PERMANENTLY, `${proxyMountPath(artifact.id)}/`);
50503
50505
  return;
50504
50506
  }
50505
- pipeWithInjection(req, res, subpath, { root: artifact.path, index: ["index.html", "index.htm"], dotfiles: "allow" }, subpath === "/" ? () => sendArtifactNotFound(req, res, store) : void 0);
50507
+ pipeWithInjection(req, res, subpath, { root: artifact.path, index: ["index.html", "index.htm"], dotfiles: "allow" }, bridgeSource, subpath === "/" ? () => sendArtifactNotFound(req, res, store) : void 0);
50506
50508
  }
50507
- function serveFileArtifact(req, res, store, artifact, subpath) {
50509
+ function serveFileArtifact(req, res, store, artifact, subpath, bridgeSource) {
50508
50510
  let stat;
50509
50511
  try {
50510
50512
  stat = import_node_fs3.default.statSync(artifact.path);
@@ -50530,9 +50532,9 @@ function serveFileArtifact(req, res, store, artifact, subpath) {
50530
50532
  sendNotFound(res);
50531
50533
  return;
50532
50534
  }
50533
- pipeWithInjection(req, res, subpath, { root: import_node_path3.default.dirname(artifact.path), index: false, dotfiles: "allow" }, () => sendArtifactNotFound(req, res, store));
50535
+ pipeWithInjection(req, res, subpath, { root: import_node_path3.default.dirname(artifact.path), index: false, dotfiles: "allow" }, bridgeSource, () => sendArtifactNotFound(req, res, store));
50534
50536
  }
50535
- function serveMarkdownArtifact(req, res, store, artifact, subpath) {
50537
+ function serveMarkdownArtifact(req, res, store, artifact, subpath, bridgeSource) {
50536
50538
  const basename = artifactBasename(artifact.path);
50537
50539
  const canonical = proxyFilePath(artifact.id, basename);
50538
50540
  let stat;
@@ -50557,9 +50559,10 @@ function serveMarkdownArtifact(req, res, store, artifact, subpath) {
50557
50559
  sendNotFound(res);
50558
50560
  return;
50559
50561
  }
50560
- sendRenderedMarkdown(req, res, artifact.path, stat);
50562
+ sendRenderedMarkdown(req, res, artifact.path, stat, bridgeSource);
50561
50563
  }
50562
- function serveArtifactProxy(store) {
50564
+ function serveArtifactProxy(store, options = {}) {
50565
+ const bridgeSource = bridgeScriptSource({ pollCadence: options.pollCadence });
50563
50566
  return (req, res) => {
50564
50567
  if (req.method !== "GET" && req.method !== "HEAD") {
50565
50568
  sendMethodNotAllowed(res);
@@ -50576,9 +50579,9 @@ function serveArtifactProxy(store) {
50576
50579
  sendNotFound(res);
50577
50580
  return;
50578
50581
  }
50579
- if (isMarkdownPath(artifact.path)) serveMarkdownArtifact(req, res, store, artifact, subpath);
50580
- else if (hasTrailingSeparator(artifact.path)) serveDirectoryArtifact(req, res, store, artifact, subpath);
50581
- else serveFileArtifact(req, res, store, artifact, subpath);
50582
+ if (isMarkdownPath(artifact.path)) serveMarkdownArtifact(req, res, store, artifact, subpath, bridgeSource);
50583
+ else if (hasTrailingSeparator(artifact.path)) serveDirectoryArtifact(req, res, store, artifact, subpath, bridgeSource);
50584
+ else serveFileArtifact(req, res, store, artifact, subpath, bridgeSource);
50582
50585
  };
50583
50586
  }
50584
50587
 
@@ -50850,8 +50853,9 @@ function registerRoutes(app, store, options) {
50850
50853
  app.use("/themes", applyCorsMiddleware, telemetryMiddleware);
50851
50854
  app.use("/markdown", applyCorsMiddleware, telemetryMiddleware);
50852
50855
  app.use("/telemetry", applyCorsMiddleware);
50853
- app.all("/artifact/:id", serveArtifactProxy(store));
50854
- app.all("/artifact/:id/*", serveArtifactProxy(store));
50856
+ const artifactProxy = serveArtifactProxy(store, { pollCadence: options.testArtifactPollCadence });
50857
+ app.all("/artifact/:id", artifactProxy);
50858
+ app.all("/artifact/:id/*", artifactProxy);
50855
50859
  const markdownContent = serveMarkdownContent(store);
50856
50860
  app.get("/markdown/:id", ...bearerAuth, markdownContent.get);
50857
50861
  app.put("/markdown/:id", ...bearerAuth, markdownContent.put);
@@ -52489,7 +52493,7 @@ function disabledTelemetryRuntime() {
52489
52493
 
52490
52494
  // ../server/src/updates/version.ts
52491
52495
  function readVersionStamp() {
52492
- if ("0.1.182".length > 0) return "0.1.182";
52496
+ if ("0.1.184".length > 0) return "0.1.184";
52493
52497
  return void 0;
52494
52498
  }
52495
52499
  function resolveUpdateReleaseVersion(env = process.env, stamp = readVersionStamp()) {
@@ -52728,7 +52732,8 @@ var Server = class {
52728
52732
  },
52729
52733
  getTelemetryStatus: () => this.telemetryRuntime?.status() ?? { state: "unavailable", reason: null, guidPresent: false, region: "us" },
52730
52734
  enableTelemetry: async () => this.telemetryRuntime?.enable() ?? { state: "unavailable", reason: null, guidPresent: false, region: "us" },
52731
- disableTelemetry: async () => this.telemetryRuntime?.disable() ?? { state: "unavailable", reason: null, guidPresent: false, region: "us" }
52735
+ disableTelemetry: async () => this.telemetryRuntime?.disable() ?? { state: "unavailable", reason: null, guidPresent: false, region: "us" },
52736
+ testArtifactPollCadence: options.testArtifactPollCadence
52732
52737
  });
52733
52738
  if (options.canonicalDir) {
52734
52739
  this.app.use("/canonical/v1", (_req, res, next) => {
@@ -52933,7 +52938,7 @@ var Server = class {
52933
52938
  deriveServerConfigSnapshotProperties({
52934
52939
  version: version2,
52935
52940
  storagePath: this.store.storagePath,
52936
- port: this.port,
52941
+ port: this.getListeningPort(),
52937
52942
  bindAddresses: this.bindAddresses,
52938
52943
  authMode: this.authMode,
52939
52944
  launchMode,
@@ -52945,7 +52950,7 @@ var Server = class {
52945
52950
  configurationSnapshot() {
52946
52951
  return {
52947
52952
  storagePath: this.store.storagePath,
52948
- port: this.port,
52953
+ port: this.getListeningPort(),
52949
52954
  bindAddresses: this.bindAddresses,
52950
52955
  boundURLs: this.baseURLs,
52951
52956
  bindFailures: this.bindFailures.map((failure) => ({
@@ -52990,8 +52995,8 @@ var Server = class {
52990
52995
  };
52991
52996
  };
52992
52997
  function readServerPackageVersion() {
52993
- if ("0.1.182".length > 0) {
52994
- return telemetryVersion("0.1.182");
52998
+ if ("0.1.184".length > 0) {
52999
+ return telemetryVersion("0.1.184");
52995
53000
  }
52996
53001
  const packageJsonPath = import_node_path11.default.resolve(import_node_path11.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url)), "..", "package.json");
52997
53002
  if (!(0, import_node_fs9.existsSync)(packageJsonPath)) return telemetryVersion("0.0.0");
@@ -54562,8 +54567,8 @@ function resolveVercelSkillsInstallerBin() {
54562
54567
  return localRequire.resolve("skills/bin/cli.mjs");
54563
54568
  }
54564
54569
  function readCLIVersion() {
54565
- if ("0.1.182".length > 0) {
54566
- return "0.1.182";
54570
+ if ("0.1.184".length > 0) {
54571
+ return "0.1.184";
54567
54572
  }
54568
54573
  const devPackageJsonPath = import_node_path17.default.join(getDevPackageDir(), "package.json");
54569
54574
  if (!(0, import_node_fs14.existsSync)(devPackageJsonPath)) {
@@ -58,8 +58,8 @@
58
58
  display: none !important;
59
59
  }
60
60
  </style>
61
- <script type="module" crossorigin src="../../assets/artifactMissing-DWPZdkiF.js"></script>
62
- <link rel="modulepreload" crossorigin href="../../assets/artifact-bridge-C0H5cXgO.js">
61
+ <script type="module" crossorigin src="../../assets/artifactMissing-DY3nzD0p.js"></script>
62
+ <link rel="modulepreload" crossorigin href="../../assets/artifact-bridge-BhiFDvPj.js">
63
63
  <link rel="modulepreload" crossorigin href="../../assets/missing-artifact-page-DVzJ41AE.js">
64
64
  </head>
65
65
  <body>