@tempo-ai/mcp 0.0.140 → 0.0.141

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
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __tempoCreateRequire } from 'node:module'; const require = __tempoCreateRequire(import.meta.url);
3
3
  import {
4
4
  run
5
- } from "./chunk-M5AY262E.js";
5
+ } from "./chunk-PS5EHQSO.js";
6
6
  import "./chunk-4R6XIZCX.js";
7
7
  import "./chunk-JKT5N6IQ.js";
8
8
 
@@ -9,7 +9,7 @@ import "./chunk-JKT5N6IQ.js";
9
9
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
10
10
  import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
11
11
  async function connectAggregate(options) {
12
- const { createTempoAggregate } = await import("./serve-ET2RUR3U.js");
12
+ const { createTempoAggregate } = await import("./serve-M2K2KY4U.js");
13
13
  const handle = await createTempoAggregate(options, { stageDocuments: false });
14
14
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
15
15
  const client = new Client({ name: "tempo-mcp-cli", version: "0" });
@@ -128,4 +128,4 @@ export {
128
128
  runCall,
129
129
  runTools
130
130
  };
131
- //# sourceMappingURL=call-MOTOOUHY.js.map
131
+ //# sourceMappingURL=call-MXGPQG43.js.map
@@ -122,7 +122,7 @@ async function run(argv) {
122
122
  process.stderr.write(USAGE);
123
123
  return 1;
124
124
  }
125
- const { runServe } = await import("./serve-ET2RUR3U.js");
125
+ const { runServe } = await import("./serve-M2K2KY4U.js");
126
126
  return await runServe(options);
127
127
  }
