theus-cli 0.2.58 → 0.2.60

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/cli.js +345 -166
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -36057,6 +36057,7 @@ var init_keys2 = __esm(() => {
36057
36057
  // constants/oauth.ts
36058
36058
  var exports_oauth = {};
36059
36059
  __export(exports_oauth, {
36060
+ supportsUpstreamCompatibilityEndpoints: () => supportsUpstreamCompatibilityEndpoints,
36060
36061
  getOauthConfig: () => getOauthConfig,
36061
36062
  fileSuffixForOauthConfig: () => fileSuffixForOauthConfig,
36062
36063
  THEUS_AI_PROFILE_SCOPE: () => THEUS_AI_PROFILE_SCOPE,
@@ -36153,6 +36154,12 @@ function getOauthConfig() {
36153
36154
  }
36154
36155
  return config2;
36155
36156
  }
36157
+ function supportsUpstreamCompatibilityEndpoints() {
36158
+ if (isEnvTruthy(process.env.THEUS_UPSTREAM_COMPAT_API))
36159
+ return true;
36160
+ const base = getOauthConfig().BASE_API_URL.replace(/\/+$/, "");
36161
+ return base !== "https://theus.pe" && base !== "https://api.theus.pe";
36162
+ }
36156
36163
  var THEUS_AI_INFERENCE_SCOPE = "user:inference", THEUS_AI_PROFILE_SCOPE = "user:profile", CONSOLE_SCOPE = "org:create_api_key", OAUTH_BETA_HEADER = "oauth-2025-04-20", CONSOLE_OAUTH_SCOPES, THEUS_AI_OAUTH_SCOPES, ALL_OAUTH_SCOPES, PROD_OAUTH_CONFIG, MCP_CLIENT_METADATA_URL = "https://theus.pe/oauth/theus-code-client-metadata", STAGING_OAUTH_CONFIG, ALLOWED_OAUTH_BASE_URLS;
36157
36164
  var init_oauth = __esm(() => {
36158
36165
  init_envUtils();
@@ -36181,7 +36188,7 @@ var init_oauth = __esm(() => {
36181
36188
  MANUAL_REDIRECT_URL: "https://theus.pe/oauth/code/callback",
36182
36189
  CLIENT_ID: "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
36183
36190
  OAUTH_FILE_SUFFIX: "",
36184
- MCP_PROXY_URL: "https://mcp-proxy.theus.pe",
36191
+ MCP_PROXY_URL: "https://theus.pe",
36185
36192
  MCP_PROXY_PATH: "/v1/mcp/{server_id}"
36186
36193
  };
36187
36194
  STAGING_OAUTH_CONFIG = process.env.USER_TYPE === "ant" ? {
@@ -54421,6 +54428,7 @@ __export(exports_client, {
54421
54428
  refreshOAuthToken: () => refreshOAuthToken,
54422
54429
  populateOAuthAccountInfoIfNeeded: () => populateOAuthAccountInfoIfNeeded,
54423
54430
  parseScopes: () => parseScopes,
54431
+ isPermanentOAuthRefreshError: () => isPermanentOAuthRefreshError,
54424
54432
  isOAuthTokenExpired: () => isOAuthTokenExpired,
54425
54433
  getOrganizationUUID: () => getOrganizationUUID,
54426
54434
  fetchProfileInfo: () => fetchProfileInfo,
@@ -54490,6 +54498,20 @@ async function exchangeCodeForTokens(authorizationCode, state, codeVerifier, por
54490
54498
  logEvent("tengu_oauth_token_exchange_success", {});
54491
54499
  return response.data;
54492
54500
  }
54501
+ function isPermanentOAuthRefreshError(error40) {
54502
+ if (!axios_default.isAxiosError(error40))
54503
+ return false;
54504
+ const status = error40.response?.status;
54505
+ if (status === 401)
54506
+ return true;
54507
+ if (status !== 400)
54508
+ return false;
54509
+ const data = error40.response?.data;
54510
+ if (!data || typeof data !== "object")
54511
+ return false;
54512
+ const code = String(data.error ?? "");
54513
+ return code === "invalid_grant" || code === "invalid_refresh_token" || code === "refresh_token_expired";
54514
+ }
54493
54515
  async function refreshOAuthToken(refreshToken, { scopes: requestedScopes } = {}) {
54494
54516
  const requestBody = {
54495
54517
  grant_type: "refresh_token",
@@ -55246,6 +55268,10 @@ async function prefetchFastModeStatus() {
55246
55268
  if (!isFastModeEnabled()) {
55247
55269
  return;
55248
55270
  }
55271
+ if (!supportsUpstreamCompatibilityEndpoints()) {
55272
+ orgStatus = { status: "disabled", reason: "preference" };
55273
+ return;
55274
+ }
55249
55275
  if (inflightPrefetch) {
55250
55276
  logForDebugging("Fast mode prefetch in progress, returning in-flight promise");
55251
55277
  return inflightPrefetch;
@@ -58896,7 +58922,7 @@ async function _executeApiKeyHelper(isNonInteractiveSession) {
58896
58922
  if (isApiKeyHelperFromProjectOrLocalSettings()) {
58897
58923
  const hasTrust = checkHasTrustDialogAccepted();
58898
58924
  if (!hasTrust && !isNonInteractiveSession) {
58899
- const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
58925
+ const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
58900
58926
  logAntError("apiKeyHelper invoked before trust check", error40);
58901
58927
  logEvent("tengu_apiKeyHelper_missing_trust11", {});
58902
58928
  return null;
@@ -58940,7 +58966,7 @@ async function runAwsAuthRefresh() {
58940
58966
  if (isAwsAuthRefreshFromProjectSettings()) {
58941
58967
  const hasTrust = checkHasTrustDialogAccepted();
58942
58968
  if (!hasTrust && !getIsNonInteractiveSession()) {
58943
- const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
58969
+ const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
58944
58970
  logAntError("awsAuthRefresh invoked before trust check", error40);
58945
58971
  logEvent("tengu_awsAuthRefresh_missing_trust", {});
58946
58972
  return false;
@@ -59000,7 +59026,7 @@ async function getAwsCredsFromCredentialExport() {
59000
59026
  if (isAwsCredentialExportFromProjectSettings()) {
59001
59027
  const hasTrust = checkHasTrustDialogAccepted();
59002
59028
  if (!hasTrust && !getIsNonInteractiveSession()) {
59003
- const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
59029
+ const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
59004
59030
  logAntError("awsCredentialExport invoked before trust check", error40);
59005
59031
  logEvent("tengu_awsCredentialExport_missing_trust", {});
59006
59032
  return null;
@@ -59085,7 +59111,7 @@ async function runGcpAuthRefresh() {
59085
59111
  if (isGcpAuthRefreshFromProjectSettings()) {
59086
59112
  const hasTrust = checkHasTrustDialogAccepted();
59087
59113
  if (!hasTrust && !getIsNonInteractiveSession()) {
59088
- const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
59114
+ const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
59089
59115
  logAntError("gcpAuthRefresh invoked before trust check", error40);
59090
59116
  logEvent("tengu_gcpAuthRefresh_missing_trust", {});
59091
59117
  return false;
@@ -59279,6 +59305,26 @@ function saveOAuthTokensIfNeeded(tokens) {
59279
59305
  return { success: false, warning: "Failed to save OAuth tokens" };
59280
59306
  }
59281
59307
  }
59308
+ function clearInvalidOAuthTokens() {
59309
+ const secureStorage = getSecureStorage();
59310
+ try {
59311
+ const storageData = secureStorage.read();
59312
+ if (!storageData?.theusAiOauth)
59313
+ return true;
59314
+ delete storageData.theusAiOauth;
59315
+ const updateStatus = secureStorage.update(storageData);
59316
+ if (!updateStatus.success)
59317
+ return false;
59318
+ getTheusAIOAuthTokens.cache?.clear?.();
59319
+ clearKeychainCache();
59320
+ clearBetasCaches();
59321
+ clearToolSchemaCache();
59322
+ return true;
59323
+ } catch (error40) {
59324
+ logError2(error40);
59325
+ return false;
59326
+ }
59327
+ }
59282
59328
  function clearOAuthTokenCache() {
59283
59329
  getTheusAIOAuthTokens.cache?.clear?.();
59284
59330
  clearKeychainCache();
@@ -59414,6 +59460,7 @@ async function checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) {
59414
59460
  return true;
59415
59461
  } catch (error40) {
59416
59462
  logError2(error40);
59463
+ const permanentRefreshFailure = isPermanentOAuthRefreshError(error40);
59417
59464
  getTheusAIOAuthTokens.cache?.clear?.();
59418
59465
  clearKeychainCache();
59419
59466
  const currentTokens = await getTheusAIOAuthTokensAsync();
@@ -59421,6 +59468,9 @@ async function checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) {
59421
59468
  logEvent("tengu_oauth_token_refresh_race_recovered", {});
59422
59469
  return true;
59423
59470
  }
59471
+ if (permanentRefreshFailure && clearInvalidOAuthTokens()) {
59472
+ logEvent("tengu_oauth_invalid_refresh_token_cleared", {});
59473
+ }
59424
59474
  return false;
59425
59475
  } finally {
59426
59476
  logEvent("tengu_oauth_token_refresh_lock_releasing", {});
@@ -59780,7 +59830,7 @@ var init_auth = __esm(() => {
59780
59830
 
59781
59831
  // utils/userAgent.ts
59782
59832
  function getTheusCodeUserAgent() {
59783
- return `theus-code/${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`;
59833
+ return `theus-code/${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`;
59784
59834
  }
59785
59835
 
59786
59836
  // utils/workloadContext.ts
@@ -59802,7 +59852,7 @@ function getUserAgent() {
59802
59852
  const clientApp = process.env.THEUS_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}` : "";
59803
59853
  const workload = getWorkload();
59804
59854
  const workloadSuffix = workload ? `, workload/${workload}` : "";
59805
- return `theus-cli/${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (${process.env.USER_TYPE}, ${process.env.THEUS_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
59855
+ return `theus-cli/${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (${process.env.USER_TYPE}, ${process.env.THEUS_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
59806
59856
  }
59807
59857
  function getMCPUserAgent() {
59808
59858
  const parts = [];
@@ -59816,7 +59866,7 @@ function getMCPUserAgent() {
59816
59866
  parts.push(`client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}`);
59817
59867
  }
59818
59868
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
59819
- return `theus-code/${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}${suffix}`;
59869
+ return `theus-code/${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}${suffix}`;
59820
59870
  }
59821
59871
  function getWebFetchUserAgent() {
59822
59872
  return `Theus-User (${getTheusCodeUserAgent()}; +https://support.theus.pe/)`;
@@ -59954,7 +60004,7 @@ var init_user = __esm(() => {
59954
60004
  deviceId,
59955
60005
  sessionId: getSessionId(),
59956
60006
  email: getEmail(),
59957
- appVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
60007
+ appVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
59958
60008
  platform: getHostPlatformForAnalytics(),
59959
60009
  organizationUuid,
59960
60010
  accountUuid,
@@ -61669,7 +61719,7 @@ var init_metadata = __esm(() => {
61669
61719
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
61670
61720
  WHITESPACE_REGEX = /\s+/;
61671
61721
  getVersionBase = memoize_default(() => {
61672
- const match = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
61722
+ const match = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
61673
61723
  return match ? match[0] : undefined;
61674
61724
  });
61675
61725
  buildEnvContext = memoize_default(async () => {
@@ -61709,9 +61759,9 @@ var init_metadata = __esm(() => {
61709
61759
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
61710
61760
  isTheusCodeAction: isEnvTruthy(process.env.THEUS_CODE_ACTION),
61711
61761
  isTheusAiAuth: isTheusAISubscriber(),
61712
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
61762
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
61713
61763
  versionBase: getVersionBase(),
61714
- buildTime: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME,
61764
+ buildTime: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME,
61715
61765
  deploymentEnvironment: env3.detectDeploymentEnvironment(),
61716
61766
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
61717
61767
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -62377,7 +62427,7 @@ function initialize1PEventLogging() {
62377
62427
  const platform2 = getPlatform();
62378
62428
  const attributes = {
62379
62429
  [ATTR_SERVICE_NAME]: "theus-code",
62380
- [ATTR_SERVICE_VERSION]: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
62430
+ [ATTR_SERVICE_VERSION]: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
62381
62431
  };
62382
62432
  if (platform2 === "wsl") {
62383
62433
  const wslVersion = getWslVersion();
@@ -62404,7 +62454,7 @@ function initialize1PEventLogging() {
62404
62454
  })
62405
62455
  ]
62406
62456
  });
62407
- firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
62457
+ firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
62408
62458
  }
62409
62459
  async function reinitialize1PEventLoggingIfConfigChanged() {
62410
62460
  if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
@@ -64275,7 +64325,7 @@ function getAttributionHeader(fingerprint) {
64275
64325
  if (!isAttributionHeaderEnabled()) {
64276
64326
  return "";
64277
64327
  }
64278
- const version2 = `${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}.${fingerprint}`;
64328
+ const version2 = `${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}.${fingerprint}`;
64279
64329
  const entrypoint = process.env.THEUS_CODE_ENTRYPOINT ?? "unknown";
64280
64330
  const cch = "";
64281
64331
  const workload = getWorkload();
@@ -108362,7 +108412,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
108362
108412
  }
108363
108413
  function getFeedbackGuideline() {
108364
108414
  if (isUsing3PServices()) {
108365
- return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER}`;
108415
+ return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER}`;
108366
108416
  }
108367
108417
  return "- When you cannot find an answer or the feature doesn't exist, direct the user to use /feedback to report a feature request or bug";
108368
108418
  }
@@ -167334,7 +167384,7 @@ function getTelemetryAttributes() {
167334
167384
  attributes["session.id"] = sessionId;
167335
167385
  }
167336
167386
  if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
167337
- attributes["app.version"] = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
167387
+ attributes["app.version"] = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
167338
167388
  }
167339
167389
  const oauthAccount = getOauthAccountInfo();
167340
167390
  if (oauthAccount) {
@@ -203218,7 +203268,7 @@ function getInstallationEnv() {
203218
203268
  return;
203219
203269
  }
203220
203270
  function getTheusCodeVersion() {
203221
- return { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
203271
+ return { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
203222
203272
  }
203223
203273
  async function getInstalledVSCodeExtensionVersion(command) {
203224
203274
  const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
@@ -204736,7 +204786,7 @@ async function getMcpHeadersFromHelper(serverName, config2) {
204736
204786
  if ("scope" in config2 && isMcpServerFromProjectOrLocalSettings(config2) && !getIsNonInteractiveSession()) {
204737
204787
  const hasTrust = checkHasTrustDialogAccepted();
204738
204788
  if (!hasTrust) {
204739
- const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
204789
+ const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
204740
204790
  logAntError("MCP headersHelper invoked before trust check", error40);
204741
204791
  logEvent("tengu_mcp_headersHelper_missing_trust", {});
204742
204792
  return null;
@@ -205946,7 +205996,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
205946
205996
  const client2 = new Client({
205947
205997
  name: "theus-code",
205948
205998
  title: "Theus",
205949
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
205999
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
205950
206000
  description: "Theus's agentic coding tool",
205951
206001
  websiteUrl: PRODUCT_URL
205952
206002
  }, {
@@ -206300,7 +206350,7 @@ var init_client5 = __esm(() => {
206300
206350
  const client2 = new Client({
206301
206351
  name: "theus-code",
206302
206352
  title: "Theus",
206303
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
206353
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
206304
206354
  description: "Theus's agentic coding tool",
206305
206355
  websiteUrl: PRODUCT_URL
206306
206356
  }, {
@@ -210575,6 +210625,9 @@ var init_grove = __esm(() => {
210575
210625
  if (isEssentialTrafficOnly()) {
210576
210626
  return { success: false };
210577
210627
  }
210628
+ if (!supportsUpstreamCompatibilityEndpoints()) {
210629
+ return { success: false };
210630
+ }
210578
210631
  try {
210579
210632
  const response = await withOAuth401Retry(() => {
210580
210633
  const authHeaders = getAuthHeaders();
@@ -216879,7 +216932,7 @@ async function initializeBetaTracing(resource) {
216879
216932
  });
216880
216933
  logs.setGlobalLoggerProvider(loggerProvider);
216881
216934
  setLoggerProvider(loggerProvider);
216882
- const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
216935
+ const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
216883
216936
  setEventLogger(eventLogger);
216884
216937
  process.on("beforeExit", async () => {
216885
216938
  await loggerProvider?.forceFlush();
@@ -216919,7 +216972,7 @@ async function initializeTelemetry() {
216919
216972
  const platform4 = getPlatform();
216920
216973
  const baseAttributes = {
216921
216974
  [ATTR_SERVICE_NAME]: "theus-code",
216922
- [ATTR_SERVICE_VERSION]: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
216975
+ [ATTR_SERVICE_VERSION]: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
216923
216976
  };
216924
216977
  if (platform4 === "wsl") {
216925
216978
  const wslVersion = getWslVersion();
@@ -216964,7 +217017,7 @@ async function initializeTelemetry() {
216964
217017
  } catch {}
216965
217018
  };
216966
217019
  registerCleanup(shutdownTelemetry2);
216967
- return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
217020
+ return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
216968
217021
  }
216969
217022
  const meterProvider = new MeterProvider({
216970
217023
  resource,
@@ -216984,7 +217037,7 @@ async function initializeTelemetry() {
216984
217037
  });
216985
217038
  logs.setGlobalLoggerProvider(loggerProvider);
216986
217039
  setLoggerProvider(loggerProvider);
216987
- const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
217040
+ const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
216988
217041
  setEventLogger(eventLogger);
216989
217042
  logForDebugging("[3P telemetry] Event logger set successfully");
216990
217043
  process.on("beforeExit", async () => {
@@ -217046,7 +217099,7 @@ Current timeout: ${timeoutMs}ms
217046
217099
  }
217047
217100
  };
217048
217101
  registerCleanup(shutdownTelemetry);
217049
- return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
217102
+ return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
217050
217103
  }
217051
217104
  async function flushTelemetry() {
217052
217105
  const meterProvider = getMeterProvider();
@@ -217246,6 +217299,8 @@ var init_logout = __esm(() => {
217246
217299
  // services/api/firstTokenDate.ts
217247
217300
  async function fetchAndStoreTheusCodeFirstTokenDate() {
217248
217301
  try {
217302
+ if (!supportsUpstreamCompatibilityEndpoints())
217303
+ return;
217249
217304
  const config2 = getGlobalConfig();
217250
217305
  if (config2.theusCodeFirstTokenDate !== undefined) {
217251
217306
  return;
@@ -217586,7 +217641,7 @@ async function installOrUpdateTheusPackage(channel2, specificVersion) {
217586
217641
  return "install_failed";
217587
217642
  }
217588
217643
  const versionSpec = specificVersion ? specificVersion : channel2 === "stable" ? "stable" : "latest";
217589
- const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${versionSpec}`], { cwd: getLocalInstallDir(), maxBuffer: 1e6 });
217644
+ const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${versionSpec}`], { cwd: getLocalInstallDir(), maxBuffer: 1e6 });
217590
217645
  if (result.code !== 0) {
217591
217646
  const error40 = new Error(`Failed to install Theus CLI package: ${result.stderr}`);
217592
217647
  logError2(error40);
@@ -217732,9 +217787,9 @@ async function assertMinVersion() {
217732
217787
  if (false) {}
217733
217788
  try {
217734
217789
  const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
217735
- if (versionConfig.minVersion && lt({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, versionConfig.minVersion)) {
217790
+ if (versionConfig.minVersion && lt({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, versionConfig.minVersion)) {
217736
217791
  console.error(`
217737
- It looks like your version of Theus (${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}) needs an update.
217792
+ It looks like your version of Theus (${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}) needs an update.
217738
217793
  A newer version (${versionConfig.minVersion} or higher) is required to continue.
217739
217794
 
217740
217795
  To update, please run:
@@ -217875,7 +217930,7 @@ async function getInstallationPrefix() {
217875
217930
  return prefixResult.stdout.trim();
217876
217931
  }
217877
217932
  function getGlobalInstallPackageManager() {
217878
- if ({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL === "theus-cli") {
217933
+ if ({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL === "theus-cli") {
217879
217934
  return "npm";
217880
217935
  }
217881
217936
  return env3.isRunningWithBun() ? "bun" : "npm";
@@ -217900,7 +217955,7 @@ async function checkGlobalInstallPermissions() {
217900
217955
  }
217901
217956
  async function getLatestVersion(channel2) {
217902
217957
  const npmTag = channel2 === "stable" ? "stable" : "latest";
217903
- const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
217958
+ const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
217904
217959
  if (result.code !== 0) {
217905
217960
  logForDebugging(`npm view failed with code ${result.code}`);
217906
217961
  if (result.stderr) {
@@ -217916,7 +217971,7 @@ async function getLatestVersion(channel2) {
217916
217971
  return result.stdout.trim();
217917
217972
  }
217918
217973
  async function getNpmDistTags() {
217919
- const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL, "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
217974
+ const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL, "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
217920
217975
  if (result.code !== 0) {
217921
217976
  logForDebugging(`npm view dist-tags failed with code ${result.code}`);
217922
217977
  return { latest: null, stable: null };
@@ -217956,7 +218011,7 @@ async function installGlobalPackage(specificVersion) {
217956
218011
  logError2(new AutoUpdaterError("Another process is currently installing an update"));
217957
218012
  logEvent("tengu_auto_updater_lock_contention", {
217958
218013
  pid: process.pid,
217959
- currentVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
218014
+ currentVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
217960
218015
  });
217961
218016
  return "in_progress";
217962
218017
  }
@@ -217965,7 +218020,7 @@ async function installGlobalPackage(specificVersion) {
217965
218020
  if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
217966
218021
  logError2(new Error("Windows NPM detected in WSL environment"));
217967
218022
  logEvent("tengu_auto_updater_windows_npm_in_wsl", {
217968
- currentVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
218023
+ currentVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
217969
218024
  });
217970
218025
  console.error(`
217971
218026
  Error: Windows NPM detected in WSL
@@ -217984,7 +218039,7 @@ To fix this issue:
217984
218039
  if (!hasPermissions) {
217985
218040
  return "no_permissions";
217986
218041
  }
217987
- const packageSpec = specificVersion ? `${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${specificVersion}` : { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL;
218042
+ const packageSpec = specificVersion ? `${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${specificVersion}` : { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL;
217988
218043
  const packageManager = getGlobalInstallPackageManager();
217989
218044
  const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir18() });
217990
218045
  if (installResult.code !== 0) {
@@ -218312,8 +218367,8 @@ async function detectMultipleInstallations() {
218312
218367
  installations.push({ type: "npm-local", path: localPath });
218313
218368
  }
218314
218369
  const packagesToCheck = ["@theus-ai/theus-code"];
218315
- if ({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
218316
- packagesToCheck.push({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
218370
+ if ({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
218371
+ packagesToCheck.push({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
218317
218372
  }
218318
218373
  const npmResult = await execFileNoThrow("npm", [
218319
218374
  "-g",
@@ -218496,7 +218551,7 @@ function detectLinuxGlobPatternWarnings() {
218496
218551
  }
218497
218552
  async function getDoctorDiagnostic() {
218498
218553
  const installationType = await getCurrentInstallationType();
218499
- const version2 = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "unknown";
218554
+ const version2 = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "unknown";
218500
218555
  const installationPath = await getInstallationPath();
218501
218556
  const invokedBinary = getInvokedBinary();
218502
218557
  const multipleInstallations = await detectMultipleInstallations();
@@ -218508,8 +218563,8 @@ async function getDoctorDiagnostic() {
218508
218563
  for (const install of npmInstalls) {
218509
218564
  if (install.type === "npm-global") {
218510
218565
  let uninstallCmd = "npm -g uninstall @theus-ai/theus-code";
218511
- if ({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
218512
- uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`;
218566
+ if ({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
218567
+ uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`;
218513
218568
  }
218514
218569
  warnings.push({
218515
218570
  issue: `Leftover npm global installation at ${install.path}`,
@@ -218621,7 +218676,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
218621
218676
  const startTime2 = Date.now();
218622
218677
  const { stdout, code, stderr } = await execFileNoThrowWithCwd("npm", [
218623
218678
  "view",
218624
- `${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2}`,
218679
+ `${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2}`,
218625
218680
  "version",
218626
218681
  "--prefer-online",
218627
218682
  "--registry",
@@ -218645,7 +218700,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
218645
218700
  latency_ms: latencyMs,
218646
218701
  source_npm: true
218647
218702
  });
218648
- logForDebugging(`npm view ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2} version: ${stdout}`);
218703
+ logForDebugging(`npm view ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2} version: ${stdout}`);
218649
218704
  const latestVersion = stdout.trim();
218650
218705
  return latestVersion;
218651
218706
  }
@@ -218701,7 +218756,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
218701
218756
  const fs3 = getFsImplementation();
218702
218757
  await fs3.rm(stagingPath, { recursive: true, force: true });
218703
218758
  const platform4 = getPlatform2();
218704
- const platformPackageName = `${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}-${platform4}`;
218759
+ const platformPackageName = `${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}-${platform4}`;
218705
218760
  logForDebugging(`Fetching integrity hash for ${platformPackageName}@${version2}`);
218706
218761
  const {
218707
218762
  stdout: integrityOutput,
@@ -218730,7 +218785,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
218730
218785
  name: "theus-native-installer",
218731
218786
  version: "0.0.1",
218732
218787
  dependencies: {
218733
- [{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
218788
+ [{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
218734
218789
  }
218735
218790
  };
218736
218791
  const packageLock = {
@@ -218743,10 +218798,10 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
218743
218798
  name: "theus-native-installer",
218744
218799
  version: "0.0.1",
218745
218800
  dependencies: {
218746
- [{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
218801
+ [{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
218747
218802
  }
218748
218803
  },
218749
- [`node_modules/${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}`]: {
218804
+ [`node_modules/${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}`]: {
218750
218805
  version: version2,
218751
218806
  optionalDependencies: {
218752
218807
  [platformPackageName]: version2
@@ -218768,7 +218823,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
218768
218823
  if (result.code !== 0) {
218769
218824
  throw new Error(`npm ci failed with code ${result.code}: ${result.stderr}`);
218770
218825
  }
218771
- logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${version2}`);
218826
+ logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${version2}`);
218772
218827
  }
218773
218828
  function getStallTimeoutMs() {
218774
218829
  return Number(process.env.THEUS_CODE_STALL_TIMEOUT_MS_FOR_TESTING) || DEFAULT_STALL_TIMEOUT_MS;
@@ -219431,8 +219486,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
219431
219486
  const maxVersion = await getMaxVersion();
219432
219487
  if (maxVersion && gt(version2, maxVersion)) {
219433
219488
  logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
219434
- if (gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
219435
- logForDebugging(`Native installer: current version ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} is already at or above maxVersion ${maxVersion}, skipping update`);
219489
+ if (gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
219490
+ logForDebugging(`Native installer: current version ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} is already at or above maxVersion ${maxVersion}, skipping update`);
219436
219491
  logEvent("tengu_native_update_skipped_max_version", {
219437
219492
  latency_ms: Date.now() - startTime2,
219438
219493
  max_version: maxVersion,
@@ -219443,7 +219498,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
219443
219498
  version2 = maxVersion;
219444
219499
  }
219445
219500
  }
219446
- if (!forceReinstall && version2 === { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION && await versionIsAvailable(version2) && await isPossibleTheusBinary(executablePath)) {
219501
+ if (!forceReinstall && version2 === { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION && await versionIsAvailable(version2) && await isPossibleTheusBinary(executablePath)) {
219447
219502
  logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
219448
219503
  logEvent("tengu_native_update_complete", {
219449
219504
  latency_ms: Date.now() - startTime2,
@@ -220193,8 +220248,8 @@ async function cleanupNpmInstallations() {
220193
220248
  } else if (codePackageResult.error) {
220194
220249
  errors4.push(codePackageResult.error);
220195
220250
  }
220196
- if ({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
220197
- const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
220251
+ if ({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
220252
+ const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
220198
220253
  if (macroPackageResult.success) {
220199
220254
  removed++;
220200
220255
  if (macroPackageResult.warning) {
@@ -230683,6 +230738,28 @@ var init_ConsoleOAuthFlow = __esm(() => {
230683
230738
  var NOVEDADES;
230684
230739
  var init_data = __esm(() => {
230685
230740
  NOVEDADES = [
230741
+ {
230742
+ version: "v0.2.60",
230743
+ fecha: "2026-07-26",
230744
+ titulo: "Los cortes de red ya no dejan respuestas a medias",
230745
+ puntos: [
230746
+ "Si un proveedor cerraba una respuesta en streaming sin terminarla, Theus pod\xEDa aceptar ese texto incompleto como definitivo. Ahora detecta el corte, descarta el fragmento y contin\xFAa con el siguiente proveedor disponible.",
230747
+ "El inicio de sesi\xF3n ya tiene un tiempo l\xEDmite real durante todo el intercambio: si el servidor deja de responder, se cancela la conexi\xF3n y la terminal vuelve a quedar disponible. La p\xE1gina de confirmaci\xF3n s\xED termina de cargarse cuando el acceso sale bien.",
230748
+ "Un refresh token revocado o vencido ya no provoca un 401 en cada arranque. Theus retira solo esa sesi\xF3n inv\xE1lida, conserva tus proveedores y llaves propias, y te permite volver a entrar limpiamente.",
230749
+ "El arranque deja de consultar rutas heredadas que theus.pe no ofrece. Tambi\xE9n se reforz\xF3 el actualizador del motor: si ignora el cierre normal, Theus lo detiene y ejecuta la recuperaci\xF3n del binario."
230750
+ ]
230751
+ },
230752
+ {
230753
+ version: "v0.2.59",
230754
+ fecha: "2026-07-26",
230755
+ titulo: "La recarga ya no te manda a un comando que no existe",
230756
+ puntos: [
230757
+ "El texto de ayuda de \xAB/recarga\xBB te dec\xEDa \xABtheus recarga turbo\xBB, que NO es un comando: en lugar de comprar, tu frase llegaba al modelo como si fuera una pregunta \u2014 gastabas una llamada, no aparec\xEDa ning\xFAn pago y la compra mor\xEDa en silencio. Peor que un error. Ahora imprime la orden real, que adem\xE1s es la misma que usamos para probarlo.",
230758
+ "Enter tampoco puede lanzar un cobro cuando ya agotaste los packs del ciclo: antes la pantalla lo avisaba pero la tecla segu\xEDa disparando la petici\xF3n, y el error que sal\xEDa no dec\xEDa la verdad. Ahora se bloquea antes de tocar la red.",
230759
+ "Y las peticiones llevan tiempo l\xEDmite: si el servidor no responde, ya no te quedas mirando \xABabriendo el pago\xBB sin salida.",
230760
+ "Si los precios que se muestran no vienen del servidor (por ejemplo si no hay conexi\xF3n), se avisa de que son de referencia y que el importe final lo confirma el pago."
230761
+ ]
230762
+ },
230686
230763
  {
230687
230764
  version: "v0.2.58",
230688
230765
  fecha: "2026-07-26",
@@ -305712,9 +305789,9 @@ function getTheusEnvMetadata() {
305712
305789
  };
305713
305790
  }
305714
305791
  function getBuildAgeMinutes() {
305715
- if (!{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME)
305792
+ if (!{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME)
305716
305793
  return;
305717
- const buildTime = new Date({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME).getTime();
305794
+ const buildTime = new Date({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME).getTime();
305718
305795
  if (isNaN(buildTime))
305719
305796
  return;
305720
305797
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -322369,7 +322446,7 @@ function getAssistantMessageFromError(error40, model, options2) {
322369
322446
  if (process.env.USER_TYPE === "ant") {
322370
322447
  const baseMessage = `API Error: 400 ${error40.message}
322371
322448
 
322372
- Run /share and post the JSON file to ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`;
322449
+ Run /share and post the JSON file to ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`;
322373
322450
  const rewindInstruction = getIsNonInteractiveSession() ? "" : " Then, use /rewind to recover the conversation.";
322374
322451
  return createAssistantAPIErrorMessage({
322375
322452
  content: baseMessage + rewindInstruction,
@@ -322405,7 +322482,7 @@ Run /share and post the JSON file to ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01
322405
322482
  if (process.env.USER_TYPE === "ant" && !process.env.THEUS_MODEL && error40 instanceof Error && error40.message.toLowerCase().includes("invalid model name")) {
322406
322483
  const orgId = getOauthAccountInfo()?.organizationUuid;
322407
322484
  const baseMsg = `[THEUS-INTERNAL] Your org isn't gated into the \`${model}\` model. Either run \`theus\` with \`THEUS_MODEL=${getDefaultMainLoopModelSetting()}\``;
322408
- const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL} for help getting access.` : `${baseMsg} or reach out in ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL} for help getting access.`;
322485
+ const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL} for help getting access.` : `${baseMsg} or reach out in ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL} for help getting access.`;
322409
322486
  return createAssistantAPIErrorMessage({
322410
322487
  content: msg,
322411
322488
  error: "invalid_request"
@@ -330329,7 +330406,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
330329
330406
  } catch {}
330330
330407
  const data = {
330331
330408
  trigger,
330332
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
330409
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
330333
330410
  platform: process.platform,
330334
330411
  transcript,
330335
330412
  subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
@@ -330534,10 +330611,10 @@ Si el usuario indic\xF3 una duraci\xF3n, p\xE1sala en el par\xE1metro \`duration
330534
330611
 
330535
330612
  // commands/issue/index.ts
330536
330613
  function getCliVersion() {
330537
- return { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "desconocida";
330614
+ return { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "desconocida";
330538
330615
  }
330539
330616
  function getIssuesExplainer() {
330540
- return { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER ? { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER : "report issues to the Theus maintainers";
330617
+ return { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER ? { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER : "report issues to the Theus maintainers";
330541
330618
  }
330542
330619
  function getActiveModelLabel() {
330543
330620
  try {
@@ -333370,7 +333447,7 @@ function buildPrimarySection() {
333370
333447
  });
333371
333448
  return [{
333372
333449
  label: "Version",
333373
- value: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
333450
+ value: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
333374
333451
  }, {
333375
333452
  label: "Session name",
333376
333453
  value: nameValue
@@ -337186,7 +337263,7 @@ function Config({
337186
337263
  }
337187
337264
  })
337188
337265
  }) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime189.jsx(ChannelDowngradeDialog, {
337189
- currentVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
337266
+ currentVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
337190
337267
  onChoice: (choice) => {
337191
337268
  setShowSubmenu(null);
337192
337269
  setTabsHidden(false);
@@ -337198,7 +337275,7 @@ function Config({
337198
337275
  autoUpdatesChannel: "stable"
337199
337276
  };
337200
337277
  if (choice === "stay") {
337201
- newSettings.minimumVersion = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
337278
+ newSettings.minimumVersion = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
337202
337279
  }
337203
337280
  updateSettingsForSource("userSettings", newSettings);
337204
337281
  setSettingsData((prev_27) => ({
@@ -345443,7 +345520,7 @@ function HelpV2(t0) {
345443
345520
  let t6;
345444
345521
  if ($2[31] !== tabs) {
345445
345522
  t6 = /* @__PURE__ */ jsx_runtime217.jsx(Tabs, {
345446
- title: `Theus v${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
345523
+ title: `Theus v${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
345447
345524
  color: "professionalBlue",
345448
345525
  defaultTab: "general",
345449
345526
  children: tabs
@@ -347280,7 +347357,8 @@ async function exchangeCodeForTheusSession({
347280
347357
  code,
347281
347358
  redirectUri,
347282
347359
  state,
347283
- codeVerifier
347360
+ codeVerifier,
347361
+ signal
347284
347362
  }) {
347285
347363
  const tokenResponse = await postJson(`${webUrl}/v1/oauth/token`, {
347286
347364
  grant_type: "authorization_code",
@@ -347289,19 +347367,19 @@ async function exchangeCodeForTheusSession({
347289
347367
  client_id: CLIENT_ID,
347290
347368
  code_verifier: codeVerifier,
347291
347369
  state
347292
- });
347370
+ }, undefined, signal);
347293
347371
  const accessToken = stringField(tokenResponse, "access_token");
347294
347372
  if (!accessToken)
347295
347373
  throw new Error("Theus no devolvio access_token OAuth.");
347296
347374
  let profile = {};
347297
347375
  try {
347298
- profile = await getJson(`${webUrl}/api/oauth/profile`, accessToken);
347376
+ profile = await getJson(`${webUrl}/api/oauth/profile`, accessToken, signal);
347299
347377
  } catch {
347300
347378
  profile = {};
347301
347379
  }
347302
347380
  const account = objectField(profile, "account");
347303
347381
  const organization = objectField(profile, "organization");
347304
- const apiKey = await postJson(`${webUrl}/api/oauth/theus_cli/create_api_key`, { label: "Theus CLI" }, accessToken);
347382
+ const apiKey = await postJson(`${webUrl}/api/oauth/theus_cli/create_api_key`, { label: "Theus CLI" }, accessToken, signal);
347305
347383
  const rawKey = stringField(apiKey, "raw_key");
347306
347384
  if (!rawKey)
347307
347385
  throw new Error("Theus no devolvio API key para el CLI.");
@@ -347360,20 +347438,22 @@ function planLabelFromProfile(profile) {
347360
347438
  return profile?.billingType ? "pro" : "free";
347361
347439
  }
347362
347440
  }
347363
- async function postJson(url3, body, bearerToken) {
347441
+ async function postJson(url3, body, bearerToken, signal) {
347364
347442
  const response = await fetchOrExplain(url3, {
347365
347443
  method: "POST",
347366
347444
  headers: {
347367
347445
  "content-type": "application/json",
347368
347446
  ...bearerToken ? { authorization: `Bearer ${bearerToken}` } : {}
347369
347447
  },
347370
- body: JSON.stringify(body)
347448
+ body: JSON.stringify(body),
347449
+ signal
347371
347450
  });
347372
347451
  return readJsonResponse(response);
347373
347452
  }
347374
- async function getJson(url3, bearerToken) {
347453
+ async function getJson(url3, bearerToken, signal) {
347375
347454
  const response = await fetchOrExplain(url3, {
347376
- headers: { authorization: `Bearer ${bearerToken}` }
347455
+ headers: { authorization: `Bearer ${bearerToken}` },
347456
+ signal
347377
347457
  });
347378
347458
  return readJsonResponse(response);
347379
347459
  }
@@ -347449,6 +347529,7 @@ async function runTheusWebLogin(options2 = {}) {
347449
347529
  return await new Promise((resolvePromise) => {
347450
347530
  let settled = false;
347451
347531
  let redirectUri = "";
347532
+ const exchangeAbort = new AbortController;
347452
347533
  const server2 = createServer7((req, res) => {
347453
347534
  const url3 = new URL(req.url ?? "/", "http://127.0.0.1");
347454
347535
  if (url3.pathname !== "/auth/callback" && url3.pathname !== "/callback") {
@@ -347469,7 +347550,8 @@ async function runTheusWebLogin(options2 = {}) {
347469
347550
  code,
347470
347551
  redirectUri,
347471
347552
  state,
347472
- codeVerifier
347553
+ codeVerifier,
347554
+ signal: exchangeAbort.signal
347473
347555
  }).then((payload) => installTheusSession(payload, webUrl).then(() => payload)).then((payload) => {
347474
347556
  const plan = planLabelFromProfile(payload.profile);
347475
347557
  sendHtml2(res, callbackHtml(`Sesion instalada para ${payload.email} (plan ${plan}).`, true));
@@ -347493,20 +347575,27 @@ async function runTheusWebLogin(options2 = {}) {
347493
347575
  });
347494
347576
  });
347495
347577
  const timer = setTimeout(() => {
347578
+ exchangeAbort.abort(new Error("login_timeout"));
347496
347579
  finish({
347497
347580
  success: false,
347498
347581
  message: "Login cancelado por tiempo. Vuelve a ejecutar `theus login` cuando estes listo.",
347499
347582
  webUrl,
347500
347583
  loginUrl
347501
- });
347584
+ }, true);
347502
347585
  }, timeoutMs);
347503
347586
  let loginUrl = "";
347504
- function finish(result) {
347587
+ function finish(result, forceClose = false) {
347505
347588
  if (settled)
347506
347589
  return;
347507
347590
  settled = true;
347508
347591
  clearTimeout(timer);
347509
- server2.close(() => resolvePromise(result));
347592
+ exchangeAbort.abort();
347593
+ if (server2.listening) {
347594
+ server2.close();
347595
+ if (forceClose)
347596
+ server2.closeAllConnections?.();
347597
+ }
347598
+ resolvePromise(result);
347510
347599
  }
347511
347600
  server2.once("error", (error40) => {
347512
347601
  finish({
@@ -363695,7 +363784,7 @@ function Onboarding({
363695
363784
  flexDirection: "column",
363696
363785
  children: [
363697
363786
  /* @__PURE__ */ jsx_runtime250.jsx(TheusBanner, {
363698
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
363787
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
363699
363788
  }),
363700
363789
  /* @__PURE__ */ jsx_runtime250.jsxs(ThemedBox_default, {
363701
363790
  flexDirection: "column",
@@ -363919,6 +364008,13 @@ var init_providers3 = __esm(() => {
363919
364008
  });
363920
364009
 
363921
364010
  // commands/recarga/api.ts
364011
+ function esTimeout(err2) {
364012
+ const nombre = err2?.name;
364013
+ return nombre === "TimeoutError" || nombre === "AbortError";
364014
+ }
364015
+ function sinCupoDeCiclo(packsRestantes) {
364016
+ return typeof packsRestantes === "number" && Number.isFinite(packsRestantes) && packsRestantes <= 0;
364017
+ }
363922
364018
  function safeAccessToken() {
363923
364019
  try {
363924
364020
  return getTheusAIOAuthTokens()?.accessToken;
@@ -363962,11 +364058,13 @@ async function fetchRecargaStatus(token) {
363962
364058
  packs: PACKS_FALLBACK,
363963
364059
  saldoCreditos: null,
363964
364060
  packsRestantes: null,
363965
- maxPacks: null
364061
+ maxPacks: null,
364062
+ importesLocales: true
363966
364063
  };
363967
364064
  try {
363968
364065
  const res = await fetch(`${apiBase()}/v1/recarga/status`, {
363969
- headers: { authorization: `Bearer ${token}`, "theus-version": "2023-06-01" }
364066
+ headers: { authorization: `Bearer ${token}`, "theus-version": "2023-06-01" },
364067
+ signal: AbortSignal.timeout(STATUS_TIMEOUT_MS)
363970
364068
  });
363971
364069
  if (!res.ok)
363972
364070
  return apagado;
@@ -363985,12 +364083,14 @@ async function fetchRecargaStatus(token) {
363985
364083
  return null;
363986
364084
  return { id, nombre: String(p?.nombre || id), precioUsd, creditos };
363987
364085
  }).filter((p) => p !== null);
364086
+ const usaFallback = remotos.length === 0;
363988
364087
  return {
363989
364088
  disponible: true,
363990
- packs: remotos.length > 0 ? remotos : PACKS_FALLBACK,
364089
+ packs: usaFallback ? PACKS_FALLBACK : remotos,
363991
364090
  saldoCreditos: typeof data.saldo_creditos === "number" ? data.saldo_creditos : null,
363992
364091
  packsRestantes: typeof data.packs_restantes === "number" ? data.packs_restantes : null,
363993
- maxPacks: typeof data.max_packs_per_cycle === "number" ? data.max_packs_per_cycle : null
364092
+ maxPacks: typeof data.max_packs_per_cycle === "number" ? data.max_packs_per_cycle : null,
364093
+ importesLocales: usaFallback
363994
364094
  };
363995
364095
  } catch {
363996
364096
  return apagado;
@@ -364005,7 +364105,8 @@ async function fetchCheckoutUrl(token, pack) {
364005
364105
  "content-type": "application/json",
364006
364106
  "theus-version": "2023-06-01"
364007
364107
  },
364008
- body: JSON.stringify({ pack })
364108
+ body: JSON.stringify({ pack }),
364109
+ signal: AbortSignal.timeout(CHECKOUT_TIMEOUT_MS)
364009
364110
  });
364010
364111
  const cuerpo = await res.json().catch(() => null);
364011
364112
  if (res.ok) {
@@ -364051,7 +364152,15 @@ async function fetchCheckoutUrl(token, pack) {
364051
364152
  reintentable: res.status >= 500,
364052
364153
  requiereLogin: false
364053
364154
  };
364054
- } catch {
364155
+ } catch (err2) {
364156
+ if (esTimeout(err2)) {
364157
+ return {
364158
+ ok: false,
364159
+ motivo: "El servidor tard\xF3 demasiado en crear el pago seguro.",
364160
+ reintentable: true,
364161
+ requiereLogin: false
364162
+ };
364163
+ }
364055
364164
  return {
364056
364165
  ok: false,
364057
364166
  motivo: "No pude contactar con el servidor. Comprueba tu conexi\xF3n.",
@@ -364068,7 +364177,7 @@ function precioPorCredito(pack) {
364068
364177
  return "\u2014";
364069
364178
  return `$${(pack.precioUsd / pack.creditos).toFixed(3)}/cr`;
364070
364179
  }
364071
- var PACKS_FALLBACK, PACK_IDS;
364180
+ var PACKS_FALLBACK, PACK_IDS, AVISO_IMPORTES_LOCALES = "Precios de referencia; el importe final lo confirma el pago.", STATUS_TIMEOUT_MS = 1e4, CHECKOUT_TIMEOUT_MS = 30000;
364072
364181
  var init_api4 = __esm(() => {
364073
364182
  init_oauth();
364074
364183
  init_auth();
@@ -364095,8 +364204,11 @@ function decideTecla(faseT, tecla2, ctx) {
364095
364204
  if (tecla2.abajo || tecla2.letra === "j") {
364096
364205
  return { tipo: "mover", index: Math.min(Math.max(0, ctx.total - 1), ctx.index + 1) };
364097
364206
  }
364098
- if (tecla2.return)
364207
+ if (tecla2.return) {
364208
+ if (sinCupoDeCiclo(ctx.packsRestantes))
364209
+ return null;
364099
364210
  return { tipo: "confirmar" };
364211
+ }
364100
364212
  if (esc2)
364101
364213
  return { tipo: "salir", mensaje: "Recarga cancelada. No se cobr\xF3 nada." };
364102
364214
  return null;
@@ -364382,6 +364494,7 @@ function RecargaUI({
364382
364494
  }, {
364383
364495
  index,
364384
364496
  total: estado?.packs.length ?? 0,
364497
+ packsRestantes: estado?.packsRestantes ?? null,
364385
364498
  ...pack ? { nombrePack: pack.nombre, creditos: pack.creditos } : {},
364386
364499
  ...fase.t === "acreditado" ? { saldo: fase.saldoNuevo } : {}
364387
364500
  });
@@ -364500,7 +364613,7 @@ function RecargaUI({
364500
364613
  if (fase.t === "eligiendo") {
364501
364614
  const packs = estado?.packs ?? [];
364502
364615
  const sel = packs[index];
364503
- const sinCupo = estado?.packsRestantes === 0;
364616
+ const sinCupo = sinCupoDeCiclo(estado?.packsRestantes);
364504
364617
  return /* @__PURE__ */ jsx_runtime253.jsxs(ThemedBox_default, {
364505
364618
  flexDirection: "column",
364506
364619
  marginTop: 1,
@@ -364513,6 +364626,13 @@ function RecargaUI({
364513
364626
  packs,
364514
364627
  index
364515
364628
  }),
364629
+ estado?.importesLocales === true && /* @__PURE__ */ jsx_runtime253.jsx(ThemedBox_default, {
364630
+ marginTop: 1,
364631
+ children: /* @__PURE__ */ jsx_runtime253.jsx(ThemedText, {
364632
+ color: "warning",
364633
+ children: AVISO_IMPORTES_LOCALES
364634
+ })
364635
+ }),
364516
364636
  /* @__PURE__ */ jsx_runtime253.jsx(ThemedBox_default, {
364517
364637
  marginTop: 1,
364518
364638
  children: /* @__PURE__ */ jsx_runtime253.jsxs(ThemedText, {
@@ -364794,6 +364914,9 @@ var exports_noninteractive = {};
364794
364914
  __export(exports_noninteractive, {
364795
364915
  call: () => call33
364796
364916
  });
364917
+ function ordenRecarga(...partes) {
364918
+ return `theus -p "/recarga${partes.length > 0 ? ` ${partes.join(" ")}` : ""}"`;
364919
+ }
364797
364920
  function formatPackLine(pack) {
364798
364921
  return ` \u2022 ${pack.nombre} \u2014 $${pack.precioUsd} \u2192 ${formatCreditos(pack.creditos)} cr\xE9ditos`;
364799
364922
  }
@@ -364814,7 +364937,7 @@ var call33 = async (args) => {
364814
364937
  "",
364815
364938
  " theus auth login",
364816
364939
  "",
364817
- "Despu\xE9s vuelve a ejecutar la recarga."
364940
+ `Despu\xE9s vuelve a ejecutar: ${ordenRecarga()}`
364818
364941
  ].join(`
364819
364942
  `)
364820
364943
  };
@@ -364825,6 +364948,7 @@ var call33 = async (args) => {
364825
364948
  }
364826
364949
  const packs = estado.packs;
364827
364950
  const { packId, confirmar } = parseArgs2(args);
364951
+ const sinCupo = sinCupoDeCiclo(estado.packsRestantes);
364828
364952
  if (!packId) {
364829
364953
  const lines = [];
364830
364954
  lines.push("\uD83D\uDCB3 Recarga de cr\xE9ditos Theus");
@@ -364840,8 +364964,15 @@ var call33 = async (args) => {
364840
364964
  lines.push("Packs disponibles:");
364841
364965
  for (const pack2 of packs)
364842
364966
  lines.push(formatPackLine(pack2));
364967
+ if (estado.importesLocales) {
364968
+ lines.push("");
364969
+ lines.push(AVISO_IMPORTES_LOCALES);
364970
+ }
364843
364971
  lines.push("");
364844
- if (estado.packsRestantes != null) {
364972
+ if (sinCupo) {
364973
+ lines.push("Primero se consume la cuota incluida de tu plan; tu saldo de cr\xE9ditos");
364974
+ lines.push("recargado se usa solo despu\xE9s.");
364975
+ } else if (estado.packsRestantes != null) {
364845
364976
  lines.push(`Te quedan ${estado.packsRestantes} packs comprables en este ciclo. Primero se consume`);
364846
364977
  lines.push("la cuota incluida de tu plan; tu saldo recargado se usa solo despu\xE9s.");
364847
364978
  } else {
@@ -364849,7 +364980,14 @@ var call33 = async (args) => {
364849
364980
  lines.push("recargado se usa solo despu\xE9s.");
364850
364981
  }
364851
364982
  lines.push("");
364852
- lines.push("Para comprar: theus recarga <pack> (por ejemplo: theus recarga turbo)");
364983
+ if (sinCupo) {
364984
+ lines.push("Alcanzaste el m\xE1ximo de packs de este ciclo, as\xED que ahora no puedes comprar");
364985
+ lines.push("otro. El cupo se renueva con tu plan.");
364986
+ } else {
364987
+ lines.push(`Para comprar: ${ordenRecarga("<pack>")}`);
364988
+ lines.push(`Por ejemplo: ${ordenRecarga("turbo")}`);
364989
+ lines.push("(En una sesi\xF3n interactiva de Theus basta con escribir /recarga turbo.)");
364990
+ }
364853
364991
  if (!safeIsSubscriber()) {
364854
364992
  lines.push("");
364855
364993
  lines.push("Nota: no detect\xE9 una sesi\xF3n de suscriptor de theus.pe activa.");
@@ -364861,15 +364999,26 @@ var call33 = async (args) => {
364861
364999
  if (!pack) {
364862
365000
  return { type: "text", value: `Pack desconocido: ${packId}` };
364863
365001
  }
365002
+ if (sinCupo) {
365003
+ return {
365004
+ type: "text",
365005
+ value: [
365006
+ `No puedo comprar ${pack.nombre}: alcanzaste el m\xE1ximo de packs de este ciclo.`,
365007
+ "No se cobr\xF3 nada. El cupo se renueva con tu plan."
365008
+ ].join(`
365009
+ `)
365010
+ };
365011
+ }
364864
365012
  if (!confirmar) {
364865
365013
  return {
364866
365014
  type: "text",
364867
365015
  value: [
364868
365016
  `Pack ${pack.nombre} \u2014 $${pack.precioUsd} \u2192 ${formatCreditos(pack.creditos)} cr\xE9ditos (no expiran).`,
365017
+ ...estado.importesLocales ? ["", AVISO_IMPORTES_LOCALES] : [],
364869
365018
  "",
364870
365019
  "Compra final, sin reembolsos.",
364871
365020
  "",
364872
- `Para abrir el checkout seguro de Stripe: theus recarga ${packId} confirmar`,
365021
+ `Para abrir el checkout seguro de Stripe: ${ordenRecarga(packId, "confirmar")}`,
364873
365022
  "Nada se cobra ni se abre hasta que confirmes."
364874
365023
  ].join(`
364875
365024
  `)
@@ -364883,7 +365032,8 @@ var call33 = async (args) => {
364883
365032
  `No pude generar el pago de ${pack.nombre}. No se cobr\xF3 nada.`,
364884
365033
  "",
364885
365034
  res.motivo,
364886
- ...res.requiereLogin ? ["", " theus auth login"] : []
365035
+ ...res.requiereLogin ? ["", " theus auth login"] : [],
365036
+ ...res.reintentable ? ["", `Reintentar: ${ordenRecarga(packId, "confirmar")}`] : []
364887
365037
  ].join(`
364888
365038
  `)
364889
365039
  };
@@ -365054,9 +365204,9 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
365054
365204
  return [];
365055
365205
  }
365056
365206
  }
365057
- async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
365207
+ async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
365058
365208
  if (process.env.USER_TYPE === "ant") {
365059
- const changelog = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION_CHANGELOG;
365209
+ const changelog = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION_CHANGELOG;
365060
365210
  if (changelog) {
365061
365211
  const commits = changelog.trim().split(`
365062
365212
  `).filter(Boolean);
@@ -369258,7 +369408,7 @@ var init_Messages = __esm(() => {
369258
369408
  let t1;
369259
369409
  if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
369260
369410
  t1 = /* @__PURE__ */ jsx_runtime263.jsx(TheusSessionHeader, {
369261
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
369411
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
369262
369412
  });
369263
369413
  $2[0] = t1;
369264
369414
  } else {
@@ -398082,7 +398232,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
398082
398232
  smapsRollup,
398083
398233
  platform: process.platform,
398084
398234
  nodeVersion: process.version,
398085
- ccVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
398235
+ ccVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
398086
398236
  };
398087
398237
  }
398088
398238
  async function performHeapDump(trigger = "manual", dumpNumber = 0) {
@@ -398901,7 +399051,7 @@ var init_bridge_kick = __esm(() => {
398901
399051
  var call65 = async () => {
398902
399052
  return {
398903
399053
  type: "text",
398904
- value: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME ? `${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (built ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME})` : { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
399054
+ value: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME ? `${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (built ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME})` : { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
398905
399055
  };
398906
399056
  }, version2, version_default;
398907
399057
  var init_version = __esm(() => {
@@ -401502,7 +401652,7 @@ var SECRET_NAME_PATTERN, EXTRA_ENV_ALLOWLIST, REDACTED2 = "\u2039oculto\u203A",
401502
401652
  const lines = [];
401503
401653
  lines.push("## Entorno de ejecuci\xF3n");
401504
401654
  lines.push("");
401505
- const version3 = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "desconocida";
401655
+ const version3 = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "desconocida";
401506
401656
  lines.push(`- Versi\xF3n de Theus: ${version3}`);
401507
401657
  lines.push(`- Directorio de trabajo: ${getCwd()}`);
401508
401658
  lines.push(`- \xBFRepositorio git?: ${isGit ? "s\xED" : "no"}`);
@@ -403857,7 +404007,9 @@ var init_remote_env2 = __esm(() => {
403857
404007
  // cli/update.ts
403858
404008
  var exports_update = {};
403859
404009
  __export(exports_update, {
403860
- update: () => update
404010
+ update: () => update,
404011
+ rescatarNaupaMalUbicado: () => rescatarNaupaMalUbicado,
404012
+ rescatarNaupaBorrado: () => rescatarNaupaBorrado
403861
404013
  });
403862
404014
  import { spawn as spawn9, spawnSync as spawnSync8 } from "child_process";
403863
404015
  import { createHash as createHash28 } from "crypto";
@@ -403899,12 +404051,14 @@ function rescatarNaupaBorrado(binEnUso) {
403899
404051
  logEvent("tengu_naupa_binario_restaurado", { ruta: "old" });
403900
404052
  } catch {}
403901
404053
  }
403902
- function rescatarNaupaMalUbicado(binEnUso) {
404054
+ function rescatarNaupaMalUbicado(binEnUso, options2 = {}) {
403903
404055
  try {
403904
- const home = process.env.HOME ?? process.env.USERPROFILE;
404056
+ const home = options2.home ?? process.env.HOME ?? process.env.USERPROFILE;
403905
404057
  if (!home)
403906
404058
  return;
403907
- const nombre = process.platform === "win32" ? "naupa.exe" : "naupa";
404059
+ const platform6 = options2.platform ?? process.platform;
404060
+ const versionOf = options2.versionOf ?? naupaVersionOf;
404061
+ const nombre = platform6 === "win32" ? "naupa.exe" : "naupa";
403908
404062
  const rutaFija = join143(home, ".local", "bin", nombre);
403909
404063
  if (!existsSync18(rutaFija))
403910
404064
  return;
@@ -403912,8 +404066,8 @@ function rescatarNaupaMalUbicado(binEnUso) {
403912
404066
  if (realpathSync4(rutaFija) === realpathSync4(binEnUso))
403913
404067
  return;
403914
404068
  } catch {}
403915
- const vUso = naupaVersionOf(binEnUso);
403916
- const vFija = naupaVersionOf(rutaFija);
404069
+ const vUso = versionOf(binEnUso);
404070
+ const vFija = versionOf(rutaFija);
403917
404071
  if (!vUso || !vFija || vUso === vFija)
403918
404072
  return;
403919
404073
  if (!gte(vFija, vUso))
@@ -403942,36 +404096,46 @@ async function updateNaupa() {
403942
404096
  `);
403943
404097
  await new Promise((resolve45) => {
403944
404098
  let settled = false;
403945
- const done = () => {
404099
+ let timer;
404100
+ let forceKillTimer;
404101
+ const done = (repair) => {
403946
404102
  if (settled)
403947
404103
  return;
403948
404104
  settled = true;
404105
+ if (timer)
404106
+ clearTimeout(timer);
404107
+ if (forceKillTimer)
404108
+ clearTimeout(forceKillTimer);
404109
+ if (repair) {
404110
+ rescatarNaupaBorrado(bin);
404111
+ rescatarNaupaMalUbicado(bin);
404112
+ }
403949
404113
  resolve45();
403950
404114
  };
403951
404115
  const child = spawn9(bin, ["update", "-y", "--ui"], {
403952
404116
  stdio: ["ignore", "inherit", "inherit"],
403953
404117
  env: process.env
403954
404118
  });
403955
- const timer = setTimeout(() => {
404119
+ timer = setTimeout(() => {
403956
404120
  child.kill("SIGTERM");
403957
404121
  writeToStdout(source_default.yellow("Aviso: la actualizaci\xF3n de \xD1aupa excedi\xF3 el tiempo l\xEDmite. " + "Puedes reintentar a mano: naupa update --ui") + `
403958
404122
  `);
404123
+ forceKillTimer = setTimeout(() => {
404124
+ child.kill("SIGKILL");
404125
+ done(true);
404126
+ }, 5000);
403959
404127
  }, 180000);
403960
404128
  child.on("error", () => {
403961
- clearTimeout(timer);
403962
404129
  writeToStdout(source_default.yellow("Aviso: no se pudo ejecutar la actualizaci\xF3n de \xD1aupa. " + "Puedes hacerlo a mano: naupa update --ui") + `
403963
404130
  `);
403964
- done();
404131
+ done(false);
403965
404132
  });
403966
404133
  child.on("close", (code) => {
403967
- clearTimeout(timer);
403968
404134
  if (code !== 0 && code !== null) {
403969
404135
  writeToStdout(source_default.yellow(`Aviso: \xD1aupa update termin\xF3 con c\xF3digo ${code}. ` + "Puedes reintentar a mano: naupa update --ui") + `
403970
404136
  `);
403971
404137
  }
403972
- rescatarNaupaBorrado(bin);
403973
- rescatarNaupaMalUbicado(bin);
403974
- done();
404138
+ done(true);
403975
404139
  });
403976
404140
  });
403977
404141
  }
@@ -404029,13 +404193,13 @@ async function updateReleaseBundle() {
404029
404193
  await gracefulShutdown(1);
404030
404194
  return;
404031
404195
  }
404032
- if (gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404033
- writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
404196
+ if (gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404197
+ writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
404034
404198
  `);
404035
404199
  await gracefulShutdown(0);
404036
404200
  return;
404037
404201
  }
404038
- writeToStdout(`New version available: ${latest} (current: ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
404202
+ writeToStdout(`New version available: ${latest} (current: ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
404039
404203
  `);
404040
404204
  writeToStdout(`Installing update from theus.pe/dl...
404041
404205
  `);
@@ -404069,7 +404233,7 @@ async function updateReleaseBundle() {
404069
404233
  return;
404070
404234
  }
404071
404235
  cpSync(staged, bundleDir, { recursive: true, force: true });
404072
- writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${latest}`) + `
404236
+ writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${latest}`) + `
404073
404237
  `);
404074
404238
  await regenerateCompletionCache();
404075
404239
  } finally {
@@ -404082,7 +404246,7 @@ async function updateReleaseBundle() {
404082
404246
  async function update() {
404083
404247
  logEvent("tengu_update_check", {});
404084
404248
  await updateNaupa();
404085
- writeToStdout(`Current version: ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
404249
+ writeToStdout(`Current version: ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
404086
404250
  `);
404087
404251
  const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
404088
404252
  writeToStdout(`Checking for updates to ${channel2} version...
@@ -404161,8 +404325,8 @@ async function update() {
404161
404325
  writeToStdout(`Theus is managed by Homebrew.
404162
404326
  `);
404163
404327
  const latest = await getLatestVersion(channel2);
404164
- if (latest && !gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404165
- writeToStdout(`Update available: ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} \u2192 ${latest}
404328
+ if (latest && !gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404329
+ writeToStdout(`Update available: ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} \u2192 ${latest}
404166
404330
  `);
404167
404331
  writeToStdout(`
404168
404332
  `);
@@ -404178,8 +404342,8 @@ async function update() {
404178
404342
  writeToStdout(`Theus is managed by winget.
404179
404343
  `);
404180
404344
  const latest = await getLatestVersion(channel2);
404181
- if (latest && !gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404182
- writeToStdout(`Update available: ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} \u2192 ${latest}
404345
+ if (latest && !gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404346
+ writeToStdout(`Update available: ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} \u2192 ${latest}
404183
404347
  `);
404184
404348
  writeToStdout(`
404185
404349
  `);
@@ -404195,8 +404359,8 @@ async function update() {
404195
404359
  writeToStdout(`Theus is managed by apk.
404196
404360
  `);
404197
404361
  const latest = await getLatestVersion(channel2);
404198
- if (latest && !gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404199
- writeToStdout(`Update available: ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} \u2192 ${latest}
404362
+ if (latest && !gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest)) {
404363
+ writeToStdout(`Update available: ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} \u2192 ${latest}
404200
404364
  `);
404201
404365
  writeToStdout(`
404202
404366
  `);
@@ -404261,11 +404425,11 @@ async function update() {
404261
404425
  `);
404262
404426
  await gracefulShutdown(1);
404263
404427
  }
404264
- if (result.latestVersion === { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
404265
- writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
404428
+ if (result.latestVersion === { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
404429
+ writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
404266
404430
  `);
404267
404431
  } else {
404268
- writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${result.latestVersion}`) + `
404432
+ writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${result.latestVersion}`) + `
404269
404433
  `);
404270
404434
  await regenerateCompletionCache();
404271
404435
  }
@@ -404284,9 +404448,9 @@ async function update() {
404284
404448
  await removeInstalledSymlink();
404285
404449
  }
404286
404450
  logForDebugging("update: Checking npm registry for latest version");
404287
- logForDebugging(`update: Package URL: ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`);
404451
+ logForDebugging(`update: Package URL: ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`);
404288
404452
  const npmTag = channel2 === "stable" ? "stable" : "latest";
404289
- const npmCommand = `npm view ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${npmTag} version`;
404453
+ const npmCommand = `npm view ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${npmTag} version`;
404290
404454
  logForDebugging(`update: Running: ${npmCommand}`);
404291
404455
  const latestVersion = await getLatestVersion(channel2);
404292
404456
  logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
@@ -404306,7 +404470,7 @@ async function update() {
404306
404470
  `);
404307
404471
  process.stderr.write(` \u2022 Corporate proxy/firewall blocking npm
404308
404472
  `);
404309
- if ({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && !{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL.startsWith("@theus")) {
404473
+ if ({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && !{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL.startsWith("@theus")) {
404310
404474
  process.stderr.write(` \u2022 Internal/development build not published to npm
404311
404475
  `);
404312
404476
  }
@@ -404318,19 +404482,19 @@ async function update() {
404318
404482
  `);
404319
404483
  process.stderr.write(` \u2022 Run with --debug flag for more details
404320
404484
  `);
404321
- const packageName = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL || (process.env.USER_TYPE === "ant" ? "@theus-ai/theus-cli" : "@theus-ai/theus-code");
404485
+ const packageName = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL || (process.env.USER_TYPE === "ant" ? "@theus-ai/theus-cli" : "@theus-ai/theus-code");
404322
404486
  process.stderr.write(` \u2022 Manually check: npm view ${packageName} version
404323
404487
  `);
404324
404488
  process.stderr.write(` \u2022 Check if you need to login: npm whoami
404325
404489
  `);
404326
404490
  await gracefulShutdown(1);
404327
404491
  }
404328
- if (gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latestVersion)) {
404329
- writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
404492
+ if (gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latestVersion)) {
404493
+ writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
404330
404494
  `);
404331
404495
  await gracefulShutdown(0);
404332
404496
  }
404333
- writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
404497
+ writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
404334
404498
  `);
404335
404499
  writeToStdout(`Installing update...
404336
404500
  `);
@@ -404375,7 +404539,7 @@ async function update() {
404375
404539
  logForDebugging(`update: Installation status: ${status2}`);
404376
404540
  switch (status2) {
404377
404541
  case "success":
404378
- writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${latestVersion}`) + `
404542
+ writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${latestVersion}`) + `
404379
404543
  `);
404380
404544
  await regenerateCompletionCache();
404381
404545
  break;
@@ -404385,7 +404549,7 @@ async function update() {
404385
404549
  if (useLocalUpdate) {
404386
404550
  process.stderr.write(`Try manually updating with:
404387
404551
  `);
404388
- process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}
404552
+ process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}
404389
404553
  `);
404390
404554
  } else {
404391
404555
  process.stderr.write(`Try running with sudo or fix npm permissions
@@ -404401,7 +404565,7 @@ async function update() {
404401
404565
  if (useLocalUpdate) {
404402
404566
  process.stderr.write(`Try manually updating with:
404403
404567
  `);
404404
- process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}
404568
+ process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}
404405
404569
  `);
404406
404570
  } else {
404407
404571
  process.stderr.write(`Or consider using native installation with: theus install
@@ -414241,7 +414405,7 @@ var init_sessionStorage = __esm(() => {
414241
414405
  init_settings2();
414242
414406
  init_slowOperations();
414243
414407
  init_uuid();
414244
- VERSION4 = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
414408
+ VERSION4 = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
414245
414409
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
414246
414410
  SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
414247
414411
  EPHEMERAL_PROGRESS_TYPES = new Set([
@@ -415446,7 +415610,7 @@ var init_filesystem = __esm(() => {
415446
415610
  });
415447
415611
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
415448
415612
  const nonce = randomBytes21(16).toString("hex");
415449
- return join150(getTheusTempDir(), "bundled-skills", { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, nonce);
415613
+ return join150(getTheusTempDir(), "bundled-skills", { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, nonce);
415450
415614
  });
415451
415615
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
415452
415616
  });
@@ -420625,7 +420789,7 @@ function getSimpleDoingTasksSection() {
420625
420789
  ];
420626
420790
  const userHelpSubitems = [
420627
420791
  `/help: Get help with using Theus`,
420628
- `To give feedback, users should ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER}`
420792
+ `To give feedback, users should ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER}`
420629
420793
  ];
420630
420794
  const items = [
420631
420795
  `The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these software engineering tasks and the current working directory. For example, if the user asks you to change "methodName" to snake case, do not reply with just "method_name", instead find the method in the code and modify the code.`,
@@ -421525,7 +421689,7 @@ function computeFingerprint(messageText, version3) {
421525
421689
  }
421526
421690
  function computeFingerprintFromMessages(messages) {
421527
421691
  const firstMessageText = extractFirstMessageText(messages);
421528
- return computeFingerprint(firstMessageText, { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
421692
+ return computeFingerprint(firstMessageText, { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
421529
421693
  }
421530
421694
  var FINGERPRINT_SALT = "59cf53e54c78";
421531
421695
  var init_fingerprint = () => {};
@@ -423711,8 +423875,10 @@ async function* readSSEChunks(body, signal) {
423711
423875
  const data = line.slice(5).trim();
423712
423876
  if (!data)
423713
423877
  continue;
423714
- if (data === "[DONE]")
423878
+ if (data === "[DONE]") {
423879
+ yield { __theusDone: true };
423715
423880
  return;
423881
+ }
423716
423882
  try {
423717
423883
  yield JSON.parse(data);
423718
423884
  } catch {}
@@ -423839,7 +424005,12 @@ async function* callOpenAICompatible({
423839
424005
  let usageIn = 0;
423840
424006
  let usageOut = 0;
423841
424007
  let sawUsage = false;
424008
+ let sawDone = false;
423842
424009
  for await (const chunk2 of readSSEChunks(response.body, signal)) {
424010
+ if (chunk2.__theusDone) {
424011
+ sawDone = true;
424012
+ continue;
424013
+ }
423843
424014
  const events2 = [];
423844
424015
  if (!started) {
423845
424016
  started = true;
@@ -423939,6 +424110,10 @@ async function* callOpenAICompatible({
423939
424110
  };
423940
424111
  }
423941
424112
  }
424113
+ const hasUsableContent = text.length > 0 || [...toolBlocks.values()].some((block2) => block2.name);
424114
+ if (!started || !hasUsableContent || finishReason === null && !sawDone) {
424115
+ throw new Error(`${provider.id}: el stream termin\xF3 antes de completar una respuesta`);
424116
+ }
423942
424117
  const closingEvents = [];
423943
424118
  if (textOpen && textBlockIndex !== null) {
423944
424119
  closingEvents.push({ type: "content_block_stop", index: textBlockIndex });
@@ -424148,7 +424323,7 @@ async function sideQuery(opts) {
424148
424323
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
424149
424324
  }
424150
424325
  const messageText = extractFirstUserMessageText(messages);
424151
- const fingerprint = computeFingerprint(messageText, { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
424326
+ const fingerprint = computeFingerprint(messageText, { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
424152
424327
  const attributionHeader = getAttributionHeader(fingerprint);
424153
424328
  const systemBlocks = [
424154
424329
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -425451,7 +425626,7 @@ async function handleMemories(state) {
425451
425626
  async function runProjectContextMcpServer() {
425452
425627
  const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
425453
425628
  const state = new ProjectContextState(projectRoot);
425454
- const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION }, { capabilities: { tools: {} } });
425629
+ const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION }, { capabilities: { tools: {} } });
425455
425630
  server2.setRequestHandler(ListToolsRequestSchema, async () => ({
425456
425631
  tools: TOOL_DEFINITIONS.map((t) => ({
425457
425632
  name: t.name,
@@ -427433,7 +427608,7 @@ function createBridgeLogger(options2) {
427433
427608
  connectUrl = buildBridgeConnectUrl(environmentId, cachedIngressUrl);
427434
427609
  regenerateQr(connectUrl);
427435
427610
  if (verbose) {
427436
- write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
427611
+ write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
427437
427612
  `);
427438
427613
  }
427439
427614
  if (verbose) {
@@ -428406,7 +428581,7 @@ function appendToLog(path19, message) {
428406
428581
  cwd: getFsImplementation().cwd(),
428407
428582
  userType: process.env.USER_TYPE,
428408
428583
  sessionId: getSessionId(),
428409
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
428584
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
428410
428585
  };
428411
428586
  getLogWriter(path19).write(messageWithTimestamp);
428412
428587
  }
@@ -429676,7 +429851,7 @@ Spawn mode for this project:
429676
429851
  const api2 = createBridgeApiClient({
429677
429852
  baseUrl,
429678
429853
  getAccessToken: getBridgeAccessToken2,
429679
- runnerVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
429854
+ runnerVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
429680
429855
  onDebug: logForDebugging,
429681
429856
  onAuth401: handleOAuth401Error2,
429682
429857
  getTrustedDeviceToken
@@ -429914,7 +430089,7 @@ async function runBridgeHeadless(opts, signal) {
429914
430089
  const api2 = createBridgeApiClient({
429915
430090
  baseUrl,
429916
430091
  getAccessToken: opts.getAccessToken,
429917
- runnerVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
430092
+ runnerVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
429918
430093
  onDebug: log2,
429919
430094
  onAuth401: opts.onAuth401,
429920
430095
  getTrustedDeviceToken
@@ -433980,7 +434155,7 @@ function buildSystemInitMessage(inputs) {
433980
434155
  slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
433981
434156
  apiKeySource: getTheusApiKeyWithSource().source,
433982
434157
  betas: getSdkBetas(),
433983
- theus_code_version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
434158
+ theus_code_version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
433984
434159
  output_style: outputStyle2,
433985
434160
  agents: inputs.agents.map((agent) => agent.agentType),
433986
434161
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -434020,8 +434195,8 @@ async function getEnvLessBridgeConfig() {
434020
434195
  }
434021
434196
  async function checkEnvLessBridgeMinVersion() {
434022
434197
  const cfg = await getEnvLessBridgeConfig();
434023
- if (cfg.min_version && lt({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, cfg.min_version)) {
434024
- return `Your version of Theus (${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}) is too old for Remote Control.
434198
+ if (cfg.min_version && lt({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, cfg.min_version)) {
434199
+ return `Your version of Theus (${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}) is too old for Remote Control.
434025
434200
  Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
434026
434201
  }
434027
434202
  return null;
@@ -436345,7 +436520,7 @@ async function initBridgeCore(params) {
436345
436520
  const rawApi = createBridgeApiClient({
436346
436521
  baseUrl,
436347
436522
  getAccessToken,
436348
- runnerVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
436523
+ runnerVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
436349
436524
  onDebug: logForDebugging,
436350
436525
  onAuth401,
436351
436526
  getTrustedDeviceToken
@@ -453088,7 +453263,7 @@ var init_useVoiceEnabled = __esm(() => {
453088
453263
  function getSemverPart(version3) {
453089
453264
  return `${import_semver14.major(version3, { loose: true })}.${import_semver14.minor(version3, { loose: true })}.${import_semver14.patch(version3, { loose: true })}`;
453090
453265
  }
453091
- function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
453266
+ function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
453092
453267
  const [lastNotifiedSemver, setLastNotifiedSemver] = import_react233.useState(() => getSemverPart(initialVersion));
453093
453268
  if (!updatedVersion) {
453094
453269
  return null;
@@ -453128,7 +453303,7 @@ function AutoUpdater({
453128
453303
  return;
453129
453304
  }
453130
453305
  if (false) {}
453131
- const currentVersion = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
453306
+ const currentVersion = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
453132
453307
  const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
453133
453308
  let latestVersion = await getLatestVersion(channel2);
453134
453309
  const isDisabled2 = isAutoUpdaterDisabled();
@@ -453264,7 +453439,7 @@ function AutoUpdater({
453264
453439
  " ",
453265
453440
  /* @__PURE__ */ jsx_runtime409.jsx(ThemedText, {
453266
453441
  bold: true,
453267
- children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}` : `npm i -g ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`
453442
+ children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}` : `npm i -g ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`
453268
453443
  })
453269
453444
  ]
453270
453445
  })
@@ -453341,12 +453516,12 @@ function NativeAutoUpdater({
453341
453516
  logEvent("tengu_native_auto_updater_start", {});
453342
453517
  try {
453343
453518
  const maxVersion = await getMaxVersion();
453344
- if (maxVersion && gt({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
453519
+ if (maxVersion && gt({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
453345
453520
  const msg = await getMaxVersionMessage();
453346
453521
  setMaxVersionIssue(msg ?? "affects your version");
453347
453522
  }
453348
453523
  const result = await installLatest(channel2);
453349
- const currentVersion = { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
453524
+ const currentVersion = { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
453350
453525
  const latencyMs = Date.now() - startTime2;
453351
453526
  if (result.lockFailed) {
453352
453527
  logEvent("tengu_native_auto_updater_lock_contention", {
@@ -453483,17 +453658,17 @@ function PackageManagerAutoUpdater(t0) {
453483
453658
  const maxVersion = await getMaxVersion();
453484
453659
  if (maxVersion && latest && gt(latest, maxVersion)) {
453485
453660
  logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
453486
- if (gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
453487
- logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} is already at or above maxVersion ${maxVersion}, skipping update`);
453661
+ if (gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
453662
+ logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} is already at or above maxVersion ${maxVersion}, skipping update`);
453488
453663
  setUpdateAvailable(false);
453489
453664
  return;
453490
453665
  }
453491
453666
  latest = maxVersion;
453492
453667
  }
453493
- const hasUpdate = latest && !gte({ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest) && !shouldSkipVersion(latest);
453668
+ const hasUpdate = latest && !gte({ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, latest) && !shouldSkipVersion(latest);
453494
453669
  setUpdateAvailable(!!hasUpdate);
453495
453670
  if (hasUpdate) {
453496
- logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} -> ${latest}`);
453671
+ logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} -> ${latest}`);
453497
453672
  }
453498
453673
  };
453499
453674
  $2[0] = t1;
@@ -453527,7 +453702,7 @@ function PackageManagerAutoUpdater(t0) {
453527
453702
  wrap: "truncate",
453528
453703
  children: [
453529
453704
  "currentVersion: ",
453530
- { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
453705
+ { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
453531
453706
  ]
453532
453707
  });
453533
453708
  $2[3] = verbose;
@@ -461401,7 +461576,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
461401
461576
  project_dir: getOriginalCwd(),
461402
461577
  added_dirs: addedDirs
461403
461578
  },
461404
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
461579
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
461405
461580
  output_style: {
461406
461581
  name: outputStyleName
461407
461582
  },
@@ -485681,7 +485856,7 @@ function completeOnboarding() {
485681
485856
  saveGlobalConfig((current) => ({
485682
485857
  ...current,
485683
485858
  hasCompletedOnboarding: true,
485684
- lastOnboardingVersion: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
485859
+ lastOnboardingVersion: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
485685
485860
  }));
485686
485861
  }
485687
485862
  function showDialog(root2, renderer) {
@@ -486593,6 +486768,10 @@ async function fetchBootstrapAPI() {
486593
486768
  logForDebugging("[Bootstrap] Skipped: Nonessential traffic disabled");
486594
486769
  return null;
486595
486770
  }
486771
+ if (!supportsUpstreamCompatibilityEndpoints()) {
486772
+ logForDebugging("[Bootstrap] Skipped: endpoint no disponible en theus.pe");
486773
+ return null;
486774
+ }
486596
486775
  if (getAPIProvider() !== "firstParty") {
486597
486776
  logForDebugging("[Bootstrap] Skipped: 3P provider");
486598
486777
  return null;
@@ -496632,7 +496811,7 @@ async function startMCPServer(cwd3, debug3, verbose) {
496632
496811
  setCwd(cwd3);
496633
496812
  const server2 = new Server({
496634
496813
  name: "theus/tengu",
496635
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
496814
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
496636
496815
  }, {
496637
496816
  capabilities: {
496638
496817
  tools: {}
@@ -498074,7 +498253,7 @@ async function setupTokenHandler(root2) {
498074
498253
  gap: 1,
498075
498254
  children: [
498076
498255
  /* @__PURE__ */ jsx_runtime495.jsx(TheusBanner, {
498077
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
498256
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
498078
498257
  }),
498079
498258
  showAuthWarning && /* @__PURE__ */ jsx_runtime495.jsxs(ThemedBox_default, {
498080
498259
  flexDirection: "column",
@@ -499556,7 +499735,7 @@ ${assistantAddendum}` : assistantAddendum;
499556
499735
  }
499557
499736
  }
499558
499737
  logForDiagnosticsNoPII("info", "started", {
499559
- version: { VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
499738
+ version: { VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
499560
499739
  is_native_binary: isInBundledMode()
499561
499740
  });
499562
499741
  registerCleanup(async () => {
@@ -500424,7 +500603,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
500424
500603
  pendingHookMessages
500425
500604
  }, renderAndRun);
500426
500605
  }
500427
- }).version(`${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (Theus)`, "-v, --version", "Muestra el n\xFAmero de versi\xF3n");
500606
+ }).version(`${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (Theus)`, "-v, --version", "Muestra el n\xFAmero de versi\xF3n");
500428
500607
  program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
500429
500608
  program2.option("--tmux", "Crea una sesi\xF3n de tmux para el worktree (requiere --worktree). Usa paneles nativos de iTerm2 cuando est\xE1n disponibles; usa --tmux=classic para tmux tradicional.");
500430
500609
  if (canUserConfigureAdvisor()) {
@@ -500976,7 +501155,7 @@ if (false) {}
500976
501155
  async function main2() {
500977
501156
  const args = process.argv.slice(2);
500978
501157
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
500979
- console.log(`${{ VERSION: "0.2.58", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (Theus)`);
501158
+ console.log(`${{ VERSION: "0.2.60", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (Theus)`);
500980
501159
  return;
500981
501160
  }
500982
501161
  const {