@tempo-ai/mcp 0.0.132 → 0.0.133-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.
@@ -18,7 +18,7 @@ import {
18
18
  resolveConvexUrl,
19
19
  resolveSignInWaitMs,
20
20
  storedAuthMatchesAccessToken
21
- } from "./chunk-24QSPUN7.js";
21
+ } from "./chunk-4R6XIZCX.js";
22
22
  import {
23
23
  __commonJS,
24
24
  __esm,
@@ -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.79",
88138
+ version: "0.0.81",
88139
88139
  publishConfig: {
88140
88140
  tag: "sdk-v2-latest"
88141
88141
  },
@@ -99317,6 +99317,9 @@ var TempoDevServer = class _TempoDevServer {
99317
99317
  // one. URL equality is not enough of a fence: a replacement process on the
99318
99318
  // same URL would inherit the old process's last failure.
99319
99319
  this.urlHealthProbeGeneration = 0;
99320
+ this.urlHealthProbeInFlight = null;
99321
+ this.hostConnectionListeners = /* @__PURE__ */ new Set();
99322
+ this.hostConnectionStatus = null;
99320
99323
  // Tempo-managed Next hosts never share the user's ordinary `.next` cache.
99321
99324
  // This starts at the stable Tempo-owned directory and only receives a suffix
99322
99325
  // after Next reports an observed lock conflict for that directory.
@@ -99404,6 +99407,15 @@ var TempoDevServer = class _TempoDevServer {
99404
99407
  // crash→restart cycles in one snapshot.
99405
99408
  this.RECENT_EXITS_LIMIT = 30;
99406
99409
  }
99410
+ publishHostConnection(status) {
99411
+ this.hostConnectionStatus = status;
99412
+ for (const listener of this.hostConnectionListeners) {
99413
+ try {
99414
+ listener(status);
99415
+ } catch {
99416
+ }
99417
+ }
99418
+ }
99407
99419
  static {
99408
99420
  this.installBarriers = /* @__PURE__ */ new Map();
99409
99421
  }
@@ -99875,6 +99887,16 @@ var TempoDevServer = class _TempoDevServer {
99875
99887
  hintListeners.push(listener);
99876
99888
  process2.onHint(listener);
99877
99889
  },
99890
+ onConnectionStatus(listener) {
99891
+ const current = (status) => {
99892
+ if (self2.activeHostProcess === process2) listener(status);
99893
+ };
99894
+ self2.hostConnectionListeners.add(current);
99895
+ if (self2.hostConnectionStatus) current(self2.hostConnectionStatus);
99896
+ return () => {
99897
+ self2.hostConnectionListeners.delete(current);
99898
+ };
99899
+ },
99878
99900
  onFlutterStatus(listener) {
99879
99901
  self2.flutterStatusListeners.add(listener);
99880
99902
  const status = self2.flutterDevServer?.status();
@@ -100994,6 +101016,7 @@ var TempoDevServer = class _TempoDevServer {
100994
101016
  }
100995
101017
  async dispose() {
100996
101018
  this.disposed = true;
101019
+ this.hostConnectionListeners.clear();
100997
101020
  this.managedReconciliation.dispose();
100998
101021
  this.flutterReconciliation.dispose();
100999
101022
  this.restartHostForFlutter = null;
@@ -101020,9 +101043,10 @@ var TempoDevServer = class _TempoDevServer {
101020
101043
  }
101021
101044
  // Periodic HTTP probe that re-asserts the dev server URL is reachable.
101022
101045
  // Foreground starts clear the URL through their child exit; daemonized
101023
- // starts have no live child after launch, so three consecutive failures are
101024
- // their terminal signal. A failed probe against a child we still hold alive
101025
- // never demotes — it only records urlUnreachableSince.
101046
+ // starts have no live child after launch. HTTP failures report connection
101047
+ // state to the workspace owner, which owns the shared restart budget.
101048
+ // Reachability alone never proves that an external runtime has exited.
101049
+ // A failed probe against a child we still hold alive never demotes it.
101026
101050
  startUrlHealthProbe(url) {
101027
101051
  this.stopUrlHealthProbe();
101028
101052
  if (this.disposed) return;
@@ -101043,20 +101067,41 @@ var TempoDevServer = class _TempoDevServer {
101043
101067
  }
101044
101068
  this.urlHealthProbeUrl = null;
101045
101069
  this.urlHealthProbeConsecutiveFailures = 0;
101070
+ this.hostConnectionStatus = null;
101046
101071
  this.urlHealthProbeGeneration += 1;
101047
101072
  }
101048
101073
  async runUrlHealthProbeTick() {
101049
101074
  const probedUrl = this.urlHealthProbeUrl;
101050
101075
  const generation = this.urlHealthProbeGeneration;
101051
101076
  if (!probedUrl || this.disposed) return;
101052
- const reachable = await probeUrlOnce(
101077
+ if (this.urlHealthProbeInFlight === generation) return;
101078
+ this.urlHealthProbeInFlight = generation;
101079
+ try {
101080
+ await this.performUrlHealthProbeTick(probedUrl, generation);
101081
+ } finally {
101082
+ if (this.urlHealthProbeInFlight === generation) {
101083
+ this.urlHealthProbeInFlight = null;
101084
+ }
101085
+ }
101086
+ }
101087
+ async performUrlHealthProbeTick(probedUrl, generation) {
101088
+ const observation = await probeHostHealth(
101053
101089
  probedUrl,
101054
101090
  1500,
101055
101091
  this.projectRoot,
101056
101092
  this.activeHostIdentity
101057
101093
  );
101058
101094
  if (this.urlHealthProbeGeneration !== generation) return;
101059
- if (reachable) {
101095
+ if (observation.outcome === "ok") {
101096
+ if (this.state.urlUnreachableSince !== null) {
101097
+ devLog("supervisor:url_probe_recovered", { url: probedUrl });
101098
+ }
101099
+ if (this.activeHostLivenessSource() === "probe") {
101100
+ this.publishHostConnection({
101101
+ state: "connected",
101102
+ unreachableSince: null
101103
+ });
101104
+ }
101060
101105
  this.state.urlUnreachableSince = null;
101061
101106
  this.urlHealthProbeConsecutiveFailures = 0;
101062
101107
  this.activeHostProcess?.clearSupervisorHint("host-unresponsive");
@@ -101087,11 +101132,17 @@ var TempoDevServer = class _TempoDevServer {
101087
101132
  requiredFailures: _TempoDevServer.URL_HEALTH_FAILURES_TO_DEMOTE,
101088
101133
  unreachableSince: this.state.urlUnreachableSince
101089
101134
  });
101090
- if (this.urlHealthProbeConsecutiveFailures < _TempoDevServer.URL_HEALTH_FAILURES_TO_DEMOTE) {
101135
+ const incompatible = this.activeHostIdentity !== null && (observation.outcome === "wrong-responder" || observation.outcome === "verified-incompatible");
101136
+ this.publishHostConnection({
101137
+ state: incompatible ? "incompatible" : "unreachable",
101138
+ unreachableSince: this.state.urlUnreachableSince
101139
+ });
101140
+ if (this.urlHealthProbeConsecutiveFailures < _TempoDevServer.URL_HEALTH_FAILURES_TO_DEMOTE)
101091
101141
  return;
101092
- }
101142
+ if (!incompatible) return;
101093
101143
  const activeProcess = this.activeHostProcess;
101094
101144
  activeProcess?.reportProbeBackedDeath();
101145
+ if (this.urlHealthProbeGeneration !== generation) return;
101095
101146
  if (this.state.devserverUrl === probedUrl) {
101096
101147
  this.state.devserverUrl = null;
101097
101148
  this.state.urlUnreachableSince = null;
@@ -103324,6 +103375,11 @@ function fetchBodyTextViaNodeHttp(url, timeoutMs) {
103324
103375
  return Promise.resolve(null);
103325
103376
  }
103326
103377
  return new Promise((resolve2) => {
103378
+ let deadline;
103379
+ const finish = (response) => {
103380
+ clearTimeout(deadline);
103381
+ resolve2(response);
103382
+ };
103327
103383
  const request = httpRequest2(
103328
103384
  parsed,
103329
103385
  { headers: { accept: "text/html" } },
@@ -103339,19 +103395,19 @@ function fetchBodyTextViaNodeHttp(url, timeoutMs) {
103339
103395
  });
103340
103396
  response.on(
103341
103397
  "end",
103342
- () => resolve2({
103398
+ () => finish({
103343
103399
  status: response.statusCode ?? 0,
103344
103400
  body: Buffer.concat(chunks).toString("utf-8")
103345
103401
  })
103346
103402
  );
103347
- response.on("error", () => resolve2(null));
103403
+ response.on("error", () => finish(null));
103348
103404
  }
103349
103405
  );
103350
- request.setTimeout(timeoutMs, () => {
103406
+ deadline = setTimeout(() => {
103351
103407
  request.destroy();
103352
- resolve2(null);
103353
- });
103354
- request.on("error", () => resolve2(null));
103408
+ finish(null);
103409
+ }, timeoutMs);
103410
+ request.on("error", () => finish(null));
103355
103411
  request.end();
103356
103412
  });
103357
103413
  }
@@ -103386,9 +103442,15 @@ async function fetchProbeResponse(url, timeoutMs) {
103386
103442
  fetchBodyTextViaNodeHttp,
103387
103443
  ...extraProbeTransports
103388
103444
  ];
103389
- return firstNonNullResponse(
103390
- transports.map((transport) => transport(url, timeoutMs).catch(() => null))
103391
- );
103445
+ return withTimeout(
103446
+ firstNonNullResponse(
103447
+ transports.map(
103448
+ (transport) => transport(url, timeoutMs).catch(() => null)
103449
+ )
103450
+ ),
103451
+ timeoutMs,
103452
+ "Host probe response timeout"
103453
+ ).catch(() => null);
103392
103454
  }
103393
103455
  async function probeTempoHost(url, timeoutMs, expectedProjectRoot, expectedIdentity) {
103394
103456
  const response = await fetchProbeResponse(url, timeoutMs);
@@ -103407,7 +103469,7 @@ async function probeTempoHost(url, timeoutMs, expectedProjectRoot, expectedIdent
103407
103469
  }
103408
103470
  if (!expectedIdentity && advertisedRootMismatch) return "wrong-responder";
103409
103471
  if (!expectedIdentity && hasLegacyMarker) return "ok";
103410
- const identity2 = await probeTempoIdentityEndpoint(
103472
+ const { outcome: identity2 } = await probeTempoIdentityEndpoint(
103411
103473
  url,
103412
103474
  timeoutMs,
103413
103475
  expectedIdentity
@@ -103423,45 +103485,45 @@ async function probeTempoHost(url, timeoutMs, expectedProjectRoot, expectedIdent
103423
103485
  }
103424
103486
  return body !== null ? "wrong-responder" : identity2;
103425
103487
  }
103426
- async function fetchIsTempoHost(url, timeoutMs, expectedProjectRoot, expectedIdentity) {
103427
- return await probeTempoHost(
103428
- url,
103429
- timeoutMs,
103430
- expectedProjectRoot,
103431
- expectedIdentity
103432
- ) === "ok";
103433
- }
103434
103488
  async function probeTempoIdentityEndpoint(tempoHostUrl, timeoutMs, expectedIdentity) {
103489
+ const startedAt = performance.now();
103490
+ let status = null;
103491
+ const observed = (outcome) => ({
103492
+ outcome,
103493
+ status,
103494
+ elapsedMs: Math.round(performance.now() - startedAt)
103495
+ });
103435
103496
  let identityUrl;
103436
103497
  try {
103437
103498
  identityUrl = `${new URL(tempoHostUrl).origin}/__tempo/identity`;
103438
103499
  } catch {
103439
- return "unreachable";
103500
+ return observed("unreachable");
103440
103501
  }
103441
103502
  const response = await fetchProbeResponse(identityUrl, timeoutMs);
103503
+ status = response?.status ?? null;
103442
103504
  if (response === null) {
103443
- return "unreachable";
103505
+ return observed("unreachable");
103444
103506
  }
103445
103507
  if (response.status < 200 || response.status >= 300) {
103446
- return "identity-incompatible";
103508
+ return observed("identity-incompatible");
103447
103509
  }
103448
103510
  let parsed;
103449
103511
  try {
103450
103512
  parsed = JSON.parse(response.body);
103451
103513
  } catch {
103452
- return "identity-incompatible";
103514
+ return observed("identity-incompatible");
103453
103515
  }
103454
103516
  if (parsed.tempoHost !== true) {
103455
- return "identity-incompatible";
103517
+ return observed("identity-incompatible");
103456
103518
  }
103457
- if (!expectedIdentity) return "ok";
103519
+ if (!expectedIdentity) return observed("ok");
103458
103520
  if (parsed.workspaceNonce !== expectedIdentity.workspaceNonce) {
103459
- return "wrong-responder";
103521
+ return observed("wrong-responder");
103460
103522
  }
103461
103523
  if (typeof parsed.contractVersion !== "number" || parsed.contractVersion < 1 || parsed.pluginActive !== true || parsed.framework !== expectedIdentity.framework || typeof parsed.sdkVersion !== "string" || !tempoSdkVersionSatisfiesCanvasHost(parsed.sdkVersion, parsed.sdkChannel)) {
103462
- return "verified-incompatible";
103524
+ return observed("verified-incompatible");
103463
103525
  }
103464
- return "ok";
103526
+ return observed("ok");
103465
103527
  }
103466
103528
  async function waitForHttpReachable(url, timeoutMs, expectedProjectRoot, expectedIdentity) {
103467
103529
  const startedAt = Date.now();
@@ -103566,12 +103628,29 @@ async function waitForHttpUnreachable(url, timeoutMs) {
103566
103628
  return false;
103567
103629
  }
103568
103630
  async function probeUrlOnce(url, timeoutMs, expectedProjectRoot, expectedIdentity) {
103569
- return fetchIsTempoHost(
103631
+ return (await probeHostHealth(
103570
103632
  url,
103571
103633
  timeoutMs,
103572
103634
  expectedProjectRoot,
103573
103635
  expectedIdentity
103574
- );
103636
+ )).outcome === "ok";
103637
+ }
103638
+ async function probeHostHealth(url, timeoutMs, expectedProjectRoot, expectedIdentity) {
103639
+ const startedAt = performance.now();
103640
+ const observation = expectedIdentity ? await probeTempoIdentityEndpoint(url, timeoutMs, expectedIdentity) : {
103641
+ outcome: await probeTempoHost(url, timeoutMs, expectedProjectRoot),
103642
+ status: null,
103643
+ elapsedMs: Math.round(performance.now() - startedAt)
103644
+ };
103645
+ if (observation.outcome !== "ok") {
103646
+ devLog("supervisor:url_probe_failed", {
103647
+ url,
103648
+ probe: expectedIdentity ? "identity" : "document",
103649
+ timeoutMs,
103650
+ ...observation
103651
+ });
103652
+ }
103653
+ return observation;
103575
103654
  }
103576
103655
  async function withTimeout(promise, timeoutMs, message) {
103577
103656
  return await new Promise((resolve2, reject2) => {
@@ -110823,12 +110902,13 @@ config.resolver.alias = {
110823
110902
  // react-dom are the renderer/runtime pair whose duplication causes "Invalid
110824
110903
  // hook call" \u2014 forcing them through resolveRequest (which runs before
110825
110904
  // hierarchical resolution) is the only reliable singleton guarantee once
110826
- // hierarchical lookup is on. react-native / react-native-web are deliberately
110827
- // NOT forced here: on web, Expo's own resolver swaps react-native ->
110828
- // react-native-web by platform, and intercepting it would break that swap.
110905
+ // hierarchical lookup is on. NativeWind also keys its interop registry by
110906
+ // component identity: its react-native imports and Babel's direct
110907
+ // react-native-web subpath imports must resolve to the SAME web components.
110829
110908
  const forcedReactSingletons = {
110830
110909
  react: path.join(sidecarNodeModules, "react"),
110831
110910
  "react-dom": path.join(sidecarNodeModules, "react-dom"),
110911
+ "react-native-web": path.join(sidecarNodeModules, "react-native-web"),
110832
110912
  };
110833
110913
  const tempoSdkRuntimeModules = {
110834
110914
  "tempo-sdk/canvas": path.join(sidecarNodeModules, "tempo-sdk", "dist", "canvas", "index.js"),
@@ -110863,13 +110943,15 @@ const tempoWebShims = ${webShimLiteral};
110863
110943
  // resolve through package.json exports.
110864
110944
  // 3. Web shims (web platform only) for native-only modules.
110865
110945
  // 4. User @/ tsconfig aliases (canvas imports of app source).
110866
- // 5. Expo's default resolver (owns the web react-native -> react-native-web
110867
- // swap).
110946
+ // 5. Expo's default resolver (including native-platform react-native).
110868
110947
  const baseResolveRequest = userMetroResolveRequest || config.resolver.resolveRequest;
110869
110948
  config.resolver.resolveRequest = (context, moduleName, platform) => {
110870
110949
  if (isStorybookModule(moduleName)) {
110871
110950
  return { type: "sourceFile", filePath: tempoStorybookStub };
110872
110951
  }
110952
+ if (platform === "web" && moduleName === "react-native") {
110953
+ return context.resolveRequest(context, forcedReactSingletons["react-native-web"], platform);
110954
+ }
110873
110955
  for (const pkg of Object.keys(forcedReactSingletons)) {
110874
110956
  const pkgRoot = forcedReactSingletons[pkg];
110875
110957
  if (moduleName === pkg) {
@@ -110975,9 +111057,13 @@ config.server = {
110975
111057
  // so without a stamp bump a resolver change reshuffles module IDs while stale
110976
111058
  // cached chunks still reference the old IDs \u2014 surfacing as "Requiring unknown
110977
111059
  // module <n>". Bumping the stamp forces a clean rebuild.
111060
+ // The Babel annotations also embed absolute source paths and the sidecar root.
111061
+ // Metro otherwise keys transforms by relative path, allowing identical files
111062
+ // in different projects/worktrees to reuse another project's source identity.
110978
111063
  config.cacheVersion = [
110979
111064
  config.cacheVersion,
110980
- "tempo-metrocfg-v13",
111065
+ "tempo-metrocfg-v15",
111066
+ projectRoot,
110981
111067
  \`tempo-\${process.env.TEMPO === "true" ? "on" : "off"}\`,
110982
111068
  ]
110983
111069
  .filter(Boolean)
@@ -119278,6 +119364,9 @@ function createTsWorkspaceService(descriptor) {
119278
119364
  };
119279
119365
  }
119280
119366
 
119367
+ // ../../modules/typescript/children-forwarding.ts
119368
+ import { createHash as createHash7 } from "crypto";
119369
+
119281
119370
  // ../canvas-pages/pages/validate-page.ts
119282
119371
  import ts6 from "typescript";
119283
119372
 
@@ -120868,7 +120957,7 @@ function buildDirectRenderIdleUrl(hostUrl) {
120868
120957
  }
120869
120958
 
120870
120959
  // ../canvas-capture-headless/src/capture.ts
120871
- import { createHash as createHash7 } from "crypto";
120960
+ import { createHash as createHash8 } from "crypto";
120872
120961
  var import_pngjs = __toESM(require_png(), 1);
120873
120962
 
120874
120963
  // ../../modules/frame-pool/capture-determinism.ts
@@ -130516,7 +130605,7 @@ function buildDirectRenderUrl2(hostUrl, target) {
130516
130605
  });
130517
130606
  }
130518
130607
  function sha256Hex(bytes) {
130519
- return createHash7("sha256").update(bytes).digest("hex");
130608
+ return createHash8("sha256").update(bytes).digest("hex");
130520
130609
  }
130521
130610
  function looksBlank(pngBytes) {
130522
130611
  let png;
@@ -131705,7 +131794,7 @@ async function startDevserverSession(options2) {
131705
131794
  // ../canvas-capture-headless/src/enumerate.ts
131706
131795
  import { access as access19, readFile as readFile38 } from "fs/promises";
131707
131796
  import path75 from "path";
131708
- import { createHash as createHash8 } from "crypto";
131797
+ import { createHash as createHash9 } from "crypto";
131709
131798
 
131710
131799
  // ../canvas-capture-headless/src/ignore-mask.ts
131711
131800
  function ignoredStoryboardArea(regions, width, height) {
@@ -131810,7 +131899,7 @@ async function enumerateCanvasStoryboards(options2) {
131810
131899
  canvasPath: parsed.canvasPath ?? toPosixPath7(
131811
131900
  path75.relative(projectRoot, path75.dirname(filePath))
131812
131901
  ),
131813
- revision: createHash8("sha256").update(source).digest("hex")
131902
+ revision: createHash9("sha256").update(source).digest("hex")
131814
131903
  }
131815
131904
  } : storyboard.kind === "html" ? {
131816
131905
  source: {
@@ -135539,7 +135628,7 @@ function buildBackends(runtime, toolsets, workspace) {
135539
135628
  }
135540
135629
 
135541
135630
  // src/version.ts
135542
- var CLI_VERSION = "0.0.132";
135631
+ var CLI_VERSION = "0.0.133-staging.2";
135543
135632
 
135544
135633
  // src/canvas-hooks.ts
135545
135634
  var import_pngjs4 = __toESM(require_png(), 1);
@@ -135549,7 +135638,7 @@ import { gzipSync } from "zlib";
135549
135638
  import { anyApi as anyApi10 } from "convex/server";
135550
135639
 
135551
135640
  // ../workspaces/git-worktree/worktree.ts
135552
- import { createHash as createHash9, randomUUID as randomUUID7 } from "crypto";
135641
+ import { createHash as createHash10, randomUUID as randomUUID7 } from "crypto";
135553
135642
  import fs7 from "fs/promises";
135554
135643
  import os4 from "os";
135555
135644
  import path80 from "path";
@@ -136778,4 +136867,4 @@ unpdf/dist/index.mjs:
136778
136867
  * @license Apache-2.0
136779
136868
  *)
136780
136869
  */
136781
- //# sourceMappingURL=serve-OZVFLBAM.js.map
136870
+ //# sourceMappingURL=serve-VBVYI6O7.js.map