meshy-node 0.10.3 → 0.10.5

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/main.cjs CHANGED
@@ -131632,6 +131632,8 @@ function formatHelp(command) {
131632
131632
  " --reset Ignore remembered startup options and prompt again",
131633
131633
  " --disable-auth Disable bearer auth for this run",
131634
131634
  " --qr-code Render a mobile connection QR for the node DevTunnel URL",
131635
+ " --enable-ghc-tunnel Enable the GitHub Copilot Tunnel without prompting",
131636
+ " --disable-ghc-tunnel Disable the GitHub Copilot Tunnel without prompting",
131635
131637
  " -h, --help Show this help"
131636
131638
  ].join("\n");
131637
131639
  }
@@ -131664,6 +131666,8 @@ function formatHelp(command) {
131664
131666
  " --reset Ignore remembered startup options and prompt again",
131665
131667
  " --disable-auth Disable bearer auth for this run",
131666
131668
  " --qr-code Render a mobile connection QR for the node DevTunnel URL",
131669
+ " --enable-ghc-tunnel Enable the GitHub Copilot Tunnel without prompting",
131670
+ " --disable-ghc-tunnel Disable the GitHub Copilot Tunnel without prompting",
131667
131671
  " -h, --help Show this help"
131668
131672
  ].join("\n");
131669
131673
  }