128
128
  switch (subcommand) {
@@ -137,11 +137,11 @@ async function run(argv) {
137
137
  return await runToken(rest);
138
138
  }
139
139
  case "tools": {
140
- const { runTools } = await import("./call-MOTOOUHY.js");
140
+ const { runTools } = await import("./call-MXGPQG43.js");
141
141
  return await runTools(rest);
142
142
  }
143
143
  case "call": {
144
- const { runCall } = await import("./call-MOTOOUHY.js");
144
+ const { runCall } = await import("./call-MXGPQG43.js");
145
145
  return await runCall(rest);
146
146
  }
147
147
  default:
@@ -164,4 +164,4 @@ async function run(argv) {
164
164
  export {
165
165
  run
166
166
  };
167
- //# sourceMappingURL=chunk-M5AY262E.js.map
167
+ //# sourceMappingURL=chunk-PS5EHQSO.js.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __tempoCreateRequire } from 'node:module'; const require = __tempoCreateRequire(import.meta.url);
2
2
  import {
3
3
  run
4
- } from "./chunk-M5AY262E.js";
4
+ } from "./chunk-PS5EHQSO.js";
5
5
  import "./chunk-4R6XIZCX.js";
6
6
  import "./chunk-JKT5N6IQ.js";
7
7
  export {
@@ -11012,8 +11012,8 @@ var require_lib2 = __commonJS({
11012
11012
  }
11013
11013
  var UNHANDLED;
11014
11014
  module2.exports = Promise2;
11015
- function Promise2(resolver2) {
11016
- if (typeof resolver2 !== "function") {
11015
+ function Promise2(resolver) {
11016
+ if (typeof resolver !== "function") {
11017
11017
  throw new TypeError("resolver must be a function");
11018
11018
  }
11019
11019
  this.state = PENDING;
@@ -11022,8 +11022,8 @@ var require_lib2 = __commonJS({
11022
11022
  if (!process.browser) {
11023
11023
  this.handled = UNHANDLED;
11024
11024
  }
11025
- if (resolver2 !== INTERNAL) {
11026
- safelyResolveThenable(this, resolver2);
11025
+ if (resolver !== INTERNAL) {
11026
+ safelyResolveThenable(this, resolver);
11027
11027
  }
11028
11028
  }
11029
11029
  Promise2.prototype.finally = function(callback) {
@@ -11059,8 +11059,8 @@ var require_lib2 = __commonJS({
11059
11059
  }
11060
11060
  }
11061
11061
  if (this.state !== PENDING) {
11062
- var resolver2 = this.state === FULFILLED ? onFulfilled : onRejected;
11063
- unwrap(promise, resolver2, this.outcome);
11062
+ var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
11063
+ unwrap(promise, resolver, this.outcome);
11064
11064
  } else {
11065
11065
  this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
11066
11066
  }
@@ -11246,10 +11246,10 @@ var require_lib2 = __commonJS({
11246
11246
  var i = -1;
11247
11247
  var promise = new this(INTERNAL);
11248
11248
  while (++i < len) {
11249
- resolver2(iterable[i]);
11249
+ resolver(iterable[i]);
11250
11250
  }
11251
11251
  return promise;
11252
- function resolver2(value) {
11252
+ function resolver(value) {
11253
11253
  self2.resolve(value).then(function(response) {
11254
11254
  if (!called) {
11255
11255
  called = true;
@@ -92698,8 +92698,12 @@ var CanvasRegistry = class {
92698
92698
  );
92699
92699
  }
92700
92700
  async pruneDeletedRequestedPaths(requestedPaths) {
92701
+ const candidates = /* @__PURE__ */ new Set([
92702
+ ...requestedPaths,
92703
+ ...this.requestedThisSession
92704
+ ]);
92701
92705
  const existingPaths = [];
92702
- for (const requestedPath of requestedPaths) {
92706
+ for (const requestedPath of candidates) {
92703
92707
  const absolutePath = this.requestedPathToAbsolutePath(requestedPath);
92704
92708
  if (!absolutePath) continue;
92705
92709
  if (await this.canvasFileExistsWithRecheck(absolutePath)) {
@@ -92708,17 +92712,17 @@ var CanvasRegistry = class {
92708
92712
  }
92709
92713
  return {
92710
92714
  requestedPaths: existingPaths,
92711
- changed: existingPaths.length !== requestedPaths.length
92715
+ changed: existingPaths.length !== requestedPaths.length || existingPaths.some((value, index) => value !== requestedPaths[index])
92712
92716
  };
92713
92717
  }
92714
- // A prune drop is PERMANENT — nothing re-adds the entry until the next
92715
- // explicit canvas open — so a single ENOENT must not be trusted. Editors and
92718
+ // Avoid dropping an import for a brief ENOENT. Editors and
92716
92719
  // AI tools rewrite canvas files via write-temp + rename, and git operations
92717
92720
  // (checkout, stash) briefly remove them; a prune racing that window used to
92718
92721
  // silently unregister the canvas, leaving the generated tempo-host.tsx
92719
92722
  // serving without it and every storyboard stuck "waiting for iframe content"
92720
92723
  // until the 180s watchdog (TEM-919). Re-check once after a short delay and
92721
- // only drop when the file is still gone.
92724
+ // only drop when the file is still gone. Session demand survives the drop
92725
+ // and restores registration on reconciliation when the file returns.
92722
92726
  async canvasFileExistsWithRecheck(absolutePath) {
92723
92727
  for (let attempt = 0; ; attempt += 1) {
92724
92728
  try {
@@ -123183,7 +123187,7 @@ function buildDirectRenderIdleUrl(hostUrl) {
123183
123187
  }
123184
123188
 
123185
123189
  // ../canvas-capture-headless/src/capture.ts
123186
- import { createHash as createHash8 } from "crypto";
123190
+ import { createHash as createHash9 } from "crypto";
123187
123191
  var import_pngjs = __toESM(require_png(), 1);
123188
123192
 
123189
123193
  // ../../modules/frame-pool/capture-determinism.ts
@@ -123659,7 +123663,7 @@ function buildSettleWaitScript(options2) {
123659
123663
  }
123660
123664
 
123661
123665
  // ../canvas-capture-headless/src/fingerprint.ts
123662
- var KIT_VERSION = "8";
123666
+ var KIT_VERSION = "9";
123663
123667
  var FONTS_BUNDLE_VERSION = "system-1";
123664
123668
  var DEVICE_SCALE_FACTOR = 1;
123665
123669
  function buildEnvFingerprint(input) {
@@ -123883,6 +123887,166 @@ import { randomBytes } from "crypto";
123883
123887
  import { readFile as readFile35, stat as stat18 } from "fs/promises";
123884
123888
  import path75 from "path";
123885
123889
 
123890
+ // ../canvas-capture-headless/src/capture-images.ts
123891
+ import { createHash as createHash8 } from "crypto";
123892
+ import { createRequire as createRequire9 } from "module";
123893
+ var MAX_IMAGE_BYTES2 = 24 * 1024 * 1024;
123894
+ var MAX_IMAGE_PIXELS = 64 * 1024 * 1024;
123895
+ var CACHE_BYTES = 32 * 1024 * 1024;
123896
+ var requireModule3 = createRequire9(import.meta.url);
123897
+ var codec;
123898
+ var loadSharp = () => codec ??= requireModule3("sharp");
123899
+ function createCaptureImageNormalizer() {
123900
+ const cache2 = /* @__PURE__ */ new Map();
123901
+ let retainedBytes = 0;
123902
+ return async (bytes) => {
123903
+ if (bytes[0] !== 255 || bytes[1] !== 216 || bytes[2] !== 255)
123904
+ return bytes;
123905
+ if (bytes.length > MAX_IMAGE_BYTES2)
123906
+ throw new Error("capture JPEG exceeds the 24 MiB input limit");
123907
+ const key = createHash8("sha256").update(bytes).digest("hex");
123908
+ const cached = cache2.get(key);
123909
+ if (cached) {
123910
+ cache2.delete(key);
123911
+ cache2.set(key, cached);
123912
+ return cached;
123913
+ }
123914
+ const sharp = loadSharp();
123915
+ const png = await sharp(bytes, { limitInputPixels: MAX_IMAGE_PIXELS }).keepExif().png().toBuffer();
123916
+ if (cache2.has(key)) return cache2.get(key);
123917
+ if (png.length <= CACHE_BYTES) {
123918
+ while (retainedBytes + png.length > CACHE_BYTES) {
123919
+ const oldest = cache2.keys().next().value;
123920
+ retainedBytes -= cache2.get(oldest).length;
123921
+ cache2.delete(oldest);
123922
+ }
123923
+ cache2.set(key, png);
123924
+ retainedBytes += png.length;
123925
+ }
123926
+ return png;
123927
+ };
123928
+ }
123929
+ async function installCaptureImages(page, normalize3) {
123930
+ const session = await page.context().newCDPSession(page);
123931
+ const failures = /* @__PURE__ */ new Map();
123932
+ const pending = /* @__PURE__ */ new Set();
123933
+ const requests = /* @__PURE__ */ new Map();
123934
+ let disposing = false;
123935
+ const handle = async (event) => {
123936
+ const {
123937
+ requestId,
123938
+ networkId,
123939
+ request,
123940
+ responseStatusCode,
123941
+ responseHeaders = []
123942
+ } = event;
123943
+ const requestState = {
123944
+ canceled: false
123945
+ };
123946
+ if (networkId) requests.set(networkId, requestState);
123947
+ try {
123948
+ const mime = responseHeaders.find((h2) => h2.name.toLowerCase() === "content-type")?.value.split(";", 1)[0].trim().toLowerCase();
123949
+ const mayBeJpeg = mime === "image/jpeg" || mime === "image/jpg" || mime === "application/octet-stream" || !mime;
123950
+ if (responseStatusCode !== 200 || !mayBeJpeg) {
123951
+ await session.send("Fetch.continueRequest", { requestId });
123952
+ return;
123953
+ }
123954
+ const declaredLength = Number(
123955
+ responseHeaders.find((h2) => h2.name.toLowerCase() === "content-length")?.value
123956
+ );
123957
+ if (declaredLength > MAX_IMAGE_BYTES2)
123958
+ throw new Error("capture image exceeds the 24 MiB input limit");
123959
+ let timer;
123960
+ const response = await Promise.race([
123961
+ session.send("Fetch.getResponseBody", { requestId }),
123962
+ new Promise((_4, reject2) => {
123963
+ timer = setTimeout(
123964
+ () => reject2(new Error("capture image download exceeded 30 seconds")),
123965
+ 3e4
123966
+ );
123967
+ }),
123968
+ new Promise((_4, reject2) => {
123969
+ requestState.cancelBody = () => reject2(new Error("capture image request was canceled"));
123970
+ if (requestState.canceled) requestState.cancelBody();
123971
+ })
123972
+ ]).finally(() => {
123973
+ clearTimeout(timer);
123974
+ requestState.cancelBody = void 0;
123975
+ });
123976
+ const body = Buffer.from(
123977
+ response.body,
123978
+ response.base64Encoded ? "base64" : "utf8"
123979
+ );
123980
+ const normalized = await normalize3(body);
123981
+ if (normalized === body) {
123982
+ await session.send("Fetch.continueRequest", { requestId });
123983
+ return;
123984
+ }
123985
+ const replaced = /* @__PURE__ */ new Set([
123986
+ "content-type",
123987
+ "content-encoding",
123988
+ "content-length",
123989
+ "etag",
123990
+ "content-md5",
123991
+ "digest",
123992
+ "content-digest",
123993
+ "repr-digest"
123994
+ ]);
123995
+ const headers = responseHeaders.filter(
123996
+ (h2) => !replaced.has(h2.name.toLowerCase())
123997
+ );
123998
+ headers.push({ name: "Content-Type", value: "image/png" });
123999
+ await session.send("Fetch.fulfillRequest", {
124000
+ requestId,
124001
+ responseCode: responseStatusCode,
124002
+ responseHeaders: headers,
124003
+ body: normalized.toString("base64")
124004
+ });
124005
+ } catch (error) {
124006
+ if (!disposing && !requestState.canceled)
124007
+ failures.set(request.url, String(error));
124008
+ await session.send("Fetch.failRequest", { requestId, errorReason: "Failed" }).catch(() => {
124009
+ });
124010
+ } finally {
124011
+ if (networkId && requests.get(networkId) === requestState)
124012
+ requests.delete(networkId);
124013
+ }
124014
+ };
124015
+ session.on("Network.loadingFailed", (event) => {
124016
+ if (!event.canceled) return;
124017
+ const request = requests.get(event.requestId);
124018
+ if (!request) return;
124019
+ request.canceled = true;
124020
+ request.cancelBody?.();
124021
+ });
124022
+ session.on("Fetch.requestPaused", (event) => {
124023
+ const task = handle(event);
124024
+ pending.add(task);
124025
+ void task.finally(() => pending.delete(task)).catch(() => {
124026
+ });
124027
+ });
124028
+ await session.send("Network.enable");
124029
+ await session.send("Fetch.enable", {
124030
+ patterns: [{ resourceType: "Image", requestStage: "Response" }]
124031
+ });
124032
+ return {
124033
+ assertHealthy() {
124034
+ if (failures.size)
124035
+ throw new Error(
124036
+ `capture image normalization failed: ${[...failures].map(([url, error]) => `${url}: ${error}`).join("; ")}`
124037
+ );
124038
+ },
124039
+ async dispose() {
124040
+ disposing = true;
124041
+ await session.send("Fetch.disable").catch(() => {
124042
+ });
124043
+ await session.detach().catch(() => {
124044
+ });
124045
+ await Promise.allSettled([...pending]);
124046
+ }
124047
+ };
124048
+ }
124049
+
123886
124050
  // ../canvas/html-storyboard-resources.ts
123887
124051
  import path74 from "path";
123888
124052
  import { realpath as realpath10, stat as stat17 } from "fs/promises";
@@ -131970,7 +132134,7 @@ var contentTypes = {
131970
132134
  ".wav": "audio/wav",
131971
132135
  ".webm": "video/webm"
131972
132136
  };
131973
- async function openHeadlessHtmlSource(context, filepath) {
132137
+ async function openHeadlessHtmlSource(context, filepath, normalizeImage = createCaptureImageNormalizer()) {
131974
132138
  const accepted = await authorizeHtmlStoryboardResource(filepath);
131975
132139
  const content = await readFile35(accepted.filepath, "utf8");
131976
132140
  const annotated = annotateHtmlStoryboardRevision(content, {
@@ -131986,7 +132150,7 @@ async function openHeadlessHtmlSource(context, filepath) {
131986
132150
  if (requested.origin !== origin) {
131987
132151
  if (requested.protocol === "file:" || request.isNavigationRequest())
131988
132152
  return route.abort("blockedbyclient");
131989
- return route.continue();
132153
+ return route.fallback();
131990
132154
  }
131991
132155
  const resource = await resolveHtmlStoryboardResource(
131992
132156
  accepted.authorization,
@@ -131997,14 +132161,16 @@ async function openHeadlessHtmlSource(context, filepath) {
131997
132161
  return route.fulfill({ status: resource.status, body: "" });
131998
132162
  }
131999
132163
  try {
132164
+ const body = resource.filepath === accepted.filepath ? annotated : await readFile35(resource.filepath);
132165
+ const normalized = request.resourceType() === "image" && Buffer.isBuffer(body) ? await normalizeImage(body) : body;
132000
132166
  await route.fulfill({
132001
132167
  status: 200,
132002
- contentType: contentTypes[path75.extname(resource.filepath).toLowerCase()],
132168
+ contentType: normalized !== body ? "image/png" : contentTypes[path75.extname(resource.filepath).toLowerCase()],
132003
132169
  headers: {
132004
132170
  "cache-control": "no-store",
132005
132171
  "content-security-policy": "sandbox allow-scripts allow-same-origin"
132006
132172
  },
132007
- body: resource.filepath === accepted.filepath ? annotated : await readFile35(resource.filepath)
132173
+ body: normalized
132008
132174
  });
132009
132175
  } catch (error) {
132010
132176
  failures.add(`${requested.pathname}: ${String(error)}`);
@@ -132253,7 +132419,11 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132253
132419
  );
132254
132420
  }
132255
132421
  function images() {
132256
- return Array.from(doc.querySelectorAll("img")).filter(visibleImage);
132422
+ return Array.from(doc.querySelectorAll("img"))
132423
+ .filter(visibleImage)
132424
+ .map(function (img) {
132425
+ return [img, img.currentSrc, img.src, img.srcset];
132426
+ });
132257
132427
  }
132258
132428
  async function scheduledImages() {
132259
132429
  var candidates,
@@ -132265,7 +132435,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132265
132435
  var limit = Math.min(offset + 32, candidates.length);
132266
132436
  while (offset < limit) {
132267
132437
  var img = candidates[offset++];
132268
- if (visibleImage(img)) selected.push(img);
132438
+ if (visibleImage(img))
132439
+ selected.push([img, img.currentSrc, img.src, img.srcset]);
132269
132440
  if (slice && !slice.hasTime()) break;
132270
132441
  }
132271
132442
  });
@@ -132319,7 +132490,7 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132319
132490
  check();
132320
132491
  });
132321
132492
  }
132322
- function inventory() {
132493
+ function inventory(includeImages) {
132323
132494
  return {
132324
132495
  links: links().map(function (link) {
132325
132496
  // Resource evidence can change during a font/image await without
@@ -132334,15 +132505,13 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132334
132505
  link.getAttribute("data-tempo-stylesheet-error") === link.href,
132335
132506
  ];
132336
132507
  }),
132337
- images: images().map(function (img) {
132338
- return [img, img.currentSrc, img.src, img.srcset];
132339
- }),
132508
+ images: includeImages ? images() : [],
132340
132509
  styles: Array.from(doc.querySelectorAll("style")).map(function (style) {
132341
132510
  return [style, style.textContent];
132342
132511
  }),
132343
132512
  };
132344
132513
  }
132345
- async function scheduledInventory() {
132514
+ async function scheduledInventory(includeImages) {
132346
132515
  var candidates,
132347
132516
  offset = 0;
132348
132517
  var result = { revision: revision, links: [], images: [], styles: [] };
@@ -132352,7 +132521,11 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132352
132521
  await work(function (slice) {
132353
132522
  if (!candidates)
132354
132523
  candidates = Array.from(
132355
- doc.querySelectorAll('link[rel~="stylesheet"],img,style'),
132524
+ doc.querySelectorAll(
132525
+ includeImages
132526
+ ? 'link[rel~="stylesheet"],img,style'
132527
+ : 'link[rel~="stylesheet"],style',
132528
+ ),
132356
132529
  );
132357
132530
  var limit = Math.min(offset + 32, candidates.length);
132358
132531
  while (offset < limit) {
@@ -132398,8 +132571,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132398
132571
  async function run() {
132399
132572
  while (!stopped) {
132400
132573
  var before = options.scheduleWork
132401
- ? await scheduledInventory()
132402
- : inventory();
132574
+ ? await scheduledInventory(false)
132575
+ : inventory(false);
132403
132576
  if (stopped) return;
132404
132577
  await Promise.race([
132405
132578
  terminal,
@@ -132455,14 +132628,18 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132455
132628
  }),
132456
132629
  ]);
132457
132630
  if (stopped) return;
132631
+ // Fonts can change which images are visible. Capture the image evidence
132632
+ // only after their layout settles, before awaiting any selected decode.
132458
132633
  var selected = options.scheduleWork
132459
132634
  ? await scheduledImages()
132460
132635
  : images();
132461
132636
  if (stopped) return;
132637
+ before.images = selected;
132462
132638
  if (options.scheduleWork) {
132463
132639
  var pendingImages = [],
132464
132640
  pendingLoads = [];
132465
- var imageWaits = await mapWork(selected, function (img) {
132641
+ var imageWaits = await mapWork(selected, function (row) {
132642
+ var img = row[0];
132466
132643
  if (img.loading === "lazy") img.loading = "eager";
132467
132644
  // Warm images need no load-event continuation. Prepare their
132468
132645
  // decodes in this bounded batch rather than one new task per image.
@@ -132504,7 +132681,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132504
132681
  await Promise.race([
132505
132682
  terminal,
132506
132683
  Promise.all(
132507
- selected.map(async function (img) {
132684
+ selected.map(async function (row) {
132685
+ var img = row[0];
132508
132686
  if (img.loading === "lazy") img.loading = "eager";
132509
132687
  await Promise.race([
132510
132688
  terminal,
@@ -132538,8 +132716,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132538
132716
  if (face.status === "error") failure("font", face.family);
132539
132717
  });
132540
132718
  var after = options.scheduleWork
132541
- ? await scheduledInventory()
132542
- : inventory();
132719
+ ? await scheduledInventory(true)
132720
+ : inventory(true);
132543
132721
  if (stopped) return;
132544
132722
  // A scheduled inventory can span multiple tasks. A mutation during
132545
132723
  // its geometry reads cannot certify a mixed document observation.
@@ -133036,7 +133214,7 @@ function buildDirectRenderUrl2(hostUrl, target) {
133036
133214
  });
133037
133215
  }
133038
133216
  function sha256Hex(bytes) {
133039
- return createHash8("sha256").update(bytes).digest("hex");
133217
+ return createHash9("sha256").update(bytes).digest("hex");
133040
133218
  }
133041
133219
  function looksBlank(pngBytes) {
133042
133220
  let png;
@@ -133139,6 +133317,7 @@ async function startCaptureSession(options2) {
133139
133317
  const log = options2.log ?? (() => {
133140
133318
  });
133141
133319
  const parallelPages = options2.parallelPages ?? 1;
133320
+ const normalizeImage = createCaptureImageNormalizer();
133142
133321
  const { chromium } = await import("playwright");
133143
133322
  let browser;
133144
133323
  try {
@@ -133170,10 +133349,12 @@ async function startCaptureSession(options2) {
133170
133349
  await context.addInitScript(buildFreezeInitScript());
133171
133350
  await context.addInitScript(installRenderProfileInPage);
133172
133351
  const page = await context.newPage();
133352
+ const images = await installCaptureImages(page, normalizeImage);
133173
133353
  const documentEvents = await context.newCDPSession(page);
133174
133354
  const worker = {
133175
133355
  context,
133176
133356
  page,
133357
+ images,
133177
133358
  contextMs: Date.now() - contextStart,
133178
133359
  contextClaimed: false,
133179
133360
  hasNavigated: false,
@@ -133184,6 +133365,7 @@ async function startCaptureSession(options2) {
133184
133365
  documentsLoaded: 0,
133185
133366
  navigationsInFlight: 0,
133186
133367
  async dispose() {
133368
+ await images.dispose();
133187
133369
  await documentEvents.detach().catch(() => {
133188
133370
  });
133189
133371
  await page.close().catch(() => {
@@ -133260,7 +133442,8 @@ async function startCaptureSession(options2) {
133260
133442
  try {
133261
133443
  const source = target.source.kind === "html" ? await openHeadlessHtmlSource(
133262
133444
  worker2.context,
133263
- target.source.filepath
133445
+ target.source.filepath,
133446
+ normalizeImage
133264
133447
  ) : {
133265
133448
  url: astroCaptureUrl(
133266
133449
  await (options2.getAppUrl?.() ?? Promise.reject(
@@ -133322,7 +133505,9 @@ async function startCaptureSession(options2) {
133322
133505
  `Astro storyboard failed: ${[...failures].join("; ")}`
133323
133506
  );
133324
133507
  timings.settleMs = Date.now() - settling;
133508
+ worker2.images.assertHealthy();
133325
133509
  const value = await work(worker2.page, "body");
133510
+ worker2.images.assertHealthy();
133326
133511
  source.assertResources();
133327
133512
  if (target.source.kind === "astro" && failures.size)
133328
133513
  throw new Error(
@@ -133487,7 +133672,9 @@ async function startCaptureSession(options2) {
133487
133672
  errorSelector: STORYBOARD_RENDER_ERROR_SELECTOR,
133488
133673
  messageAttribute: STORYBOARD_RENDER_ERROR_MESSAGE_ATTRIBUTE
133489
133674
  });
133675
+ worker.images.assertHealthy();
133490
133676
  const value = await work(page, selector);
133677
+ worker.images.assertHealthy();
133491
133678
  const renderErrors = await page.evaluate(readRenderErrorsInPage);
133492
133679
  if (renderErrors.length > 0) {
133493
133680
  throw new Error(
@@ -134225,7 +134412,7 @@ async function startDevserverSession(options2) {
134225
134412
  // ../canvas-capture-headless/src/enumerate.ts
134226
134413
  import { access as access19, readFile as readFile38 } from "fs/promises";
134227
134414
  import path78 from "path";
134228
- import { createHash as createHash9 } from "crypto";
134415
+ import { createHash as createHash10 } from "crypto";
134229
134416
 
134230
134417
  // ../canvas-capture-headless/src/ignore-mask.ts
134231
134418
  function ignoredStoryboardArea(regions, width, height) {
@@ -134330,7 +134517,7 @@ async function enumerateCanvasStoryboards(options2) {
134330
134517
  canvasPath: parsed.canvasPath ?? toPosixPath7(
134331
134518
  path78.relative(projectRoot, path78.dirname(filePath))
134332
134519
  ),
134333
- revision: createHash9("sha256").update(source).digest("hex")
134520
+ revision: createHash10("sha256").update(source).digest("hex")
134334
134521
  }
134335
134522
  } : storyboard.kind === "html" ? {
134336
134523
  source: {
@@ -138953,7 +139140,7 @@ function buildBackends(runtime, toolsets, workspace) {
138953
139140
  }
138954
139141
 
138955
139142
  // src/version.ts
138956
- var CLI_VERSION = "0.0.140";
139143
+ var CLI_VERSION = "0.0.141";
138957
139144
 
138958
139145
  // src/canvas-hooks.ts
138959
139146
  var import_pngjs4 = __toESM(require_png(), 1);
@@ -138963,7 +139150,7 @@ import { gzipSync } from "zlib";
138963
139150
  import { anyApi as anyApi10 } from "convex/server";
138964
139151
 
138965
139152
  // ../workspaces/git-worktree/worktree.ts
138966
- import { createHash as createHash10, randomUUID as randomUUID7 } from "crypto";
139153
+ import { createHash as createHash11, randomUUID as randomUUID7 } from "crypto";
138967
139154
  import fs7 from "fs/promises";
138968
139155
  import os4 from "os";
138969
139156
  import path83 from "path";
@@ -139255,39 +139442,10 @@ function nonInteractiveGitEnv(base = process.env) {
139255
139442
  };
139256
139443
  }
139257
139444
 
139258
- // ../workspaces/git-worktree/network-auth.ts
139259
- var resolver = null;
139260
- async function resolveGitNetworkAuth(repoPath, remote = "origin") {
139261
- if (!resolver) return null;
139262
- try {
139263
- return await resolver(repoPath, remote);
139264
- } catch {
139265
- return null;
139266
- }
139267
- }
139268
- var GIT_BINARY = ["git", "--no-optional-locks"];
139269
- async function networkSimpleGit(repoPath, options2 = {}) {
139270
- const auth = await resolveGitNetworkAuth(repoPath, options2.remote ?? "origin");
139271
- const config = [
139272
- ...options2.nonInteractive ? NON_INTERACTIVE_GIT_CONFIG : [],
139273
- ...auth?.config ?? []
139274
- ];
139275
- const git = simpleGit({
139276
- baseDir: repoPath,
139277
- binary: GIT_BINARY,
139278
- ...config.length > 0 ? { config } : {},
139279
- ...options2.timeout ? { timeout: options2.timeout } : {}
139280
- });
139281
- if (options2.nonInteractive) {
139282
- return git.env({ ...nonInteractiveGitEnv(), ...auth?.env });
139283
- }
139284
- return auth ? git.env({ ...process.env, ...auth.env }) : git;
139285
- }
139286
-
139287
139445
  // ../workspaces/git-worktree/worktree.ts
139288
- var GIT_BINARY2 = ["git", "--no-optional-locks"];
139446
+ var GIT_BINARY = ["git", "--no-optional-locks"];
139289
139447
  function simpleGit2(repoPath) {
139290
- return repoPath ? simpleGit({ baseDir: repoPath, binary: GIT_BINARY2 }) : simpleGit({ binary: GIT_BINARY2 });
139448
+ return repoPath ? simpleGit({ baseDir: repoPath, binary: GIT_BINARY }) : simpleGit({ binary: GIT_BINARY });
139291
139449
  }
139292
139450
  async function getRemoteUrl2(repoPath, remoteName = "origin") {
139293
139451
  const git = simpleGit2(repoPath);
@@ -139372,11 +139530,13 @@ async function computeShareStatus(repoPath) {
139372
139530
  };
139373
139531
  }
139374
139532
  async function checkBranchOnRemote(repoPath, branch) {
139533
+ const git = simpleGit({
139534
+ baseDir: repoPath,
139535
+ binary: GIT_BINARY,
139536
+ config: [...NON_INTERACTIVE_GIT_CONFIG],
139537
+ timeout: { block: 15e3 }
139538
+ }).env(nonInteractiveGitEnv());
139375
139539
  try {
139376
- const git = await networkSimpleGit(repoPath, {
139377
- nonInteractive: true,
139378
- timeout: { block: 15e3 }
139379
- });
139380
139540
  const out = await git.raw(["ls-remote", "--heads", "origin", branch]);
139381
139541
  return out.trim().length > 0;
139382
139542
  } catch {
@@ -140219,4 +140379,4 @@ unpdf/dist/index.mjs:
140219
140379
  * @license Apache-2.0
140220
140380
  *)
140221
140381
  */
140222
- //# sourceMappingURL=serve-ET2RUR3U.js.map
140382
+ //# sourceMappingURL=serve-M2K2KY4U.js.map