@rayu-dev/rayu-cli 1.4.475 → 1.4.476

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.
Files changed (2) hide show
  1. package/dist/rayu.js +646 -104
  2. package/package.json +1 -1
package/dist/rayu.js CHANGED
@@ -148992,7 +148992,7 @@ var init_isEqual = __esm(() => {
148992
148992
 
148993
148993
  // src/utils/userAgent.ts
148994
148994
  function getRayuUserAgent() {
148995
- return `rayu/${"1.4.475"}`;
148995
+ return `rayu/${"1.4.476"}`;
148996
148996
  }
148997
148997
  var getClaudeCodeUserAgent;
148998
148998
  var init_userAgent = __esm(() => {
@@ -149018,7 +149018,7 @@ function getUserAgent() {
149018
149018
  const clientApp = process.env.RAYU_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.RAYU_AGENT_SDK_CLIENT_APP}` : "";
149019
149019
  const workload = getWorkload();
149020
149020
  const workloadSuffix = workload ? `, workload/${workload}` : "";
149021
- return `rayu/${"1.4.475"} (${"external"}, ${process.env.RAYU_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
149021
+ return `rayu/${"1.4.476"} (${"external"}, ${process.env.RAYU_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
149022
149022
  }
149023
149023
  function getMCPUserAgent() {
149024
149024
  const parts = [];
@@ -149032,7 +149032,7 @@ function getMCPUserAgent() {
149032
149032
  parts.push(`client-app/${process.env.RAYU_AGENT_SDK_CLIENT_APP}`);
149033
149033
  }
149034
149034
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
149035
- return `rayu/${"1.4.475"}${suffix}`;
149035
+ return `rayu/${"1.4.476"}${suffix}`;
149036
149036
  }
149037
149037
  function getWebFetchUserAgent() {
149038
149038
  return `Rayu-User (${getRayuUserAgent()})`;
@@ -205400,7 +205400,7 @@ function getAttributionHeader(fingerprint) {
205400
205400
  if (!isAttributionHeaderEnabled()) {
205401
205401
  return "";
205402
205402
  }
205403
- const version2 = `${"1.4.475"}.${fingerprint}`;
205403
+ const version2 = `${"1.4.476"}.${fingerprint}`;
205404
205404
  const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
205405
205405
  const cch = "";
205406
205406
  const workload = getWorkload();
@@ -259369,7 +259369,7 @@ var init_metadata = __esm(() => {
259369
259369
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
259370
259370
  WHITESPACE_REGEX = /\s+/;
259371
259371
  getVersionBase = memoize_default(() => {
259372
- const match = "1.4.475".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
259372
+ const match = "1.4.476".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
259373
259373
  return match ? match[0] : undefined;
259374
259374
  });
259375
259375
  buildEnvContext = memoize_default(async () => {
@@ -259408,7 +259408,7 @@ var init_metadata = __esm(() => {
259408
259408
  },
259409
259409
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
259410
259410
  isRayuAction: isEnvTruthy(process.env.RAYU_ACTION),
259411
- version: "1.4.475",
259411
+ version: "1.4.476",
259412
259412
  versionBase: getVersionBase(),
259413
259413
  buildTime: "",
259414
259414
  deploymentEnvironment: env3.detectDeploymentEnvironment(),
@@ -291424,7 +291424,7 @@ function getTelemetryAttributes() {
291424
291424
  attributes["session.id"] = sessionId;
291425
291425
  }
291426
291426
  if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
291427
- attributes["app.version"] = "1.4.475";
291427
+ attributes["app.version"] = "1.4.476";
291428
291428
  }
291429
291429
  const oauthAccount = getOauthAccountInfo();
291430
291430
  if (oauthAccount) {
@@ -401781,7 +401781,7 @@ function getInstallationEnv() {
401781
401781
  return;
401782
401782
  }
401783
401783
  function getClaudeCodeVersion() {
401784
- return "1.4.475";
401784
+ return "1.4.476";
401785
401785
  }
401786
401786
  async function getInstalledVSCodeExtensionVersion(command) {
401787
401787
  const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
@@ -407019,7 +407019,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
407019
407019
  const client3 = new Client({
407020
407020
  name: "claude-code",
407021
407021
  title: "RAYU",
407022
- version: "1.4.475",
407022
+ version: "1.4.476",
407023
407023
  description: "Anthropic's agentic coding tool",
407024
407024
  websiteUrl: PRODUCT_URL
407025
407025
  }, {
@@ -407336,7 +407336,7 @@ var init_client7 = __esm(() => {
407336
407336
  const client3 = new Client({
407337
407337
  name: "claude-code",
407338
407338
  title: "RAYU",
407339
- version: "1.4.475",
407339
+ version: "1.4.476",
407340
407340
  description: "Anthropic's agentic coding tool",
407341
407341
  websiteUrl: PRODUCT_URL
407342
407342
  }, {
@@ -422155,7 +422155,7 @@ function computeFingerprint(messageText, version2) {
422155
422155
  }
422156
422156
  function computeFingerprintFromMessages(messages) {
422157
422157
  const firstMessageText = extractFirstMessageText(messages);
422158
- return computeFingerprint(firstMessageText, "1.4.475");
422158
+ return computeFingerprint(firstMessageText, "1.4.476");
422159
422159
  }
422160
422160
  var FINGERPRINT_SALT = "59cf53e54c78";
422161
422161
  var init_fingerprint = () => {};
@@ -422197,7 +422197,7 @@ async function sideQuery(opts) {
422197
422197
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
422198
422198
  }
422199
422199
  const messageText = extractFirstUserMessageText(messages);
422200
- const fingerprint = computeFingerprint(messageText, "1.4.475");
422200
+ const fingerprint = computeFingerprint(messageText, "1.4.476");
422201
422201
  const attributionHeader = getAttributionHeader(fingerprint);
422202
422202
  const systemBlocks = [
422203
422203
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -498695,6 +498695,9 @@ function getContentText(content) {
498695
498695
  }
498696
498696
  return null;
498697
498697
  }
498698
+ function finalizeStreamingThinkingOnTurnEnd(current) {
498699
+ return current && current.isStreaming ? null : current;
498700
+ }
498698
498701
  function handleMessageFromStream(message, onMessage2, onUpdateLength, onSetStreamMode, onStreamingToolUses, onTombstone, onStreamingThinking, onApiMetrics, onStreamingText) {
498699
498702
  if (message.type !== "stream_event" && message.type !== "stream_request_start") {
498700
498703
  if (message.type === "tombstone") {
@@ -521603,9 +521606,9 @@ async function assertMinVersion() {
521603
521606
  if (false) {}
521604
521607
  try {
521605
521608
  const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
521606
- if (versionConfig.minVersion && lt("1.4.475", versionConfig.minVersion)) {
521609
+ if (versionConfig.minVersion && lt("1.4.476", versionConfig.minVersion)) {
521607
521610
  console.error(`
521608
- It looks like your version of RAYU (${"1.4.475"}) needs an update.
521611
+ It looks like your version of RAYU (${"1.4.476"}) needs an update.
521609
521612
  A newer version (${versionConfig.minVersion} or higher) is required to continue.
521610
521613
 
521611
521614
  To update, please run:
@@ -521831,7 +521834,7 @@ async function installGlobalPackage(specificVersion) {
521831
521834
  logError2(new AutoUpdaterError("Another process is currently installing an update"));
521832
521835
  logEvent("tengu_auto_updater_lock_contention", {
521833
521836
  pid: process.pid,
521834
- currentVersion: "1.4.475"
521837
+ currentVersion: "1.4.476"
521835
521838
  });
521836
521839
  return "in_progress";
521837
521840
  }
@@ -521840,7 +521843,7 @@ async function installGlobalPackage(specificVersion) {
521840
521843
  if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
521841
521844
  logError2(new Error("Windows NPM detected in WSL environment"));
521842
521845
  logEvent("tengu_auto_updater_windows_npm_in_wsl", {
521843
- currentVersion: "1.4.475"
521846
+ currentVersion: "1.4.476"
521844
521847
  });
521845
521848
  console.error(`
521846
521849
  Error: Windows NPM detected in WSL
@@ -522368,7 +522371,7 @@ function detectLinuxGlobPatternWarnings() {
522368
522371
  }
522369
522372
  async function getDoctorDiagnostic() {
522370
522373
  const installationType = await getCurrentInstallationType();
522371
- const version2 = typeof MACRO !== "undefined" ? "1.4.475" : "unknown";
522374
+ const version2 = typeof MACRO !== "undefined" ? "1.4.476" : "unknown";
522372
522375
  const installationPath = await getInstallationPath();
522373
522376
  const invokedBinary = getInvokedBinary();
522374
522377
  const multipleInstallations = await detectMultipleInstallations();
@@ -523159,8 +523162,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
523159
523162
  const maxVersion = await getMaxVersion();
523160
523163
  if (maxVersion && gt(version2, maxVersion)) {
523161
523164
  logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
523162
- if (gte("1.4.475", maxVersion)) {
523163
- logForDebugging(`Native installer: current version ${"1.4.475"} is already at or above maxVersion ${maxVersion}, skipping update`);
523165
+ if (gte("1.4.476", maxVersion)) {
523166
+ logForDebugging(`Native installer: current version ${"1.4.476"} is already at or above maxVersion ${maxVersion}, skipping update`);
523164
523167
  logEvent("tengu_native_update_skipped_max_version", {
523165
523168
  latency_ms: Date.now() - startTime2,
523166
523169
  max_version: maxVersion,
@@ -523171,7 +523174,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
523171
523174
  version2 = maxVersion;
523172
523175
  }
523173
523176
  }
523174
- if (!forceReinstall && version2 === "1.4.475" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
523177
+ if (!forceReinstall && version2 === "1.4.476" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
523175
523178
  logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
523176
523179
  logEvent("tengu_native_update_complete", {
523177
523180
  latency_ms: Date.now() - startTime2,
@@ -524379,7 +524382,7 @@ function buildPrimarySection() {
524379
524382
  });
524380
524383
  return [{
524381
524384
  label: "Version",
524382
- value: "1.4.475"
524385
+ value: "1.4.476"
524383
524386
  }, {
524384
524387
  label: "Session name",
524385
524388
  value: nameValue
@@ -528050,7 +528053,7 @@ function Config({
528050
528053
  }
528051
528054
  })
528052
528055
  }) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime168.jsx(ChannelDowngradeDialog, {
528053
- currentVersion: "1.4.475",
528056
+ currentVersion: "1.4.476",
528054
528057
  onChoice: (choice) => {
528055
528058
  setShowSubmenu(null);
528056
528059
  setTabsHidden(false);
@@ -528062,7 +528065,7 @@ function Config({
528062
528065
  autoUpdatesChannel: "stable"
528063
528066
  };
528064
528067
  if (choice === "stay") {
528065
- newSettings.minimumVersion = "1.4.475";
528068
+ newSettings.minimumVersion = "1.4.476";
528066
528069
  }
528067
528070
  updateSettingsForSource("userSettings", newSettings);
528068
528071
  setSettingsData((prev_27) => ({
@@ -536123,7 +536126,7 @@ function HelpV2(t0) {
536123
536126
  let t6;
536124
536127
  if ($3[31] !== tabs) {
536125
536128
  t6 = /* @__PURE__ */ jsx_runtime195.jsx(Tabs, {
536126
- title: `Rayu-CLI v${"1.4.475"}`,
536129
+ title: `Rayu-CLI v${"1.4.476"}`,
536127
536130
  color: "professionalBlue",
536128
536131
  defaultTab: "general",
536129
536132
  children: tabs
@@ -554231,6 +554234,23 @@ import { join as join137 } from "path";
554231
554234
  function configPath2() {
554232
554235
  return join137(getRayuConfigHomeDir(), "telegram.json");
554233
554236
  }
554237
+ function getTelegramMode() {
554238
+ const cfg = readTelegramConfig();
554239
+ if (cfg.mode === "hosted" || cfg.mode === "byo")
554240
+ return cfg.mode;
554241
+ return cfg.botToken && cfg.botToken.trim().length > 0 ? "byo" : "hosted";
554242
+ }
554243
+ function setTelegramMode(mode) {
554244
+ const cfg = readTelegramConfig();
554245
+ cfg.mode = mode;
554246
+ writeTelegramConfig(cfg);
554247
+ }
554248
+ function setLinkedChat(chatId, username) {
554249
+ const cfg = readTelegramConfig();
554250
+ cfg.linkedChatId = chatId;
554251
+ cfg.linkedUsername = username;
554252
+ writeTelegramConfig(cfg);
554253
+ }
554234
554254
  function getBotToken() {
554235
554255
  const cfg = readTelegramConfig();
554236
554256
  if (cfg.botToken && cfg.botToken.trim().length > 0)
@@ -554243,6 +554263,14 @@ function saveBotToken(token) {
554243
554263
  cfg.botToken = token.trim();
554244
554264
  writeTelegramConfig(cfg);
554245
554265
  }
554266
+ function clearBotToken() {
554267
+ const cfg = readTelegramConfig();
554268
+ delete cfg.botToken;
554269
+ delete cfg.pendingToken;
554270
+ delete cfg.linkedChatId;
554271
+ delete cfg.linkedUsername;
554272
+ writeTelegramConfig(cfg);
554273
+ }
554246
554274
  function readTelegramConfig() {
554247
554275
  const path27 = configPath2();
554248
554276
  if (!existsSync25(path27))
@@ -554294,6 +554322,9 @@ var init_telegramConfig = __esm(() => {
554294
554322
  // src/telegram/telegramApi.ts
554295
554323
  import { readFile as readFile45 } from "fs/promises";
554296
554324
  import { existsSync as existsSync26, statSync as statSync13 } from "fs";
554325
+ function setHostedRouter(router) {
554326
+ hostedRouter = router;
554327
+ }
554297
554328
  function escapeHtml(text2) {
554298
554329
  return text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
554299
554330
  }
@@ -554301,6 +554332,8 @@ function url3(token, method) {
554301
554332
  return `${API_BASE2}/bot${token}/${method}`;
554302
554333
  }
554303
554334
  async function callApi(token, method, body) {
554335
+ if (hostedRouter)
554336
+ return hostedRouter.call(method, body);
554304
554337
  const res = await fetch(url3(token, method), {
554305
554338
  method: "POST",
554306
554339
  headers: { "content-type": "application/json" },
@@ -554318,6 +554351,8 @@ async function callApi(token, method, body) {
554318
554351
  return json2.result;
554319
554352
  }
554320
554353
  async function getBotUsername(token) {
554354
+ if (hostedRouter)
554355
+ return hostedRouter.botUsername();
554321
554356
  try {
554322
554357
  const result = await callApi(token, "getMe", {});
554323
554358
  return result.username;
@@ -554326,6 +554361,13 @@ async function getBotUsername(token) {
554326
554361
  }
554327
554362
  }
554328
554363
  async function getUpdates(token, offset, timeoutSec = 50) {
554364
+ if (hostedRouter) {
554365
+ try {
554366
+ return await hostedRouter.getUpdates(offset);
554367
+ } catch {
554368
+ return [];
554369
+ }
554370
+ }
554329
554371
  try {
554330
554372
  const result = await callApi(token, "getUpdates", { offset, timeout: timeoutSec });
554331
554373
  return Array.isArray(result) ? result : [];
@@ -554377,6 +554419,10 @@ async function editMessageText(token, chatId, messageId, text2, parseMode) {
554377
554419
  }
554378
554420
  }
554379
554421
  async function sendPhoto(token, chatId, base64Data, mediaType, caption) {
554422
+ if (hostedRouter) {
554423
+ await sendMessage3(token, chatId, caption ?? "\uD83D\uDDBC Image generated (view it in the CLI).");
554424
+ return;
554425
+ }
554380
554426
  const ext = mediaType.includes("jpeg") || mediaType.includes("jpg") ? "jpg" : "png";
554381
554427
  const buffer = Buffer.from(base64Data, "base64");
554382
554428
  const blob2 = new Blob([buffer], { type: mediaType });
@@ -554392,6 +554438,10 @@ async function sendPhoto(token, chatId, base64Data, mediaType, caption) {
554392
554438
  }
554393
554439
  }
554394
554440
  async function sendVideo(token, chatId, filePath, caption) {
554441
+ if (hostedRouter) {
554442
+ await sendMessage3(token, chatId, caption ?? "\uD83C\uDFAC Video generated (view it in the CLI).");
554443
+ return;
554444
+ }
554395
554445
  if (!existsSync26(filePath)) {
554396
554446
  await sendMessage3(token, chatId, `\uD83C\uDFAC Video generated but file not found: ${filePath}`);
554397
554447
  return;
@@ -554470,6 +554520,8 @@ async function setMyCommands(token, commands) {
554470
554520
  } catch {}
554471
554521
  }
554472
554522
  async function getFile(token, fileId) {
554523
+ if (hostedRouter)
554524
+ return;
554473
554525
  try {
554474
554526
  const result = await callApi(token, "getFile", { file_id: fileId });
554475
554527
  return result.file_path;
@@ -554478,6 +554530,8 @@ async function getFile(token, fileId) {
554478
554530
  }
554479
554531
  }
554480
554532
  async function downloadFileAsBase64(token, filePath) {
554533
+ if (hostedRouter)
554534
+ return;
554481
554535
  try {
554482
554536
  const fileUrl = `${API_BASE2}/file/bot${token}/${filePath}`;
554483
554537
  const res = await fetch(fileUrl);
@@ -554503,31 +554557,321 @@ async function downloadFileAsBase64(token, filePath) {
554503
554557
  return;
554504
554558
  }
554505
554559
  }
554506
- var API_BASE2 = "https://api.telegram.org", MAX_MESSAGE_CHARS = 4096, MAX_FILE_BYTES;
554560
+ var API_BASE2 = "https://api.telegram.org", MAX_MESSAGE_CHARS = 4096, hostedRouter = null, MAX_FILE_BYTES;
554507
554561
  var init_telegramApi = __esm(() => {
554508
554562
  MAX_FILE_BYTES = 50 * 1024 * 1024;
554509
554563
  });
554510
554564
 
554565
+ // src/telegram/telegramHostedApi.ts
554566
+ async function authedFetch(path27, init2) {
554567
+ const token = await getValidRayuAccessToken();
554568
+ if (!token)
554569
+ throw new Error("Not signed in to Rayu");
554570
+ return globalThis.fetch(`${getRayuApiBaseUrl()}${path27}`, {
554571
+ method: init2?.method ?? "GET",
554572
+ headers: {
554573
+ Authorization: `Bearer ${token}`,
554574
+ ...init2?.body ? { "content-type": "application/json" } : {}
554575
+ },
554576
+ ...init2?.body ? { body: init2.body } : {}
554577
+ });
554578
+ }
554579
+ async function getHostedBotInfo() {
554580
+ try {
554581
+ const res = await authedFetch("/telegram/bot");
554582
+ if (!res.ok)
554583
+ return { configured: false, username: null };
554584
+ return await res.json();
554585
+ } catch {
554586
+ return { configured: false, username: null };
554587
+ }
554588
+ }
554589
+ async function createHostedPairing() {
554590
+ try {
554591
+ const res = await authedFetch("/telegram/pair", { method: "POST" });
554592
+ if (!res.ok)
554593
+ return null;
554594
+ return await res.json();
554595
+ } catch {
554596
+ return null;
554597
+ }
554598
+ }
554599
+ async function getHostedLink() {
554600
+ try {
554601
+ const res = await authedFetch("/telegram/link");
554602
+ if (!res.ok)
554603
+ return { linked: false };
554604
+ return await res.json();
554605
+ } catch {
554606
+ return { linked: false };
554607
+ }
554608
+ }
554609
+ async function deleteHostedLink() {
554610
+ try {
554611
+ await authedFetch("/telegram/link", { method: "DELETE" });
554612
+ } catch {}
554613
+ }
554614
+ async function getHostedUpdates(after) {
554615
+ try {
554616
+ const res = await authedFetch(`/telegram/updates?after=${after}`);
554617
+ if (!res.ok)
554618
+ return { linked: false, updates: [] };
554619
+ return await res.json();
554620
+ } catch {
554621
+ return { linked: false, updates: [] };
554622
+ }
554623
+ }
554624
+ async function relayHostedSend(method, params) {
554625
+ const res = await authedFetch("/telegram/send", {
554626
+ method: "POST",
554627
+ body: JSON.stringify({ method, params })
554628
+ });
554629
+ if (!res.ok)
554630
+ throw new Error(`hosted relay ${method} failed: ${res.status}`);
554631
+ const json2 = await res.json();
554632
+ return json2.result;
554633
+ }
554634
+ var init_telegramHostedApi = __esm(() => {
554635
+ init_rayuSession();
554636
+ });
554637
+
554511
554638
  // src/commands/telegram-bot/telegram-bot.tsx
554512
554639
  var exports_telegram_bot = {};
554513
554640
  __export(exports_telegram_bot, {
554514
554641
  call: () => call20
554515
554642
  });
554516
554643
  import { randomUUID as randomUUID29 } from "crypto";
554517
- function TokenInputStep({ onTokenSaved }) {
554518
- const [input, setInput] = import_react132.useState("");
554644
+ function useKeyPress(target, handler) {
554645
+ import_react132.useEffect(() => {
554646
+ const onData = (data) => {
554647
+ const ch2 = data.toString().trim().toLowerCase();
554648
+ if (ch2 === target)
554649
+ handler();
554650
+ };
554651
+ process.stdin.on("data", onData);
554652
+ return () => {
554653
+ process.stdin.off("data", onData);
554654
+ };
554655
+ }, [target, handler]);
554656
+ }
554657
+ function HostedStep({
554658
+ onDone,
554659
+ onUseByo
554660
+ }) {
554661
+ const [status, setStatus] = import_react132.useState("loading");
554662
+ const [pairing, setPairing] = import_react132.useState(null);
554663
+ const [qr, setQr] = import_react132.useState("");
554664
+ const setAppState = useSetAppState();
554665
+ useKeyPress("b", onUseByo);
554666
+ import_react132.useEffect(() => {
554667
+ let cancelled = false;
554668
+ (async () => {
554669
+ if (!hasRayuSession()) {
554670
+ if (!cancelled)
554671
+ setStatus("nosession");
554672
+ return;
554673
+ }
554674
+ const info = await getHostedBotInfo();
554675
+ if (cancelled)
554676
+ return;
554677
+ if (!info.configured) {
554678
+ setStatus("unconfigured");
554679
+ return;
554680
+ }
554681
+ const p = await createHostedPairing();
554682
+ if (cancelled)
554683
+ return;
554684
+ if (!p) {
554685
+ setStatus("error");
554686
+ return;
554687
+ }
554688
+ setTelegramMode("hosted");
554689
+ setPairing(p);
554690
+ setStatus("ready");
554691
+ if (p.deepLink) {
554692
+ try {
554693
+ setQr(await $toString(p.deepLink, { type: "utf8", errorCorrectionLevel: "L" }));
554694
+ } catch {}
554695
+ }
554696
+ })();
554697
+ return () => {
554698
+ cancelled = true;
554699
+ };
554700
+ }, []);
554701
+ import_react132.useEffect(() => {
554702
+ if (status !== "ready")
554703
+ return;
554704
+ const timer = setInterval(() => {
554705
+ getHostedLink().then((link5) => {
554706
+ if (!link5.linked)
554707
+ return;
554708
+ clearInterval(timer);
554709
+ if (link5.chatId)
554710
+ setLinkedChat(Number(link5.chatId), link5.username ?? undefined);
554711
+ setAppState((prev) => ({ ...prev, telegramBridgeActive: true }));
554712
+ onDone();
554713
+ });
554714
+ }, 1500);
554715
+ return () => clearInterval(timer);
554716
+ }, [status, onDone, setAppState]);
554717
+ if (status === "loading") {
554718
+ return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
554719
+ children: /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554720
+ dimColor: true,
554721
+ children: "Connecting to the Rayu Telegram bot…"
554722
+ })
554723
+ });
554724
+ }
554725
+ if (status === "nosession") {
554726
+ return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
554727
+ children: /* @__PURE__ */ jsx_runtime222.jsxs(ThemedBox_default, {
554728
+ flexDirection: "column",
554729
+ children: [
554730
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554731
+ bold: true,
554732
+ children: "\uD83D\uDCF1 Connect Telegram"
554733
+ }),
554734
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554735
+ children: " "
554736
+ }),
554737
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554738
+ color: "yellow",
554739
+ children: "Sign in first: run /login to use the shared Rayu bot."
554740
+ }),
554741
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554742
+ children: " "
554743
+ }),
554744
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
554745
+ dimColor: true,
554746
+ children: [
554747
+ "Or press ",
554748
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554749
+ bold: true,
554750
+ children: "b"
554751
+ }),
554752
+ " to connect your own bot token instead."
554753
+ ]
554754
+ })
554755
+ ]
554756
+ })
554757
+ });
554758
+ }
554759
+ if (status === "unconfigured" || status === "error") {
554760
+ return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
554761
+ children: /* @__PURE__ */ jsx_runtime222.jsxs(ThemedBox_default, {
554762
+ flexDirection: "column",
554763
+ children: [
554764
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554765
+ bold: true,
554766
+ children: "\uD83D\uDCF1 Connect Telegram"
554767
+ }),
554768
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554769
+ children: " "
554770
+ }),
554771
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554772
+ color: "yellow",
554773
+ children: status === "unconfigured" ? "The shared Rayu Telegram bot isn't available right now." : "Couldn't reach the Rayu Telegram service."
554774
+ }),
554775
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554776
+ children: " "
554777
+ }),
554778
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
554779
+ children: [
554780
+ "Press ",
554781
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554782
+ bold: true,
554783
+ children: "b"
554784
+ }),
554785
+ " to connect your own bot token instead."
554786
+ ]
554787
+ })
554788
+ ]
554789
+ })
554790
+ });
554791
+ }
554792
+ const lines2 = qr.split(`
554793
+ `).filter((l3) => l3.length > 0);
554794
+ const bot = pairing?.botUsername;
554795
+ return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
554796
+ children: /* @__PURE__ */ jsx_runtime222.jsxs(ThemedBox_default, {
554797
+ flexDirection: "column",
554798
+ children: [
554799
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554800
+ bold: true,
554801
+ children: "\uD83D\uDCF1 Connect Telegram (Rayu bot — no setup needed)"
554802
+ }),
554803
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554804
+ children: " "
554805
+ }),
554806
+ lines2.map((line, i4) => /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554807
+ children: line
554808
+ }, i4)),
554809
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554810
+ children: " "
554811
+ }),
554812
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
554813
+ children: [
554814
+ "Scan the QR",
554815
+ bot ? ` to open @${bot}` : "",
554816
+ ", or open the bot and send:"
554817
+ ]
554818
+ }),
554819
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
554820
+ bold: true,
554821
+ children: [
554822
+ " /start ",
554823
+ pairing?.code
554824
+ ]
554825
+ }),
554826
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554827
+ children: " "
554828
+ }),
554829
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554830
+ dimColor: true,
554831
+ children: "Waiting for you to link… (code valid 10 min)"
554832
+ }),
554833
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
554834
+ dimColor: true,
554835
+ children: [
554836
+ "Press ",
554837
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554838
+ bold: true,
554839
+ children: "b"
554840
+ }),
554841
+ " to use your own bot token instead."
554842
+ ]
554843
+ })
554844
+ ]
554845
+ })
554846
+ });
554847
+ }
554848
+ function TokenInputStep({ onReady }) {
554849
+ const [existing, setExisting] = import_react132.useState(() => getBotToken());
554519
554850
  const [error54, setError] = import_react132.useState("");
554520
554851
  const [waiting, setWaiting] = import_react132.useState(false);
554521
554852
  import_react132.useEffect(() => {
554522
554853
  const handler = (data) => {
554523
554854
  const line = data.toString().trim();
554855
+ if (existing) {
554856
+ if (line === "") {
554857
+ setTelegramMode("byo");
554858
+ onReady();
554859
+ return;
554860
+ }
554861
+ if (line.toLowerCase() === "d") {
554862
+ clearBotToken();
554863
+ setExisting(undefined);
554864
+ setError("");
554865
+ return;
554866
+ }
554867
+ }
554524
554868
  if (!line)
554525
554869
  return;
554526
- setInput(line);
554527
554870
  if (/^\d+:[A-Za-z0-9_-]+$/.test(line)) {
554528
- setWaiting(true);
554529
554871
  saveBotToken(line);
554530
- setTimeout(() => onTokenSaved(), 300);
554872
+ setTelegramMode("byo");
554873
+ setWaiting(true);
554874
+ setTimeout(() => onReady(), 300);
554531
554875
  } else {
554532
554876
  setError("That doesn't look like a valid bot token. It should be like: 123456789:ABCDefGHI...");
554533
554877
  }
@@ -554536,7 +554880,7 @@ function TokenInputStep({ onTokenSaved }) {
554536
554880
  return () => {
554537
554881
  process.stdin.off("data", handler);
554538
554882
  };
554539
- }, [onTokenSaved]);
554883
+ }, [existing, onReady]);
554540
554884
  if (waiting) {
554541
554885
  return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
554542
554886
  children: /* @__PURE__ */ jsx_runtime222.jsxs(ThemedBox_default, {
@@ -554554,19 +554898,65 @@ function TokenInputStep({ onTokenSaved }) {
554554
554898
  })
554555
554899
  });
554556
554900
  }
554901
+ if (existing) {
554902
+ return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
554903
+ children: /* @__PURE__ */ jsx_runtime222.jsxs(ThemedBox_default, {
554904
+ flexDirection: "column",
554905
+ children: [
554906
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554907
+ bold: true,
554908
+ children: "\uD83D\uDCF1 Your Telegram bot token"
554909
+ }),
554910
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554911
+ children: " "
554912
+ }),
554913
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
554914
+ children: [
554915
+ "A bot token is already saved (…",
554916
+ existing.slice(-6),
554917
+ ")."
554918
+ ]
554919
+ }),
554920
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554921
+ children: " "
554922
+ }),
554923
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
554924
+ children: [
554925
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554926
+ bold: true,
554927
+ children: "Enter"
554928
+ }),
554929
+ " connect with it",
554930
+ " ",
554931
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554932
+ bold: true,
554933
+ children: "d"
554934
+ }),
554935
+ " remove it",
554936
+ " ",
554937
+ "or paste a ",
554938
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554939
+ bold: true,
554940
+ children: "new"
554941
+ }),
554942
+ " token to replace it."
554943
+ ]
554944
+ }),
554945
+ error54 ? /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554946
+ color: "red",
554947
+ children: error54
554948
+ }) : null
554949
+ ]
554950
+ })
554951
+ });
554952
+ }
554557
554953
  return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
554558
554954
  children: /* @__PURE__ */ jsx_runtime222.jsxs(ThemedBox_default, {
554559
554955
  flexDirection: "column",
554560
554956
  children: [
554561
554957
  /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554562
554958
  bold: true,
554563
- children: "\uD83D\uDCF1 Connect Telegram Bot"
554564
- }),
554565
- /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554566
- children: " "
554567
- }),
554568
- /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554569
- children: "To connect rayu-cli to Telegram, you need a bot token:"
554959
+ children: "\uD83D\uDCF1 Connect your own Telegram bot"
554570
554960
  }),
554571
554961
  /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
554572
554962
  children: " "
@@ -554680,18 +555070,116 @@ function LinkStep({ onDone }) {
554680
555070
  })
554681
555071
  });
554682
555072
  }
555073
+ function ChooseModeStep({
555074
+ onChoose
555075
+ }) {
555076
+ const [sel, setSel] = import_react132.useState(0);
555077
+ import_react132.useEffect(() => {
555078
+ const onData = (data) => {
555079
+ const s2 = data.toString();
555080
+ const t2 = s2.trim();
555081
+ if (t2 === "1")
555082
+ onChoose("hosted");
555083
+ else if (t2 === "2")
555084
+ onChoose("byo");
555085
+ else if (s2 === "\r" || s2 === `
555086
+ ` || t2 === "")
555087
+ onChoose(sel === 0 ? "hosted" : "byo");
555088
+ else if (s2 === "\x1B[A" || s2 === "\x1B[B" || t2 === "j" || t2 === "k") {
555089
+ setSel((p) => p === 0 ? 1 : 0);
555090
+ }
555091
+ };
555092
+ process.stdin.on("data", onData);
555093
+ return () => {
555094
+ process.stdin.off("data", onData);
555095
+ };
555096
+ }, [onChoose, sel]);
555097
+ return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
555098
+ children: /* @__PURE__ */ jsx_runtime222.jsxs(ThemedBox_default, {
555099
+ flexDirection: "column",
555100
+ children: [
555101
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
555102
+ bold: true,
555103
+ children: "\uD83D\uDCF1 Connect Telegram — choose how"
555104
+ }),
555105
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
555106
+ children: " "
555107
+ }),
555108
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
555109
+ color: sel === 0 ? "cyan" : undefined,
555110
+ children: [
555111
+ sel === 0 ? "▶ " : " ",
555112
+ "1. Rayu shared bot",
555113
+ " ",
555114
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
555115
+ dimColor: true,
555116
+ children: "(recommended — no setup, hosted by Rayu)"
555117
+ })
555118
+ ]
555119
+ }),
555120
+ /* @__PURE__ */ jsx_runtime222.jsxs(ThemedText, {
555121
+ color: sel === 1 ? "cyan" : undefined,
555122
+ children: [
555123
+ sel === 1 ? "▶ " : " ",
555124
+ "2. Your own bot token",
555125
+ " ",
555126
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
555127
+ dimColor: true,
555128
+ children: "(private — direct to Telegram, no server)"
555129
+ })
555130
+ ]
555131
+ }),
555132
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
555133
+ children: " "
555134
+ }),
555135
+ /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
555136
+ dimColor: true,
555137
+ children: "Press 1 or 2 (or ↑/↓ then Enter). Enter = shared bot."
555138
+ })
555139
+ ]
555140
+ })
555141
+ });
555142
+ }
554683
555143
  function TelegramBotConnect({ onDone }) {
554684
- const [hasToken, setHasToken] = import_react132.useState(() => !!getBotToken());
555144
+ const alreadyLinked = readTelegramConfig().linkedChatId !== undefined;
554685
555145
  const setAppState = useSetAppState();
555146
+ const [screen, setScreen] = import_react132.useState("choose");
554686
555147
  import_react132.useEffect(() => {
554687
- if (hasToken && readTelegramConfig().linkedChatId !== undefined) {
555148
+ if (alreadyLinked) {
554688
555149
  setAppState((prev) => ({ ...prev, telegramBridgeActive: true }));
554689
555150
  onDone();
554690
555151
  }
554691
- }, [hasToken, onDone, setAppState]);
554692
- if (!hasToken) {
555152
+ }, [alreadyLinked, onDone, setAppState]);
555153
+ if (alreadyLinked) {
555154
+ return /* @__PURE__ */ jsx_runtime222.jsx(Pane, {
555155
+ children: /* @__PURE__ */ jsx_runtime222.jsx(ThemedText, {
555156
+ dimColor: true,
555157
+ children: "Reconnecting Telegram…"
555158
+ })
555159
+ });
555160
+ }
555161
+ if (screen === "choose") {
555162
+ return /* @__PURE__ */ jsx_runtime222.jsx(ChooseModeStep, {
555163
+ onChoose: (mode) => {
555164
+ if (mode === "hosted") {
555165
+ setTelegramMode("hosted");
555166
+ setScreen("hosted");
555167
+ } else {
555168
+ setTelegramMode("byo");
555169
+ setScreen("byo-token");
555170
+ }
555171
+ }
555172
+ });
555173
+ }
555174
+ if (screen === "hosted") {
555175
+ return /* @__PURE__ */ jsx_runtime222.jsx(HostedStep, {
555176
+ onDone,
555177
+ onUseByo: () => setScreen("byo-token")
555178
+ });
555179
+ }
555180
+ if (screen === "byo-token") {
554693
555181
  return /* @__PURE__ */ jsx_runtime222.jsx(TokenInputStep, {
554694
- onTokenSaved: () => setHasToken(true)
555182
+ onReady: () => setScreen("byo-link")
554695
555183
  });
554696
555184
  }
554697
555185
  return /* @__PURE__ */ jsx_runtime222.jsx(LinkStep, {
@@ -554710,6 +555198,8 @@ var init_telegram_bot = __esm(() => {
554710
555198
  init_ink2();
554711
555199
  init_telegramConfig();
554712
555200
  init_telegramApi();
555201
+ init_telegramHostedApi();
555202
+ init_rayuSession();
554713
555203
  init_AppState();
554714
555204
  import_react132 = __toESM(require_react(), 1);
554715
555205
  jsx_runtime222 = __toESM(require_jsx_runtime(), 1);
@@ -554740,9 +555230,16 @@ async function call21() {
554740
555230
  return { type: "text", value: "Telegram bot is not currently linked." };
554741
555231
  }
554742
555232
  const username = config5.linkedUsername ? `@${config5.linkedUsername}` : "the linked chat";
554743
- const token = getBotToken();
554744
- if (token) {
554745
- sendMessage3(token, config5.linkedChatId, "\uD83D\uDD0C CLI disconnected. Run `/telegram-bot` to link again.").catch(() => {});
555233
+ if (getTelegramMode() === "hosted") {
555234
+ await relayHostedSend("sendMessage", {
555235
+ text: "\uD83D\uDD0C CLI disconnected. Run /telegram-bot to link again."
555236
+ }).catch(() => {});
555237
+ await deleteHostedLink();
555238
+ } else {
555239
+ const token = getBotToken();
555240
+ if (token) {
555241
+ sendMessage3(token, config5.linkedChatId, "\uD83D\uDD0C CLI disconnected. Run `/telegram-bot` to link again.").catch(() => {});
555242
+ }
554746
555243
  }
554747
555244
  unlink18();
554748
555245
  return { type: "text", value: `Disconnected Telegram bot (was linked to ${username}).` };
@@ -554750,6 +555247,7 @@ async function call21() {
554750
555247
  var init_disconnect = __esm(() => {
554751
555248
  init_telegramConfig();
554752
555249
  init_telegramApi();
555250
+ init_telegramHostedApi();
554753
555251
  });
554754
555252
 
554755
555253
  // src/commands/telegram-bot/disconnect-index.ts
@@ -556206,7 +556704,7 @@ function getRecentReleaseNotes(currentVersion, previousVersion, changelogContent
556206
556704
  }
556207
556705
  return [];
556208
556706
  }
556209
- async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.4.475") {
556707
+ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.4.476") {
556210
556708
  if (false) {}
556211
556709
  const cachedChangelog = await getStoredChangelog();
556212
556710
  if (lastSeenVersion !== currentVersion || !cachedChangelog) {
@@ -556219,7 +556717,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.4.475")
556219
556717
  releaseNotes
556220
556718
  };
556221
556719
  }
556222
- function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.4.475") {
556720
+ function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.4.476") {
556223
556721
  if (false) {}
556224
556722
  const releaseNotes = getRecentReleaseNotes(currentVersion, lastSeenVersion);
556225
556723
  return {
@@ -556347,7 +556845,7 @@ function getRecentActivitySync() {
556347
556845
  return cachedActivity;
556348
556846
  }
556349
556847
  function getLogoDisplayData() {
556350
- const version2 = process.env.DEMO_VERSION ?? "1.4.475";
556848
+ const version2 = process.env.DEMO_VERSION ?? "1.4.476";
556351
556849
  const serverUrl = getDirectConnectServerUrl();
556352
556850
  const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
556353
556851
  const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
@@ -557512,7 +558010,7 @@ function LogoV2() {
557512
558010
  if ($3[2] === Symbol.for("react.memo_cache_sentinel")) {
557513
558011
  t2 = () => {
557514
558012
  const currentConfig = getGlobalConfig();
557515
- if (currentConfig.lastReleaseNotesSeen === "1.4.475") {
558013
+ if (currentConfig.lastReleaseNotesSeen === "1.4.476") {
557516
558014
  return;
557517
558015
  }
557518
558016
  saveGlobalConfig(_temp327);
@@ -557991,7 +558489,7 @@ function LogoV2() {
557991
558489
  t24 = $3[61];
557992
558490
  }
557993
558491
  const _latestNpm = getCachedLatestNpmVersionSync();
557994
- const _updateFeeds = _latestNpm && gt(_latestNpm, "1.4.475") ? [createUpdateAvailableFeed("1.4.475", _latestNpm)] : [];
558492
+ const _updateFeeds = _latestNpm && gt(_latestNpm, "1.4.476") ? [createUpdateAvailableFeed("1.4.476", _latestNpm)] : [];
557995
558493
  const t25 = layoutMode === "horizontal" && /* @__PURE__ */ jsx_runtime236.jsx(FeedColumn, {
557996
558494
  feeds: showOnboarding ? [createProjectOnboardingFeed(getSteps()), createRecentActivityFeed(activities)] : showGuestPassesUpsell ? [createRecentActivityFeed(activities), createGuestPassesFeed()] : showOverageCreditUpsell ? [createRecentActivityFeed(activities), createOverageCreditFeed()] : [createRecentActivityFeed(activities), ..._updateFeeds, createWhatsNewFeed(changelog)],
557997
558495
  maxWidth: rightWidth
@@ -558191,12 +558689,12 @@ function LogoV2() {
558191
558689
  return t41;
558192
558690
  }
558193
558691
  function _temp327(current) {
558194
- if (current.lastReleaseNotesSeen === "1.4.475") {
558692
+ if (current.lastReleaseNotesSeen === "1.4.476") {
558195
558693
  return current;
558196
558694
  }
558197
558695
  return {
558198
558696
  ...current,
558199
- lastReleaseNotesSeen: "1.4.475"
558697
+ lastReleaseNotesSeen: "1.4.476"
558200
558698
  };
558201
558699
  }
558202
558700
  function _temp241(s_0) {
@@ -583195,7 +583693,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
583195
583693
  smapsRollup,
583196
583694
  platform: process.platform,
583197
583695
  nodeVersion: process.version,
583198
- ccVersion: "1.4.475"
583696
+ ccVersion: "1.4.476"
583199
583697
  };
583200
583698
  }
583201
583699
  async function performHeapDump(trigger = "manual", dumpNumber = 0) {
@@ -583717,7 +584215,7 @@ var init_bridge_kick = __esm(() => {
583717
584215
  var call50 = async () => {
583718
584216
  return {
583719
584217
  type: "text",
583720
- value: "1.4.475"
584218
+ value: "1.4.476"
583721
584219
  };
583722
584220
  }, version2, version_default;
583723
584221
  var init_version = __esm(() => {
@@ -594213,7 +594711,7 @@ function generateHtmlReport(data, insights) {
594213
594711
  </html>`;
594214
594712
  }
594215
594713
  function buildExportData(data, insights, facets, remoteStats) {
594216
- const version3 = typeof MACRO !== "undefined" ? "1.4.475" : "unknown";
594714
+ const version3 = typeof MACRO !== "undefined" ? "1.4.476" : "unknown";
594217
594715
  const remote_hosts_collected = remoteStats?.hosts.filter((h3) => h3.sessionCount > 0).map((h3) => h3.name);
594218
594716
  const facets_summary = {
594219
594717
  total: facets.size,
@@ -598127,7 +598625,7 @@ var init_sessionStorage = __esm(() => {
598127
598625
  init_settings2();
598128
598626
  init_slowOperations();
598129
598627
  init_uuid();
598130
- VERSION6 = typeof MACRO !== "undefined" ? "1.4.475" : "unknown";
598628
+ VERSION6 = typeof MACRO !== "undefined" ? "1.4.476" : "unknown";
598131
598629
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
598132
598630
  SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
598133
598631
  EPHEMERAL_PROGRESS_TYPES = new Set([
@@ -599345,7 +599843,7 @@ var init_filesystem = __esm(() => {
599345
599843
  });
599346
599844
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
599347
599845
  const nonce = randomBytes19(16).toString("hex");
599348
- return join153(getClaudeTempDir(), "bundled-skills", "1.4.475", nonce);
599846
+ return join153(getClaudeTempDir(), "bundled-skills", "1.4.476", nonce);
599349
599847
  });
599350
599848
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
599351
599849
  });
@@ -604515,7 +605013,7 @@ __export(exports_update, {
604515
605013
  update: () => update
604516
605014
  });
604517
605015
  async function update() {
604518
- writeToStdout(`Current version: ${"1.4.475"}
605016
+ writeToStdout(`Current version: ${"1.4.476"}
604519
605017
  `);
604520
605018
  const isBundled = isInBundledMode();
604521
605019
  if (isBundled) {
@@ -604546,13 +605044,13 @@ Manual check: npm view ${"@rayu-dev/rayu-cli"} version
604546
605044
  process.exit(1);
604547
605045
  return;
604548
605046
  }
604549
- if (latestVersion === "1.4.475") {
605047
+ if (latestVersion === "1.4.476") {
604550
605048
  writeToStdout(source_default.green(`
604551
- Rayu CLI is up to date (${"1.4.475"})
605049
+ Rayu CLI is up to date (${"1.4.476"})
604552
605050
  `));
604553
605051
  process.exit(0);
604554
605052
  }
604555
- writeToStdout(`New version available: ${latestVersion} (current: ${"1.4.475"})
605053
+ writeToStdout(`New version available: ${latestVersion} (current: ${"1.4.476"})
604556
605054
  `);
604557
605055
  writeToStdout(`Installing update...
604558
605056
 
@@ -604619,14 +605117,14 @@ async function updateNativeBinary() {
604619
605117
  } catch {
604620
605118
  latestVersion = "";
604621
605119
  }
604622
- if (latestVersion && latestVersion === "1.4.475") {
605120
+ if (latestVersion && latestVersion === "1.4.476") {
604623
605121
  writeToStdout(source_default.green(`
604624
- Rayu CLI is up to date (1.4.475)
605122
+ Rayu CLI is up to date (1.4.476)
604625
605123
  `));
604626
605124
  process.exit(0);
604627
605125
  }
604628
605126
  if (latestVersion) {
604629
- writeToStdout(`New version available: ${latestVersion} (current: 1.4.475)
605127
+ writeToStdout(`New version available: ${latestVersion} (current: 1.4.476)
604630
605128
  `);
604631
605129
  }
604632
605130
  writeToStdout(`Downloading and installing update...
@@ -604641,13 +605139,13 @@ Rayu CLI is up to date (1.4.475)
604641
605139
  return;
604642
605140
  }
604643
605141
  writeToStdout(source_default.green(`
604644
- Rayu CLI is up to date (1.4.475)
605142
+ Rayu CLI is up to date (1.4.476)
604645
605143
  `));
604646
605144
  process.exit(0);
604647
605145
  }
604648
605146
  const updatedTo = result.latestVersion ?? latestVersion ?? "latest";
604649
605147
  writeToStdout(source_default.green(`
604650
- Successfully updated from 1.4.475 to ${updatedTo}
605148
+ Successfully updated from 1.4.476 to ${updatedTo}
604651
605149
  `));
604652
605150
  writeToStdout(`Restart your terminal to use the new version.
604653
605151
  `);
@@ -604712,7 +605210,7 @@ async function removeDataDir(dir) {
604712
605210
  async function uninstall(args = []) {
604713
605211
  const yes = args.includes("--yes") || args.includes("-y");
604714
605212
  const keepData = args.includes("--keep-data");
604715
- writeToStdout(`Uninstalling Rayu CLI (${"1.4.475"})...
605213
+ writeToStdout(`Uninstalling Rayu CLI (${"1.4.476"})...
604716
605214
  `);
604717
605215
  writeToStdout(`Running: npm uninstall -g ${"@rayu-dev/rayu-cli"}
604718
605216
 
@@ -604746,7 +605244,7 @@ This looks like a permissions error on npm's global install
604746
605244
  return;
604747
605245
  }
604748
605246
  writeToStdout(source_default.green(`
604749
- Successfully uninstalled ${"@rayu-dev/rayu-cli"} ${"1.4.475"}
605247
+ Successfully uninstalled ${"@rayu-dev/rayu-cli"} ${"1.4.476"}
604750
605248
  `));
604751
605249
  const configDir = getRayuConfigHomeDir();
604752
605250
  const dataExists = existsSync28(configDir);
@@ -604829,7 +605327,7 @@ function showFirstRunWelcome() {
604829
605327
  `);
604830
605328
  try {
604831
605329
  mkdirSync16(getRayuConfigHomeDir(), { recursive: true });
604832
- writeFileSync18(markerPath(), "1.4.475", "utf8");
605330
+ writeFileSync18(markerPath(), "1.4.476", "utf8");
604833
605331
  } catch {}
604834
605332
  }
604835
605333
  var init_firstRun = __esm(() => {
@@ -621015,7 +621513,7 @@ async function initializeBetaTracing(resource) {
621015
621513
  });
621016
621514
  import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
621017
621515
  setLoggerProvider(loggerProvider);
621018
- const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.4.475");
621516
+ const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.4.476");
621019
621517
  setEventLogger(eventLogger);
621020
621518
  process.on("beforeExit", async () => {
621021
621519
  await loggerProvider?.forceFlush();
@@ -621055,7 +621553,7 @@ async function initializeTelemetry() {
621055
621553
  const platform4 = getPlatform();
621056
621554
  const baseAttributes = {
621057
621555
  [import_semantic_conventions.ATTR_SERVICE_NAME]: "claude-code",
621058
- [import_semantic_conventions.ATTR_SERVICE_VERSION]: "1.4.475"
621556
+ [import_semantic_conventions.ATTR_SERVICE_VERSION]: "1.4.476"
621059
621557
  };
621060
621558
  if (platform4 === "wsl") {
621061
621559
  const wslVersion = getWslVersion();
@@ -621100,7 +621598,7 @@ async function initializeTelemetry() {
621100
621598
  } catch {}
621101
621599
  };
621102
621600
  registerCleanup(shutdownTelemetry2);
621103
- return meterProvider2.getMeter("com.anthropic.claude_code", "1.4.475");
621601
+ return meterProvider2.getMeter("com.anthropic.claude_code", "1.4.476");
621104
621602
  }
621105
621603
  const meterProvider = new import_sdk_metrics2.MeterProvider({
621106
621604
  resource,
@@ -621120,7 +621618,7 @@ async function initializeTelemetry() {
621120
621618
  });
621121
621619
  import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
621122
621620
  setLoggerProvider(loggerProvider);
621123
- const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.4.475");
621621
+ const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.4.476");
621124
621622
  setEventLogger(eventLogger);
621125
621623
  logForDebugging("[3P telemetry] Event logger set successfully");
621126
621624
  process.on("beforeExit", async () => {
@@ -621182,7 +621680,7 @@ Current timeout: ${timeoutMs}ms
621182
621680
  }
621183
621681
  };
621184
621682
  registerCleanup(shutdownTelemetry);
621185
- return meterProvider.getMeter("com.anthropic.claude_code", "1.4.475");
621683
+ return meterProvider.getMeter("com.anthropic.claude_code", "1.4.476");
621186
621684
  }
621187
621685
  async function flushTelemetry() {
621188
621686
  const meterProvider = getMeterProvider();
@@ -622684,7 +623182,7 @@ function buildSystemInitMessage(inputs) {
622684
623182
  slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
622685
623183
  apiKeySource: getAnthropicApiKeyWithSource().source,
622686
623184
  betas: getSdkBetas(),
622687
- claude_code_version: "1.4.475",
623185
+ claude_code_version: "1.4.476",
622688
623186
  output_style: outputStyle2,
622689
623187
  agents: inputs.agents.map((agent) => agent.agentType),
622690
623188
  skills: inputs.skills.filter((s2) => s2.userInvocable !== false).map((skill) => skill.name),
@@ -624097,6 +624595,37 @@ var init_telegramBridge = __esm(() => {
624097
624595
  ]);
624098
624596
  });
624099
624597
 
624598
+ // src/telegram/telegramTransport.ts
624599
+ function createHostedRouter() {
624600
+ let after = 0;
624601
+ return {
624602
+ async getUpdates() {
624603
+ const batch = await getHostedUpdates(after);
624604
+ for (const row of batch.updates) {
624605
+ if (row.id > after)
624606
+ after = row.id;
624607
+ }
624608
+ return batch.updates.map((row) => row.update);
624609
+ },
624610
+ async call(method, params) {
624611
+ if (method === "getMe") {
624612
+ const info = await getHostedBotInfo();
624613
+ return { username: info.username ?? undefined };
624614
+ }
624615
+ if (method === "setMyCommands")
624616
+ return {};
624617
+ return relayHostedSend(method, params);
624618
+ },
624619
+ async botUsername() {
624620
+ const info = await getHostedBotInfo();
624621
+ return info.username ?? undefined;
624622
+ }
624623
+ };
624624
+ }
624625
+ var init_telegramTransport = __esm(() => {
624626
+ init_telegramHostedApi();
624627
+ });
624628
+
624100
624629
  // src/hooks/useTelegramBridge.tsx
624101
624630
  function isToolResultMessage2(msg) {
624102
624631
  if (msg.type !== "user")
@@ -624115,19 +624644,29 @@ function useTelegramBridge(messages) {
624115
624644
  import_react187.useEffect(() => {
624116
624645
  if (!bridgeActive)
624117
624646
  return;
624118
- const token = getBotToken();
624119
- if (!token)
624120
- return;
624647
+ const mode = getTelegramMode();
624648
+ let token;
624649
+ if (mode === "hosted") {
624650
+ if (!hasRayuSession())
624651
+ return;
624652
+ setHostedRouter(createHostedRouter());
624653
+ token = "hosted";
624654
+ } else {
624655
+ const byo = getBotToken();
624656
+ if (!byo)
624657
+ return;
624658
+ setHostedRouter(null);
624659
+ token = byo;
624660
+ }
624121
624661
  const handle = initTelegramBridge({ token });
624122
624662
  handleRef.current = handle;
624123
624663
  setAppState((prev) => ({ ...prev, telegramPermissionCallbacks: handle.permissionCallbacks }));
624124
624664
  return () => {
624125
624665
  handle.endTurn();
624126
624666
  const chatId = readTelegramConfig().linkedChatId;
624127
- if (chatId && token) {
624128
- sendMessage3(token, chatId, "\uD83D\uDD0C Session closed — rayu-cli disconnected.").catch(() => {});
624129
- }
624667
+ const notice = chatId !== undefined ? sendMessage3(token, chatId, "\uD83D\uDD0C Session closed — rayu-cli disconnected.").catch(() => {}) : Promise.resolve();
624130
624668
  handle.stop();
624669
+ notice.finally(() => setHostedRouter(null));
624131
624670
  handleRef.current = null;
624132
624671
  lastSentIndexRef.current = 0;
624133
624672
  inTurnRef.current = false;
@@ -624185,6 +624724,8 @@ var init_useTelegramBridge = __esm(() => {
624185
624724
  init_telegramBridge();
624186
624725
  init_formatActivity();
624187
624726
  init_telegramApi();
624727
+ init_telegramTransport();
624728
+ init_rayuSession();
624188
624729
  init_AppState();
624189
624730
  import_react187 = __toESM(require_react(), 1);
624190
624731
  });
@@ -639015,7 +639556,7 @@ var init_useVoiceEnabled = __esm(() => {
639015
639556
  function getSemverPart(version3) {
639016
639557
  return `${import_semver12.major(version3, { loose: true })}.${import_semver12.minor(version3, { loose: true })}.${import_semver12.patch(version3, { loose: true })}`;
639017
639558
  }
639018
- function useUpdateNotification(updatedVersion, initialVersion = "1.4.475") {
639559
+ function useUpdateNotification(updatedVersion, initialVersion = "1.4.476") {
639019
639560
  const [lastNotifiedSemver, setLastNotifiedSemver] = import_react217.useState(() => getSemverPart(initialVersion));
639020
639561
  if (!updatedVersion) {
639021
639562
  return null;
@@ -639055,7 +639596,7 @@ function AutoUpdater({
639055
639596
  return;
639056
639597
  }
639057
639598
  if (false) {}
639058
- const currentVersion = "1.4.475";
639599
+ const currentVersion = "1.4.476";
639059
639600
  const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
639060
639601
  let latestVersion = await getLatestVersion(channel2);
639061
639602
  const isDisabled = isAutoUpdaterDisabled();
@@ -639268,12 +639809,12 @@ function NativeAutoUpdater({
639268
639809
  logEvent("tengu_native_auto_updater_start", {});
639269
639810
  try {
639270
639811
  const maxVersion = await getMaxVersion();
639271
- if (maxVersion && gt("1.4.475", maxVersion)) {
639812
+ if (maxVersion && gt("1.4.476", maxVersion)) {
639272
639813
  const msg = await getMaxVersionMessage();
639273
639814
  setMaxVersionIssue(msg ?? "affects your version");
639274
639815
  }
639275
639816
  const result = await installLatest(channel2);
639276
- const currentVersion = "1.4.475";
639817
+ const currentVersion = "1.4.476";
639277
639818
  const latencyMs = Date.now() - startTime2;
639278
639819
  if (result.lockFailed) {
639279
639820
  logEvent("tengu_native_auto_updater_lock_contention", {
@@ -639410,17 +639951,17 @@ function PackageManagerAutoUpdater(t0) {
639410
639951
  const maxVersion = await getMaxVersion();
639411
639952
  if (maxVersion && latest && gt(latest, maxVersion)) {
639412
639953
  logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
639413
- if (gte("1.4.475", maxVersion)) {
639414
- logForDebugging(`PackageManagerAutoUpdater: current version ${"1.4.475"} is already at or above maxVersion ${maxVersion}, skipping update`);
639954
+ if (gte("1.4.476", maxVersion)) {
639955
+ logForDebugging(`PackageManagerAutoUpdater: current version ${"1.4.476"} is already at or above maxVersion ${maxVersion}, skipping update`);
639415
639956
  setUpdateAvailable(false);
639416
639957
  return;
639417
639958
  }
639418
639959
  latest = maxVersion;
639419
639960
  }
639420
- const hasUpdate = latest && !gte("1.4.475", latest) && !shouldSkipVersion(latest);
639961
+ const hasUpdate = latest && !gte("1.4.476", latest) && !shouldSkipVersion(latest);
639421
639962
  setUpdateAvailable(!!hasUpdate);
639422
639963
  if (hasUpdate) {
639423
- logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.4.475"} -> ${latest}`);
639964
+ logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.4.476"} -> ${latest}`);
639424
639965
  }
639425
639966
  };
639426
639967
  $3[0] = t1;
@@ -639454,7 +639995,7 @@ function PackageManagerAutoUpdater(t0) {
639454
639995
  wrap: "truncate",
639455
639996
  children: [
639456
639997
  "currentVersion: ",
639457
- "1.4.475"
639998
+ "1.4.476"
639458
639999
  ]
639459
640000
  });
639460
640001
  $3[3] = verbose;
@@ -647618,7 +648159,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
647618
648159
  project_dir: getOriginalCwd(),
647619
648160
  added_dirs: addedDirs
647620
648161
  },
647621
- version: "1.4.475",
648162
+ version: "1.4.476",
647622
648163
  output_style: {
647623
648164
  name: outputStyleName
647624
648165
  },
@@ -649797,7 +650338,7 @@ var init_user = __esm(() => {
649797
650338
  deviceId,
649798
650339
  sessionId: getSessionId(),
649799
650340
  email: getEmail(),
649800
- appVersion: "1.4.475",
650341
+ appVersion: "1.4.476",
649801
650342
  platform: getHostPlatformForAnalytics(),
649802
650343
  organizationUuid,
649803
650344
  accountUuid,
@@ -659236,7 +659777,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
659236
659777
  } catch {}
659237
659778
  const data = {
659238
659779
  trigger,
659239
- version: "1.4.475",
659780
+ version: "1.4.476",
659240
659781
  platform: process.platform,
659241
659782
  transcript,
659242
659783
  subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
@@ -667514,6 +668055,7 @@ function REPL({
667514
668055
  apiMetricsRef2.current = [];
667515
668056
  setStreamingText(null);
667516
668057
  setStreamingToolUses([]);
668058
+ setStreamingThinking(finalizeStreamingThinkingOnTurnEnd);
667517
668059
  setSpinnerMessage(null);
667518
668060
  setSpinnerColor(null);
667519
668061
  setSpinnerShimmerColor(null);
@@ -671204,7 +671746,7 @@ function WelcomeV2() {
671204
671746
  dimColor: true,
671205
671747
  children: [
671206
671748
  "v",
671207
- "1.4.475"
671749
+ "1.4.476"
671208
671750
  ]
671209
671751
  })
671210
671752
  ]
@@ -672211,7 +672753,7 @@ function completeOnboarding() {
672211
672753
  saveGlobalConfig((current) => ({
672212
672754
  ...current,
672213
672755
  hasCompletedOnboarding: true,
672214
- lastOnboardingVersion: "1.4.475"
672756
+ lastOnboardingVersion: "1.4.476"
672215
672757
  }));
672216
672758
  }
672217
672759
  function showDialog(root2, renderer) {
@@ -677144,7 +677686,7 @@ function appendToLog(path29, message) {
677144
677686
  cwd: getFsImplementation().cwd(),
677145
677687
  userType: "external",
677146
677688
  sessionId: getSessionId(),
677147
- version: "1.4.475"
677689
+ version: "1.4.476"
677148
677690
  };
677149
677691
  getLogWriter(path29).write(messageWithTimestamp);
677150
677692
  }
@@ -681249,8 +681791,8 @@ async function getEnvLessBridgeConfig() {
681249
681791
  }
681250
681792
  async function checkEnvLessBridgeMinVersion() {
681251
681793
  const cfg = await getEnvLessBridgeConfig();
681252
- if (cfg.min_version && lt("1.4.475", cfg.min_version)) {
681253
- return `Your version of RAYU (${"1.4.475"}) is too old for Remote Control.
681794
+ if (cfg.min_version && lt("1.4.476", cfg.min_version)) {
681795
+ return `Your version of RAYU (${"1.4.476"}) is too old for Remote Control.
681254
681796
  Version ${cfg.min_version} or higher is required. Run \`claude update\` to update.`;
681255
681797
  }
681256
681798
  return null;
@@ -681723,7 +682265,7 @@ async function initBridgeCore(params) {
681723
682265
  const rawApi = createBridgeApiClient({
681724
682266
  baseUrl,
681725
682267
  getAccessToken,
681726
- runnerVersion: "1.4.475",
682268
+ runnerVersion: "1.4.476",
681727
682269
  onDebug: logForDebugging,
681728
682270
  onAuth401,
681729
682271
  getTrustedDeviceToken
@@ -687078,7 +687620,7 @@ async function startMCPServer(cwd3, debug4, verbose) {
687078
687620
  setCwd(cwd3);
687079
687621
  const server = new Server({
687080
687622
  name: "claude/tengu",
687081
- version: "1.4.475"
687623
+ version: "1.4.476"
687082
687624
  }, {
687083
687625
  capabilities: {
687084
687626
  tools: {}
@@ -689607,7 +690149,7 @@ ${customInstructions}` : customInstructions;
689607
690149
  }
689608
690150
  }
689609
690151
  logForDiagnosticsNoPII("info", "started", {
689610
- version: "1.4.475",
690152
+ version: "1.4.476",
689611
690153
  is_native_binary: isInBundledMode()
689612
690154
  });
689613
690155
  registerCleanup(async () => {
@@ -690326,7 +690868,7 @@ Usage: rayu --remote "your task description"`, () => gracefulShutdown(1));
690326
690868
  pendingHookMessages
690327
690869
  }, renderAndRun);
690328
690870
  }
690329
- }).version(`1.4.475 (${PRODUCT_NAME})`, "-v, --version", "Output the version number");
690871
+ }).version(`1.4.476 (${PRODUCT_NAME})`, "-v, --version", "Output the version number");
690330
690872
  program.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
690331
690873
  program.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
690332
690874
  if (canUserConfigureAdvisor()) {
@@ -690786,7 +691328,7 @@ if (false) {}
690786
691328
  async function main2() {
690787
691329
  const args = process.argv.slice(2);
690788
691330
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
690789
- console.log(`${"1.4.475"} (Rayu-CLI)`);
691331
+ console.log(`${"1.4.476"} (Rayu-CLI)`);
690790
691332
  return;
690791
691333
  }
690792
691334
  if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)) {