@tempo-ai/mcp 0.0.114 → 0.0.115

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-BZ75OCOP.js";
5
+ } from "./chunk-AWEC6T2J.js";
6
6
  import "./chunk-2P3T5CJG.js";
7
7
  import "./chunk-WRI3HTCJ.js";
8
8
 
@@ -9,7 +9,7 @@ import "./chunk-WRI3HTCJ.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-3ZUJJ3NU.js");
12
+ const { createTempoAggregate } = await import("./serve-55E32OUF.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-6LLLWLZQ.js.map
131
+ //# sourceMappingURL=call-XISZNFTQ.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-3ZUJJ3NU.js");
125
+ const { runServe } = await import("./serve-55E32OUF.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-6LLLWLZQ.js");
140
+ const { runTools } = await import("./call-XISZNFTQ.js");
141
141
  return await runTools(rest);
142
142
  }
143
143
  case "call": {
144
- const { runCall } = await import("./call-6LLLWLZQ.js");
144
+ const { runCall } = await import("./call-XISZNFTQ.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-BZ75OCOP.js.map
167
+ //# sourceMappingURL=chunk-AWEC6T2J.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-BZ75OCOP.js";
4
+ } from "./chunk-AWEC6T2J.js";
5
5
  import "./chunk-2P3T5CJG.js";
6
6
  import "./chunk-WRI3HTCJ.js";
7
7
  export {
@@ -25736,18 +25736,23 @@ function runAbortableShellCommand(options) {
25736
25736
  exitCode: null,
25737
25737
  stdout: "",
25738
25738
  stderr: "",
25739
+ output: "",
25739
25740
  aborted: true,
25741
+ timedOut: false,
25740
25742
  spawnError: null
25741
25743
  });
25742
25744
  }
