@tempo-ai/mcp 0.0.131 → 0.0.132-staging.2

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-YC74KIHQ.js";
5
+ } from "./chunk-F2MVJAIZ.js";
6
6
  import "./chunk-24QSPUN7.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-WFVSDX7G.js");
12
+ const { createTempoAggregate } = await import("./serve-N6QYESHT.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-V2L7YBWT.js.map
131
+ //# sourceMappingURL=call-KDVWVZP3.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-WFVSDX7G.js");
125
+ const { runServe } = await import("./serve-N6QYESHT.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-V2L7YBWT.js");
140
+ const { runTools } = await import("./call-KDVWVZP3.js");
141
141
  return await runTools(rest);
142
142
  }
143
143
  case "call": {
144
- const { runCall } = await import("./call-V2L7YBWT.js");
144
+ const { runCall } = await import("./call-KDVWVZP3.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-YC74KIHQ.js.map
167
+ //# sourceMappingURL=chunk-F2MVJAIZ.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-YC74KIHQ.js";
4
+ } from "./chunk-F2MVJAIZ.js";
5
5
  import "./chunk-24QSPUN7.js";
6
6
  import "./chunk-JKT5N6IQ.js";
7
7
  export {
@@ -88135,7 +88135,7 @@ var MissingRootDepsError = class extends TempoDevServerError {
88135
88135
  // ../tempo-sdk/package.json
88136
88136
  var package_default = {
88137
88137
  name: "tempo-sdk",
88138
- version: "0.0.76",
88138
+ version: "0.0.79",
88139
88139
  publishConfig: {
88140
88140
  tag: "sdk-v2-latest"
88141
88141
  },
@@ -89164,7 +89164,7 @@ function probeNodeVersion(env2) {
89164
89164
  output += String(chunk2);
89165
89165
  });
89166
89166
  child.on("error", () => resolve2(null));
89167
- child.on("exit", (code) => {
89167
+ child.on("close", (code) => {
89168
89168
  resolve2(code === 0 ? output.trim() || null : null);
89169
89169
  });
89170
89170
  });
@@ -96334,7 +96334,7 @@ var FlutterDevServer = class {
96334
96334
  this.resolutionSignature = "";
96335
96335
  this.sourceDebounceTimer = null;
96336
96336
  this.pendingSourcePaths = /* @__PURE__ */ new Set();
96337
- this.sourceSyncRunning = false;
96337
+ this.sourceSyncPromise = null;
96338
96338
  // Reloads run one at a time; the daemon answers concurrent restarts poorly.
96339
96339
  this.reloadChain = Promise.resolve();
96340
96340
  // One listener on the public port for this server's whole lifetime: no
@@ -96434,6 +96434,7 @@ var FlutterDevServer = class {
96434
96434
  this.cancelPendingSourceSync();
96435
96435
  await this.gate.close();
96436
96436
  await this.daemon?.stop(this.timing.stopGraceMs, this.timing.killGraceMs);
96437
+ await this.sourceSyncPromise;
96437
96438
  this.setStatus({ state: "stopped" });
96438
96439
  }
96439
96440
  /** Synchronous teardown for process-exit paths only. */
@@ -96818,6 +96819,7 @@ var FlutterDevServer = class {
96818
96819
  );
96819
96820
  }
96820
96821
  sourceFilesChanged(relativePaths) {
96822
+ if (this.stopRequested) return;
96821
96823
  for (const relativePath of relativePaths) {
96822
96824
  this.pendingSourcePaths.add(relativePath);
96823
96825
  }
@@ -96838,35 +96840,43 @@ var FlutterDevServer = class {
96838
96840
  * relaunch, which consumes the batch. Starting: leave them pending; the
96839
96841
  * transition to ready flushes again.
96840
96842
  */
96841
- async flushSourceChanges() {
96842
- if (this.sourceSyncRunning) return;
96843
- this.sourceSyncRunning = true;
96844
- try {
96845
- while (this.pendingSourcePaths.size > 0 && !this.stopRequested) {
96846
- const state = this.currentStatus.state;
96847
- if (state === "failed") {
96848
- const changed2 = [...this.pendingSourcePaths];
96849
- this.pendingSourcePaths.clear();
96850
- const stamps = await this.readSourceStamps(changed2);
96851
- const graph = await readPackageGraphFingerprint(
96852
- this.sourceDirectories(),
96853
- this.options.projectRoot
96854
- );
96855
- if (graph === this.launchedPackageGraph && changed2.every(
96856
- (file) => (this.attemptedSourceStamps.get(file) ?? "missing") === stamps.get(file)
96857
- ))
96858
- continue;
96859
- await this.relaunch("source-change-after-failure");
96860
- if (this.status().state === "ready") this.rememberCompiled(stamps);
96861
- continue;
96862
- }
96863
- if (state !== "ready") break;
96864
- const changed = [...this.pendingSourcePaths];
96843
+ flushSourceChanges() {
96844
+ if (this.sourceSyncPromise) return this.sourceSyncPromise;
96845
+ const pending = this.performSourceSync();
96846
+ this.sourceSyncPromise = pending;
96847
+ void pending.then(
96848
+ () => {
96849
+ if (this.sourceSyncPromise === pending) this.sourceSyncPromise = null;
96850
+ },
96851
+ () => {
96852
+ if (this.sourceSyncPromise === pending) this.sourceSyncPromise = null;
96853
+ }
96854
+ );
96855
+ return pending;
96856
+ }
96857
+ async performSourceSync() {
96858
+ while (this.pendingSourcePaths.size > 0 && !this.stopRequested) {
96859
+ const state = this.currentStatus.state;
96860
+ if (state === "failed") {
96861
+ const changed2 = [...this.pendingSourcePaths];
96865
96862
  this.pendingSourcePaths.clear();
96866
- await this.applySourceChanges(changed);
96863
+ const stamps = await this.readSourceStamps(changed2);
96864
+ const graph = await readPackageGraphFingerprint(
96865
+ this.sourceDirectories(),
96866
+ this.options.projectRoot
96867
+ );
96868
+ if (graph === this.launchedPackageGraph && changed2.every(
96869
+ (file) => (this.attemptedSourceStamps.get(file) ?? "missing") === stamps.get(file)
96870
+ ))
96871
+ continue;
96872
+ await this.relaunch("source-change-after-failure");
96873
+ if (this.status().state === "ready") this.rememberCompiled(stamps);
96874
+ continue;
96867
96875
  }
96868
- } finally {
96869
- this.sourceSyncRunning = false;
96876
+ if (state !== "ready") break;
96877
+ const changed = [...this.pendingSourcePaths];
96878
+ this.pendingSourcePaths.clear();
96879
+ await this.applySourceChanges(changed);
96870
96880
  }
96871
96881
  }
96872
96882
  /** Spec §4.4 source-change policy. */
@@ -96952,7 +96962,7 @@ var FlutterDevServer = class {
96952
96962
  const startedAt = Date.now();
96953
96963
  const daemon = this.daemon;
96954
96964
  const appId = daemon?.appId ?? null;
96955
- if (!daemon || !appId || this.currentStatus.state !== "ready") {
96965
+ if (this.stopRequested || !daemon || !appId || this.currentStatus.state !== "ready") {
96956
96966
  return this.recordReload({
96957
96967
  kind,
96958
96968
  ok: false,
@@ -99626,9 +99636,14 @@ var TempoDevServer = class _TempoDevServer {
99626
99636
  upgradeError: sdkUpgradeResult.error ?? null,
99627
99637
  projectNodeHint: getProjectNodeUnsatisfiedHint(this.commandCwd)
99628
99638
  } : null;
99639
+ const attemptedPorts = /* @__PURE__ */ new Set();
99629
99640
  const spawnProcess = async (attempt) => {
99630
99641
  throwIfLaunchAborted(options2?.signal);
99631
- const startPlan = await this.buildStartCommandForAttempt(attempt);
99642
+ const startPlan = await this.buildStartCommandForAttempt(
99643
+ attempt,
99644
+ attemptedPorts
99645
+ );
99646
+ attemptedPorts.add(startPlan.injectedPort);
99632
99647
  throwIfLaunchAborted(options2?.signal);
99633
99648
  const expectedIdentity = await this.readExpectedHostIdentity();
99634
99649
  const stopCommand = this.config.scripts.stop ? substituteAppPort(this.config.scripts.stop, startPlan.injectedPort) : null;
@@ -100331,13 +100346,13 @@ var TempoDevServer = class _TempoDevServer {
100331
100346
  });
100332
100347
  }
100333
100348
  }
100334
- async buildStartCommandForAttempt(attempt) {
100349
+ async buildStartCommandForAttempt(attempt, attemptedPorts) {
100335
100350
  const configuredPort = portFromConfiguredTempoHostUrl(
100336
100351
  this.config.tempoHostUrl
100337
100352
  );
100338
100353
  const needsLegacyPortInjection = !this.config.scripts.start.includes("${PORT}") && canInjectDevServerPort(this.config.scripts.start);
100339
100354
  const framework = needsLegacyPortInjection ? await this.resolveStartFramework() : "vite";
100340
- const port = configuredPort ?? await getAvailableLocalPort();
100355
+ const port = configuredPort ?? await getAvailableLocalPort(attemptedPorts);
100341
100356
  const plan = buildManagedStartPlan({
100342
100357
  command: this.config.scripts.start,
100343
100358
  tempoHostUrl: this.config.tempoHostUrl,
@@ -102189,7 +102204,7 @@ async function resolveProjectNodeOverrideForDir(cwd) {
102189
102204
  projectNodeOverrideCache.set(key, resolution);
102190
102205
  return await resolution;
102191
102206
  }
102192
- async function getAvailableLocalPort() {
102207
+ async function getAvailableLocalPort(excludedPorts = /* @__PURE__ */ new Set()) {
102193
102208
  return await new Promise((resolve2, reject2) => {
102194
102209
  const server = createServer2();
102195
102210
  server.unref();
@@ -102197,6 +102212,13 @@ async function getAvailableLocalPort() {
102197
102212
  server.listen(0, "127.0.0.1", () => {
102198
102213
  const address = server.address();
102199
102214
  const port = address && typeof address === "object" ? address.port : null;
102215
+ if (port && excludedPorts.has(port)) {
102216
+ void getAvailableLocalPort(excludedPorts).then(
102217
+ (next) => server.close(() => resolve2(next)),
102218
+ (error) => server.close(() => reject2(error))
102219
+ );
102220
+ return;
102221
+ }
102200
102222
  server.close(() => {
102201
102223
  if (port) {
102202
102224
  resolve2(port);
@@ -120798,6 +120820,8 @@ var RESPONSIVE_CAPTURE_VIEWPORT = {
120798
120820
  };
120799
120821
  var STORYBOARD_RENDER_ID_ATTRIBUTE = "data-tempo-storyboard-render-id";
120800
120822
  var STORYBOARD_PENDING_SELECTOR = `[${PROJECTION_PENDING_ATTRIBUTE}]`;
120823
+ var STORYBOARD_RENDER_ERROR_SELECTOR = '[data-render-error="true"]';
120824
+ var STORYBOARD_RENDER_ERROR_MESSAGE_ATTRIBUTE = "data-render-error-message";
120801
120825
  function buildCanvasStoryboardRenderId(canvasPath, storyboardId) {
120802
120826
  return `canvas:${encodeURIComponent(canvasPath.trim())}#storyboard:${encodeURIComponent(
120803
120827
  storyboardId.trim()
@@ -120893,7 +120917,6 @@ var FREEZE_MOTION_CSS = `
120893
120917
  *, *::before, *::after {
120894
120918
  animation-duration: 0s !important;
120895
120919
  animation-delay: 0s !important;
120896
- animation-iteration-count: 1 !important;
120897
120920
  transition-duration: 0s !important;
120898
120921
  transition-delay: 0s !important;
120899
120922
  scroll-behavior: auto !important;
@@ -130171,6 +130194,41 @@ function assessPageStylesInPage(selector) {
130171
130194
  inlineStyledElementCount: scope.querySelectorAll("[style]").length
130172
130195
  };
130173
130196
  }
130197
+ function watchRenderErrorsInPage(input) {
130198
+ const target = document.querySelector(input.selector);
130199
+ const messages = [];
130200
+ const record = () => {
130201
+ if (!target) return;
130202
+ for (const element of Array.from(
130203
+ target.querySelectorAll(input.errorSelector)
130204
+ )) {
130205
+ const message = element.getAttribute(input.messageAttribute) || "unknown error";
130206
+ if (!messages.includes(message)) messages.push(message);
130207
+ }
130208
+ };
130209
+ record();
130210
+ const observer = new MutationObserver(record);
130211
+ if (target) {
130212
+ observer.observe(target, {
130213
+ subtree: true,
130214
+ childList: true,
130215
+ attributes: true,
130216
+ attributeFilter: [input.messageAttribute]
130217
+ });
130218
+ }
130219
+ window.__tempoCaptureRenderErrors = () => {
130220
+ observer.takeRecords();
130221
+ observer.disconnect();
130222
+ record();
130223
+ return messages;
130224
+ };
130225
+ }
130226
+ function readRenderErrorsInPage() {
130227
+ const captureWindow = window;
130228
+ const stop = captureWindow.__tempoCaptureRenderErrors;
130229
+ delete captureWindow.__tempoCaptureRenderErrors;
130230
+ return stop ? stop() : [];
130231
+ }
130174
130232
  async function inlinePortableHtmlInPage(input) {
130175
130233
  const warnings = [];
130176
130234
  const warn = (message) => {
@@ -130904,7 +130962,18 @@ async function startCaptureSession(options2) {
130904
130962
  profile.longTaskCount,
130905
130963
  "count"
130906
130964
  );
130965
+ await page.evaluate(watchRenderErrorsInPage, {
130966
+ selector,
130967
+ errorSelector: STORYBOARD_RENDER_ERROR_SELECTOR,
130968
+ messageAttribute: STORYBOARD_RENDER_ERROR_MESSAGE_ATTRIBUTE
130969
+ });
130907
130970
  const value = await work(page, selector);
130971
+ const renderErrors = await page.evaluate(readRenderErrorsInPage);
130972
+ if (renderErrors.length > 0) {
130973
+ throw new Error(
130974
+ `storyboard rendered its error boundary: ${renderErrors.join("; ")}`
130975
+ );
130976
+ }
130908
130977
  return { value, navigated: navigatedSinceStart() };
130909
130978
  } catch (error) {
130910
130979
  markNavigated(error, navigatedSinceStart());
@@ -135470,7 +135539,7 @@ function buildBackends(runtime, toolsets, workspace) {
135470
135539
  }
135471
135540
 
135472
135541
  // src/version.ts
135473
- var CLI_VERSION = "0.0.131";
135542
+ var CLI_VERSION = "0.0.132-staging.2";
135474
135543
 
135475
135544
  // src/canvas-hooks.ts
135476
135545
  var import_pngjs4 = __toESM(require_png(), 1);
@@ -136709,4 +136778,4 @@ unpdf/dist/index.mjs:
136709
136778
  * @license Apache-2.0
136710
136779
  *)
136711
136780
  */
136712
- //# sourceMappingURL=serve-WFVSDX7G.js.map
136781
+ //# sourceMappingURL=serve-N6QYESHT.js.map