@@ -131750,6 +131754,12 @@ function parseArgs(argv) {
131750
131754
  case "--qr-code":
131751
131755
  result.qrCode = true;
131752
131756
  break;
131757
+ case "--enable-ghc-tunnel":
131758
+ result.ghcTunnel = true;
131759
+ break;
131760
+ case "--disable-ghc-tunnel":
131761
+ result.ghcTunnel = false;
131762
+ break;
131753
131763
  default:
131754
131764
  if (!arg.startsWith("-") && !result.command && isKnownCommand(arg)) {
131755
131765
  result.command = arg;
@@ -132242,7 +132252,7 @@ function formatBanner(info) {
132242
132252
  const lines = [
132243
132253
  `Node: ${info.name}`,
132244
132254
  `Role: ${info.role} (term ${info.term})`,
132245
- `Endpoint: ${info.endpoint}`,
132255
+ `Node URL: ${info.endpoint}`,
132246
132256
  `Dashboard: http://localhost:${info.port}`
132247
132257
  ];
132248
132258
  if (info.dashboardOrigin) {
@@ -148093,6 +148103,12 @@ function parseRuntimeRestartStartArgs(value) {
148093
148103
  }
148094
148104
  startArgs.qrCode = value.qrCode;
148095
148105
  }
148106
+ if (value.ghcTunnel !== void 0) {
148107
+ if (typeof value.ghcTunnel !== "boolean") {
148108
+ throw new MeshyError("VALIDATION_ERROR", "Runtime restart ghcTunnel must be a boolean", 400);
148109
+ }
148110
+ startArgs.ghcTunnel = value.ghcTunnel;
148111
+ }
148096
148112
  return Object.keys(startArgs).length > 0 ? startArgs : void 0;
148097
148113
  }
148098
148114
  function parseOptionalString(value, key2) {
@@ -148119,6 +148135,9 @@ var DEFAULT_POLL_INTERVAL_MS = 1e3;
148119
148135
  var DEFAULT_STARTUP_TIMEOUT_MS = 15 * 60 * 1e3;
148120
148136
  var DEFAULT_STOP_TIMEOUT_MS = 3e3;
148121
148137
  var GHC_TUNNEL_ARGS = ["-y", "ghc-tunnel@latest", "-d"];
148138
+ var GHC_TUNNEL_SETUP_ARGS = ["-y", "ghc-tunnel@latest", "--setup", "-d"];
148139
+ var GHC_TUNNEL_READY_PATTERN = /GitHub Copilot API Proxy/i;
148140
+ var GHC_TUNNEL_API_PATTERN = /^\s*(OpenAI API|Responses API|Anthropic API)\b/im;
148122
148141
  var trackedTunnels = /* @__PURE__ */ new Map();
148123
148142
  function createTail() {
148124
148143
  return { text: "", observedBytes: 0, truncated: false };
@@ -148191,11 +148210,8 @@ function tunnelArgs() {
148191
148210
  function windowsShellQuote(value) {
148192
148211
  return /[\s&()^|<>"]/.test(value) ? `"${value.replace(/"/g, '\\"')}"` : value;
148193
148212
  }
148194
- function createCopilotTunnelSpawnInvocation(host, port, platform6 = process.platform) {
148195
- void host;
148196
- void port;
148213
+ function buildNpxInvocation(displayArgs, platform6) {
148197
148214
  const displayCommand = tunnelCommand(platform6);
148198
- const displayArgs = tunnelArgs();
148199
148215
  if (platform6 !== "win32") return { command: displayCommand, args: displayArgs, displayCommand, displayArgs };
148200
148216
  return {
148201
148217
  command: "cmd.exe",
@@ -148204,6 +148220,14 @@ function createCopilotTunnelSpawnInvocation(host, port, platform6 = process.plat
148204
148220
  displayArgs
148205
148221
  };
148206
148222
  }
148223
+ function createCopilotTunnelSpawnInvocation(host, port, platform6 = process.platform) {
148224
+ void host;
148225
+ void port;
148226
+ return buildNpxInvocation(tunnelArgs(), platform6);
148227
+ }
148228
+ function createCopilotTunnelSetupInvocation(platform6 = process.platform) {
148229
+ return buildNpxInvocation([...GHC_TUNNEL_SETUP_ARGS], platform6);
148230
+ }
148207
148231
  function checkTcpPort(host, port, timeoutMs) {
148208
148232
  return new Promise((resolve24) => {
148209
148233
  const socket = import_node_net.default.createConnection({ host, port });
@@ -148244,6 +148268,9 @@ function parseGithubDeviceFlow(output) {
148244
148268
  ...expires ? { expiresInSeconds: Number(expires) } : {}
148245
148269
  };
148246
148270
  }
148271
+ function hasGithubCopilotTunnelReadyOutput(output) {
148272
+ return GHC_TUNNEL_READY_PATTERN.test(output) && GHC_TUNNEL_API_PATTERN.test(output);
148273
+ }
148247
148274
  function buildResult(options) {
148248
148275
  const available = options.available ?? (options.status === "already-running" || options.status === "available");
148249
148276
  return {
@@ -148429,8 +148456,11 @@ async function enableGithubCopilotTunnel(options = {}) {
148429
148456
  ${stderr.text}`) ?? auth;
148430
148457
  publish2(auth ? "auth-required" : "starting");
148431
148458
  };
148432
- child.stdout?.on("data", (chunk) => handleOutput(stdout, Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk))));
148433
- child.stderr?.on("data", (chunk) => handleOutput(stderr, Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk))));
148459
+ const stdoutListener = (chunk) => handleOutput(stdout, Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
148460
+ const stderrListener = (chunk) => handleOutput(stderr, Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
148461
+ const drainListener = (_chunk) => void 0;
148462
+ child.stdout?.on("data", stdoutListener);
148463
+ child.stderr?.on("data", stderrListener);
148434
148464
  child.once("error", (err) => {
148435
148465
  childState.spawnError = err instanceof Error ? err : new Error(String(err));
148436
148466
  });
@@ -148439,11 +148469,21 @@ ${stderr.text}`) ?? auth;
148439
148469
  if (trackedTunnels.get(key2) === child) trackedTunnels.delete(key2);
148440
148470
  });
148441
148471
  publish2("starting");
148472
+ const releaseStartupOutputCapture = () => {
148473
+ child.stdout?.unref?.();
148474
+ child.stderr?.unref?.();
148475
+ if (options.captureOutputAfterReady !== false) return;
148476
+ child.stdout?.removeListener?.("data", stdoutListener);
148477
+ child.stderr?.removeListener?.("data", stderrListener);
148478
+ child.stdout?.on("data", drainListener);
148479
+ child.stderr?.on("data", drainListener);
148480
+ };
148442
148481
  const deadline = Date.now() + startupTimeoutMs;
148443
148482
  while (Date.now() < deadline) {
148444
148483
  if (await portChecker(host, port, portCheckTimeoutMs)) {
148445
148484
  trackedTunnels.set(key2, child);
148446
148485
  child.unref?.();
148486
+ releaseStartupOutputCapture();
148447
148487
  return buildResult({ host, port, command, args, pid, status: "available", stdout, stderr, auth });
148448
148488
  }
148449
148489
  if (childState.spawnError) {
@@ -148458,6 +148498,72 @@ ${stderr.text}`) ?? auth;
148458
148498
  await terminateChildProcess(child, stopTimeoutMs);
148459
148499
  return buildResult({ host, port, command, args, pid, status: "failed", stdout, stderr, auth, detail: `Timed out waiting for port ${port}` });
148460
148500
  }
148501
+ async function runGithubCopilotTunnelSetup(options = {}) {
148502
+ const host = DEFAULT_HOST;
148503
+ const port = DEFAULT_PORT;
148504
+ const invocation = createCopilotTunnelSetupInvocation();
148505
+ const command = invocation.displayCommand;
148506
+ const args = invocation.displayArgs;
148507
+ const stdout = createTail();
148508
+ const stderr = createTail();
148509
+ const outputLimitBytes = options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES;
148510
+ let auth = null;
148511
+ const child = (options.spawnSetup ?? defaultSpawnTunnel)(invocation.command, invocation.args, {
148512
+ cwd: options.cwd ?? process.cwd(),
148513
+ shell: false,
148514
+ windowsHide: true,
148515
+ stdio: ["ignore", "pipe", "pipe"]
148516
+ });
148517
+ const pid = typeof child.pid === "number" ? child.pid : null;
148518
+ const publish2 = (status, detail) => {
148519
+ options.onProgress?.(buildResult({ host, port, command, args, pid, status, stdout, stderr, auth, detail }));
148520
+ };
148521
+ let settled = false;
148522
+ let resolveResult;
148523
+ const releaseSetupOutputCapture = () => {
148524
+ child.stdout?.unref?.();
148525
+ child.stderr?.unref?.();
148526
+ child.stdout?.removeListener?.("data", stdoutListener);
148527
+ child.stderr?.removeListener?.("data", stderrListener);
148528
+ child.unref?.();
148529
+ };
148530
+ const settle = (result) => {
148531
+ if (settled) return;
148532
+ settled = true;
148533
+ resolveResult?.(result);
148534
+ };
148535
+ const handleOutput = (target, chunk) => {
148536
+ appendTail(target, chunk, outputLimitBytes);
148537
+ auth = parseGithubDeviceFlow(`${stdout.text}
148538
+ ${stderr.text}`) ?? auth;
148539
+ publish2(auth ? "auth-required" : "starting");
148540
+ if (options.resolveOnReadyOutput && hasGithubCopilotTunnelReadyOutput(`${stdout.text}
148541
+ ${stderr.text}`)) {
148542
+ releaseSetupOutputCapture();
148543
+ settle(buildResult({ host, port, command, args, pid, status: "available", available: true, stdout, stderr, auth }));
148544
+ }
148545
+ };
148546
+ const stdoutListener = (chunk) => handleOutput(stdout, Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
148547
+ const stderrListener = (chunk) => handleOutput(stderr, Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
148548
+ child.stdout?.on("data", stdoutListener);
148549
+ child.stderr?.on("data", stderrListener);
148550
+ publish2("starting");
148551
+ return new Promise((resolve24) => {
148552
+ resolveResult = resolve24;
148553
+ child.once("error", (err) => {
148554
+ const message = err instanceof Error ? err.message : String(err);
148555
+ settle(buildResult({ host, port, command, args, pid, status: "failed", available: false, stdout, stderr, auth, detail: message }));
148556
+ });
148557
+ child.once("close", (code4, signal) => {
148558
+ if (code4 === 0) {
148559
+ settle(buildResult({ host, port, command, args, pid, status: "available", available: true, stdout, stderr, auth }));
148560
+ return;
148561
+ }
148562
+ const detail = `ghc-tunnel --setup exited with code ${code4 ?? "null"}${signal ? ` (${signal})` : ""}`;
148563
+ settle(buildResult({ host, port, command, args, pid, status: "failed", available: false, stdout, stderr, auth, detail }));
148564
+ });
148565
+ });
148566
+ }
148461
148567
 
148462
148568
  // ../../packages/api/src/node/node-operation-service.ts
148463
148569
  var LEADER_REPORT_RETRY_MS = 5e3;
@@ -180150,10 +180256,27 @@ var path34 = __toESM(require("path"), 1);
180150
180256
  var readline = __toESM(require("readline/promises"), 1);
180151
180257
  var import_node_child_process13 = require("child_process");
180152
180258
  var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex", "copilot"];
180259
+ var GITHUB_AUTH_STATUS_ARGS = ["auth", "status", "--hostname", "github.com"];
180260
+ var GITHUB_AUTH_LOGIN_ARGS = [
180261
+ "auth",
180262
+ "login",
180263
+ "--hostname",
180264
+ "github.com",
180265
+ "--web",
180266
+ "--git-protocol",
180267
+ "https",
180268
+ "--skip-ssh-key"
180269
+ ];
180270
+ var COPILOT_TUNNEL_PORT2 = 8314;
180153
180271
  function writeLine(stream, message = "") {
180154
180272
  stream.write(`${message}
180155
180273
  `);
180156
180274
  }
180275
+ var ANSI = { reset: "\x1B[0m", bold: "\x1B[1m", cyan: "\x1B[36m", green: "\x1B[32m", amber: "\x1B[33m", red: "\x1B[31m" };
180276
+ function highlight(label, message) {
180277
+ const color2 = { info: "bold", success: "green", warning: "amber", error: "red", accent: "cyan" }[label];
180278
+ return `${ANSI[color2]}${message}${ANSI.reset}`;
180279
+ }
180157
180280
  function shouldPromptForStartupTools() {
180158
180281
  return Boolean(process.stdin.isTTY && process.stdout.isTTY);
180159
180282
  }
@@ -180265,10 +180388,13 @@ function buildLoginCommand(requirement) {
180265
180388
  if (requirement === "az") {
180266
180389
  return { command: "az", args: ["login"] };
180267
180390
  }
180391
+ if (requirement === "copilot") {
180392
+ return { command: "gh", args: [...GITHUB_AUTH_LOGIN_ARGS] };
180393
+ }
180268
180394
  return { command: "devtunnel", args: ["user", "login"] };
180269
180395
  }
180270
180396
  function isAuthenticated(requirement, commandRunner) {
180271
- const command = requirement === "az" ? { command: "az", args: ["account", "show"] } : { command: "devtunnel", args: ["user", "show"] };
180397
+ const command = requirement === "az" ? { command: "az", args: ["account", "show"] } : requirement === "copilot" ? { command: "gh", args: [...GITHUB_AUTH_STATUS_ARGS] } : { command: "devtunnel", args: ["user", "show"] };
180272
180398
  const result = commandRunner(command.command, command.args, false);
180273
180399
  if (!result.ok) {
180274
180400
  return false;
@@ -180284,7 +180410,7 @@ function isRequirementSatisfied(requirement, status) {
180284
180410
  if (!status || status.installed !== true || status.status !== "ok") {
180285
180411
  return false;
180286
180412
  }
180287
- if (requirement === "az" || requirement === "devtunnel") {
180413
+ if (requirement === "az" || requirement === "devtunnel" || requirement === "copilot") {
180288
180414
  return status.authenticated === true;
180289
180415
  }
180290
180416
  return true;
@@ -180293,12 +180419,214 @@ function sleep4(ms) {
180293
180419
  return new Promise((resolve24) => setTimeout(resolve24, ms));
180294
180420
  }
180295
180421
  function areCachedAuthRequirementsCurrent(commandRunner) {
180296
- return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner);
180422
+ return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner) && isAuthenticated("copilot", commandRunner);
180297
180423
  }
180298
180424
  function resolveStartupRequirementsMetadata(storagePath) {
180299
180425
  const metadata = readStartupMetadataFile(storagePath).startupRequirements;
180300
180426
  return metadata && typeof metadata === "object" ? metadata : {};
180301
180427
  }
180428
+ function persistCopilotTunnelPreference(storagePath, metadata, enabled2, now) {
180429
+ metadata.copilotTunnel = { enabled: enabled2, updatedAt: now.toISOString() };
180430
+ const metadataFile = readStartupMetadataFile(storagePath);
180431
+ metadataFile.startupRequirements = {
180432
+ ...metadataFile.startupRequirements ?? {},
180433
+ ...metadata
180434
+ };
180435
+ writeStartupMetadataFile(storagePath, metadataFile);
180436
+ return metadata;
180437
+ }
180438
+ async function ensureOptionalCopilotTunnel(options) {
180439
+ if (!isRequirementSatisfied("copilot", options.metadata.components?.copilot)) {
180440
+ return;
180441
+ }
180442
+ const status = await checkGithubCopilotTunnel({
180443
+ portChecker: options.startupOptions.copilotTunnelPortChecker,
180444
+ portCheckTimeoutMs: options.startupOptions.copilotTunnelPortCheckTimeoutMs
180445
+ });
180446
+ if (status.available) {
180447
+ if (options.startupOptions.copilotTunnelEnabled !== void 0) {
180448
+ persistCopilotTunnelPreference(options.storagePath, options.metadata, options.startupOptions.copilotTunnelEnabled, options.now);
180449
+ }
180450
+ writeLine(options.stdout, highlight("success", `GitHub Copilot Tunnel already available on port ${COPILOT_TUNNEL_PORT2}; skipping setup.`));
180451
+ return;
180452
+ }
180453
+ const preference = options.startupOptions.copilotTunnelEnabled ?? options.metadata.copilotTunnel?.enabled;
180454
+ if (preference === false) {
180455
+ persistCopilotTunnelPreference(options.storagePath, options.metadata, false, options.now);
180456
+ writeLine(options.stdout, highlight("info", "GitHub Copilot Tunnel disabled by startup preference."));
180457
+ return;
180458
+ }
180459
+ if (preference === true) {
180460
+ persistCopilotTunnelPreference(options.storagePath, options.metadata, true, options.now);
180461
+ await options.releasePrompt();
180462
+ const auth2 = await ensureRequirementAuthenticated(
180463
+ "copilot",
180464
+ options.getAsk,
180465
+ options.commandRunner,
180466
+ options.stdout,
180467
+ options.stderr,
180468
+ options.releasePrompt,
180469
+ options.authPollIntervalMs,
180470
+ options.authPollTimeoutMs
180471
+ );
180472
+ if (!auth2.authenticated) {
180473
+ writeLine(options.stderr, highlight("error", "GitHub Copilot Tunnel requires GitHub authentication; skipping tunnel setup."));
180474
+ return;
180475
+ }
180476
+ writeLine(options.stdout, highlight("accent", "Configuring GitHub Copilot Tunnel..."));
180477
+ await runCopilotTunnel(options);
180478
+ return;
180479
+ }
180480
+ const ask = options.getAsk();
180481
+ if (!ask) {
180482
+ writeLine(options.stdout, highlight("warning", `GitHub Copilot Tunnel is optional. Start in a TTY to enable the local proxy on port ${COPILOT_TUNNEL_PORT2}.`));
180483
+ return;
180484
+ }
180485
+ writeLine(options.stdout);
180486
+ writeLine(options.stdout, highlight("info", "Enable GitHub Copilot Tunnel?"));
180487
+ writeLine(
180488
+ options.stdout,
180489
+ highlight("warning", "This will configure Claude Code and Codex to use the GitHub Copilot model provider, then start a local proxy on port 8314. You may be asked to sign in to GitHub with a device code.")
180490
+ );
180491
+ if (!await confirm(ask, "Enable GitHub Copilot Tunnel?")) {
180492
+ persistCopilotTunnelPreference(options.storagePath, options.metadata, false, options.now);
180493
+ return;
180494
+ }
180495
+ persistCopilotTunnelPreference(options.storagePath, options.metadata, true, options.now);
180496
+ await options.releasePrompt();
180497
+ const auth = await ensureRequirementAuthenticated(
180498
+ "copilot",
180499
+ options.getAsk,
180500
+ options.commandRunner,
180501
+ options.stdout,
180502
+ options.stderr,
180503
+ options.releasePrompt,
180504
+ options.authPollIntervalMs,
180505
+ options.authPollTimeoutMs
180506
+ );
180507
+ if (!auth.authenticated) {
180508
+ writeLine(options.stderr, highlight("error", "GitHub Copilot Tunnel requires GitHub authentication; skipping tunnel setup."));
180509
+ return;
180510
+ }
180511
+ writeLine(options.stdout, highlight("accent", "Configuring GitHub Copilot Tunnel..."));
180512
+ await runCopilotTunnel(options);
180513
+ }
180514
+ var COPILOT_TUNNEL_KEY_INFO_PATTERN = /GitHub Copilot API Proxy|^\s*(Dashboard|OpenAI API|Responses API|Anthropic API)\b/i;
180515
+ var COPILOT_TUNNEL_API_INFO_PATTERN = /^\s*(OpenAI API|Responses API|Anthropic API)\b/i;
180516
+ function extractCopilotTunnelKeyInfo(output) {
180517
+ return output.split(/\r?\n/).map((line) => line.replace(/\s+$/, "")).filter((line) => line.trim() !== "" && COPILOT_TUNNEL_KEY_INFO_PATTERN.test(line));
180518
+ }
180519
+ function hasCopilotTunnelApiInfo(lines) {
180520
+ return lines.some((line) => COPILOT_TUNNEL_API_INFO_PATTERN.test(line));
180521
+ }
180522
+ async function runCopilotTunnel(options) {
180523
+ let lastAuthCode;
180524
+ let reportedKeyInfo = false;
180525
+ let reportedWaitingForAuth = false;
180526
+ let releaseStartupWait;
180527
+ const startupWait = new Promise((resolve24) => {
180528
+ releaseStartupWait = resolve24;
180529
+ });
180530
+ const reportTunnelKeyInfo = (tunnel) => {
180531
+ if (reportedKeyInfo) return false;
180532
+ const keyInfo = extractCopilotTunnelKeyInfo(`${tunnel.stdout}
180533
+ ${tunnel.stderr}`);
180534
+ const pidSuffix = tunnel.pid ? ` (pid ${tunnel.pid})` : "";
180535
+ if (keyInfo.length > 0 && hasCopilotTunnelApiInfo(keyInfo)) {
180536
+ reportedKeyInfo = true;
180537
+ writeLine(options.stdout, `GitHub Copilot Tunnel is ready${pidSuffix}:`);
180538
+ for (const line of keyInfo) writeLine(options.stdout, ` ${line.trim()}`);
180539
+ return true;
180540
+ }
180541
+ return false;
180542
+ };
180543
+ const reportTunnelReady = (tunnel) => {
180544
+ if (reportTunnelKeyInfo(tunnel)) return true;
180545
+ if (!tunnel.available) return false;
180546
+ reportedKeyInfo = true;
180547
+ const pidSuffix = tunnel.pid ? ` (pid ${tunnel.pid})` : "";
180548
+ writeLine(options.stdout, `GitHub Copilot Tunnel is available on port ${tunnel.port}${pidSuffix}.`);
180549
+ return true;
180550
+ };
180551
+ const reportTunnelFailure = (tunnel) => {
180552
+ if (tunnel.available || tunnel.status === "auth-required") return;
180553
+ writeLine(options.stderr, tunnel.detail ?? "GitHub Copilot Tunnel failed to start.");
180554
+ };
180555
+ const surfaceDeviceLogin = (update, releaseOnAuth) => {
180556
+ if (update.status === "auth-required" && update.auth && update.auth.code !== lastAuthCode) {
180557
+ lastAuthCode = update.auth.code;
180558
+ writeLine(options.stdout);
180559
+ writeLine(options.stdout, "GitHub sign-in required to enable the Copilot tunnel.");
180560
+ writeLine(options.stdout, `Open ${update.auth.url} and enter the device code below.`);
180561
+ writeLine(options.stdout, `Device code: ${update.auth.code}`);
180562
+ writeLine(options.stdout, "Waiting for you to finish signing in...");
180563
+ if (releaseOnAuth && !reportedWaitingForAuth) {
180564
+ reportedWaitingForAuth = true;
180565
+ writeLine(options.stdout, "GitHub Copilot Tunnel is waiting for GitHub sign-in; Meshy startup will continue.");
180566
+ }
180567
+ if (releaseOnAuth) releaseStartupWait?.();
180568
+ return;
180569
+ }
180570
+ if (reportTunnelKeyInfo(update)) {
180571
+ releaseStartupWait?.();
180572
+ }
180573
+ };
180574
+ const waitForSetup = async () => {
180575
+ const setupPromise = runGithubCopilotTunnelSetup({
180576
+ resolveOnReadyOutput: true,
180577
+ spawnSetup: options.startupOptions.copilotTunnelSetupSpawn,
180578
+ onProgress: (update) => surfaceDeviceLogin(update, false)
180579
+ });
180580
+ const firstSetupResult = await Promise.race([
180581
+ setupPromise.then((setup) => ({ kind: "result", setup })),
180582
+ startupWait.then(() => ({ kind: "started-proxy" }))
180583
+ ]);
180584
+ if (firstSetupResult.kind === "started-proxy") {
180585
+ void setupPromise.then((setup) => {
180586
+ if (!reportedKeyInfo && !setup.ok) reportTunnelFailure(setup);
180587
+ }).catch((err) => {
180588
+ if (!reportedKeyInfo) writeLine(options.stderr, `GitHub Copilot Tunnel setup failed: ${err instanceof Error ? err.message : String(err)}`);
180589
+ });
180590
+ return "started-proxy";
180591
+ }
180592
+ if (!firstSetupResult.setup.ok) {
180593
+ writeLine(options.stderr, firstSetupResult.setup.detail ?? "GitHub Copilot Tunnel setup failed.");
180594
+ return "failed";
180595
+ }
180596
+ return reportTunnelKeyInfo(firstSetupResult.setup) ? "started-proxy" : "completed";
180597
+ };
180598
+ try {
180599
+ const setupStatus = await waitForSetup();
180600
+ if (setupStatus !== "completed") {
180601
+ return;
180602
+ }
180603
+ writeLine(options.stdout, "Waiting for ghc-tunnel to launch...");
180604
+ const tunnelPromise = enableGithubCopilotTunnel({
180605
+ captureOutputAfterReady: false,
180606
+ portChecker: options.startupOptions.copilotTunnelPortChecker,
180607
+ portCheckTimeoutMs: options.startupOptions.copilotTunnelPortCheckTimeoutMs,
180608
+ pollIntervalMs: options.startupOptions.copilotTunnelPollIntervalMs,
180609
+ spawnTunnel: options.startupOptions.copilotTunnelSpawn,
180610
+ startupTimeoutMs: options.startupOptions.copilotTunnelStartupTimeoutMs,
180611
+ onProgress: (update) => surfaceDeviceLogin(update, true)
180612
+ });
180613
+ const firstResult = await Promise.race([
180614
+ tunnelPromise.then((tunnel) => ({ kind: "result", tunnel })),
180615
+ startupWait.then(() => ({ kind: "progress" }))
180616
+ ]);
180617
+ if (firstResult.kind === "result") {
180618
+ if (!reportTunnelReady(firstResult.tunnel)) reportTunnelFailure(firstResult.tunnel);
180619
+ return;
180620
+ }
180621
+ void tunnelPromise.then((tunnel) => {
180622
+ if (!reportTunnelReady(tunnel)) reportTunnelFailure(tunnel);
180623
+ }).catch((err) => {
180624
+ writeLine(options.stderr, `GitHub Copilot Tunnel failed to start: ${err instanceof Error ? err.message : String(err)}`);
180625
+ });
180626
+ } catch (err) {
180627
+ writeLine(options.stderr, `GitHub Copilot Tunnel failed to start: ${err instanceof Error ? err.message : String(err)}`);
180628
+ }
180629
+ }
180302
180630
  function shouldSkipStartupRequirementsCheck(storagePath, now = /* @__PURE__ */ new Date()) {
180303
180631
  const metadata = resolveStartupRequirementsMetadata(storagePath);
180304
180632
  if (metadata.lastCheckedOn !== formatLocalDate2(now)) {
@@ -180366,12 +180694,6 @@ async function ensureStartupRequirements(storagePath, options = {}) {
180366
180694
  const commandRunner = options.commandRunner ?? createDefaultCommandRunner(platform6);
180367
180695
  const authPollIntervalMs = options.authPollIntervalMs ?? 1e3;
180368
180696
  const authPollTimeoutMs = options.authPollTimeoutMs ?? 12e4;
180369
- if (shouldSkipStartupRequirementsCheck(storagePath, now) && areCachedAuthRequirementsCurrent(commandRunner)) {
180370
- return {
180371
- skipped: true,
180372
- metadata: resolveStartupRequirementsMetadata(storagePath)
180373
- };
180374
- }
180375
180697
  const promptSessionFactory = options.promptSessionFactory ?? createPromptSession;
180376
180698
  let promptSession;
180377
180699
  const getAsk = () => {
@@ -180384,6 +180706,26 @@ async function ensureStartupRequirements(storagePath, options = {}) {
180384
180706
  promptSession = void 0;
180385
180707
  await current.close();
180386
180708
  };
180709
+ if (shouldSkipStartupRequirementsCheck(storagePath, now) && areCachedAuthRequirementsCurrent(commandRunner)) {
180710
+ const metadata2 = resolveStartupRequirementsMetadata(storagePath);
180711
+ await ensureOptionalCopilotTunnel({
180712
+ storagePath,
180713
+ metadata: metadata2,
180714
+ now,
180715
+ getAsk,
180716
+ releasePrompt,
180717
+ commandRunner,
180718
+ stdout,
180719
+ stderr,
180720
+ startupOptions: options,
180721
+ authPollIntervalMs,
180722
+ authPollTimeoutMs
180723
+ });
180724
+ return {
180725
+ skipped: true,
180726
+ metadata: metadata2
180727
+ };
180728
+ }
180387
180729
  const checkedAt = now.toISOString();
180388
180730
  const checkedOn = formatLocalDate2(now);
180389
180731
  const components = {};
@@ -180406,7 +180748,7 @@ async function ensureStartupRequirements(storagePath, options = {}) {
180406
180748
  };
180407
180749
  continue;
180408
180750
  }
180409
- if (requirement === "az" || requirement === "devtunnel") {
180751
+ if (requirement === "az" || requirement === "devtunnel" || requirement === "copilot") {
180410
180752
  const authResult = await ensureRequirementAuthenticated(
180411
180753
  requirement,
180412
180754
  getAsk,
@@ -180442,6 +180784,19 @@ async function ensureStartupRequirements(storagePath, options = {}) {
180442
180784
  };
180443
180785
  metadataFile.startupRequirements = metadata;
180444
180786
  writeStartupMetadataFile(storagePath, metadataFile);
180787
+ await ensureOptionalCopilotTunnel({
180788
+ storagePath,
180789
+ metadata,
180790
+ now,
180791
+ getAsk,
180792
+ releasePrompt,
180793
+ commandRunner,
180794
+ stdout,
180795
+ stderr,
180796
+ startupOptions: options,
180797
+ authPollIntervalMs,
180798
+ authPollTimeoutMs
180799
+ });
180445
180800
  return {
180446
180801
  skipped: false,
180447
180802
  metadata
@@ -181525,6 +181880,8 @@ function formatStartArgs(args) {
181525
181880
  if (args.config) result.push("--config", args.config);
181526
181881
  if (args.disableAuth) result.push("--disable-auth");
181527
181882
  if (args.qrCode) result.push("--qr-code");
181883
+ if (args.ghcTunnel === true) result.push("--enable-ghc-tunnel");
181884
+ if (args.ghcTunnel === false) result.push("--disable-ghc-tunnel");
181528
181885
  return result;
181529
181886
  }
181530
181887
  function detectRuntimeRestartMode(env4 = process.env, entryPath = process.argv[1]) {
@@ -190450,7 +190807,7 @@ function createNodeTelemetry(config2, logger33, baseDimensions) {
190450
190807
  createAzureTelemetryService({ connectionString: config2.connectionString, baseDimensions }),
190451
190808
  { logger: telemetryLogger }
190452
190809
  );
190453
- telemetryLogger.info("Telemetry initialized [succeeded]");
190810
+ telemetryLogger.info("Telemetry initialized [succeeded]. Meshy collects sanitized operational telemetry such as runtime details, feature usage, task lifecycle events, and API route metrics. Prompts, transcripts, request bodies, bearer tokens, raw paths, and raw stack traces are not collected.");
190454
190811
  return telemetry;
190455
190812
  } catch {
190456
190813
  telemetryLogger.warn("Telemetry initialized [failed]");
@@ -190578,7 +190935,9 @@ async function startNode(args) {
190578
190935
  });
190579
190936
  telemetry.trackEvent("startup.started");
190580
190937
  terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex, copilot)...");
190581
- const startupRequirements = await ensureNpxStartupTools(config2.storage.path);
190938
+ const startupRequirements = await ensureNpxStartupTools(config2.storage.path, {
190939
+ copilotTunnelEnabled: hydratedArgs.args.ghcTunnel
190940
+ });
190582
190941
  telemetry.trackEvent("startup.preflight.completed", startupRequirementDimensions(startupRequirements));
190583
190942
  terminalWriter.line(
190584
190943
  startupRequirements.skipped ? "Startup requirements already verified today; skipping checks." : "Startup requirements check complete."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meshy-node",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "private": false,
5
5
  "description": "Standalone Meshy node package with bundled runtime and dashboard assets.",
6
6
  "type": "commonjs",
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "packageName": "meshy-node",
3
- "packageVersion": "0.10.3",
3
+ "packageVersion": "0.10.5",
4
4
  "packages": {
5
5
  "workspace": {
6
6
  "name": "meshy",
7
- "version": "0.10.3"
7
+ "version": "0.10.5"
8
8
  },
9
9
  "node": {
10
10
  "name": "meshy-node",
11
- "version": "0.10.3"
11
+ "version": "0.10.5"
12
12
  },
13
13
  "core": {
14
14
  "name": "@meshy/core",
@@ -26,6 +26,6 @@
26
26
  "repository": {
27
27
  "url": "https://github.com/gim-home/meshy",
28
28
  "branch": "main",
29
- "commit": "58bcf4c"
29
+ "commit": "2b58f22"
30
30
  }
31
31
  }