25743
25745
  return new Promise((resolve2) => {
25744
25746
  let stdout = "";
25745
25747
  let stderr = "";
25748
+ let output = "";
25746
25749
  let aborted = false;
25750
+ let timedOut = false;
25747
25751
  let settled = false;
25748
25752
  let terminationComplete = true;
25749
25753
  let closeResult;
25750
25754
  let forceTimer = null;
25755
+ let idleTimer = null;
25751
25756
  let child;
25752
25757
  try {
25753
25758
  child = spawn(options.command, {
@@ -25763,7 +25768,9 @@ function runAbortableShellCommand(options) {
25763
25768
  exitCode: null,
25764
25769
  stdout,
25765
25770
  stderr,
25771
+ output,
25766
25772
  aborted: false,
25773
+ timedOut: false,
25767
25774
  spawnError: error instanceof Error ? error : new Error(String(error))
25768
25775
  });
25769
25776
  return;
@@ -25773,18 +25780,23 @@ function runAbortableShellCommand(options) {
25773
25780
  if (settled || closeResult === void 0 || !terminationComplete) return;
25774
25781
  settled = true;
25775
25782
  if (forceTimer) clearTimeout(forceTimer);
25783
+ if (idleTimer) clearTimeout(idleTimer);
25776
25784
  options.signal?.removeEventListener("abort", onAbort);
25777
25785
  resolve2({
25778
25786
  exitCode: closeResult,
25779
25787
  stdout,
25780
25788
  stderr,
25789
+ output,
25781
25790
  aborted,
25791
+ timedOut,
25782
25792
  spawnError
25783
25793
  });
25784
25794
  };
25785
- const terminateTree = () => {
25786
- if (aborted) return;
25787
- aborted = true;
25795
+ const terminateTree = (reason) => {
25796
+ if (aborted || timedOut || closeResult !== void 0) return;
25797
+ aborted = reason === "abort";
25798
+ timedOut = reason === "timeout";
25799
+ if (idleTimer) clearTimeout(idleTimer);
25788
25800
  terminationComplete = false;
25789
25801
  const pid = child.pid;
25790
25802
  if (pid != null && process.platform !== "win32") {
@@ -25835,19 +25847,41 @@ function runAbortableShellCommand(options) {
25835
25847
  terminationComplete = true;
25836
25848
  }
25837
25849
  };
25838
- const onAbort = () => terminateTree();
25850
+ const onAbort = () => terminateTree("abort");
25839
25851
  options.signal?.addEventListener("abort", onAbort, { once: true });
25840
- if (options.signal?.aborted) terminateTree();
25852
+ if (options.signal?.aborted) onAbort();
25853
+ const resetIdleTimer = () => {
25854
+ if (idleTimer) clearTimeout(idleTimer);
25855
+ if (aborted || timedOut || closeResult !== void 0 || !options.idleTimeoutMs)
25856
+ return;
25857
+ idleTimer = setTimeout(
25858
+ () => terminateTree("timeout"),
25859
+ options.idleTimeoutMs
25860
+ );
25861
+ };
25862
+ const forwardOutput = (chunk) => {
25863
+ if (settled || String(chunk).length === 0) return;
25864
+ output = appendTail(output, chunk, outputLimit);
25865
+ resetIdleTimer();
25866
+ try {
25867
+ options.onOutput?.(String(chunk));
25868
+ } catch {
25869
+ }
25870
+ };
25871
+ resetIdleTimer();
25841
25872
  child.stdout?.on("data", (chunk) => {
25842
25873
  stdout = appendTail(stdout, chunk, outputLimit);
25874
+ forwardOutput(chunk);
25843
25875
  });
25844
25876
  child.stderr?.on("data", (chunk) => {
25845
25877
  stderr = appendTail(stderr, chunk, outputLimit);
25878
+ forwardOutput(chunk);
25846
25879
  });
25847
25880
  child.on("error", (error) => {
25848
25881
  spawnError = error;
25849
25882
  });
25850
25883
  child.on("close", (exitCode) => {
25884
+ if (idleTimer) clearTimeout(idleTimer);
25851
25885
  closeResult = exitCode;
25852
25886
  finishIfComplete();
25853
25887
  });
@@ -29109,6 +29143,34 @@ async function parcelEventToFileEvent(event, rootInfo) {
29109
29143
  };
29110
29144
  }
29111
29145
 
29146
+ // ../tempo-devserver/install-feedback.ts
29147
+ var INSTALL_IDLE_TIMEOUT_MS = 5 * 6e4;
29148
+ var CONNECTION_CODE = /\b(?:ETIMEDOUT|ESOCKETTIMEDOUT|ECONNRESET|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|ENETUNREACH|EHOSTUNREACH|ERR_SOCKET_TIMEOUT|UND_ERR_CONNECT_TIMEOUT|UND_ERR_SOCKET)\b/;
29149
+ var CERTIFICATE_CODE = /\b(?:CERT_HAS_EXPIRED|CERT_NOT_YET_VALID|SELF_SIGNED_CERT_IN_CHAIN|DEPTH_ZERO_SELF_SIGNED_CERT|UNABLE_TO_VERIFY_LEAF_SIGNATURE|UNABLE_TO_GET_ISSUER_CERT_LOCALLY|ERR_TLS_CERT_ALTNAME_INVALID)\b/;
29150
+ function describeInstallConnectivity(output) {
29151
+ const relevant = output.replace(/\u001b\[[0-9;]*m/g, "").split(/\r?\n/).filter((line) => !/\b(?:warn|warning)\s+deprecated\b/i.test(line)).join("\n");
29152
+ const terminal = [
29153
+ ...relevant.matchAll(/npm (?:error|ERR!) code\s+(\w+)|\bERR_PNPM_(\w+)/g)
29154
+ ].at(-1);
29155
+ const terminalCode = terminal?.[1] ?? terminal?.[2];
29156
+ const failureDetail = terminal?.[2] === "META_FETCH_FAIL" ? relevant.slice(terminal.index) : terminalCode ?? relevant;
29157
+ if (terminalCode && terminalCode !== "META_FETCH_FAIL" && !CONNECTION_CODE.test(terminalCode) && !CERTIFICATE_CODE.test(terminalCode))
29158
+ return null;
29159
+ const certificate = failureDetail.match(CERTIFICATE_CODE)?.[0];
29160
+ if (certificate)
29161
+ return {
29162
+ code: certificate,
29163
+ hint: "Check your proxy or registry certificate trust, then retry."
29164
+ };
29165
+ const connection = failureDetail.match(CONNECTION_CODE)?.[0];
29166
+ if (connection)
29167
+ return {
29168
+ code: connection,
29169
+ hint: "Check your internet connection, VPN, or proxy, then retry."
29170
+ };
29171
+ return null;
29172
+ }
29173
+
29112
29174
  // ../tempo-sdk/package.json
29113
29175
  var package_default = {
29114
29176
  name: "tempo-sdk",
@@ -29787,10 +29849,11 @@ import path15 from "path";
29787
29849
 
29788
29850
  // ../tempo-devserver/errors.ts
29789
29851
  var TempoDevServerError = class extends Error {
29790
- constructor(code, message) {
29852
+ constructor(code, message, recoveryHint) {
29791
29853
  super(message);
29792
29854
  this.code = code;
29793
29855
  this.name = "TempoDevServerError";
29856
+ if (recoveryHint) this.recoveryHint = recoveryHint;
29794
29857
  }
29795
29858
  };
29796
29859
  var ConfigMissingError = class extends TempoDevServerError {
@@ -29828,6 +29891,32 @@ ${output}` : "";
29828
29891
  this.name = "InstallFailedError";
29829
29892
  }
29830
29893
  };
29894
+ var InstallNetworkError = class extends TempoDevServerError {
29895
+ constructor(command, output, problem) {
29896
+ super(
29897
+ "install_network_error",
29898
+ `${problem.hint}
29899
+
29900
+ Package download failed (${problem.code}): ${command}
29901
+ ${output.trim()}`
29902
+ );
29903
+ this.name = "InstallNetworkError";
29904
+ this.recoveryHint = problem.hint;
29905
+ }
29906
+ };
29907
+ var InstallTimeoutError = class extends TempoDevServerError {
29908
+ constructor(command, output) {
29909
+ super(
29910
+ "install_timeout",
29911
+ `Dependency installation produced no output for 5 minutes and was stopped. Check the install logs, your connection, or a waiting install script before retrying.
29912
+
29913
+ Command: ${command}
29914
+ ${output.trim()}`
29915
+ );
29916
+ this.recoveryHint = "No install output for 5 minutes. Check the install logs and your connection, then retry.";
29917
+ this.name = "InstallTimeoutError";
29918
+ }
29919
+ };
29831
29920
  var ToolMissingError = class extends TempoDevServerError {
29832
29921
  constructor(toolName, cwd) {
29833
29922
  super(
@@ -30638,13 +30727,15 @@ function buildUnsatisfiedNodeHint(args) {
30638
30727
  // ../tempo-devserver/sdk-upgrade-plan.ts
30639
30728
  import { access as access3, readFile as readFile12 } from "fs/promises";
30640
30729
  import path18 from "path";
30641
- var LOCKFILES = [
30730
+ var INSTALL_MARKERS = [
30642
30731
  // Order matters, same rationale as pm-detect: a tree carrying both bun.lock
30643
30732
  // and package-lock.json is a bun tree with a stale npm lockfile.
30644
30733
  { file: "bun.lock", pm: "bun" },
30645
30734
  { file: "bun.lockb", pm: "bun" },
30646
30735
  { file: "pnpm-lock.yaml", pm: "pnpm" },
30647
30736
  { file: "yarn.lock", pm: "yarn" },
30737
+ // A pnpm workspace owns its install even before its first lockfile exists.
30738
+ { file: "pnpm-workspace.yaml", pm: "pnpm" },
30648
30739
  { file: "package-lock.json", pm: "npm" }
30649
30740
  ];
30650
30741
  async function fileExists2(filePath) {
@@ -30666,11 +30757,11 @@ function parsePackageManagerField2(value) {
30666
30757
  function isYarnBerryLockfile(contents) {
30667
30758
  return /^__metadata:/m.test(contents);
30668
30759
  }
30669
- function buildCommands(pm, yarnBerry, metadataCacheDir, scopedToTempoRoot) {
30760
+ function buildCommands(pm, yarnBerry, metadataCacheDir, ignorePnpmWorkspace) {
30670
30761
  switch (pm) {
30671
30762
  case "pnpm": {
30672
30763
  const cacheFlag = metadataCacheDir ? ` --config.cacheDir=${metadataCacheDir}` : "";
30673
- const workspaceFlag = scopedToTempoRoot ? " --ignore-workspace" : "";
30764
+ const workspaceFlag = ignorePnpmWorkspace ? " --ignore-workspace" : "";
30674
30765
  return {
30675
30766
  updateCommand: `pnpm update tempo-sdk --latest${workspaceFlag}${cacheFlag}`,
30676
30767
  remediationCommand: `pnpm update tempo-sdk --latest${workspaceFlag}${cacheFlag}`
@@ -30705,9 +30796,10 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
30705
30796
  const parsed = JSON.parse(raw);
30706
30797
  return parsePackageManagerField2(parsed.packageManager);
30707
30798
  }).catch(() => null);
30708
- const owner = await findLockfileOwner(resolvedRoot);
30799
+ const owner = await findInstallOwner(resolvedRoot);
30709
30800
  const resolvedPm = declared ?? owner?.pm ?? "npm";
30710
30801
  const governedByAncestorWorkspace = owner !== null && owner.dir !== resolvedRoot;
30802
+ const hasOwnPnpmWorkspace = resolvedPm === "pnpm" && await fileExists2(path18.join(resolvedRoot, "pnpm-workspace.yaml"));
30711
30803
  return {
30712
30804
  packageManager: resolvedPm,
30713
30805
  cwd: resolvedRoot,
@@ -30716,20 +30808,20 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
30716
30808
  resolvedPm,
30717
30809
  owner?.yarnLockContents !== void 0 && isYarnBerryLockfile(owner.yarnLockContents),
30718
30810
  options.metadataCacheDir ?? null,
30719
- !governedByAncestorWorkspace
30811
+ !governedByAncestorWorkspace && !hasOwnPnpmWorkspace
30720
30812
  )
30721
30813
  };
30722
30814
  }
30723
- async function findLockfileOwner(startDir) {
30815
+ async function findInstallOwner(startDir) {
30724
30816
  for (let dir = startDir; ; dir = path18.dirname(dir)) {
30725
- for (const candidate of LOCKFILES) {
30726
- const lockPath = path18.join(dir, candidate.file);
30727
- if (!await fileExists2(lockPath)) continue;
30817
+ for (const candidate of INSTALL_MARKERS) {
30818
+ const markerPath = path18.join(dir, candidate.file);
30819
+ if (!await fileExists2(markerPath)) continue;
30728
30820
  return {
30729
30821
  dir,
30730
30822
  pm: candidate.pm,
30731
30823
  ...candidate.pm === "yarn" ? {
30732
- yarnLockContents: await readFile12(lockPath, "utf-8").catch(
30824
+ yarnLockContents: await readFile12(markerPath, "utf-8").catch(
30733
30825
  () => ""
30734
30826
  )
30735
30827
  } : {}
@@ -32079,7 +32171,8 @@ var TempoDevServer = class _TempoDevServer {
32079
32171
  if (options?.forceInstall || !this.state.dependenciesInstalled) {
32080
32172
  await this.installDependenciesForStart(
32081
32173
  options?.forceInstall === true,
32082
- options?.signal
32174
+ options?.signal,
32175
+ options?.onInstallOutput
32083
32176
  );
32084
32177
  }
32085
32178
  throwIfLaunchAborted(options?.signal);
@@ -32113,7 +32206,12 @@ var TempoDevServer = class _TempoDevServer {
32113
32206
  }
32114
32207
  await invalidateInstallCompletionMarkers(root);
32115
32208
  }
32116
- await runShellCommand(command, cwd, signal);
32209
+ await runShellCommand(
32210
+ command,
32211
+ cwd,
32212
+ signal,
32213
+ options?.onInstallOutput
32214
+ );
32117
32215
  sdkCommandCompleted = true;
32118
32216
  }
32119
32217
  }
@@ -32320,7 +32418,7 @@ var TempoDevServer = class _TempoDevServer {
32320
32418
  }
32321
32419
  };
32322
32420
  }
32323
- async installDependenciesForStart(forceInstall, signal) {
32421
+ async installDependenciesForStart(forceInstall, signal, onOutput) {
32324
32422
  const installTimer = devTimer("supervisor:install", {
32325
32423
  tempoRoot: this.tempoRoot,
32326
32424
  commandCwd: this.commandCwd,
@@ -32338,7 +32436,7 @@ var TempoDevServer = class _TempoDevServer {
32338
32436
  try {
32339
32437
  for (const step of steps) {
32340
32438
  throwIfLaunchAborted(signal);
32341
- await runInstallStep(step, signal);
32439
+ await runInstallStep(step, signal, onOutput);
32342
32440
  }
32343
32441
  } catch (error) {
32344
32442
  throwIfLaunchAborted(signal);
@@ -32351,7 +32449,7 @@ var TempoDevServer = class _TempoDevServer {
32351
32449
  );
32352
32450
  for (const step of localSteps) {
32353
32451
  throwIfLaunchAborted(signal);
32354
- await runInstallStep(step, signal);
32452
+ await runInstallStep(step, signal, onOutput);
32355
32453
  }
32356
32454
  }
32357
32455
  };
@@ -34224,6 +34322,9 @@ function classifyInstallFailure(command, output) {
34224
34322
  if (INSTALL_LOCK_PATTERN.test(output)) {
34225
34323
  return new InstallPermissionDeniedError(command, output);
34226
34324
  }
34325
+ const connectivity = describeInstallConnectivity(output);
34326
+ if (connectivity)
34327
+ return new InstallNetworkError(command, output, connectivity);
34227
34328
  return null;
34228
34329
  }
34229
34330
  function isIgnoredBuildScriptsOnlyFailure(output) {
@@ -34237,6 +34338,7 @@ async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runSh
34237
34338
  await runCommandFn(command, cwd, signal);
34238
34339
  return;
34239
34340
  } catch (error) {
34341
+ if (error instanceof InstallTimeoutError) throw error;
34240
34342
  const output = error instanceof Error ? error.message : String(error);
34241
34343
  const delay2 = retryDelaysMs[attempt];
34242
34344
  if (delay2 === void 0 || !isTransientFsLockOutput(output)) throw error;
@@ -34245,7 +34347,7 @@ async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runSh
34245
34347
  }
34246
34348
  }
34247
34349
  }
34248
- async function runInstallStep(step, signal) {
34350
+ async function runInstallStep(step, signal, onOutput) {
34249
34351
  throwIfLaunchAborted(signal);
34250
34352
  await Promise.all(
34251
34353
  [
@@ -34272,12 +34374,13 @@ async function runInstallStep(step, signal) {
34272
34374
  await runInstallCommandWithLockRetry(
34273
34375
  step.command,
34274
34376
  step.cwd,
34275
- runShellCommand,
34377
+ (command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput),
34276
34378
  INSTALL_LOCK_RETRY_DELAYS_MS,
34277
34379
  signal
34278
34380
  );
34279
34381
  } catch (error) {
34280
34382
  throwIfLaunchAborted(signal);
34383
+ if (error instanceof InstallTimeoutError) throw error;
34281
34384
  const output = error instanceof Error ? error.message : String(error);
34282
34385
  if (isIgnoredBuildScriptsOnlyFailure(output) && await nodeModulesHasMeaningfulEntries(step.cwd)) {
34283
34386
  console.warn(
@@ -34745,7 +34848,7 @@ async function runBoundedShellCommand(options) {
34745
34848
  );
34746
34849
  });
34747
34850
  }
34748
- async function runShellCommand(command, cwd, signal) {
34851
+ async function runShellCommand(command, cwd, signal, onOutput) {
34749
34852
  throwIfLaunchAborted(signal);
34750
34853
  const projectNode = toProjectNodeEnvOption(
34751
34854
  await resolveProjectNodeOverrideForDir(cwd)
@@ -34755,12 +34858,15 @@ async function runShellCommand(command, cwd, signal) {
34755
34858
  command: lifted.command,
34756
34859
  cwd,
34757
34860
  signal,
34758
- env: { ...buildManagedCommandEnv({ projectNode }), ...lifted.env }
34861
+ env: { ...buildManagedCommandEnv({ projectNode }), ...lifted.env },
34862
+ onOutput,
34863
+ idleTimeoutMs: INSTALL_IDLE_TIMEOUT_MS
34759
34864
  });
34760
34865
  if (result.aborted) throw launchAbortError();
34866
+ if (result.timedOut) throw new InstallTimeoutError(command, result.output);
34761
34867
  if (result.spawnError) throw result.spawnError;
34762
34868
  if (result.exitCode === 0) return;
34763
- const output = (result.stderr.trim() || result.stdout.trim()).slice(0, 4e3);
34869
+ const output = result.output.trim();
34764
34870
  throw new InstallFailedError(command, result.exitCode, output);
34765
34871
  }
34766
34872
  async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
@@ -52595,7 +52701,7 @@ function buildBackends(runtime, toolsets, workspace) {
52595
52701
  }
52596
52702
 
52597
52703
  // src/version.ts
52598
- var CLI_VERSION = "0.0.114";
52704
+ var CLI_VERSION = "0.0.115";
52599
52705
 
52600
52706
  // src/canvas-hooks.ts
52601
52707
  var import_pngjs4 = __toESM(require_png(), 1);
@@ -53546,4 +53652,4 @@ unpdf/dist/index.mjs:
53546
53652
  * @license Apache-2.0
53547
53653
  *)
53548
53654
  */
53549
- //# sourceMappingURL=serve-3ZUJJ3NU.js.map
53655
+ //# sourceMappingURL=serve-55E32OUF.js.map