@tempo-ai/mcp 0.0.133-staging.1 → 0.0.133

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-XDKVAKNU.js";
5
+ } from "./chunk-M6XWUZ3I.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-IE5HYP4X.js");
12
+ const { createTempoAggregate } = await import("./serve-MJ3Z2OAP.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-ZPF64F76.js.map
131
+ //# sourceMappingURL=call-FTE6VIKJ.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-IE5HYP4X.js");
125
+ const { runServe } = await import("./serve-MJ3Z2OAP.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-ZPF64F76.js");
140
+ const { runTools } = await import("./call-FTE6VIKJ.js");
141
141
  return await runTools(rest);
142
142
  }
143
143
  case "call": {
144
- const { runCall } = await import("./call-ZPF64F76.js");
144
+ const { runCall } = await import("./call-FTE6VIKJ.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-XDKVAKNU.js.map
167
+ //# sourceMappingURL=chunk-M6XWUZ3I.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-XDKVAKNU.js";
4
+ } from "./chunk-M6XWUZ3I.js";
5
5
  import "./chunk-4R6XIZCX.js";
6
6
  import "./chunk-JKT5N6IQ.js";
7
7
  export {
@@ -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) => {
@@ -135549,7 +135628,7 @@ function buildBackends(runtime, toolsets, workspace) {
135549
135628
  }
135550
135629
 
135551
135630
  // src/version.ts
135552
- var CLI_VERSION = "0.0.133-staging.1";
135631
+ var CLI_VERSION = "0.0.133";
135553
135632
 
135554
135633
  // src/canvas-hooks.ts
135555
135634
  var import_pngjs4 = __toESM(require_png(), 1);
@@ -136788,4 +136867,4 @@ unpdf/dist/index.mjs:
136788
136867
  * @license Apache-2.0
136789
136868
  *)
136790
136869
  */
136791
- //# sourceMappingURL=serve-IE5HYP4X.js.map
136870
+ //# sourceMappingURL=serve-MJ3Z2OAP.js.map