@tempo-ai/mcp 0.0.140-staging.1 → 0.0.141-staging.1

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-B3HAGK2B.js";
5
+ } from "./chunk-5VZFHPWP.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-D2DPKEDS.js");
12
+ const { createTempoAggregate } = await import("./serve-DFPNHVBV.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-FKB6YICD.js.map
131
+ //# sourceMappingURL=call-DFSOEUGA.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-D2DPKEDS.js");
125
+ const { runServe } = await import("./serve-DFPNHVBV.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-FKB6YICD.js");
140
+ const { runTools } = await import("./call-DFSOEUGA.js");
141
141
  return await runTools(rest);
142
142
  }
143
143
  case "call": {
144
- const { runCall } = await import("./call-FKB6YICD.js");
144
+ const { runCall } = await import("./call-DFSOEUGA.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-B3HAGK2B.js.map
167
+ //# sourceMappingURL=chunk-5VZFHPWP.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-B3HAGK2B.js";
4
+ } from "./chunk-5VZFHPWP.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,162 @@ 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 sharp from "sharp";
123893
+ var MAX_IMAGE_BYTES2 = 24 * 1024 * 1024;
123894
+ var MAX_IMAGE_PIXELS = 64 * 1024 * 1024;
123895
+ var CACHE_BYTES = 32 * 1024 * 1024;
123896
+ function createCaptureImageNormalizer() {
123897
+ const cache2 = /* @__PURE__ */ new Map();
123898
+ let retainedBytes = 0;
123899
+ return async (bytes) => {
123900
+ if (bytes[0] !== 255 || bytes[1] !== 216 || bytes[2] !== 255)
123901
+ return bytes;
123902
+ if (bytes.length > MAX_IMAGE_BYTES2)
123903
+ throw new Error("capture JPEG exceeds the 24 MiB input limit");
123904
+ const key = createHash8("sha256").update(bytes).digest("hex");
123905
+ const cached = cache2.get(key);
123906
+ if (cached) {
123907
+ cache2.delete(key);
123908
+ cache2.set(key, cached);
123909
+ return cached;
123910
+ }
123911
+ const png = await sharp(bytes, { limitInputPixels: MAX_IMAGE_PIXELS }).keepExif().png().toBuffer();
123912
+ if (cache2.has(key)) return cache2.get(key);
123913
+ if (png.length <= CACHE_BYTES) {
123914
+ while (retainedBytes + png.length > CACHE_BYTES) {
123915
+ const oldest = cache2.keys().next().value;
123916
+ retainedBytes -= cache2.get(oldest).length;
123917
+ cache2.delete(oldest);
123918
+ }
123919
+ cache2.set(key, png);
123920
+ retainedBytes += png.length;
123921
+ }
123922
+ return png;
123923
+ };
123924
+ }
123925
+ async function installCaptureImages(page, normalize3) {
123926
+ const session = await page.context().newCDPSession(page);
123927
+ const failures = /* @__PURE__ */ new Map();
123928
+ const pending = /* @__PURE__ */ new Set();
123929
+ const requests = /* @__PURE__ */ new Map();
123930
+ let disposing = false;
123931
+ const handle = async (event) => {
123932
+ const {
123933
+ requestId,
123934
+ networkId,
123935
+ request,
123936
+ responseStatusCode,
123937
+ responseHeaders = []
123938
+ } = event;
123939
+ const requestState = {
123940
+ canceled: false
123941
+ };
123942
+ if (networkId) requests.set(networkId, requestState);
123943
+ try {
123944
+ const mime = responseHeaders.find((h2) => h2.name.toLowerCase() === "content-type")?.value.split(";", 1)[0].trim().toLowerCase();
123945
+ const mayBeJpeg = mime === "image/jpeg" || mime === "image/jpg" || mime === "application/octet-stream" || !mime;
123946
+ if (responseStatusCode !== 200 || !mayBeJpeg) {
123947
+ await session.send("Fetch.continueRequest", { requestId });
123948
+ return;
123949
+ }
123950
+ const declaredLength = Number(
123951
+ responseHeaders.find((h2) => h2.name.toLowerCase() === "content-length")?.value
123952
+ );
123953
+ if (declaredLength > MAX_IMAGE_BYTES2)
123954
+ throw new Error("capture image exceeds the 24 MiB input limit");
123955
+ let timer;
123956
+ const response = await Promise.race([
123957
+ session.send("Fetch.getResponseBody", { requestId }),
123958
+ new Promise((_4, reject2) => {
123959
+ timer = setTimeout(
123960
+ () => reject2(new Error("capture image download exceeded 30 seconds")),
123961
+ 3e4
123962
+ );
123963
+ }),
123964
+ new Promise((_4, reject2) => {
123965
+ requestState.cancelBody = () => reject2(new Error("capture image request was canceled"));
123966
+ if (requestState.canceled) requestState.cancelBody();
123967
+ })
123968
+ ]).finally(() => {
123969
+ clearTimeout(timer);
123970
+ requestState.cancelBody = void 0;
123971
+ });
123972
+ const body = Buffer.from(
123973
+ response.body,
123974
+ response.base64Encoded ? "base64" : "utf8"
123975
+ );
123976
+ const normalized = await normalize3(body);
123977
+ if (normalized === body) {
123978
+ await session.send("Fetch.continueRequest", { requestId });
123979
+ return;
123980
+ }
123981
+ const replaced = /* @__PURE__ */ new Set([
123982
+ "content-type",
123983
+ "content-encoding",
123984
+ "content-length",
123985
+ "etag",
123986
+ "content-md5",
123987
+ "digest",
123988
+ "content-digest",
123989
+ "repr-digest"
123990
+ ]);
123991
+ const headers = responseHeaders.filter(
123992
+ (h2) => !replaced.has(h2.name.toLowerCase())
123993
+ );
123994
+ headers.push({ name: "Content-Type", value: "image/png" });
123995
+ await session.send("Fetch.fulfillRequest", {
123996
+ requestId,
123997
+ responseCode: responseStatusCode,
123998
+ responseHeaders: headers,
123999
+ body: normalized.toString("base64")
124000
+ });
124001
+ } catch (error) {
124002
+ if (!disposing && !requestState.canceled)
124003
+ failures.set(request.url, String(error));
124004
+ await session.send("Fetch.failRequest", { requestId, errorReason: "Failed" }).catch(() => {
124005
+ });
124006
+ } finally {
124007
+ if (networkId && requests.get(networkId) === requestState)
124008
+ requests.delete(networkId);
124009
+ }
124010
+ };
124011
+ session.on("Network.loadingFailed", (event) => {
124012
+ if (!event.canceled) return;
124013
+ const request = requests.get(event.requestId);
124014
+ if (!request) return;
124015
+ request.canceled = true;
124016
+ request.cancelBody?.();
124017
+ });
124018
+ session.on("Fetch.requestPaused", (event) => {
124019
+ const task = handle(event);
124020
+ pending.add(task);
124021
+ void task.finally(() => pending.delete(task)).catch(() => {
124022
+ });
124023
+ });
124024
+ await session.send("Network.enable");
124025
+ await session.send("Fetch.enable", {
124026
+ patterns: [{ resourceType: "Image", requestStage: "Response" }]
124027
+ });
124028
+ return {
124029
+ assertHealthy() {
124030
+ if (failures.size)
124031
+ throw new Error(
124032
+ `capture image normalization failed: ${[...failures].map(([url, error]) => `${url}: ${error}`).join("; ")}`
124033
+ );
124034
+ },
124035
+ async dispose() {
124036
+ disposing = true;
124037
+ await session.send("Fetch.disable").catch(() => {
124038
+ });
124039
+ await session.detach().catch(() => {
124040
+ });
124041
+ await Promise.allSettled([...pending]);
124042
+ }
124043
+ };
124044
+ }
124045
+
123886
124046
  // ../canvas/html-storyboard-resources.ts
123887
124047
  import path74 from "path";
123888
124048
  import { realpath as realpath10, stat as stat17 } from "fs/promises";
@@ -131970,7 +132130,7 @@ var contentTypes = {
131970
132130
  ".wav": "audio/wav",
131971
132131
  ".webm": "video/webm"
131972
132132
  };
131973
- async function openHeadlessHtmlSource(context, filepath) {
132133
+ async function openHeadlessHtmlSource(context, filepath, normalizeImage = createCaptureImageNormalizer()) {
131974
132134
  const accepted = await authorizeHtmlStoryboardResource(filepath);
131975
132135
  const content = await readFile35(accepted.filepath, "utf8");
131976
132136
  const annotated = annotateHtmlStoryboardRevision(content, {
@@ -131986,7 +132146,7 @@ async function openHeadlessHtmlSource(context, filepath) {
131986
132146
  if (requested.origin !== origin) {
131987
132147
  if (requested.protocol === "file:" || request.isNavigationRequest())
131988
132148
  return route.abort("blockedbyclient");
131989
- return route.continue();
132149
+ return route.fallback();
131990
132150
  }
131991
132151
  const resource = await resolveHtmlStoryboardResource(
131992
132152
  accepted.authorization,
@@ -131997,14 +132157,16 @@ async function openHeadlessHtmlSource(context, filepath) {
131997
132157
  return route.fulfill({ status: resource.status, body: "" });
131998
132158
  }
131999
132159
  try {
132160
+ const body = resource.filepath === accepted.filepath ? annotated : await readFile35(resource.filepath);
132161
+ const normalized = request.resourceType() === "image" && Buffer.isBuffer(body) ? await normalizeImage(body) : body;
132000
132162
  await route.fulfill({
132001
132163
  status: 200,
132002
- contentType: contentTypes[path75.extname(resource.filepath).toLowerCase()],
132164
+ contentType: normalized !== body ? "image/png" : contentTypes[path75.extname(resource.filepath).toLowerCase()],
132003
132165
  headers: {
132004
132166
  "cache-control": "no-store",
132005
132167
  "content-security-policy": "sandbox allow-scripts allow-same-origin"
132006
132168
  },
132007
- body: resource.filepath === accepted.filepath ? annotated : await readFile35(resource.filepath)
132169
+ body: normalized
132008
132170
  });
132009
132171
  } catch (error) {
132010
132172
  failures.add(`${requested.pathname}: ${String(error)}`);
@@ -132253,7 +132415,11 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132253
132415
  );
132254
132416
  }
132255
132417
  function images() {
132256
- return Array.from(doc.querySelectorAll("img")).filter(visibleImage);
132418
+ return Array.from(doc.querySelectorAll("img"))
132419
+ .filter(visibleImage)
132420
+ .map(function (img) {
132421
+ return [img, img.currentSrc, img.src, img.srcset];
132422
+ });
132257
132423
  }
132258
132424
  async function scheduledImages() {
132259
132425
  var candidates,
@@ -132265,7 +132431,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132265
132431
  var limit = Math.min(offset + 32, candidates.length);
132266
132432
  while (offset < limit) {
132267
132433
  var img = candidates[offset++];
132268
- if (visibleImage(img)) selected.push(img);
132434
+ if (visibleImage(img))
132435
+ selected.push([img, img.currentSrc, img.src, img.srcset]);
132269
132436
  if (slice && !slice.hasTime()) break;
132270
132437
  }
132271
132438
  });
@@ -132319,7 +132486,7 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132319
132486
  check();
132320
132487
  });
132321
132488
  }
132322
- function inventory() {
132489
+ function inventory(includeImages) {
132323
132490
  return {
132324
132491
  links: links().map(function (link) {
132325
132492
  // Resource evidence can change during a font/image await without
@@ -132334,15 +132501,13 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132334
132501
  link.getAttribute("data-tempo-stylesheet-error") === link.href,
132335
132502
  ];
132336
132503
  }),
132337
- images: images().map(function (img) {
132338
- return [img, img.currentSrc, img.src, img.srcset];
132339
- }),
132504
+ images: includeImages ? images() : [],
132340
132505
  styles: Array.from(doc.querySelectorAll("style")).map(function (style) {
132341
132506
  return [style, style.textContent];
132342
132507
  }),
132343
132508
  };
132344
132509
  }
132345
- async function scheduledInventory() {
132510
+ async function scheduledInventory(includeImages) {
132346
132511
  var candidates,
132347
132512
  offset = 0;
132348
132513
  var result = { revision: revision, links: [], images: [], styles: [] };
@@ -132352,7 +132517,11 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132352
132517
  await work(function (slice) {
132353
132518
  if (!candidates)
132354
132519
  candidates = Array.from(
132355
- doc.querySelectorAll('link[rel~="stylesheet"],img,style'),
132520
+ doc.querySelectorAll(
132521
+ includeImages
132522
+ ? 'link[rel~="stylesheet"],img,style'
132523
+ : 'link[rel~="stylesheet"],style',
132524
+ ),
132356
132525
  );
132357
132526
  var limit = Math.min(offset + 32, candidates.length);
132358
132527
  while (offset < limit) {
@@ -132398,8 +132567,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132398
132567
  async function run() {
132399
132568
  while (!stopped) {
132400
132569
  var before = options.scheduleWork
132401
- ? await scheduledInventory()
132402
- : inventory();
132570
+ ? await scheduledInventory(false)
132571
+ : inventory(false);
132403
132572
  if (stopped) return;
132404
132573
  await Promise.race([
132405
132574
  terminal,
@@ -132455,14 +132624,18 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132455
132624
  }),
132456
132625
  ]);
132457
132626
  if (stopped) return;
132627
+ // Fonts can change which images are visible. Capture the image evidence
132628
+ // only after their layout settles, before awaiting any selected decode.
132458
132629
  var selected = options.scheduleWork
132459
132630
  ? await scheduledImages()
132460
132631
  : images();
132461
132632
  if (stopped) return;
132633
+ before.images = selected;
132462
132634
  if (options.scheduleWork) {
132463
132635
  var pendingImages = [],
132464
132636
  pendingLoads = [];
132465
- var imageWaits = await mapWork(selected, function (img) {
132637
+ var imageWaits = await mapWork(selected, function (row) {
132638
+ var img = row[0];
132466
132639
  if (img.loading === "lazy") img.loading = "eager";
132467
132640
  // Warm images need no load-event continuation. Prepare their
132468
132641
  // decodes in this bounded batch rather than one new task per image.
@@ -132504,7 +132677,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132504
132677
  await Promise.race([
132505
132678
  terminal,
132506
132679
  Promise.all(
132507
- selected.map(async function (img) {
132680
+ selected.map(async function (row) {
132681
+ var img = row[0];
132508
132682
  if (img.loading === "lazy") img.loading = "eager";
132509
132683
  await Promise.race([
132510
132684
  terminal,
@@ -132538,8 +132712,8 @@ var DOCUMENT_VISUAL_READINESS_SOURCE = `return (function documentVisualReadiness
132538
132712
  if (face.status === "error") failure("font", face.family);
132539
132713
  });
132540
132714
  var after = options.scheduleWork
132541
- ? await scheduledInventory()
132542
- : inventory();
132715
+ ? await scheduledInventory(true)
132716
+ : inventory(true);
132543
132717
  if (stopped) return;
132544
132718
  // A scheduled inventory can span multiple tasks. A mutation during
132545
132719
  // its geometry reads cannot certify a mixed document observation.
@@ -133036,7 +133210,7 @@ function buildDirectRenderUrl2(hostUrl, target) {
133036
133210
  });
133037
133211
  }
133038
133212
  function sha256Hex(bytes) {
133039
- return createHash8("sha256").update(bytes).digest("hex");
133213
+ return createHash9("sha256").update(bytes).digest("hex");
133040
133214
  }
133041
133215
  function looksBlank(pngBytes) {
133042
133216
  let png;
@@ -133139,6 +133313,7 @@ async function startCaptureSession(options2) {
133139
133313
  const log = options2.log ?? (() => {
133140
133314
  });
133141
133315
  const parallelPages = options2.parallelPages ?? 1;
133316
+ const normalizeImage = createCaptureImageNormalizer();
133142
133317
  const { chromium } = await import("playwright");
133143
133318
  let browser;
133144
133319
  try {
@@ -133170,10 +133345,12 @@ async function startCaptureSession(options2) {
133170
133345
  await context.addInitScript(buildFreezeInitScript());
133171
133346
  await context.addInitScript(installRenderProfileInPage);
133172
133347
  const page = await context.newPage();
133348
+ const images = await installCaptureImages(page, normalizeImage);
133173
133349
  const documentEvents = await context.newCDPSession(page);
133174
133350
  const worker = {
133175
133351
  context,
133176
133352
  page,
133353
+ images,
133177
133354
  contextMs: Date.now() - contextStart,
133178
133355
  contextClaimed: false,
133179
133356
  hasNavigated: false,
@@ -133184,6 +133361,7 @@ async function startCaptureSession(options2) {
133184
133361
  documentsLoaded: 0,
133185
133362
  navigationsInFlight: 0,
133186
133363
  async dispose() {
133364
+ await images.dispose();
133187
133365
  await documentEvents.detach().catch(() => {
133188
133366
  });
133189
133367
  await page.close().catch(() => {
@@ -133260,7 +133438,8 @@ async function startCaptureSession(options2) {
133260
133438
  try {
133261
133439
  const source = target.source.kind === "html" ? await openHeadlessHtmlSource(
133262
133440
  worker2.context,
133263
- target.source.filepath
133441
+ target.source.filepath,
133442
+ normalizeImage
133264
133443
  ) : {
133265
133444
  url: astroCaptureUrl(
133266
133445
  await (options2.getAppUrl?.() ?? Promise.reject(
@@ -133322,7 +133501,9 @@ async function startCaptureSession(options2) {
133322
133501
  `Astro storyboard failed: ${[...failures].join("; ")}`
133323
133502
  );
133324
133503
  timings.settleMs = Date.now() - settling;
133504
+ worker2.images.assertHealthy();
133325
133505
  const value = await work(worker2.page, "body");
133506
+ worker2.images.assertHealthy();
133326
133507
  source.assertResources();
133327
133508
  if (target.source.kind === "astro" && failures.size)
133328
133509
  throw new Error(
@@ -133487,7 +133668,9 @@ async function startCaptureSession(options2) {
133487
133668
  errorSelector: STORYBOARD_RENDER_ERROR_SELECTOR,
133488
133669
  messageAttribute: STORYBOARD_RENDER_ERROR_MESSAGE_ATTRIBUTE
133489
133670
  });
133671
+ worker.images.assertHealthy();
133490
133672
  const value = await work(page, selector);
133673
+ worker.images.assertHealthy();
133491
133674
  const renderErrors = await page.evaluate(readRenderErrorsInPage);
133492
133675
  if (renderErrors.length > 0) {
133493
133676
  throw new Error(
@@ -134225,7 +134408,7 @@ async function startDevserverSession(options2) {
134225
134408
  // ../canvas-capture-headless/src/enumerate.ts
134226
134409
  import { access as access19, readFile as readFile38 } from "fs/promises";
134227
134410
  import path78 from "path";
134228
- import { createHash as createHash9 } from "crypto";
134411
+ import { createHash as createHash10 } from "crypto";
134229
134412
 
134230
134413
  // ../canvas-capture-headless/src/ignore-mask.ts
134231
134414
  function ignoredStoryboardArea(regions, width, height) {
@@ -134330,7 +134513,7 @@ async function enumerateCanvasStoryboards(options2) {
134330
134513
  canvasPath: parsed.canvasPath ?? toPosixPath7(
134331
134514
  path78.relative(projectRoot, path78.dirname(filePath))
134332
134515
  ),
134333
- revision: createHash9("sha256").update(source).digest("hex")
134516
+ revision: createHash10("sha256").update(source).digest("hex")
134334
134517
  }
134335
134518
  } : storyboard.kind === "html" ? {
134336
134519
  source: {
@@ -138953,7 +139136,7 @@ function buildBackends(runtime, toolsets, workspace) {
138953
139136
  }
138954
139137
 
138955
139138
  // src/version.ts
138956
- var CLI_VERSION = "0.0.140-staging.1";
139139
+ var CLI_VERSION = "0.0.141-staging.1";
138957
139140
 
138958
139141
  // src/canvas-hooks.ts
138959
139142
  var import_pngjs4 = __toESM(require_png(), 1);
@@ -138963,7 +139146,7 @@ import { gzipSync } from "zlib";
138963
139146
  import { anyApi as anyApi10 } from "convex/server";
138964
139147
 
138965
139148
  // ../workspaces/git-worktree/worktree.ts
138966
- import { createHash as createHash10, randomUUID as randomUUID7 } from "crypto";
139149
+ import { createHash as createHash11, randomUUID as randomUUID7 } from "crypto";
138967
139150
  import fs7 from "fs/promises";
138968
139151
  import os4 from "os";
138969
139152
  import path83 from "path";
@@ -139255,39 +139438,10 @@ function nonInteractiveGitEnv(base = process.env) {
139255
139438
  };
139256
139439
  }
139257
139440
 
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
139441
  // ../workspaces/git-worktree/worktree.ts
139288
- var GIT_BINARY2 = ["git", "--no-optional-locks"];
139442
+ var GIT_BINARY = ["git", "--no-optional-locks"];
139289
139443
  function simpleGit2(repoPath) {
139290
- return repoPath ? simpleGit({ baseDir: repoPath, binary: GIT_BINARY2 }) : simpleGit({ binary: GIT_BINARY2 });
139444
+ return repoPath ? simpleGit({ baseDir: repoPath, binary: GIT_BINARY }) : simpleGit({ binary: GIT_BINARY });
139291
139445
  }
139292
139446
  async function getRemoteUrl2(repoPath, remoteName = "origin") {
139293
139447
  const git = simpleGit2(repoPath);
@@ -139372,11 +139526,13 @@ async function computeShareStatus(repoPath) {
139372
139526
  };
139373
139527
  }
139374
139528
  async function checkBranchOnRemote(repoPath, branch) {
139529
+ const git = simpleGit({
139530
+ baseDir: repoPath,
139531
+ binary: GIT_BINARY,
139532
+ config: [...NON_INTERACTIVE_GIT_CONFIG],
139533
+ timeout: { block: 15e3 }
139534
+ }).env(nonInteractiveGitEnv());
139375
139535
  try {
139376
- const git = await networkSimpleGit(repoPath, {
139377
- nonInteractive: true,
139378
- timeout: { block: 15e3 }
139379
- });
139380
139536
  const out = await git.raw(["ls-remote", "--heads", "origin", branch]);
139381
139537
  return out.trim().length > 0;
139382
139538
  } catch {
@@ -140219,4 +140375,4 @@ unpdf/dist/index.mjs:
140219
140375
  * @license Apache-2.0
140220
140376
  *)
140221
140377
  */
140222
- //# sourceMappingURL=serve-D2DPKEDS.js.map
140378
+ //# sourceMappingURL=serve-DFPNHVBV.js.map