theus-cli 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +561 -383
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -58283,7 +58283,7 @@ async function _executeApiKeyHelper(isNonInteractiveSession) {
|
|
|
58283
58283
|
if (isApiKeyHelperFromProjectOrLocalSettings()) {
|
|
58284
58284
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58285
58285
|
if (!hasTrust && !isNonInteractiveSession) {
|
|
58286
|
-
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58286
|
+
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58287
58287
|
logAntError("apiKeyHelper invoked before trust check", error40);
|
|
58288
58288
|
logEvent("tengu_apiKeyHelper_missing_trust11", {});
|
|
58289
58289
|
return null;
|
|
@@ -58327,7 +58327,7 @@ async function runAwsAuthRefresh() {
|
|
|
58327
58327
|
if (isAwsAuthRefreshFromProjectSettings()) {
|
|
58328
58328
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58329
58329
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58330
|
-
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58330
|
+
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58331
58331
|
logAntError("awsAuthRefresh invoked before trust check", error40);
|
|
58332
58332
|
logEvent("tengu_awsAuthRefresh_missing_trust", {});
|
|
58333
58333
|
return false;
|
|
@@ -58387,7 +58387,7 @@ async function getAwsCredsFromCredentialExport() {
|
|
|
58387
58387
|
if (isAwsCredentialExportFromProjectSettings()) {
|
|
58388
58388
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58389
58389
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58390
|
-
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58390
|
+
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58391
58391
|
logAntError("awsCredentialExport invoked before trust check", error40);
|
|
58392
58392
|
logEvent("tengu_awsCredentialExport_missing_trust", {});
|
|
58393
58393
|
return null;
|
|
@@ -58472,7 +58472,7 @@ async function runGcpAuthRefresh() {
|
|
|
58472
58472
|
if (isGcpAuthRefreshFromProjectSettings()) {
|
|
58473
58473
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58474
58474
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58475
|
-
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58475
|
+
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58476
58476
|
logAntError("gcpAuthRefresh invoked before trust check", error40);
|
|
58477
58477
|
logEvent("tengu_gcpAuthRefresh_missing_trust", {});
|
|
58478
58478
|
return false;
|
|
@@ -59167,7 +59167,7 @@ var init_auth = __esm(() => {
|
|
|
59167
59167
|
|
|
59168
59168
|
// utils/userAgent.ts
|
|
59169
59169
|
function getTheusCodeUserAgent() {
|
|
59170
|
-
return `theus-code/${{ VERSION: "0.1.
|
|
59170
|
+
return `theus-code/${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
59171
59171
|
}
|
|
59172
59172
|
|
|
59173
59173
|
// utils/workloadContext.ts
|
|
@@ -59189,7 +59189,7 @@ function getUserAgent() {
|
|
|
59189
59189
|
const clientApp = process.env.THEUS_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}` : "";
|
|
59190
59190
|
const workload = getWorkload();
|
|
59191
59191
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
59192
|
-
return `theus-cli/${{ VERSION: "0.1.
|
|
59192
|
+
return `theus-cli/${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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})`;
|
|
59193
59193
|
}
|
|
59194
59194
|
function getMCPUserAgent() {
|
|
59195
59195
|
const parts = [];
|
|
@@ -59203,7 +59203,7 @@ function getMCPUserAgent() {
|
|
|
59203
59203
|
parts.push(`client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}`);
|
|
59204
59204
|
}
|
|
59205
59205
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
59206
|
-
return `theus-code/${{ VERSION: "0.1.
|
|
59206
|
+
return `theus-code/${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
59207
59207
|
}
|
|
59208
59208
|
function getWebFetchUserAgent() {
|
|
59209
59209
|
return `Theus-User (${getTheusCodeUserAgent()}; +https://support.theus.pe/)`;
|
|
@@ -59341,7 +59341,7 @@ var init_user = __esm(() => {
|
|
|
59341
59341
|
deviceId,
|
|
59342
59342
|
sessionId: getSessionId(),
|
|
59343
59343
|
email: getEmail(),
|
|
59344
|
-
appVersion: { VERSION: "0.1.
|
|
59344
|
+
appVersion: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
59345
59345
|
platform: getHostPlatformForAnalytics(),
|
|
59346
59346
|
organizationUuid,
|
|
59347
59347
|
accountUuid,
|
|
@@ -61056,7 +61056,7 @@ var init_metadata = __esm(() => {
|
|
|
61056
61056
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
61057
61057
|
WHITESPACE_REGEX = /\s+/;
|
|
61058
61058
|
getVersionBase = memoize_default(() => {
|
|
61059
|
-
const match = { VERSION: "0.1.
|
|
61059
|
+
const match = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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]+)?/);
|
|
61060
61060
|
return match ? match[0] : undefined;
|
|
61061
61061
|
});
|
|
61062
61062
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -61096,9 +61096,9 @@ var init_metadata = __esm(() => {
|
|
|
61096
61096
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
61097
61097
|
isTheusCodeAction: isEnvTruthy(process.env.THEUS_CODE_ACTION),
|
|
61098
61098
|
isTheusAiAuth: isTheusAISubscriber(),
|
|
61099
|
-
version: { VERSION: "0.1.
|
|
61099
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
61100
61100
|
versionBase: getVersionBase(),
|
|
61101
|
-
buildTime: { VERSION: "0.1.
|
|
61101
|
+
buildTime: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
61102
61102
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
61103
61103
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
61104
61104
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -61764,7 +61764,7 @@ function initialize1PEventLogging() {
|
|
|
61764
61764
|
const platform2 = getPlatform();
|
|
61765
61765
|
const attributes = {
|
|
61766
61766
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
61767
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.
|
|
61767
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
61768
61768
|
};
|
|
61769
61769
|
if (platform2 === "wsl") {
|
|
61770
61770
|
const wslVersion = getWslVersion();
|
|
@@ -61791,7 +61791,7 @@ function initialize1PEventLogging() {
|
|
|
61791
61791
|
})
|
|
61792
61792
|
]
|
|
61793
61793
|
});
|
|
61794
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
61794
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
61795
61795
|
}
|
|
61796
61796
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
61797
61797
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -63662,7 +63662,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
63662
63662
|
if (!isAttributionHeaderEnabled()) {
|
|
63663
63663
|
return "";
|
|
63664
63664
|
}
|
|
63665
|
-
const version2 = `${{ VERSION: "0.1.
|
|
63665
|
+
const version2 = `${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
63666
63666
|
const entrypoint = process.env.THEUS_CODE_ENTRYPOINT ?? "unknown";
|
|
63667
63667
|
const cch = "";
|
|
63668
63668
|
const workload = getWorkload();
|
|
@@ -107180,7 +107180,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
107180
107180
|
}
|
|
107181
107181
|
function getFeedbackGuideline() {
|
|
107182
107182
|
if (isUsing3PServices()) {
|
|
107183
|
-
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.1.
|
|
107183
|
+
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
107184
107184
|
}
|
|
107185
107185
|
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";
|
|
107186
107186
|
}
|
|
@@ -165877,7 +165877,7 @@ function getTelemetryAttributes() {
|
|
|
165877
165877
|
attributes["session.id"] = sessionId;
|
|
165878
165878
|
}
|
|
165879
165879
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
165880
|
-
attributes["app.version"] = { VERSION: "0.1.
|
|
165880
|
+
attributes["app.version"] = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
165881
165881
|
}
|
|
165882
165882
|
const oauthAccount = getOauthAccountInfo();
|
|
165883
165883
|
if (oauthAccount) {
|
|
@@ -201923,7 +201923,7 @@ function getInstallationEnv() {
|
|
|
201923
201923
|
return;
|
|
201924
201924
|
}
|
|
201925
201925
|
function getTheusCodeVersion() {
|
|
201926
|
-
return { VERSION: "0.1.
|
|
201926
|
+
return { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
201927
201927
|
}
|
|
201928
201928
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
201929
201929
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -203441,7 +203441,7 @@ async function getMcpHeadersFromHelper(serverName, config2) {
|
|
|
203441
203441
|
if ("scope" in config2 && isMcpServerFromProjectOrLocalSettings(config2) && !getIsNonInteractiveSession()) {
|
|
203442
203442
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
203443
203443
|
if (!hasTrust) {
|
|
203444
|
-
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.1.
|
|
203444
|
+
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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
203445
203445
|
logAntError("MCP headersHelper invoked before trust check", error40);
|
|
203446
203446
|
logEvent("tengu_mcp_headersHelper_missing_trust", {});
|
|
203447
203447
|
return null;
|
|
@@ -204651,7 +204651,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
204651
204651
|
const client2 = new Client({
|
|
204652
204652
|
name: "theus-code",
|
|
204653
204653
|
title: "Theus",
|
|
204654
|
-
version: { VERSION: "0.1.
|
|
204654
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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",
|
|
204655
204655
|
description: "Theus's agentic coding tool",
|
|
204656
204656
|
websiteUrl: PRODUCT_URL
|
|
204657
204657
|
}, {
|
|
@@ -205005,7 +205005,7 @@ var init_client5 = __esm(() => {
|
|
|
205005
205005
|
const client2 = new Client({
|
|
205006
205006
|
name: "theus-code",
|
|
205007
205007
|
title: "Theus",
|
|
205008
|
-
version: { VERSION: "0.1.
|
|
205008
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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",
|
|
205009
205009
|
description: "Theus's agentic coding tool",
|
|
205010
205010
|
websiteUrl: PRODUCT_URL
|
|
205011
205011
|
}, {
|
|
@@ -215564,7 +215564,7 @@ async function initializeBetaTracing(resource) {
|
|
|
215564
215564
|
});
|
|
215565
215565
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215566
215566
|
setLoggerProvider(loggerProvider);
|
|
215567
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215567
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
215568
215568
|
setEventLogger(eventLogger);
|
|
215569
215569
|
process.on("beforeExit", async () => {
|
|
215570
215570
|
await loggerProvider?.forceFlush();
|
|
@@ -215604,7 +215604,7 @@ async function initializeTelemetry() {
|
|
|
215604
215604
|
const platform4 = getPlatform();
|
|
215605
215605
|
const baseAttributes = {
|
|
215606
215606
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
215607
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.
|
|
215607
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
215608
215608
|
};
|
|
215609
215609
|
if (platform4 === "wsl") {
|
|
215610
215610
|
const wslVersion = getWslVersion();
|
|
@@ -215649,7 +215649,7 @@ async function initializeTelemetry() {
|
|
|
215649
215649
|
} catch {}
|
|
215650
215650
|
};
|
|
215651
215651
|
registerCleanup(shutdownTelemetry2);
|
|
215652
|
-
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215652
|
+
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
215653
215653
|
}
|
|
215654
215654
|
const meterProvider = new MeterProvider({
|
|
215655
215655
|
resource,
|
|
@@ -215669,7 +215669,7 @@ async function initializeTelemetry() {
|
|
|
215669
215669
|
});
|
|
215670
215670
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215671
215671
|
setLoggerProvider(loggerProvider);
|
|
215672
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215672
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
215673
215673
|
setEventLogger(eventLogger);
|
|
215674
215674
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
215675
215675
|
process.on("beforeExit", async () => {
|
|
@@ -215731,7 +215731,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
215731
215731
|
}
|
|
215732
215732
|
};
|
|
215733
215733
|
registerCleanup(shutdownTelemetry);
|
|
215734
|
-
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215734
|
+
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
215735
215735
|
}
|
|
215736
215736
|
async function flushTelemetry() {
|
|
215737
215737
|
const meterProvider = getMeterProvider();
|
|
@@ -216271,7 +216271,7 @@ async function installOrUpdateTheusPackage(channel2, specificVersion) {
|
|
|
216271
216271
|
return "install_failed";
|
|
216272
216272
|
}
|
|
216273
216273
|
const versionSpec = specificVersion ? specificVersion : channel2 === "stable" ? "stable" : "latest";
|
|
216274
|
-
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.
|
|
216274
|
+
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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 });
|
|
216275
216275
|
if (result.code !== 0) {
|
|
216276
216276
|
const error40 = new Error(`Failed to install Theus CLI package: ${result.stderr}`);
|
|
216277
216277
|
logError2(error40);
|
|
@@ -216417,9 +216417,9 @@ async function assertMinVersion() {
|
|
|
216417
216417
|
if (false) {}
|
|
216418
216418
|
try {
|
|
216419
216419
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
216420
|
-
if (versionConfig.minVersion && lt({ VERSION: "0.1.
|
|
216420
|
+
if (versionConfig.minVersion && lt({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
216421
216421
|
console.error(`
|
|
216422
|
-
It looks like your version of Theus (${{ VERSION: "0.1.
|
|
216422
|
+
It looks like your version of Theus (${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.
|
|
216423
216423
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
216424
216424
|
|
|
216425
216425
|
To update, please run:
|
|
@@ -216560,7 +216560,7 @@ async function getInstallationPrefix() {
|
|
|
216560
216560
|
return prefixResult.stdout.trim();
|
|
216561
216561
|
}
|
|
216562
216562
|
function getGlobalInstallPackageManager() {
|
|
216563
|
-
if ({ VERSION: "0.1.
|
|
216563
|
+
if ({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
216564
216564
|
return "npm";
|
|
216565
216565
|
}
|
|
216566
216566
|
return env3.isRunningWithBun() ? "bun" : "npm";
|
|
@@ -216585,7 +216585,7 @@ async function checkGlobalInstallPermissions() {
|
|
|
216585
216585
|
}
|
|
216586
216586
|
async function getLatestVersion(channel2) {
|
|
216587
216587
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
216588
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.
|
|
216588
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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() });
|
|
216589
216589
|
if (result.code !== 0) {
|
|
216590
216590
|
logForDebugging(`npm view failed with code ${result.code}`);
|
|
216591
216591
|
if (result.stderr) {
|
|
@@ -216601,7 +216601,7 @@ async function getLatestVersion(channel2) {
|
|
|
216601
216601
|
return result.stdout.trim();
|
|
216602
216602
|
}
|
|
216603
216603
|
async function getNpmDistTags() {
|
|
216604
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.
|
|
216604
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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() });
|
|
216605
216605
|
if (result.code !== 0) {
|
|
216606
216606
|
logForDebugging(`npm view dist-tags failed with code ${result.code}`);
|
|
216607
216607
|
return { latest: null, stable: null };
|
|
@@ -216641,7 +216641,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216641
216641
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
216642
216642
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
216643
216643
|
pid: process.pid,
|
|
216644
|
-
currentVersion: { VERSION: "0.1.
|
|
216644
|
+
currentVersion: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
216645
216645
|
});
|
|
216646
216646
|
return "in_progress";
|
|
216647
216647
|
}
|
|
@@ -216650,7 +216650,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216650
216650
|
if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
|
|
216651
216651
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
216652
216652
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
216653
|
-
currentVersion: { VERSION: "0.1.
|
|
216653
|
+
currentVersion: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
216654
216654
|
});
|
|
216655
216655
|
console.error(`
|
|
216656
216656
|
Error: Windows NPM detected in WSL
|
|
@@ -216669,7 +216669,7 @@ To fix this issue:
|
|
|
216669
216669
|
if (!hasPermissions) {
|
|
216670
216670
|
return "no_permissions";
|
|
216671
216671
|
}
|
|
216672
|
-
const packageSpec = specificVersion ? `${{ VERSION: "0.1.
|
|
216672
|
+
const packageSpec = specificVersion ? `${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
216673
216673
|
const packageManager = getGlobalInstallPackageManager();
|
|
216674
216674
|
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir18() });
|
|
216675
216675
|
if (installResult.code !== 0) {
|
|
@@ -216997,8 +216997,8 @@ async function detectMultipleInstallations() {
|
|
|
216997
216997
|
installations.push({ type: "npm-local", path: localPath });
|
|
216998
216998
|
}
|
|
216999
216999
|
const packagesToCheck = ["@theus-ai/theus-code"];
|
|
217000
|
-
if ({ VERSION: "0.1.
|
|
217001
|
-
packagesToCheck.push({ VERSION: "0.1.
|
|
217000
|
+
if ({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
217001
|
+
packagesToCheck.push({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
217002
217002
|
}
|
|
217003
217003
|
const npmResult = await execFileNoThrow("npm", [
|
|
217004
217004
|
"-g",
|
|
@@ -217181,7 +217181,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
217181
217181
|
}
|
|
217182
217182
|
async function getDoctorDiagnostic() {
|
|
217183
217183
|
const installationType = await getCurrentInstallationType();
|
|
217184
|
-
const version2 = { VERSION: "0.1.
|
|
217184
|
+
const version2 = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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";
|
|
217185
217185
|
const installationPath = await getInstallationPath();
|
|
217186
217186
|
const invokedBinary = getInvokedBinary();
|
|
217187
217187
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -217193,8 +217193,8 @@ async function getDoctorDiagnostic() {
|
|
|
217193
217193
|
for (const install of npmInstalls) {
|
|
217194
217194
|
if (install.type === "npm-global") {
|
|
217195
217195
|
let uninstallCmd = "npm -g uninstall @theus-ai/theus-code";
|
|
217196
|
-
if ({ VERSION: "0.1.
|
|
217197
|
-
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.
|
|
217196
|
+
if ({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
217197
|
+
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
217198
217198
|
}
|
|
217199
217199
|
warnings.push({
|
|
217200
217200
|
issue: `Leftover npm global installation at ${install.path}`,
|
|
@@ -217306,7 +217306,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217306
217306
|
const startTime2 = Date.now();
|
|
217307
217307
|
const { stdout, code, stderr } = await execFileNoThrowWithCwd("npm", [
|
|
217308
217308
|
"view",
|
|
217309
|
-
`${{ VERSION: "0.1.
|
|
217309
|
+
`${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`,
|
|
217310
217310
|
"version",
|
|
217311
217311
|
"--prefer-online",
|
|
217312
217312
|
"--registry",
|
|
@@ -217330,7 +217330,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217330
217330
|
latency_ms: latencyMs,
|
|
217331
217331
|
source_npm: true
|
|
217332
217332
|
});
|
|
217333
|
-
logForDebugging(`npm view ${{ VERSION: "0.1.
|
|
217333
|
+
logForDebugging(`npm view ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
217334
217334
|
const latestVersion = stdout.trim();
|
|
217335
217335
|
return latestVersion;
|
|
217336
217336
|
}
|
|
@@ -217386,7 +217386,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217386
217386
|
const fs3 = getFsImplementation();
|
|
217387
217387
|
await fs3.rm(stagingPath, { recursive: true, force: true });
|
|
217388
217388
|
const platform4 = getPlatform2();
|
|
217389
|
-
const platformPackageName = `${{ VERSION: "0.1.
|
|
217389
|
+
const platformPackageName = `${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
217390
217390
|
logForDebugging(`Fetching integrity hash for ${platformPackageName}@${version2}`);
|
|
217391
217391
|
const {
|
|
217392
217392
|
stdout: integrityOutput,
|
|
@@ -217415,7 +217415,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217415
217415
|
name: "theus-native-installer",
|
|
217416
217416
|
version: "0.0.1",
|
|
217417
217417
|
dependencies: {
|
|
217418
|
-
[{ VERSION: "0.1.
|
|
217418
|
+
[{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
217419
217419
|
}
|
|
217420
217420
|
};
|
|
217421
217421
|
const packageLock = {
|
|
@@ -217428,10 +217428,10 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217428
217428
|
name: "theus-native-installer",
|
|
217429
217429
|
version: "0.0.1",
|
|
217430
217430
|
dependencies: {
|
|
217431
|
-
[{ VERSION: "0.1.
|
|
217431
|
+
[{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
217432
217432
|
}
|
|
217433
217433
|
},
|
|
217434
|
-
[`node_modules/${{ VERSION: "0.1.
|
|
217434
|
+
[`node_modules/${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`]: {
|
|
217435
217435
|
version: version2,
|
|
217436
217436
|
optionalDependencies: {
|
|
217437
217437
|
[platformPackageName]: version2
|
|
@@ -217453,7 +217453,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217453
217453
|
if (result.code !== 0) {
|
|
217454
217454
|
throw new Error(`npm ci failed with code ${result.code}: ${result.stderr}`);
|
|
217455
217455
|
}
|
|
217456
|
-
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.
|
|
217456
|
+
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
217457
217457
|
}
|
|
217458
217458
|
function getStallTimeoutMs() {
|
|
217459
217459
|
return Number(process.env.THEUS_CODE_STALL_TIMEOUT_MS_FOR_TESTING) || DEFAULT_STALL_TIMEOUT_MS;
|
|
@@ -218116,8 +218116,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218116
218116
|
const maxVersion = await getMaxVersion();
|
|
218117
218117
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
218118
218118
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
218119
|
-
if (gte({ VERSION: "0.1.
|
|
218120
|
-
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.
|
|
218119
|
+
if (gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
218120
|
+
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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`);
|
|
218121
218121
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
218122
218122
|
latency_ms: Date.now() - startTime2,
|
|
218123
218123
|
max_version: maxVersion,
|
|
@@ -218128,7 +218128,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218128
218128
|
version2 = maxVersion;
|
|
218129
218129
|
}
|
|
218130
218130
|
}
|
|
218131
|
-
if (!forceReinstall && version2 === { VERSION: "0.1.
|
|
218131
|
+
if (!forceReinstall && version2 === { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
218132
218132
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
218133
218133
|
logEvent("tengu_native_update_complete", {
|
|
218134
218134
|
latency_ms: Date.now() - startTime2,
|
|
@@ -218729,6 +218729,14 @@ async function removeInstalledSymlink() {
|
|
|
218729
218729
|
logForDebugging(`Skipping removal of ${dirs.executable} - appears to be npm-managed`);
|
|
218730
218730
|
return;
|
|
218731
218731
|
}
|
|
218732
|
+
try {
|
|
218733
|
+
const st = await lstat4(dirs.executable);
|
|
218734
|
+
const target = st.isSymbolicLink() ? await realpath7(dirs.executable) : dirs.executable;
|
|
218735
|
+
if (target.includes("/.theus/")) {
|
|
218736
|
+
logForDebugging(`Skipping removal of ${dirs.executable} - theus.pe bundle launcher`);
|
|
218737
|
+
return;
|
|
218738
|
+
}
|
|
218739
|
+
} catch {}
|
|
218732
218740
|
await unlink7(dirs.executable);
|
|
218733
218741
|
logForDebugging(`Removed theus symlink at ${dirs.executable}`);
|
|
218734
218742
|
} catch (error40) {
|
|
@@ -218870,8 +218878,8 @@ async function cleanupNpmInstallations() {
|
|
|
218870
218878
|
} else if (codePackageResult.error) {
|
|
218871
218879
|
errors4.push(codePackageResult.error);
|
|
218872
218880
|
}
|
|
218873
|
-
if ({ VERSION: "0.1.
|
|
218874
|
-
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.
|
|
218881
|
+
if ({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
218882
|
+
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
218875
218883
|
if (macroPackageResult.success) {
|
|
218876
218884
|
removed++;
|
|
218877
218885
|
if (macroPackageResult.warning) {
|
|
@@ -295643,9 +295651,9 @@ function getTheusEnvMetadata() {
|
|
|
295643
295651
|
};
|
|
295644
295652
|
}
|
|
295645
295653
|
function getBuildAgeMinutes() {
|
|
295646
|
-
if (!{ VERSION: "0.1.
|
|
295654
|
+
if (!{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)
|
|
295647
295655
|
return;
|
|
295648
|
-
const buildTime = new Date({ VERSION: "0.1.
|
|
295656
|
+
const buildTime = new Date({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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();
|
|
295649
295657
|
if (isNaN(buildTime))
|
|
295650
295658
|
return;
|
|
295651
295659
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -311875,7 +311883,7 @@ function getAssistantMessageFromError(error40, model, options2) {
|
|
|
311875
311883
|
if (process.env.USER_TYPE === "ant") {
|
|
311876
311884
|
const baseMessage = `API Error: 400 ${error40.message}
|
|
311877
311885
|
|
|
311878
|
-
Run /share and post the JSON file to ${{ VERSION: "0.1.
|
|
311886
|
+
Run /share and post the JSON file to ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}.`;
|
|
311879
311887
|
const rewindInstruction = getIsNonInteractiveSession() ? "" : " Then, use /rewind to recover the conversation.";
|
|
311880
311888
|
return createAssistantAPIErrorMessage({
|
|
311881
311889
|
content: baseMessage + rewindInstruction,
|
|
@@ -311911,7 +311919,7 @@ Run /share and post the JSON file to ${{ VERSION: "0.1.16", BUILD_TIME: "1970-01
|
|
|
311911
311919
|
if (process.env.USER_TYPE === "ant" && !process.env.THEUS_MODEL && error40 instanceof Error && error40.message.toLowerCase().includes("invalid model name")) {
|
|
311912
311920
|
const orgId = getOauthAccountInfo()?.organizationUuid;
|
|
311913
311921
|
const baseMsg = `[THEUS-INTERNAL] Your org isn't gated into the \`${model}\` model. Either run \`theus\` with \`THEUS_MODEL=${getDefaultMainLoopModelSetting()}\``;
|
|
311914
|
-
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.
|
|
311922
|
+
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.`;
|
|
311915
311923
|
return createAssistantAPIErrorMessage({
|
|
311916
311924
|
content: msg,
|
|
311917
311925
|
error: "invalid_request"
|
|
@@ -322011,7 +322019,7 @@ function buildPrimarySection() {
|
|
|
322011
322019
|
});
|
|
322012
322020
|
return [{
|
|
322013
322021
|
label: "Version",
|
|
322014
|
-
value: { VERSION: "0.1.
|
|
322022
|
+
value: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
322015
322023
|
}, {
|
|
322016
322024
|
label: "Session name",
|
|
322017
322025
|
value: nameValue
|
|
@@ -325762,7 +325770,7 @@ function Config({
|
|
|
325762
325770
|
}
|
|
325763
325771
|
})
|
|
325764
325772
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime180.jsx(ChannelDowngradeDialog, {
|
|
325765
|
-
currentVersion: { VERSION: "0.1.
|
|
325773
|
+
currentVersion: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
325766
325774
|
onChoice: (choice) => {
|
|
325767
325775
|
setShowSubmenu(null);
|
|
325768
325776
|
setTabsHidden(false);
|
|
@@ -325774,7 +325782,7 @@ function Config({
|
|
|
325774
325782
|
autoUpdatesChannel: "stable"
|
|
325775
325783
|
};
|
|
325776
325784
|
if (choice === "stay") {
|
|
325777
|
-
newSettings.minimumVersion = { VERSION: "0.1.
|
|
325785
|
+
newSettings.minimumVersion = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
325778
325786
|
}
|
|
325779
325787
|
updateSettingsForSource("userSettings", newSettings);
|
|
325780
325788
|
setSettingsData((prev_27) => ({
|
|
@@ -333808,7 +333816,7 @@ function HelpV2(t0) {
|
|
|
333808
333816
|
let t6;
|
|
333809
333817
|
if ($2[31] !== tabs) {
|
|
333810
333818
|
t6 = /* @__PURE__ */ jsx_runtime207.jsx(Tabs, {
|
|
333811
|
-
title: `Theus v${{ VERSION: "0.1.
|
|
333819
|
+
title: `Theus v${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`,
|
|
333812
333820
|
color: "professionalBlue",
|
|
333813
333821
|
defaultTab: "general",
|
|
333814
333822
|
children: tabs
|
|
@@ -351239,9 +351247,9 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
351239
351247
|
return [];
|
|
351240
351248
|
}
|
|
351241
351249
|
}
|
|
351242
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.
|
|
351250
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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) {
|
|
351243
351251
|
if (process.env.USER_TYPE === "ant") {
|
|
351244
|
-
const changelog = { VERSION: "0.1.
|
|
351252
|
+
const changelog = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
351245
351253
|
if (changelog) {
|
|
351246
351254
|
const commits = changelog.trim().split(`
|
|
351247
351255
|
`).filter(Boolean);
|
|
@@ -355435,7 +355443,7 @@ var init_Messages = __esm(() => {
|
|
|
355435
355443
|
let t1;
|
|
355436
355444
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
355437
355445
|
t1 = /* @__PURE__ */ jsx_runtime245.jsx(TheusBanner, {
|
|
355438
|
-
version: { VERSION: "0.1.
|
|
355446
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
355439
355447
|
});
|
|
355440
355448
|
$2[0] = t1;
|
|
355441
355449
|
} else {
|
|
@@ -382975,7 +382983,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
382975
382983
|
smapsRollup,
|
|
382976
382984
|
platform: process.platform,
|
|
382977
382985
|
nodeVersion: process.version,
|
|
382978
|
-
ccVersion: { VERSION: "0.1.
|
|
382986
|
+
ccVersion: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
382979
382987
|
};
|
|
382980
382988
|
}
|
|
382981
382989
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -383561,7 +383569,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
383561
383569
|
var call54 = async () => {
|
|
383562
383570
|
return {
|
|
383563
383571
|
type: "text",
|
|
383564
|
-
value: { VERSION: "0.1.
|
|
383572
|
+
value: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
383565
383573
|
};
|
|
383566
383574
|
}, version2, version_default;
|
|
383567
383575
|
var init_version = __esm(() => {
|
|
@@ -387294,13 +387302,180 @@ var exports_update = {};
|
|
|
387294
387302
|
__export(exports_update, {
|
|
387295
387303
|
update: () => update
|
|
387296
387304
|
});
|
|
387305
|
+
import { spawn as spawn8, spawnSync as spawnSync5 } from "child_process";
|
|
387306
|
+
import { createHash as createHash27 } from "crypto";
|
|
387307
|
+
import {
|
|
387308
|
+
cpSync,
|
|
387309
|
+
existsSync as existsSync14,
|
|
387310
|
+
mkdtempSync,
|
|
387311
|
+
readFileSync as readFileSync21,
|
|
387312
|
+
realpathSync as realpathSync4,
|
|
387313
|
+
rmSync as rmSync4,
|
|
387314
|
+
writeFileSync as writeFileSync7
|
|
387315
|
+
} from "fs";
|
|
387316
|
+
import { tmpdir as tmpdir8 } from "os";
|
|
387317
|
+
import { dirname as dirname57, join as join137 } from "path";
|
|
387318
|
+
async function updateNaupa() {
|
|
387319
|
+
if (process.env.THEUS_NO_NAUPA_UPDATE === "1")
|
|
387320
|
+
return;
|
|
387321
|
+
if (!isNaupaEnabled())
|
|
387322
|
+
return;
|
|
387323
|
+
const bin = resolveNaupaBinary();
|
|
387324
|
+
if (!bin)
|
|
387325
|
+
return;
|
|
387326
|
+
writeToStdout(`
|
|
387327
|
+
`);
|
|
387328
|
+
writeToStdout(source_default.bold("\u2014 \xD1aupa (motor de c\xF3digo) \u2014") + `
|
|
387329
|
+
`);
|
|
387330
|
+
await new Promise((resolve43) => {
|
|
387331
|
+
let settled = false;
|
|
387332
|
+
const done = () => {
|
|
387333
|
+
if (settled)
|
|
387334
|
+
return;
|
|
387335
|
+
settled = true;
|
|
387336
|
+
resolve43();
|
|
387337
|
+
};
|
|
387338
|
+
const child = spawn8(bin, ["update", "-y", "--ui"], {
|
|
387339
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
387340
|
+
env: process.env
|
|
387341
|
+
});
|
|
387342
|
+
const timer = setTimeout(() => {
|
|
387343
|
+
child.kill("SIGTERM");
|
|
387344
|
+
writeToStdout(source_default.yellow("Aviso: la actualizaci\xF3n de \xD1aupa excedi\xF3 el tiempo l\xEDmite. " + "Puedes reintentar a mano: naupa update --ui") + `
|
|
387345
|
+
`);
|
|
387346
|
+
}, 180000);
|
|
387347
|
+
child.on("error", () => {
|
|
387348
|
+
clearTimeout(timer);
|
|
387349
|
+
writeToStdout(source_default.yellow("Aviso: no se pudo ejecutar la actualizaci\xF3n de \xD1aupa. " + "Puedes hacerlo a mano: naupa update --ui") + `
|
|
387350
|
+
`);
|
|
387351
|
+
done();
|
|
387352
|
+
});
|
|
387353
|
+
child.on("close", (code) => {
|
|
387354
|
+
clearTimeout(timer);
|
|
387355
|
+
if (code !== 0 && code !== null) {
|
|
387356
|
+
writeToStdout(source_default.yellow(`Aviso: \xD1aupa update termin\xF3 con c\xF3digo ${code}. ` + "Puedes reintentar a mano: naupa update --ui") + `
|
|
387357
|
+
`);
|
|
387358
|
+
}
|
|
387359
|
+
done();
|
|
387360
|
+
});
|
|
387361
|
+
});
|
|
387362
|
+
}
|
|
387363
|
+
function isReleaseBundleInstall() {
|
|
387364
|
+
try {
|
|
387365
|
+
const entry = process.argv[1];
|
|
387366
|
+
if (!entry)
|
|
387367
|
+
return false;
|
|
387368
|
+
const real = realpathSync4(entry);
|
|
387369
|
+
if (!real.endsWith("cli.js"))
|
|
387370
|
+
return false;
|
|
387371
|
+
if (real.includes("node_modules"))
|
|
387372
|
+
return false;
|
|
387373
|
+
return existsSync14(join137(dirname57(real), "bin", "theus"));
|
|
387374
|
+
} catch {
|
|
387375
|
+
return false;
|
|
387376
|
+
}
|
|
387377
|
+
}
|
|
387378
|
+
function sha256File(path19) {
|
|
387379
|
+
return createHash27("sha256").update(readFileSync21(path19)).digest("hex");
|
|
387380
|
+
}
|
|
387381
|
+
async function fetchReleaseChannelVersion() {
|
|
387382
|
+
try {
|
|
387383
|
+
const res = await fetch(`${DL_BASE}/latest.json`, {
|
|
387384
|
+
signal: AbortSignal.timeout(15000)
|
|
387385
|
+
});
|
|
387386
|
+
if (!res.ok)
|
|
387387
|
+
return null;
|
|
387388
|
+
const data = await res.json();
|
|
387389
|
+
const v = (data.version ?? data.tag_name ?? "").replace(/^v/, "").trim();
|
|
387390
|
+
return /^\d+\.\d+\.\d+/.test(v) ? v : null;
|
|
387391
|
+
} catch {
|
|
387392
|
+
return null;
|
|
387393
|
+
}
|
|
387394
|
+
}
|
|
387395
|
+
async function downloadToFile(url3, dest) {
|
|
387396
|
+
try {
|
|
387397
|
+
const res = await fetch(url3, { signal: AbortSignal.timeout(120000) });
|
|
387398
|
+
if (!res.ok)
|
|
387399
|
+
return false;
|
|
387400
|
+
writeFileSync7(dest, Buffer.from(await res.arrayBuffer()));
|
|
387401
|
+
return true;
|
|
387402
|
+
} catch {
|
|
387403
|
+
return false;
|
|
387404
|
+
}
|
|
387405
|
+
}
|
|
387406
|
+
async function updateReleaseBundle() {
|
|
387407
|
+
const bundleDir = dirname57(realpathSync4(process.argv[1]));
|
|
387408
|
+
const latest = await fetchReleaseChannelVersion();
|
|
387409
|
+
if (!latest) {
|
|
387410
|
+
process.stderr.write(source_default.red(`No pude comprobar la \xFAltima versi\xF3n en theus.pe/dl.
|
|
387411
|
+
`));
|
|
387412
|
+
process.stderr.write(`Reintenta luego, o reinstala con: curl -fsSL https://theus.pe/install.sh | bash
|
|
387413
|
+
`);
|
|
387414
|
+
await gracefulShutdown(1);
|
|
387415
|
+
return;
|
|
387416
|
+
}
|
|
387417
|
+
if (gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
387418
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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})`) + `
|
|
387419
|
+
`);
|
|
387420
|
+
await gracefulShutdown(0);
|
|
387421
|
+
return;
|
|
387422
|
+
}
|
|
387423
|
+
writeToStdout(`New version available: ${latest} (current: ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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})
|
|
387424
|
+
`);
|
|
387425
|
+
writeToStdout(`Installing update from theus.pe/dl...
|
|
387426
|
+
`);
|
|
387427
|
+
const tmp = mkdtempSync(join137(tmpdir8(), "theus-update-"));
|
|
387428
|
+
try {
|
|
387429
|
+
const tarPath = join137(tmp, "theus-cli.tar.gz");
|
|
387430
|
+
const sumsPath = join137(tmp, "SHA256SUMS");
|
|
387431
|
+
if (!await downloadToFile(`${DL_BASE}/theus-cli.tar.gz`, tarPath) || !await downloadToFile(`${DL_BASE}/SHA256SUMS`, sumsPath)) {
|
|
387432
|
+
process.stderr.write(source_default.red(`Fall\xF3 la descarga del release desde theus.pe/dl.
|
|
387433
|
+
`));
|
|
387434
|
+
await gracefulShutdown(1);
|
|
387435
|
+
return;
|
|
387436
|
+
}
|
|
387437
|
+
const expected = readFileSync21(sumsPath, "utf8").split(`
|
|
387438
|
+
`).map((line) => line.trim().split(/\s+/)).find((parts) => parts[1] === "theus-cli.tar.gz" || parts[1] === "*theus-cli.tar.gz")?.[0];
|
|
387439
|
+
const actual = sha256File(tarPath);
|
|
387440
|
+
if (!expected || expected !== actual) {
|
|
387441
|
+
process.stderr.write(source_default.red(`Checksum SHA-256 inv\xE1lido del release (esperado ${expected ?? "n/a"}, obtenido ${actual}). Abortado.
|
|
387442
|
+
`));
|
|
387443
|
+
await gracefulShutdown(1);
|
|
387444
|
+
return;
|
|
387445
|
+
}
|
|
387446
|
+
const ex = spawnSync5("tar", ["-xzf", tarPath, "-C", tmp], {
|
|
387447
|
+
stdio: "ignore"
|
|
387448
|
+
});
|
|
387449
|
+
const staged = join137(tmp, "theus-cli");
|
|
387450
|
+
if (ex.status !== 0 || !existsSync14(join137(staged, "cli.js"))) {
|
|
387451
|
+
process.stderr.write(source_default.red(`No pude extraer el release descargado (o vino incompleto).
|
|
387452
|
+
`));
|
|
387453
|
+
await gracefulShutdown(1);
|
|
387454
|
+
return;
|
|
387455
|
+
}
|
|
387456
|
+
cpSync(staged, bundleDir, { recursive: true, force: true });
|
|
387457
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`) + `
|
|
387458
|
+
`);
|
|
387459
|
+
await regenerateCompletionCache();
|
|
387460
|
+
} finally {
|
|
387461
|
+
try {
|
|
387462
|
+
rmSync4(tmp, { recursive: true, force: true });
|
|
387463
|
+
} catch {}
|
|
387464
|
+
}
|
|
387465
|
+
await gracefulShutdown(0);
|
|
387466
|
+
}
|
|
387297
387467
|
async function update() {
|
|
387298
387468
|
logEvent("tengu_update_check", {});
|
|
387299
|
-
|
|
387469
|
+
await updateNaupa();
|
|
387470
|
+
writeToStdout(`Current version: ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387300
387471
|
`);
|
|
387301
387472
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
387302
387473
|
writeToStdout(`Checking for updates to ${channel2} version...
|
|
387303
387474
|
`);
|
|
387475
|
+
if (isReleaseBundleInstall()) {
|
|
387476
|
+
await updateReleaseBundle();
|
|
387477
|
+
return;
|
|
387478
|
+
}
|
|
387304
387479
|
logForDebugging("update: Starting update check");
|
|
387305
387480
|
logForDebugging("update: Running diagnostic");
|
|
387306
387481
|
const diagnostic = await getDoctorDiagnostic();
|
|
@@ -387371,8 +387546,8 @@ async function update() {
|
|
|
387371
387546
|
writeToStdout(`Theus is managed by Homebrew.
|
|
387372
387547
|
`);
|
|
387373
387548
|
const latest = await getLatestVersion(channel2);
|
|
387374
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
387375
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
387549
|
+
if (latest && !gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
387550
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387376
387551
|
`);
|
|
387377
387552
|
writeToStdout(`
|
|
387378
387553
|
`);
|
|
@@ -387388,8 +387563,8 @@ async function update() {
|
|
|
387388
387563
|
writeToStdout(`Theus is managed by winget.
|
|
387389
387564
|
`);
|
|
387390
387565
|
const latest = await getLatestVersion(channel2);
|
|
387391
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
387392
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
387566
|
+
if (latest && !gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
387567
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387393
387568
|
`);
|
|
387394
387569
|
writeToStdout(`
|
|
387395
387570
|
`);
|
|
@@ -387405,8 +387580,8 @@ async function update() {
|
|
|
387405
387580
|
writeToStdout(`Theus is managed by apk.
|
|
387406
387581
|
`);
|
|
387407
387582
|
const latest = await getLatestVersion(channel2);
|
|
387408
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
387409
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
387583
|
+
if (latest && !gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
387584
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387410
387585
|
`);
|
|
387411
387586
|
writeToStdout(`
|
|
387412
387587
|
`);
|
|
@@ -387471,11 +387646,11 @@ async function update() {
|
|
|
387471
387646
|
`);
|
|
387472
387647
|
await gracefulShutdown(1);
|
|
387473
387648
|
}
|
|
387474
|
-
if (result.latestVersion === { VERSION: "0.1.
|
|
387475
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
387649
|
+
if (result.latestVersion === { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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) {
|
|
387650
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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})`) + `
|
|
387476
387651
|
`);
|
|
387477
387652
|
} else {
|
|
387478
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
387653
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`) + `
|
|
387479
387654
|
`);
|
|
387480
387655
|
await regenerateCompletionCache();
|
|
387481
387656
|
}
|
|
@@ -387494,9 +387669,9 @@ async function update() {
|
|
|
387494
387669
|
await removeInstalledSymlink();
|
|
387495
387670
|
}
|
|
387496
387671
|
logForDebugging("update: Checking npm registry for latest version");
|
|
387497
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.
|
|
387672
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
387498
387673
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
387499
|
-
const npmCommand = `npm view ${{ VERSION: "0.1.
|
|
387674
|
+
const npmCommand = `npm view ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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`;
|
|
387500
387675
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
387501
387676
|
const latestVersion = await getLatestVersion(channel2);
|
|
387502
387677
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -387516,7 +387691,7 @@ async function update() {
|
|
|
387516
387691
|
`);
|
|
387517
387692
|
process.stderr.write(` \u2022 Corporate proxy/firewall blocking npm
|
|
387518
387693
|
`);
|
|
387519
|
-
if ({ VERSION: "0.1.
|
|
387694
|
+
if ({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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")) {
|
|
387520
387695
|
process.stderr.write(` \u2022 Internal/development build not published to npm
|
|
387521
387696
|
`);
|
|
387522
387697
|
}
|
|
@@ -387528,19 +387703,19 @@ async function update() {
|
|
|
387528
387703
|
`);
|
|
387529
387704
|
process.stderr.write(` \u2022 Run with --debug flag for more details
|
|
387530
387705
|
`);
|
|
387531
|
-
const packageName = { VERSION: "0.1.
|
|
387706
|
+
const packageName = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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");
|
|
387532
387707
|
process.stderr.write(` \u2022 Manually check: npm view ${packageName} version
|
|
387533
387708
|
`);
|
|
387534
387709
|
process.stderr.write(` \u2022 Check if you need to login: npm whoami
|
|
387535
387710
|
`);
|
|
387536
387711
|
await gracefulShutdown(1);
|
|
387537
387712
|
}
|
|
387538
|
-
if (gte({ VERSION: "0.1.
|
|
387539
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
387713
|
+
if (gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
387714
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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})`) + `
|
|
387540
387715
|
`);
|
|
387541
387716
|
await gracefulShutdown(0);
|
|
387542
387717
|
}
|
|
387543
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.
|
|
387718
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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})
|
|
387544
387719
|
`);
|
|
387545
387720
|
writeToStdout(`Installing update...
|
|
387546
387721
|
`);
|
|
@@ -387585,7 +387760,7 @@ async function update() {
|
|
|
387585
387760
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
387586
387761
|
switch (status2) {
|
|
387587
387762
|
case "success":
|
|
387588
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
387763
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`) + `
|
|
387589
387764
|
`);
|
|
387590
387765
|
await regenerateCompletionCache();
|
|
387591
387766
|
break;
|
|
@@ -387595,7 +387770,7 @@ async function update() {
|
|
|
387595
387770
|
if (useLocalUpdate) {
|
|
387596
387771
|
process.stderr.write(`Try manually updating with:
|
|
387597
387772
|
`);
|
|
387598
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
387773
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387599
387774
|
`);
|
|
387600
387775
|
} else {
|
|
387601
387776
|
process.stderr.write(`Try running with sudo or fix npm permissions
|
|
@@ -387611,7 +387786,7 @@ async function update() {
|
|
|
387611
387786
|
if (useLocalUpdate) {
|
|
387612
387787
|
process.stderr.write(`Try manually updating with:
|
|
387613
387788
|
`);
|
|
387614
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
387789
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387615
387790
|
`);
|
|
387616
387791
|
} else {
|
|
387617
387792
|
process.stderr.write(`Or consider using native installation with: theus install
|
|
@@ -387629,9 +387804,11 @@ async function update() {
|
|
|
387629
387804
|
}
|
|
387630
387805
|
await gracefulShutdown(0);
|
|
387631
387806
|
}
|
|
387807
|
+
var DL_BASE;
|
|
387632
387808
|
var init_update = __esm(() => {
|
|
387633
387809
|
init_source();
|
|
387634
387810
|
init_analytics();
|
|
387811
|
+
init_common3();
|
|
387635
387812
|
init_autoUpdater();
|
|
387636
387813
|
init_completionCache();
|
|
387637
387814
|
init_config2();
|
|
@@ -387642,6 +387819,7 @@ var init_update = __esm(() => {
|
|
|
387642
387819
|
init_nativeInstaller();
|
|
387643
387820
|
init_packageManagers();
|
|
387644
387821
|
init_settings2();
|
|
387822
|
+
DL_BASE = (process.env.THEUS_DL_BASE ?? "https://theus.pe/dl").replace(/\/+$/, "");
|
|
387645
387823
|
});
|
|
387646
387824
|
|
|
387647
387825
|
// commands/update/update.ts
|
|
@@ -388308,7 +388486,7 @@ var require_asciichart = __commonJS((exports) => {
|
|
|
388308
388486
|
// utils/statsCache.ts
|
|
388309
388487
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
388310
388488
|
import { open as open14 } from "fs/promises";
|
|
388311
|
-
import { join as
|
|
388489
|
+
import { join as join138 } from "path";
|
|
388312
388490
|
async function withStatsCacheLock(fn) {
|
|
388313
388491
|
while (statsCacheLockPromise) {
|
|
388314
388492
|
await statsCacheLockPromise;
|
|
@@ -388325,7 +388503,7 @@ async function withStatsCacheLock(fn) {
|
|
|
388325
388503
|
}
|
|
388326
388504
|
}
|
|
388327
388505
|
function getStatsCachePath() {
|
|
388328
|
-
return
|
|
388506
|
+
return join138(getTheusConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
388329
388507
|
}
|
|
388330
388508
|
function getEmptyCache() {
|
|
388331
388509
|
return {
|
|
@@ -388992,13 +389170,13 @@ var init_ansiToPng = __esm(() => {
|
|
|
388992
389170
|
|
|
388993
389171
|
// utils/screenshotClipboard.ts
|
|
388994
389172
|
import { mkdir as mkdir41, unlink as unlink19, writeFile as writeFile45 } from "fs/promises";
|
|
388995
|
-
import { tmpdir as
|
|
388996
|
-
import { join as
|
|
389173
|
+
import { tmpdir as tmpdir9 } from "os";
|
|
389174
|
+
import { join as join139 } from "path";
|
|
388997
389175
|
async function copyAnsiToClipboard(ansiText, options2) {
|
|
388998
389176
|
try {
|
|
388999
|
-
const tempDir =
|
|
389177
|
+
const tempDir = join139(tmpdir9(), "theus-code-screenshots");
|
|
389000
389178
|
await mkdir41(tempDir, { recursive: true });
|
|
389001
|
-
const pngPath =
|
|
389179
|
+
const pngPath = join139(tempDir, `screenshot-${Date.now()}.png`);
|
|
389002
389180
|
const pngBuffer = ansiToPng(ansiText, options2);
|
|
389003
389181
|
await writeFile45(pngPath, pngBuffer);
|
|
389004
389182
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -389069,7 +389247,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
389069
389247
|
|
|
389070
389248
|
// utils/stats.ts
|
|
389071
389249
|
import { open as open15 } from "fs/promises";
|
|
389072
|
-
import { basename as basename40, join as
|
|
389250
|
+
import { basename as basename40, join as join140, sep as sep31 } from "path";
|
|
389073
389251
|
async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
389074
389252
|
const { fromDate, toDate } = options2;
|
|
389075
389253
|
const fs5 = getFsImplementation();
|
|
@@ -389247,17 +389425,17 @@ async function getAllSessionFiles() {
|
|
|
389247
389425
|
return [];
|
|
389248
389426
|
throw e;
|
|
389249
389427
|
}
|
|
389250
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
389428
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join140(projectsDir, dirent.name));
|
|
389251
389429
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
389252
389430
|
try {
|
|
389253
389431
|
const entries = await fs5.readdir(projectDir);
|
|
389254
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
389432
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join140(projectDir, dirent.name));
|
|
389255
389433
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
389256
389434
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
389257
|
-
const subagentsDir =
|
|
389435
|
+
const subagentsDir = join140(projectDir, sessionDir.name, "subagents");
|
|
389258
389436
|
try {
|
|
389259
389437
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
389260
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
389438
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join140(subagentsDir, dirent.name));
|
|
389261
389439
|
} catch {
|
|
389262
389440
|
return [];
|
|
389263
389441
|
}
|
|
@@ -391683,7 +391861,7 @@ import {
|
|
|
391683
391861
|
unlink as unlink20,
|
|
391684
391862
|
writeFile as writeFile46
|
|
391685
391863
|
} from "fs/promises";
|
|
391686
|
-
import { basename as basename41, dirname as
|
|
391864
|
+
import { basename as basename41, dirname as dirname59, join as join141 } from "path";
|
|
391687
391865
|
function isTranscriptMessage(entry) {
|
|
391688
391866
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
391689
391867
|
}
|
|
@@ -391697,18 +391875,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
391697
391875
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
391698
391876
|
}
|
|
391699
391877
|
function getProjectsDir2() {
|
|
391700
|
-
return
|
|
391878
|
+
return join141(getTheusConfigHomeDir(), "projects");
|
|
391701
391879
|
}
|
|
391702
391880
|
function getTranscriptPath() {
|
|
391703
391881
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
391704
|
-
return
|
|
391882
|
+
return join141(projectDir, `${getSessionId()}.jsonl`);
|
|
391705
391883
|
}
|
|
391706
391884
|
function getTranscriptPathForSession(sessionId) {
|
|
391707
391885
|
if (sessionId === getSessionId()) {
|
|
391708
391886
|
return getTranscriptPath();
|
|
391709
391887
|
}
|
|
391710
391888
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
391711
|
-
return
|
|
391889
|
+
return join141(projectDir, `${sessionId}.jsonl`);
|
|
391712
391890
|
}
|
|
391713
391891
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
391714
391892
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -391720,15 +391898,15 @@ function getAgentTranscriptPath(agentId) {
|
|
|
391720
391898
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
391721
391899
|
const sessionId = getSessionId();
|
|
391722
391900
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
391723
|
-
const base2 = subdir ?
|
|
391724
|
-
return
|
|
391901
|
+
const base2 = subdir ? join141(projectDir, sessionId, "subagents", subdir) : join141(projectDir, sessionId, "subagents");
|
|
391902
|
+
return join141(base2, `agent-${agentId}.jsonl`);
|
|
391725
391903
|
}
|
|
391726
391904
|
function getAgentMetadataPath(agentId) {
|
|
391727
391905
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
391728
391906
|
}
|
|
391729
391907
|
async function writeAgentMetadata(agentId, metadata) {
|
|
391730
391908
|
const path19 = getAgentMetadataPath(agentId);
|
|
391731
|
-
await mkdir42(
|
|
391909
|
+
await mkdir42(dirname59(path19), { recursive: true });
|
|
391732
391910
|
await writeFile46(path19, JSON.stringify(metadata));
|
|
391733
391911
|
}
|
|
391734
391912
|
async function readAgentMetadata(agentId) {
|
|
@@ -391744,14 +391922,14 @@ async function readAgentMetadata(agentId) {
|
|
|
391744
391922
|
}
|
|
391745
391923
|
function getRemoteAgentsDir() {
|
|
391746
391924
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
391747
|
-
return
|
|
391925
|
+
return join141(projectDir, getSessionId(), "remote-agents");
|
|
391748
391926
|
}
|
|
391749
391927
|
function getRemoteAgentMetadataPath(taskId) {
|
|
391750
|
-
return
|
|
391928
|
+
return join141(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
391751
391929
|
}
|
|
391752
391930
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
391753
391931
|
const path19 = getRemoteAgentMetadataPath(taskId);
|
|
391754
|
-
await mkdir42(
|
|
391932
|
+
await mkdir42(dirname59(path19), { recursive: true });
|
|
391755
391933
|
await writeFile46(path19, JSON.stringify(metadata));
|
|
391756
391934
|
}
|
|
391757
391935
|
async function readRemoteAgentMetadata(taskId) {
|
|
@@ -391790,7 +391968,7 @@ async function listRemoteAgentMetadata() {
|
|
|
391790
391968
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
391791
391969
|
continue;
|
|
391792
391970
|
try {
|
|
391793
|
-
const raw = await readFile48(
|
|
391971
|
+
const raw = await readFile48(join141(dir, entry.name), "utf-8");
|
|
391794
391972
|
results.push(JSON.parse(raw));
|
|
391795
391973
|
} catch (e) {
|
|
391796
391974
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -391800,7 +391978,7 @@ async function listRemoteAgentMetadata() {
|
|
|
391800
391978
|
}
|
|
391801
391979
|
function sessionIdExists(sessionId) {
|
|
391802
391980
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
391803
|
-
const sessionFile =
|
|
391981
|
+
const sessionFile = join141(projectDir, `${sessionId}.jsonl`);
|
|
391804
391982
|
const fs5 = getFsImplementation();
|
|
391805
391983
|
try {
|
|
391806
391984
|
fs5.statSync(sessionFile);
|
|
@@ -391940,7 +392118,7 @@ class Project {
|
|
|
391940
392118
|
try {
|
|
391941
392119
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
391942
392120
|
} catch {
|
|
391943
|
-
await mkdir42(
|
|
392121
|
+
await mkdir42(dirname59(filePath), { recursive: true, mode: 448 });
|
|
391944
392122
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
391945
392123
|
}
|
|
391946
392124
|
}
|
|
@@ -392539,7 +392717,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
392539
392717
|
}
|
|
392540
392718
|
for (const [agentId, entries] of byAgent) {
|
|
392541
392719
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
392542
|
-
await mkdir42(
|
|
392720
|
+
await mkdir42(dirname59(agentFile), { recursive: true, mode: 448 });
|
|
392543
392721
|
const agentContent = entries.map((p) => jsonStringify(p) + `
|
|
392544
392722
|
`).join("");
|
|
392545
392723
|
await writeFile46(agentFile, agentContent, {
|
|
@@ -393076,7 +393254,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
393076
393254
|
try {
|
|
393077
393255
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
393078
393256
|
} catch {
|
|
393079
|
-
fs5.mkdirSync(
|
|
393257
|
+
fs5.mkdirSync(dirname59(fullPath), { mode: 448 });
|
|
393080
393258
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
393081
393259
|
}
|
|
393082
393260
|
}
|
|
@@ -393769,7 +393947,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
393769
393947
|
};
|
|
393770
393948
|
}
|
|
393771
393949
|
async function loadSessionFile(sessionId) {
|
|
393772
|
-
const sessionFile =
|
|
393950
|
+
const sessionFile = join141(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
393773
393951
|
return loadTranscriptFile(sessionFile);
|
|
393774
393952
|
}
|
|
393775
393953
|
function clearSessionMessagesCache() {
|
|
@@ -393837,7 +394015,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
393837
394015
|
} catch {
|
|
393838
394016
|
return [];
|
|
393839
394017
|
}
|
|
393840
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
394018
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join141(projectsDir, dirent.name));
|
|
393841
394019
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
393842
394020
|
const allLogs = logsPerProject.flat();
|
|
393843
394021
|
const deduped = new Map;
|
|
@@ -393862,7 +394040,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
393862
394040
|
} catch {
|
|
393863
394041
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
393864
394042
|
}
|
|
393865
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
394043
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join141(projectsDir, dirent.name));
|
|
393866
394044
|
const rawLogs = [];
|
|
393867
394045
|
for (const projectDir of projectDirs) {
|
|
393868
394046
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -393923,7 +394101,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
393923
394101
|
for (const { path: wtPath, prefix } of indexed) {
|
|
393924
394102
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
393925
394103
|
seenDirs.add(dirName);
|
|
393926
|
-
allLogs.push(...await getSessionFilesLite(
|
|
394104
|
+
allLogs.push(...await getSessionFilesLite(join141(projectsDir, dirent.name), undefined, wtPath));
|
|
393927
394105
|
break;
|
|
393928
394106
|
}
|
|
393929
394107
|
}
|
|
@@ -393992,7 +394170,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
393992
394170
|
return transcripts;
|
|
393993
394171
|
}
|
|
393994
394172
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
393995
|
-
const subagentsDir =
|
|
394173
|
+
const subagentsDir = join141(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
393996
394174
|
let entries;
|
|
393997
394175
|
try {
|
|
393998
394176
|
entries = await readdir28(subagentsDir, { withFileTypes: true });
|
|
@@ -394120,7 +394298,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
394120
394298
|
const sessionId = validateUuid2(basename41(dirent.name, ".jsonl"));
|
|
394121
394299
|
if (!sessionId)
|
|
394122
394300
|
continue;
|
|
394123
|
-
candidates.push({ sessionId, filePath:
|
|
394301
|
+
candidates.push({ sessionId, filePath: join141(projectDir, dirent.name) });
|
|
394124
394302
|
}
|
|
394125
394303
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
394126
394304
|
try {
|
|
@@ -394506,7 +394684,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
394506
394684
|
init_settings2();
|
|
394507
394685
|
init_slowOperations();
|
|
394508
394686
|
init_uuid();
|
|
394509
|
-
VERSION4 = { VERSION: "0.1.
|
|
394687
|
+
VERSION4 = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
394510
394688
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
394511
394689
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
394512
394690
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -394518,7 +394696,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
394518
394696
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
394519
394697
|
agentTranscriptSubdirs = new Map;
|
|
394520
394698
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
394521
|
-
return
|
|
394699
|
+
return join141(getProjectsDir2(), sanitizePath2(projectDir));
|
|
394522
394700
|
});
|
|
394523
394701
|
METADATA_TYPE_MARKERS = [
|
|
394524
394702
|
'"type":"summary"',
|
|
@@ -394756,41 +394934,41 @@ var init_memdir = __esm(() => {
|
|
|
394756
394934
|
});
|
|
394757
394935
|
|
|
394758
394936
|
// tools/AgentTool/agentMemory.ts
|
|
394759
|
-
import { join as
|
|
394937
|
+
import { join as join142, normalize as normalize13, sep as sep32 } from "path";
|
|
394760
394938
|
function sanitizeAgentTypeForPath(agentType) {
|
|
394761
394939
|
return agentType.replace(/:/g, "-");
|
|
394762
394940
|
}
|
|
394763
394941
|
function getLocalAgentMemoryDir(dirName) {
|
|
394764
394942
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
394765
|
-
return
|
|
394943
|
+
return join142(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep32;
|
|
394766
394944
|
}
|
|
394767
|
-
return
|
|
394945
|
+
return join142(getCwd(), ".theus", "agent-memory-local", dirName) + sep32;
|
|
394768
394946
|
}
|
|
394769
394947
|
function getAgentMemoryDir(agentType, scope) {
|
|
394770
394948
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
394771
394949
|
switch (scope) {
|
|
394772
394950
|
case "project":
|
|
394773
|
-
return
|
|
394951
|
+
return join142(getCwd(), ".theus", "agent-memory", dirName) + sep32;
|
|
394774
394952
|
case "local":
|
|
394775
394953
|
return getLocalAgentMemoryDir(dirName);
|
|
394776
394954
|
case "user":
|
|
394777
|
-
return
|
|
394955
|
+
return join142(getMemoryBaseDir(), "agent-memory", dirName) + sep32;
|
|
394778
394956
|
}
|
|
394779
394957
|
}
|
|
394780
394958
|
function isAgentMemoryPath(absolutePath) {
|
|
394781
394959
|
const normalizedPath = normalize13(absolutePath);
|
|
394782
394960
|
const memoryBase = getMemoryBaseDir();
|
|
394783
|
-
if (normalizedPath.startsWith(
|
|
394961
|
+
if (normalizedPath.startsWith(join142(memoryBase, "agent-memory") + sep32)) {
|
|
394784
394962
|
return true;
|
|
394785
394963
|
}
|
|
394786
|
-
if (normalizedPath.startsWith(
|
|
394964
|
+
if (normalizedPath.startsWith(join142(getCwd(), ".theus", "agent-memory") + sep32)) {
|
|
394787
394965
|
return true;
|
|
394788
394966
|
}
|
|
394789
394967
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
394790
|
-
if (normalizedPath.includes(sep32 + "agent-memory-local" + sep32) && normalizedPath.startsWith(
|
|
394968
|
+
if (normalizedPath.includes(sep32 + "agent-memory-local" + sep32) && normalizedPath.startsWith(join142(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects") + sep32)) {
|
|
394791
394969
|
return true;
|
|
394792
394970
|
}
|
|
394793
|
-
} else if (normalizedPath.startsWith(
|
|
394971
|
+
} else if (normalizedPath.startsWith(join142(getCwd(), ".theus", "agent-memory-local") + sep32)) {
|
|
394794
394972
|
return true;
|
|
394795
394973
|
}
|
|
394796
394974
|
return false;
|
|
@@ -394798,7 +394976,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
394798
394976
|
function getMemoryScopeDisplay(memory2) {
|
|
394799
394977
|
switch (memory2) {
|
|
394800
394978
|
case "user":
|
|
394801
|
-
return `User (${
|
|
394979
|
+
return `User (${join142(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
394802
394980
|
case "project":
|
|
394803
394981
|
return "Project (.theus/agent-memory/)";
|
|
394804
394982
|
case "local":
|
|
@@ -394840,8 +395018,8 @@ var init_agentMemory = __esm(() => {
|
|
|
394840
395018
|
|
|
394841
395019
|
// utils/permissions/filesystem.ts
|
|
394842
395020
|
import { randomBytes as randomBytes21 } from "crypto";
|
|
394843
|
-
import { homedir as homedir35, tmpdir as
|
|
394844
|
-
import { join as
|
|
395021
|
+
import { homedir as homedir35, tmpdir as tmpdir10 } from "os";
|
|
395022
|
+
import { join as join143, normalize as normalize14, posix as posix8, sep as sep33 } from "path";
|
|
394845
395023
|
function normalizeCaseForComparison(path19) {
|
|
394846
395024
|
return path19.toLowerCase();
|
|
394847
395025
|
}
|
|
@@ -394850,11 +395028,11 @@ function getTheusSkillScope(filePath) {
|
|
|
394850
395028
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
394851
395029
|
const bases = [
|
|
394852
395030
|
{
|
|
394853
|
-
dir: expandPath(
|
|
395031
|
+
dir: expandPath(join143(getOriginalCwd(), ".theus", "skills")),
|
|
394854
395032
|
prefix: "/.theus/skills/"
|
|
394855
395033
|
},
|
|
394856
395034
|
{
|
|
394857
|
-
dir: expandPath(
|
|
395035
|
+
dir: expandPath(join143(homedir35(), ".theus", "skills")),
|
|
394858
395036
|
prefix: "~/.theus/skills/"
|
|
394859
395037
|
}
|
|
394860
395038
|
];
|
|
@@ -394909,21 +395087,21 @@ function isTheusConfigFilePath(filePath) {
|
|
|
394909
395087
|
if (isTheusSettingsPath(filePath)) {
|
|
394910
395088
|
return true;
|
|
394911
395089
|
}
|
|
394912
|
-
const commandsDir =
|
|
394913
|
-
const agentsDir =
|
|
394914
|
-
const skillsDir =
|
|
395090
|
+
const commandsDir = join143(getOriginalCwd(), ".theus", "commands");
|
|
395091
|
+
const agentsDir = join143(getOriginalCwd(), ".theus", "agents");
|
|
395092
|
+
const skillsDir = join143(getOriginalCwd(), ".theus", "skills");
|
|
394915
395093
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
394916
395094
|
}
|
|
394917
395095
|
function isSessionPlanFile(absolutePath) {
|
|
394918
|
-
const expectedPrefix =
|
|
395096
|
+
const expectedPrefix = join143(getPlansDirectory(), getPlanSlug());
|
|
394919
395097
|
const normalizedPath = normalize14(absolutePath);
|
|
394920
395098
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
394921
395099
|
}
|
|
394922
395100
|
function getSessionMemoryDir() {
|
|
394923
|
-
return
|
|
395101
|
+
return join143(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep33;
|
|
394924
395102
|
}
|
|
394925
395103
|
function getSessionMemoryPath() {
|
|
394926
|
-
return
|
|
395104
|
+
return join143(getSessionMemoryDir(), "summary.md");
|
|
394927
395105
|
}
|
|
394928
395106
|
function isSessionMemoryPath(absolutePath) {
|
|
394929
395107
|
const normalizedPath = normalize14(absolutePath);
|
|
@@ -394945,10 +395123,10 @@ function getTheusTempDirName() {
|
|
|
394945
395123
|
return `theus-${uid}`;
|
|
394946
395124
|
}
|
|
394947
395125
|
function getProjectTempDir() {
|
|
394948
|
-
return
|
|
395126
|
+
return join143(getTheusTempDir(), sanitizePath2(getOriginalCwd())) + sep33;
|
|
394949
395127
|
}
|
|
394950
395128
|
function getScratchpadDir() {
|
|
394951
|
-
return
|
|
395129
|
+
return join143(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
394952
395130
|
}
|
|
394953
395131
|
async function ensureScratchpadDir() {
|
|
394954
395132
|
if (!isScratchpadEnabled()) {
|
|
@@ -395526,7 +395704,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
395526
395704
|
}
|
|
395527
395705
|
};
|
|
395528
395706
|
}
|
|
395529
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
395707
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join143(getOriginalCwd(), ".theus", "launch.json"))) {
|
|
395530
395708
|
return {
|
|
395531
395709
|
behavior: "allow",
|
|
395532
395710
|
updatedInput: input,
|
|
@@ -395623,7 +395801,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
395623
395801
|
}
|
|
395624
395802
|
};
|
|
395625
395803
|
}
|
|
395626
|
-
const tasksDir =
|
|
395804
|
+
const tasksDir = join143(getTheusConfigHomeDir(), "tasks") + sep33;
|
|
395627
395805
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
395628
395806
|
return {
|
|
395629
395807
|
behavior: "allow",
|
|
@@ -395634,7 +395812,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
395634
395812
|
}
|
|
395635
395813
|
};
|
|
395636
395814
|
}
|
|
395637
|
-
const teamsReadDir =
|
|
395815
|
+
const teamsReadDir = join143(getTheusConfigHomeDir(), "teams") + sep33;
|
|
395638
395816
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
395639
395817
|
return {
|
|
395640
395818
|
behavior: "allow",
|
|
@@ -395701,17 +395879,17 @@ var init_filesystem = __esm(() => {
|
|
|
395701
395879
|
];
|
|
395702
395880
|
DIR_SEP = posix8.sep;
|
|
395703
395881
|
getTheusTempDir = memoize_default(function getTheusTempDir2() {
|
|
395704
|
-
const baseTmpDir = process.env.THEUS_CODE_TMPDIR || (getPlatform() === "windows" ?
|
|
395882
|
+
const baseTmpDir = process.env.THEUS_CODE_TMPDIR || (getPlatform() === "windows" ? tmpdir10() : "/tmp");
|
|
395705
395883
|
const fs5 = getFsImplementation();
|
|
395706
395884
|
let resolvedBaseTmpDir = baseTmpDir;
|
|
395707
395885
|
try {
|
|
395708
395886
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
395709
395887
|
} catch {}
|
|
395710
|
-
return
|
|
395888
|
+
return join143(resolvedBaseTmpDir, getTheusTempDirName()) + sep33;
|
|
395711
395889
|
});
|
|
395712
395890
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
395713
395891
|
const nonce = randomBytes21(16).toString("hex");
|
|
395714
|
-
return
|
|
395892
|
+
return join143(getTheusTempDir(), "bundled-skills", { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
395715
395893
|
});
|
|
395716
395894
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
395717
395895
|
});
|
|
@@ -395725,10 +395903,10 @@ import {
|
|
|
395725
395903
|
symlink as symlink4,
|
|
395726
395904
|
unlink as unlink21
|
|
395727
395905
|
} from "fs/promises";
|
|
395728
|
-
import { join as
|
|
395906
|
+
import { join as join144 } from "path";
|
|
395729
395907
|
function getTaskOutputDir() {
|
|
395730
395908
|
if (_taskOutputDir === undefined) {
|
|
395731
|
-
_taskOutputDir =
|
|
395909
|
+
_taskOutputDir = join144(getProjectTempDir(), getSessionId(), "tasks");
|
|
395732
395910
|
}
|
|
395733
395911
|
return _taskOutputDir;
|
|
395734
395912
|
}
|
|
@@ -395736,7 +395914,7 @@ async function ensureOutputDir() {
|
|
|
395736
395914
|
await mkdir43(getTaskOutputDir(), { recursive: true });
|
|
395737
395915
|
}
|
|
395738
395916
|
function getTaskOutputPath(taskId) {
|
|
395739
|
-
return
|
|
395917
|
+
return join144(getTaskOutputDir(), `${taskId}.output`);
|
|
395740
395918
|
}
|
|
395741
395919
|
function track(p) {
|
|
395742
395920
|
_pendingOps.add(p);
|
|
@@ -397143,7 +397321,7 @@ __export(exports_hooks2, {
|
|
|
397143
397321
|
createBaseHookInput: () => createBaseHookInput
|
|
397144
397322
|
});
|
|
397145
397323
|
import { basename as basename42 } from "path";
|
|
397146
|
-
import { spawn as
|
|
397324
|
+
import { spawn as spawn9 } from "child_process";
|
|
397147
397325
|
import { randomUUID as randomUUID31 } from "crypto";
|
|
397148
397326
|
function getSessionEndHookTimeoutMs() {
|
|
397149
397327
|
const raw = process.env.THEUS_CODE_SESSIONEND_HOOKS_TIMEOUT_MS;
|
|
@@ -397556,14 +397734,14 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
397556
397734
|
if (!pwshPath) {
|
|
397557
397735
|
throw new Error(`Hook "${hook.command}" has shell: 'powershell' but no PowerShell ` + `executable (pwsh or powershell) was found on PATH. Install ` + `PowerShell, or remove "shell": "powershell" to use bash.`);
|
|
397558
397736
|
}
|
|
397559
|
-
child =
|
|
397737
|
+
child = spawn9(pwshPath, buildPowerShellArgs(finalCommand), {
|
|
397560
397738
|
env: envVars,
|
|
397561
397739
|
cwd: safeCwd,
|
|
397562
397740
|
windowsHide: true
|
|
397563
397741
|
});
|
|
397564
397742
|
} else {
|
|
397565
397743
|
const shell = isWindows2 ? findGitBashPath() : true;
|
|
397566
|
-
child =
|
|
397744
|
+
child = spawn9(finalCommand, [], {
|
|
397567
397745
|
env: envVars,
|
|
397568
397746
|
cwd: safeCwd,
|
|
397569
397747
|
shell,
|
|
@@ -399994,7 +400172,7 @@ __export(exports_worktree, {
|
|
|
399994
400172
|
cleanupWorktree: () => cleanupWorktree,
|
|
399995
400173
|
cleanupStaleAgentWorktrees: () => cleanupStaleAgentWorktrees
|
|
399996
400174
|
});
|
|
399997
|
-
import { spawnSync as
|
|
400175
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
399998
400176
|
import {
|
|
399999
400177
|
copyFile as copyFile9,
|
|
400000
400178
|
mkdir as mkdir44,
|
|
@@ -400004,7 +400182,7 @@ import {
|
|
|
400004
400182
|
symlink as symlink5,
|
|
400005
400183
|
utimes as utimes2
|
|
400006
400184
|
} from "fs/promises";
|
|
400007
|
-
import { basename as basename43, dirname as
|
|
400185
|
+
import { basename as basename43, dirname as dirname60, join as join145 } from "path";
|
|
400008
400186
|
function validateWorktreeSlug(slug) {
|
|
400009
400187
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
400010
400188
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -400027,8 +400205,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
400027
400205
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
400028
400206
|
continue;
|
|
400029
400207
|
}
|
|
400030
|
-
const sourcePath =
|
|
400031
|
-
const destPath =
|
|
400208
|
+
const sourcePath = join145(repoRootPath, dir);
|
|
400209
|
+
const destPath = join145(worktreePath, dir);
|
|
400032
400210
|
try {
|
|
400033
400211
|
await symlink5(sourcePath, destPath, "dir");
|
|
400034
400212
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -400052,7 +400230,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
400052
400230
|
return combined.replace(/[/.]/g, "_");
|
|
400053
400231
|
}
|
|
400054
400232
|
function worktreesDir(repoRoot) {
|
|
400055
|
-
return
|
|
400233
|
+
return join145(repoRoot, ".theus", "worktrees");
|
|
400056
400234
|
}
|
|
400057
400235
|
function flattenSlug(slug) {
|
|
400058
400236
|
return slug.replaceAll("/", "+");
|
|
@@ -400061,7 +400239,7 @@ function worktreeBranchName(slug) {
|
|
|
400061
400239
|
return `worktree-${flattenSlug(slug)}`;
|
|
400062
400240
|
}
|
|
400063
400241
|
function worktreePathFor(repoRoot, slug) {
|
|
400064
|
-
return
|
|
400242
|
+
return join145(worktreesDir(repoRoot), flattenSlug(slug));
|
|
400065
400243
|
}
|
|
400066
400244
|
async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
400067
400245
|
const worktreePath = worktreePathFor(repoRoot, slug);
|
|
@@ -400142,7 +400320,7 @@ async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
|
400142
400320
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
400143
400321
|
let includeContent;
|
|
400144
400322
|
try {
|
|
400145
|
-
includeContent = await readFile49(
|
|
400323
|
+
includeContent = await readFile49(join145(repoRoot, ".worktreeinclude"), "utf-8");
|
|
400146
400324
|
} catch {
|
|
400147
400325
|
return [];
|
|
400148
400326
|
}
|
|
@@ -400197,10 +400375,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
400197
400375
|
}
|
|
400198
400376
|
const copied = [];
|
|
400199
400377
|
for (const relativePath2 of files2) {
|
|
400200
|
-
const srcPath =
|
|
400201
|
-
const destPath =
|
|
400378
|
+
const srcPath = join145(repoRoot, relativePath2);
|
|
400379
|
+
const destPath = join145(worktreePath, relativePath2);
|
|
400202
400380
|
try {
|
|
400203
|
-
await mkdir44(
|
|
400381
|
+
await mkdir44(dirname60(destPath), { recursive: true });
|
|
400204
400382
|
await copyFile9(srcPath, destPath);
|
|
400205
400383
|
copied.push(relativePath2);
|
|
400206
400384
|
} catch (e) {
|
|
@@ -400214,10 +400392,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
400214
400392
|
}
|
|
400215
400393
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
400216
400394
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
400217
|
-
const sourceSettingsLocal =
|
|
400395
|
+
const sourceSettingsLocal = join145(repoRoot, localSettingsRelativePath);
|
|
400218
400396
|
try {
|
|
400219
|
-
const destSettingsLocal =
|
|
400220
|
-
await mkdirRecursive(
|
|
400397
|
+
const destSettingsLocal = join145(worktreePath, localSettingsRelativePath);
|
|
400398
|
+
await mkdirRecursive(dirname60(destSettingsLocal));
|
|
400221
400399
|
await copyFile9(sourceSettingsLocal, destSettingsLocal);
|
|
400222
400400
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
400223
400401
|
} catch (e) {
|
|
@@ -400226,8 +400404,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
400226
400404
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
400227
400405
|
}
|
|
400228
400406
|
}
|
|
400229
|
-
const huskyPath =
|
|
400230
|
-
const gitHooksPath =
|
|
400407
|
+
const huskyPath = join145(repoRoot, ".husky");
|
|
400408
|
+
const gitHooksPath = join145(repoRoot, ".git", "hooks");
|
|
400231
400409
|
let hooksPath = null;
|
|
400232
400410
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
400233
400411
|
try {
|
|
@@ -400502,7 +400680,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
400502
400680
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p) => p.test(slug))) {
|
|
400503
400681
|
continue;
|
|
400504
400682
|
}
|
|
400505
|
-
const worktreePath =
|
|
400683
|
+
const worktreePath = join145(dir, slug);
|
|
400506
400684
|
if (currentPath === worktreePath) {
|
|
400507
400685
|
continue;
|
|
400508
400686
|
}
|
|
@@ -400563,7 +400741,7 @@ async function execIntoTmuxWorktree(args) {
|
|
|
400563
400741
|
error: "Error: --tmux is not supported on Windows"
|
|
400564
400742
|
};
|
|
400565
400743
|
}
|
|
400566
|
-
const tmuxCheck =
|
|
400744
|
+
const tmuxCheck = spawnSync6("tmux", ["-V"], { encoding: "utf-8" });
|
|
400567
400745
|
if (tmuxCheck.status !== 0) {
|
|
400568
400746
|
const installHint = process.platform === "darwin" ? "Install tmux with: brew install tmux" : "Install tmux with: sudo apt install tmux";
|
|
400569
400747
|
return {
|
|
@@ -400668,7 +400846,7 @@ async function execIntoTmuxWorktree(args) {
|
|
|
400668
400846
|
newArgs.push(arg);
|
|
400669
400847
|
}
|
|
400670
400848
|
let tmuxPrefix = "C-b";
|
|
400671
|
-
const prefixResult =
|
|
400849
|
+
const prefixResult = spawnSync6("tmux", ["show-options", "-g", "prefix"], {
|
|
400672
400850
|
encoding: "utf-8"
|
|
400673
400851
|
});
|
|
400674
400852
|
if (prefixResult.status === 0 && prefixResult.stdout) {
|
|
@@ -400695,7 +400873,7 @@ async function execIntoTmuxWorktree(args) {
|
|
|
400695
400873
|
THEUS_CODE_TMUX_PREFIX: tmuxPrefix,
|
|
400696
400874
|
THEUS_CODE_TMUX_PREFIX_CONFLICTS: prefixConflicts ? "1" : ""
|
|
400697
400875
|
};
|
|
400698
|
-
const hasSessionResult =
|
|
400876
|
+
const hasSessionResult = spawnSync6("tmux", ["has-session", "-t", tmuxSessionName], { encoding: "utf-8" });
|
|
400699
400877
|
const sessionExists = hasSessionResult.status === 0;
|
|
400700
400878
|
const isAlreadyInTmux = Boolean(process.env.TMUX);
|
|
400701
400879
|
const useControlMode = isInITerm2() && !forceClassicTmux && !isAlreadyInTmux;
|
|
@@ -400713,7 +400891,7 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
|
|
|
400713
400891
|
const isTheusCliInternal = repoName === "theus-cli-internal";
|
|
400714
400892
|
const shouldSetupDevPanes = isAnt && isTheusCliInternal && !sessionExists;
|
|
400715
400893
|
if (shouldSetupDevPanes) {
|
|
400716
|
-
|
|
400894
|
+
spawnSync6("tmux", [
|
|
400717
400895
|
"new-session",
|
|
400718
400896
|
"-d",
|
|
400719
400897
|
"-s",
|
|
@@ -400724,21 +400902,21 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
|
|
|
400724
400902
|
process.execPath,
|
|
400725
400903
|
...newArgs
|
|
400726
400904
|
], { cwd: worktreeDir, env: tmuxEnv });
|
|
400727
|
-
|
|
400728
|
-
|
|
400729
|
-
|
|
400730
|
-
|
|
400905
|
+
spawnSync6("tmux", ["split-window", "-h", "-t", tmuxSessionName, "-c", worktreeDir], { cwd: worktreeDir });
|
|
400906
|
+
spawnSync6("tmux", ["send-keys", "-t", tmuxSessionName, "bun run watch", "Enter"], { cwd: worktreeDir });
|
|
400907
|
+
spawnSync6("tmux", ["split-window", "-v", "-t", tmuxSessionName, "-c", worktreeDir], { cwd: worktreeDir });
|
|
400908
|
+
spawnSync6("tmux", ["send-keys", "-t", tmuxSessionName, "bun run start"], {
|
|
400731
400909
|
cwd: worktreeDir
|
|
400732
400910
|
});
|
|
400733
|
-
|
|
400911
|
+
spawnSync6("tmux", ["select-pane", "-t", `${tmuxSessionName}:0.0`], {
|
|
400734
400912
|
cwd: worktreeDir
|
|
400735
400913
|
});
|
|
400736
400914
|
if (isAlreadyInTmux) {
|
|
400737
|
-
|
|
400915
|
+
spawnSync6("tmux", ["switch-client", "-t", tmuxSessionName], {
|
|
400738
400916
|
stdio: "inherit"
|
|
400739
400917
|
});
|
|
400740
400918
|
} else {
|
|
400741
|
-
|
|
400919
|
+
spawnSync6("tmux", [...tmuxGlobalArgs, "attach-session", "-t", tmuxSessionName], {
|
|
400742
400920
|
stdio: "inherit",
|
|
400743
400921
|
cwd: worktreeDir
|
|
400744
400922
|
});
|
|
@@ -400746,11 +400924,11 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
|
|
|
400746
400924
|
} else {
|
|
400747
400925
|
if (isAlreadyInTmux) {
|
|
400748
400926
|
if (sessionExists) {
|
|
400749
|
-
|
|
400927
|
+
spawnSync6("tmux", ["switch-client", "-t", tmuxSessionName], {
|
|
400750
400928
|
stdio: "inherit"
|
|
400751
400929
|
});
|
|
400752
400930
|
} else {
|
|
400753
|
-
|
|
400931
|
+
spawnSync6("tmux", [
|
|
400754
400932
|
"new-session",
|
|
400755
400933
|
"-d",
|
|
400756
400934
|
"-s",
|
|
@@ -400761,7 +400939,7 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
|
|
|
400761
400939
|
process.execPath,
|
|
400762
400940
|
...newArgs
|
|
400763
400941
|
], { cwd: worktreeDir, env: tmuxEnv });
|
|
400764
|
-
|
|
400942
|
+
spawnSync6("tmux", ["switch-client", "-t", tmuxSessionName], {
|
|
400765
400943
|
stdio: "inherit"
|
|
400766
400944
|
});
|
|
400767
400945
|
}
|
|
@@ -400778,7 +400956,7 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
|
|
|
400778
400956
|
process.execPath,
|
|
400779
400957
|
...newArgs
|
|
400780
400958
|
];
|
|
400781
|
-
|
|
400959
|
+
spawnSync6("tmux", tmuxArgs, {
|
|
400782
400960
|
stdio: "inherit",
|
|
400783
400961
|
cwd: worktreeDir,
|
|
400784
400962
|
env: tmuxEnv
|
|
@@ -400886,7 +401064,7 @@ function getSimpleDoingTasksSection() {
|
|
|
400886
401064
|
];
|
|
400887
401065
|
const userHelpSubitems = [
|
|
400888
401066
|
`/help: Get help with using Theus`,
|
|
400889
|
-
`To give feedback, users should ${{ VERSION: "0.1.
|
|
401067
|
+
`To give feedback, users should ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
400890
401068
|
];
|
|
400891
401069
|
const items = [
|
|
400892
401070
|
`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.`,
|
|
@@ -401266,7 +401444,7 @@ var init_prompts4 = __esm(() => {
|
|
|
401266
401444
|
});
|
|
401267
401445
|
|
|
401268
401446
|
// utils/api.ts
|
|
401269
|
-
import { createHash as
|
|
401447
|
+
import { createHash as createHash28 } from "crypto";
|
|
401270
401448
|
function filterSwarmFieldsFromSchema(toolName, schema) {
|
|
401271
401449
|
const fieldsToRemove = SWARM_FIELDS_BY_TOOL[toolName];
|
|
401272
401450
|
if (!fieldsToRemove || fieldsToRemove.length === 0) {
|
|
@@ -401356,7 +401534,7 @@ function logAPIPrefix(systemPrompt) {
|
|
|
401356
401534
|
logEvent("tengu_sysprompt_block", {
|
|
401357
401535
|
snippet: firstSystemPrompt?.slice(0, 20),
|
|
401358
401536
|
length: firstSystemPrompt?.length ?? 0,
|
|
401359
|
-
hash: firstSystemPrompt ?
|
|
401537
|
+
hash: firstSystemPrompt ? createHash28("sha256").update(firstSystemPrompt).digest("hex") : ""
|
|
401360
401538
|
});
|
|
401361
401539
|
}
|
|
401362
401540
|
function splitSysPromptPrefix(systemPrompt, options2) {
|
|
@@ -401682,7 +401860,7 @@ var init_api4 = __esm(() => {
|
|
|
401682
401860
|
});
|
|
401683
401861
|
|
|
401684
401862
|
// utils/fingerprint.ts
|
|
401685
|
-
import { createHash as
|
|
401863
|
+
import { createHash as createHash29 } from "crypto";
|
|
401686
401864
|
function extractFirstMessageText(messages) {
|
|
401687
401865
|
const firstUserMessage = messages.find((msg) => msg.type === "user");
|
|
401688
401866
|
if (!firstUserMessage) {
|
|
@@ -401704,12 +401882,12 @@ function computeFingerprint(messageText, version3) {
|
|
|
401704
401882
|
const indices = [4, 7, 20];
|
|
401705
401883
|
const chars = indices.map((i3) => messageText[i3] || "0").join("");
|
|
401706
401884
|
const fingerprintInput = `${FINGERPRINT_SALT}${chars}${version3}`;
|
|
401707
|
-
const hash =
|
|
401885
|
+
const hash = createHash29("sha256").update(fingerprintInput).digest("hex");
|
|
401708
401886
|
return hash.slice(0, 3);
|
|
401709
401887
|
}
|
|
401710
401888
|
function computeFingerprintFromMessages(messages) {
|
|
401711
401889
|
const firstMessageText = extractFirstMessageText(messages);
|
|
401712
|
-
return computeFingerprint(firstMessageText, { VERSION: "0.1.
|
|
401890
|
+
return computeFingerprint(firstMessageText, { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
401713
401891
|
}
|
|
401714
401892
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
401715
401893
|
var init_fingerprint = () => {};
|
|
@@ -403509,7 +403687,7 @@ var init_theusEngine = __esm(() => {
|
|
|
403509
403687
|
});
|
|
403510
403688
|
|
|
403511
403689
|
// services/api/theus.ts
|
|
403512
|
-
import { existsSync as
|
|
403690
|
+
import { existsSync as existsSync15, readFileSync as readFileSync22 } from "fs";
|
|
403513
403691
|
import { randomUUID as randomUUID33 } from "crypto";
|
|
403514
403692
|
function env5(name) {
|
|
403515
403693
|
const value = process.env[name];
|
|
@@ -403520,10 +403698,10 @@ function trimBaseURL2(baseURL) {
|
|
|
403520
403698
|
}
|
|
403521
403699
|
function loadProvidersConfig3() {
|
|
403522
403700
|
const path19 = defaultProvidersConfigPath();
|
|
403523
|
-
if (!
|
|
403701
|
+
if (!existsSync15(path19))
|
|
403524
403702
|
return null;
|
|
403525
403703
|
try {
|
|
403526
|
-
return JSON.parse(
|
|
403704
|
+
return JSON.parse(readFileSync22(path19, "utf8"));
|
|
403527
403705
|
} catch {
|
|
403528
403706
|
return null;
|
|
403529
403707
|
}
|
|
@@ -404235,7 +404413,7 @@ async function sideQuery(opts) {
|
|
|
404235
404413
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
404236
404414
|
}
|
|
404237
404415
|
const messageText = extractFirstUserMessageText(messages);
|
|
404238
|
-
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.
|
|
404416
|
+
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
404239
404417
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
404240
404418
|
const systemBlocks = [
|
|
404241
404419
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -404521,7 +404699,7 @@ import {
|
|
|
404521
404699
|
} from "fs/promises";
|
|
404522
404700
|
import { createServer as createServer7 } from "net";
|
|
404523
404701
|
import { homedir as homedir36, platform as platform5 } from "os";
|
|
404524
|
-
import { join as
|
|
404702
|
+
import { join as join146 } from "path";
|
|
404525
404703
|
function log(message, ...args) {
|
|
404526
404704
|
if (LOG_FILE) {
|
|
404527
404705
|
const timestamp = new Date().toISOString();
|
|
@@ -404588,7 +404766,7 @@ class ChromeNativeHost {
|
|
|
404588
404766
|
try {
|
|
404589
404767
|
process.kill(pid, 0);
|
|
404590
404768
|
} catch {
|
|
404591
|
-
await unlink22(
|
|
404769
|
+
await unlink22(join146(socketDir, file2)).catch(() => {});
|
|
404592
404770
|
log(`Removed stale socket for PID ${pid}`);
|
|
404593
404771
|
}
|
|
404594
404772
|
}
|
|
@@ -404859,7 +405037,7 @@ var init_chromeNativeHost = __esm(() => {
|
|
|
404859
405037
|
init_slowOperations();
|
|
404860
405038
|
init_common2();
|
|
404861
405039
|
MAX_MESSAGE_SIZE = 1024 * 1024;
|
|
404862
|
-
LOG_FILE = process.env.USER_TYPE === "ant" ?
|
|
405040
|
+
LOG_FILE = process.env.USER_TYPE === "ant" ? join146(homedir36(), ".theus", "debug", "chrome-native-host.txt") : undefined;
|
|
404863
405041
|
messageSchema = lazySchema(() => exports_external2.object({
|
|
404864
405042
|
type: exports_external2.string()
|
|
404865
405043
|
}).passthrough());
|
|
@@ -405538,7 +405716,7 @@ async function handleMemories(state) {
|
|
|
405538
405716
|
async function runProjectContextMcpServer() {
|
|
405539
405717
|
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
405540
405718
|
const state = new ProjectContextState(projectRoot);
|
|
405541
|
-
const server = new Server({ name: SERVER_NAME, version: { VERSION: "0.1.
|
|
405719
|
+
const server = new Server({ name: SERVER_NAME, version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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: {} } });
|
|
405542
405720
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
405543
405721
|
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
405544
405722
|
name: t.name,
|
|
@@ -405664,13 +405842,13 @@ var init_server4 = __esm(() => {
|
|
|
405664
405842
|
|
|
405665
405843
|
// services/mcpComputerUse/macos.ts
|
|
405666
405844
|
import { execFile as execFile6 } from "child_process";
|
|
405667
|
-
import { existsSync as
|
|
405668
|
-
import { homedir as homedir37, tmpdir as
|
|
405669
|
-
import { join as
|
|
405845
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync9, readFileSync as readFileSync23, statSync as statSync10, unlinkSync as unlinkSync3, writeFileSync as writeFileSync8 } from "fs";
|
|
405846
|
+
import { homedir as homedir37, tmpdir as tmpdir11 } from "os";
|
|
405847
|
+
import { join as join147 } from "path";
|
|
405670
405848
|
import { promisify as promisify4 } from "util";
|
|
405671
405849
|
function cuDir() {
|
|
405672
|
-
const dir =
|
|
405673
|
-
if (!
|
|
405850
|
+
const dir = join147(homedir37(), ".theus", "cu");
|
|
405851
|
+
if (!existsSync16(dir))
|
|
405674
405852
|
mkdirSync9(dir, { recursive: true });
|
|
405675
405853
|
return dir;
|
|
405676
405854
|
}
|
|
@@ -405683,7 +405861,7 @@ function resolveBin(name, extra = []) {
|
|
|
405683
405861
|
`/usr/sbin/${name}`
|
|
405684
405862
|
];
|
|
405685
405863
|
for (const candidate of candidates) {
|
|
405686
|
-
if (
|
|
405864
|
+
if (existsSync16(candidate))
|
|
405687
405865
|
return candidate;
|
|
405688
405866
|
}
|
|
405689
405867
|
return name;
|
|
@@ -405717,9 +405895,9 @@ async function getScreenGeometry(force = false) {
|
|
|
405717
405895
|
return cachedGeometry;
|
|
405718
405896
|
}
|
|
405719
405897
|
async function checkPermissions() {
|
|
405720
|
-
const probe =
|
|
405898
|
+
const probe = join147(tmpdir11(), `theus-cu-probe-${process.pid}.jpg`);
|
|
405721
405899
|
const cap = await run2(SCREENCAPTURE, ["-x", "-t", "jpg", probe], { timeoutMs: 8000 });
|
|
405722
|
-
const screenRecording =
|
|
405900
|
+
const screenRecording = existsSync16(probe) && (() => {
|
|
405723
405901
|
try {
|
|
405724
405902
|
return statSync10(probe).size > 0;
|
|
405725
405903
|
} catch {
|
|
@@ -405727,7 +405905,7 @@ async function checkPermissions() {
|
|
|
405727
405905
|
}
|
|
405728
405906
|
})();
|
|
405729
405907
|
try {
|
|
405730
|
-
if (
|
|
405908
|
+
if (existsSync16(probe))
|
|
405731
405909
|
unlinkSync3(probe);
|
|
405732
405910
|
} catch {}
|
|
405733
405911
|
const cc = await run2(CLICLICK, ["p"], { timeoutMs: 5000 });
|
|
@@ -405746,14 +405924,14 @@ async function checkPermissions() {
|
|
|
405746
405924
|
async function captureScreenshot(opts = {}) {
|
|
405747
405925
|
const maxSide = opts.maxSide ?? 1400;
|
|
405748
405926
|
const quality = Math.min(Math.max(opts.quality ?? 72, 1), 100);
|
|
405749
|
-
const raw =
|
|
405750
|
-
const out =
|
|
405927
|
+
const raw = join147(cuDir(), `shot-${process.pid}.png`);
|
|
405928
|
+
const out = join147(cuDir(), `shot-${process.pid}.jpg`);
|
|
405751
405929
|
const capArgs = ["-x", "-t", "png", "-o"];
|
|
405752
405930
|
if (opts.displayIndex && opts.displayIndex > 0)
|
|
405753
405931
|
capArgs.push("-D", String(opts.displayIndex));
|
|
405754
405932
|
capArgs.push(raw);
|
|
405755
405933
|
const cap = await run2(SCREENCAPTURE, capArgs, { timeoutMs: 12000 });
|
|
405756
|
-
if (!
|
|
405934
|
+
if (!existsSync16(raw) || statSync10(raw).size === 0) {
|
|
405757
405935
|
throw new ComputerUseError("No se pudo capturar la pantalla (" + (cap.stderr.trim() || "screencapture no produjo imagen") + "). Falta el permiso de Grabaci\xF3n de pantalla para el app que corre Theus.");
|
|
405758
405936
|
}
|
|
405759
405937
|
await run2(SIPS, [
|
|
@@ -405769,14 +405947,14 @@ async function captureScreenshot(opts = {}) {
|
|
|
405769
405947
|
"--out",
|
|
405770
405948
|
out
|
|
405771
405949
|
], { timeoutMs: 12000 });
|
|
405772
|
-
if (!
|
|
405950
|
+
if (!existsSync16(out) || statSync10(out).size === 0) {
|
|
405773
405951
|
throw new ComputerUseError("sips no pudo reescalar la captura a JPEG.");
|
|
405774
405952
|
}
|
|
405775
405953
|
const dims = await run2(SIPS, ["-g", "pixelWidth", "-g", "pixelHeight", out]);
|
|
405776
405954
|
const width = Number.parseInt(/pixelWidth:\s*(\d+)/.exec(dims.stdout)?.[1] ?? "0", 10);
|
|
405777
405955
|
const height = Number.parseInt(/pixelHeight:\s*(\d+)/.exec(dims.stdout)?.[1] ?? "0", 10);
|
|
405778
405956
|
const geometry = await getScreenGeometry();
|
|
405779
|
-
const base643 =
|
|
405957
|
+
const base643 = readFileSync23(out).toString("base64");
|
|
405780
405958
|
return {
|
|
405781
405959
|
base64: base643,
|
|
405782
405960
|
mimeType: "image/jpeg",
|
|
@@ -405910,15 +406088,15 @@ async function ensureScrollHelper() {
|
|
|
405910
406088
|
if (scrollBinPromise)
|
|
405911
406089
|
return scrollBinPromise;
|
|
405912
406090
|
scrollBinPromise = (async () => {
|
|
405913
|
-
if (!
|
|
405914
|
-
const src =
|
|
405915
|
-
const bin =
|
|
405916
|
-
if (
|
|
406091
|
+
if (!existsSync16(SWIFTC) && SWIFTC === "swiftc") {}
|
|
406092
|
+
const src = join147(cuDir(), "scroll.swift");
|
|
406093
|
+
const bin = join147(cuDir(), "theus-cu-scroll");
|
|
406094
|
+
if (existsSync16(bin))
|
|
405917
406095
|
return bin;
|
|
405918
406096
|
try {
|
|
405919
|
-
|
|
406097
|
+
writeFileSync8(src, SCROLL_SWIFT, "utf8");
|
|
405920
406098
|
const res = await run2(SWIFTC, ["-O", "-o", bin, src], { timeoutMs: 60000 });
|
|
405921
|
-
if (
|
|
406099
|
+
if (existsSync16(bin))
|
|
405922
406100
|
return bin;
|
|
405923
406101
|
process.stderr.write(`[computer-use] no se pudo compilar el helper de scroll: ${res.stderr}
|
|
405924
406102
|
`);
|
|
@@ -406242,8 +406420,8 @@ var exports_selftest = {};
|
|
|
406242
406420
|
__export(exports_selftest, {
|
|
406243
406421
|
runComputerUseSelfTest: () => runComputerUseSelfTest
|
|
406244
406422
|
});
|
|
406245
|
-
import { existsSync as
|
|
406246
|
-
import { join as
|
|
406423
|
+
import { existsSync as existsSync17, writeFileSync as writeFileSync9 } from "fs";
|
|
406424
|
+
import { join as join148 } from "path";
|
|
406247
406425
|
import { homedir as homedir38 } from "os";
|
|
406248
406426
|
async function runComputerUseSelfTest() {
|
|
406249
406427
|
let pass = 0;
|
|
@@ -406264,7 +406442,7 @@ Theus computer-use \u2014 self-test (macOS)
|
|
|
406264
406442
|
`);
|
|
406265
406443
|
const tools = toolingReport();
|
|
406266
406444
|
for (const [name, path19] of Object.entries(tools)) {
|
|
406267
|
-
if (
|
|
406445
|
+
if (existsSync17(path19))
|
|
406268
406446
|
ok(`${name}: ${path19}`);
|
|
406269
406447
|
else if (name === "swiftc")
|
|
406270
406448
|
warn(`${name}: no encontrado (scroll quedar\xE1 deshabilitado; el resto funciona)`);
|
|
@@ -406293,8 +406471,8 @@ Geometr\xEDa y captura:`);
|
|
|
406293
406471
|
let captureOk = false;
|
|
406294
406472
|
try {
|
|
406295
406473
|
const shot = await captureScreenshot();
|
|
406296
|
-
const outPath =
|
|
406297
|
-
|
|
406474
|
+
const outPath = join148(homedir38(), ".theus", "cu", "selftest-shot.jpg");
|
|
406475
|
+
writeFileSync9(outPath, Buffer.from(shot.base64, "base64"));
|
|
406298
406476
|
ok(`Captura ${shot.width}\xD7${shot.height} px, ${Math.round(shot.base64.length * 0.75 / 1024)} KB \u2192 ${outPath}`);
|
|
406299
406477
|
captureOk = true;
|
|
406300
406478
|
} catch (e) {
|
|
@@ -406346,9 +406524,9 @@ var init_selftest = __esm(() => {
|
|
|
406346
406524
|
|
|
406347
406525
|
// utils/cronTasksLock.ts
|
|
406348
406526
|
import { mkdir as mkdir46, readFile as readFile50, unlink as unlink23, writeFile as writeFile47 } from "fs/promises";
|
|
406349
|
-
import { dirname as
|
|
406527
|
+
import { dirname as dirname61, join as join149 } from "path";
|
|
406350
406528
|
function getLockPath(dir) {
|
|
406351
|
-
return
|
|
406529
|
+
return join149(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
406352
406530
|
}
|
|
406353
406531
|
async function readLock(dir) {
|
|
406354
406532
|
let raw;
|
|
@@ -406371,7 +406549,7 @@ async function tryCreateExclusive(lock2, dir) {
|
|
|
406371
406549
|
if (code === "EEXIST")
|
|
406372
406550
|
return false;
|
|
406373
406551
|
if (code === "ENOENT") {
|
|
406374
|
-
await mkdir46(
|
|
406552
|
+
await mkdir46(dirname61(path19), { recursive: true });
|
|
406375
406553
|
try {
|
|
406376
406554
|
await writeFile47(path19, body, { flag: "wx" });
|
|
406377
406555
|
return true;
|
|
@@ -406454,7 +406632,7 @@ var init_cronTasksLock = __esm(() => {
|
|
|
406454
406632
|
init_genericProcessUtils();
|
|
406455
406633
|
init_json();
|
|
406456
406634
|
init_slowOperations();
|
|
406457
|
-
LOCK_FILE_REL =
|
|
406635
|
+
LOCK_FILE_REL = join149(".theus", "scheduled_tasks.lock");
|
|
406458
406636
|
schedulerLockSchema = lazySchema(() => exports_external.object({
|
|
406459
406637
|
sessionId: exports_external.string(),
|
|
406460
406638
|
pid: exports_external.number(),
|
|
@@ -406751,19 +406929,19 @@ __export(exports_workerRegistry, {
|
|
|
406751
406929
|
runDaemonWorker: () => runDaemonWorker,
|
|
406752
406930
|
makeOnFireTask: () => makeOnFireTask
|
|
406753
406931
|
});
|
|
406754
|
-
import { spawn as
|
|
406932
|
+
import { spawn as spawn10 } from "child_process";
|
|
406755
406933
|
import { randomUUID as randomUUID34 } from "crypto";
|
|
406756
|
-
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync10, readFileSync as
|
|
406934
|
+
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync10, readFileSync as readFileSync24, writeFileSync as writeFileSync10 } from "fs";
|
|
406757
406935
|
import { homedir as homedir39 } from "os";
|
|
406758
|
-
import { dirname as
|
|
406936
|
+
import { dirname as dirname62, join as join150 } from "path";
|
|
406759
406937
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
406760
406938
|
function projectsConfigPath() {
|
|
406761
|
-
return
|
|
406939
|
+
return join150(homedir39(), ".theus", "daemon", "projects.json");
|
|
406762
406940
|
}
|
|
406763
406941
|
function readEnabledProjects() {
|
|
406764
406942
|
let raw;
|
|
406765
406943
|
try {
|
|
406766
|
-
raw =
|
|
406944
|
+
raw = readFileSync24(projectsConfigPath(), "utf8");
|
|
406767
406945
|
} catch {
|
|
406768
406946
|
return [];
|
|
406769
406947
|
}
|
|
@@ -406777,17 +406955,17 @@ function readEnabledProjects() {
|
|
|
406777
406955
|
return list2.filter((p) => p && typeof p.dir === "string" && p.enabled !== false);
|
|
406778
406956
|
}
|
|
406779
406957
|
function daemonDir2() {
|
|
406780
|
-
return
|
|
406958
|
+
return join150(homedir39(), ".theus", "daemon");
|
|
406781
406959
|
}
|
|
406782
406960
|
function daemonLogPath() {
|
|
406783
|
-
return
|
|
406961
|
+
return join150(daemonDir2(), "daemon.log");
|
|
406784
406962
|
}
|
|
406785
406963
|
function resolveWorkerBin() {
|
|
406786
406964
|
const override = process.env.THEUS_DAEMON_WORKER_BIN;
|
|
406787
406965
|
if (typeof override === "string" && override.length > 0)
|
|
406788
406966
|
return override;
|
|
406789
|
-
const here =
|
|
406790
|
-
return
|
|
406967
|
+
const here = dirname62(fileURLToPath6(import.meta.url));
|
|
406968
|
+
return join150(here, "..", "bin", "theus");
|
|
406791
406969
|
}
|
|
406792
406970
|
function turnTimeoutMs() {
|
|
406793
406971
|
const raw = process.env.THEUS_DAEMON_TURN_TIMEOUT_MS;
|
|
@@ -406820,10 +406998,10 @@ function logDaemonLine(line) {
|
|
|
406820
406998
|
}
|
|
406821
406999
|
function writeRunHistory(record3) {
|
|
406822
407000
|
try {
|
|
406823
|
-
const dir =
|
|
407001
|
+
const dir = join150(daemonDir2(), "runs", record3.taskId);
|
|
406824
407002
|
mkdirSync10(dir, { recursive: true });
|
|
406825
407003
|
const stamp = record3.startedAt.replace(/:/g, "-");
|
|
406826
|
-
|
|
407004
|
+
writeFileSync10(join150(dir, `${stamp}.json`), JSON.stringify(record3, null, 2), "utf8");
|
|
406827
407005
|
} catch (e) {
|
|
406828
407006
|
logDaemonLine(`[daemon:cron] ERROR guardando historial task=${record3.taskId}: ${e?.message}`);
|
|
406829
407007
|
}
|
|
@@ -406838,7 +407016,7 @@ function makeOnFireTask(projectDir) {
|
|
|
406838
407016
|
logDaemonLine(`[daemon:cron] fire task=${task.id} cron="${task.cron}" cwd=${cwd2} bin=${bin}`);
|
|
406839
407017
|
let child;
|
|
406840
407018
|
try {
|
|
406841
|
-
child =
|
|
407019
|
+
child = spawn10(bin, ["-p", task.prompt, "--dangerously-skip-permissions"], {
|
|
406842
407020
|
cwd: cwd2,
|
|
406843
407021
|
env: {
|
|
406844
407022
|
...process.env,
|
|
@@ -406965,29 +407143,29 @@ __export(exports_main, {
|
|
|
406965
407143
|
daemonMain: () => daemonMain
|
|
406966
407144
|
});
|
|
406967
407145
|
import {
|
|
406968
|
-
existsSync as
|
|
407146
|
+
existsSync as existsSync18,
|
|
406969
407147
|
mkdirSync as mkdirSync11,
|
|
406970
|
-
readFileSync as
|
|
406971
|
-
rmSync as
|
|
406972
|
-
writeFileSync as
|
|
407148
|
+
readFileSync as readFileSync25,
|
|
407149
|
+
rmSync as rmSync5,
|
|
407150
|
+
writeFileSync as writeFileSync11
|
|
406973
407151
|
} from "fs";
|
|
406974
407152
|
import { homedir as homedir40 } from "os";
|
|
406975
|
-
import { dirname as
|
|
407153
|
+
import { dirname as dirname63, join as join151 } from "path";
|
|
406976
407154
|
function daemonDir3() {
|
|
406977
|
-
return
|
|
407155
|
+
return join151(homedir40(), ".theus", "daemon");
|
|
406978
407156
|
}
|
|
406979
407157
|
function pidFilePath() {
|
|
406980
|
-
return
|
|
407158
|
+
return join151(daemonDir3(), "theus-daemon.pid");
|
|
406981
407159
|
}
|
|
406982
407160
|
function logFilePath() {
|
|
406983
|
-
return
|
|
407161
|
+
return join151(daemonDir3(), "daemon.log");
|
|
406984
407162
|
}
|
|
406985
407163
|
function ensureDaemonDir() {
|
|
406986
407164
|
mkdirSync11(daemonDir3(), { recursive: true });
|
|
406987
407165
|
}
|
|
406988
407166
|
function readPid() {
|
|
406989
407167
|
try {
|
|
406990
|
-
const raw =
|
|
407168
|
+
const raw = readFileSync25(pidFilePath(), "utf8").trim();
|
|
406991
407169
|
const pid = Number.parseInt(raw, 10);
|
|
406992
407170
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
406993
407171
|
} catch {
|
|
@@ -407009,13 +407187,13 @@ async function doStart() {
|
|
|
407009
407187
|
console.log(`El daemon de Theus ya est\xE1 corriendo (PID ${existing}).`);
|
|
407010
407188
|
return;
|
|
407011
407189
|
}
|
|
407012
|
-
|
|
407190
|
+
writeFileSync11(pidFilePath(), String(process.pid), "utf8");
|
|
407013
407191
|
console.log(`Daemon de Theus iniciado (PID ${process.pid}).`);
|
|
407014
407192
|
const cleanup = () => {
|
|
407015
407193
|
try {
|
|
407016
407194
|
const current = readPid();
|
|
407017
407195
|
if (current === process.pid)
|
|
407018
|
-
|
|
407196
|
+
rmSync5(pidFilePath(), { force: true });
|
|
407019
407197
|
} catch {}
|
|
407020
407198
|
};
|
|
407021
407199
|
process.on("exit", cleanup);
|
|
@@ -407030,7 +407208,7 @@ function doStop() {
|
|
|
407030
407208
|
}
|
|
407031
407209
|
if (!isAlive(pid)) {
|
|
407032
407210
|
console.log(`El daemon de Theus no est\xE1 corriendo (PID ${pid} muerto). Limpiando pidfile.`);
|
|
407033
|
-
|
|
407211
|
+
rmSync5(pidFilePath(), { force: true });
|
|
407034
407212
|
return;
|
|
407035
407213
|
}
|
|
407036
407214
|
try {
|
|
@@ -407054,13 +407232,13 @@ function doStatus() {
|
|
|
407054
407232
|
}
|
|
407055
407233
|
function doLogs() {
|
|
407056
407234
|
const path19 = logFilePath();
|
|
407057
|
-
if (!
|
|
407235
|
+
if (!existsSync18(path19)) {
|
|
407058
407236
|
console.log(`Sin registro de daemon todav\xEDa (${path19}).`);
|
|
407059
407237
|
return;
|
|
407060
407238
|
}
|
|
407061
407239
|
let content;
|
|
407062
407240
|
try {
|
|
407063
|
-
content =
|
|
407241
|
+
content = readFileSync25(path19, "utf8");
|
|
407064
407242
|
} catch (e) {
|
|
407065
407243
|
console.error(`No se pudo leer el registro: ${e?.message}`);
|
|
407066
407244
|
return;
|
|
@@ -407078,7 +407256,7 @@ function resolveTheusBin() {
|
|
|
407078
407256
|
return "theus";
|
|
407079
407257
|
}
|
|
407080
407258
|
function macosServiceSpec() {
|
|
407081
|
-
const path19 =
|
|
407259
|
+
const path19 = join151(homedir40(), "Library", "LaunchAgents", "pe.theus.daemon.plist");
|
|
407082
407260
|
const bin = resolveTheusBin();
|
|
407083
407261
|
const logDir = daemonDir3();
|
|
407084
407262
|
const content = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -407105,9 +407283,9 @@ function macosServiceSpec() {
|
|
|
407105
407283
|
<key>KeepAlive</key>
|
|
407106
407284
|
<true/>
|
|
407107
407285
|
<key>StandardOutPath</key>
|
|
407108
|
-
<string>${
|
|
407286
|
+
<string>${join151(logDir, "launchd.out.log")}</string>
|
|
407109
407287
|
<key>StandardErrorPath</key>
|
|
407110
|
-
<string>${
|
|
407288
|
+
<string>${join151(logDir, "launchd.err.log")}</string>
|
|
407111
407289
|
</dict>
|
|
407112
407290
|
</plist>
|
|
407113
407291
|
`;
|
|
@@ -407122,7 +407300,7 @@ function macosServiceSpec() {
|
|
|
407122
407300
|
};
|
|
407123
407301
|
}
|
|
407124
407302
|
function linuxServiceSpec() {
|
|
407125
|
-
const path19 =
|
|
407303
|
+
const path19 = join151(homedir40(), ".config", "systemd", "user", "theus-daemon.service");
|
|
407126
407304
|
const bin = resolveTheusBin();
|
|
407127
407305
|
const content = `[Unit]
|
|
407128
407306
|
Description=Theus daemon (cron/agent supervisor)
|
|
@@ -407184,8 +407362,8 @@ Pasos posteriores:
|
|
|
407184
407362
|
return;
|
|
407185
407363
|
}
|
|
407186
407364
|
try {
|
|
407187
|
-
mkdirSync11(
|
|
407188
|
-
|
|
407365
|
+
mkdirSync11(dirname63(spec.path), { recursive: true });
|
|
407366
|
+
writeFileSync11(spec.path, spec.content, "utf8");
|
|
407189
407367
|
console.log(`Archivo de servicio escrito en: ${spec.path}`);
|
|
407190
407368
|
if (spec.notes.length > 0) {
|
|
407191
407369
|
console.log(`
|
|
@@ -407206,16 +407384,16 @@ function doUninstall(args) {
|
|
|
407206
407384
|
if (!hasConfirm(args)) {
|
|
407207
407385
|
console.log(`[dry-run] Desinstalaci\xF3n del daemon de Theus (${spec.platform}).
|
|
407208
407386
|
` + `Se eliminar\xEDa: ${spec.path}
|
|
407209
|
-
` + (
|
|
407387
|
+
` + (existsSync18(spec.path) ? "El archivo existe y ser\xEDa borrado." : "El archivo no existe actualmente (nada que borrar).") + `
|
|
407210
407388
|
Vuelve a ejecutar con --confirm para eliminarlo.`);
|
|
407211
407389
|
return;
|
|
407212
407390
|
}
|
|
407213
|
-
if (!
|
|
407391
|
+
if (!existsSync18(spec.path)) {
|
|
407214
407392
|
console.log(`No hay archivo de servicio que eliminar en: ${spec.path}`);
|
|
407215
407393
|
return;
|
|
407216
407394
|
}
|
|
407217
407395
|
try {
|
|
407218
|
-
|
|
407396
|
+
rmSync5(spec.path, { force: true });
|
|
407219
407397
|
console.log(`Archivo de servicio eliminado: ${spec.path}`);
|
|
407220
407398
|
} catch (e) {
|
|
407221
407399
|
console.error(`No se pudo eliminar el servicio: ${e?.message}`);
|
|
@@ -409591,7 +409769,7 @@ __export(exports_upstreamproxy, {
|
|
|
409591
409769
|
});
|
|
409592
409770
|
import { mkdir as mkdir47, readFile as readFile51, unlink as unlink24, writeFile as writeFile48 } from "fs/promises";
|
|
409593
409771
|
import { homedir as homedir41 } from "os";
|
|
409594
|
-
import { join as
|
|
409772
|
+
import { join as join152 } from "path";
|
|
409595
409773
|
async function initUpstreamProxy(opts) {
|
|
409596
409774
|
if (!isEnvTruthy(process.env.THEUS_CODE_REMOTE)) {
|
|
409597
409775
|
return state;
|
|
@@ -409612,7 +409790,7 @@ async function initUpstreamProxy(opts) {
|
|
|
409612
409790
|
}
|
|
409613
409791
|
setNonDumpable();
|
|
409614
409792
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.THEUS_BASE_URL ?? "https://api.theus.pe";
|
|
409615
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
409793
|
+
const caBundlePath = opts?.caBundlePath ?? join152(homedir41(), ".ccr", "ca-bundle.crt");
|
|
409616
409794
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
409617
409795
|
if (!caOk)
|
|
409618
409796
|
return state;
|
|
@@ -409712,7 +409890,7 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
409712
409890
|
}
|
|
409713
409891
|
const ccrCa = await resp.text();
|
|
409714
409892
|
const systemCa = await readFile51(systemCaPath, "utf8").catch(() => "");
|
|
409715
|
-
await mkdir47(
|
|
409893
|
+
await mkdir47(join152(outPath, ".."), { recursive: true });
|
|
409716
409894
|
await writeFile48(outPath, systemCa + `
|
|
409717
409895
|
` + ccrCa, "utf8");
|
|
409718
409896
|
return true;
|
|
@@ -410724,7 +410902,7 @@ var init_IdleReturnDialog = __esm(() => {
|
|
|
410724
410902
|
});
|
|
410725
410903
|
|
|
410726
410904
|
// services/preventSleep.ts
|
|
410727
|
-
import { spawn as
|
|
410905
|
+
import { spawn as spawn11 } from "child_process";
|
|
410728
410906
|
function startPreventSleep() {
|
|
410729
410907
|
refCount++;
|
|
410730
410908
|
if (refCount === 1) {
|
|
@@ -410782,7 +410960,7 @@ function spawnCaffeinate() {
|
|
|
410782
410960
|
});
|
|
410783
410961
|
}
|
|
410784
410962
|
try {
|
|
410785
|
-
caffeinateProcess =
|
|
410963
|
+
caffeinateProcess = spawn11("caffeinate", ["-i", "-t", String(CAFFEINATE_TIMEOUT_SECONDS)], {
|
|
410786
410964
|
stdio: "ignore"
|
|
410787
410965
|
});
|
|
410788
410966
|
caffeinateProcess.unref();
|
|
@@ -411215,7 +411393,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
411215
411393
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
411216
411394
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
411217
411395
|
betas: getSdkBetas(),
|
|
411218
|
-
theus_code_version: { VERSION: "0.1.
|
|
411396
|
+
theus_code_version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
411219
411397
|
output_style: outputStyle2,
|
|
411220
411398
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
411221
411399
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -417601,7 +417779,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
417601
417779
|
|
|
417602
417780
|
// components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
417603
417781
|
import { homedir as homedir42 } from "os";
|
|
417604
|
-
import { basename as basename47, join as
|
|
417782
|
+
import { basename as basename47, join as join153, sep as sep34 } from "path";
|
|
417605
417783
|
function isInTheusFolder(filePath) {
|
|
417606
417784
|
const absolutePath = expandPath(filePath);
|
|
417607
417785
|
const theusFolderPath = expandPath(`${getOriginalCwd()}/.theus`);
|
|
@@ -417611,7 +417789,7 @@ function isInTheusFolder(filePath) {
|
|
|
417611
417789
|
}
|
|
417612
417790
|
function isInGlobalTheusFolder(filePath) {
|
|
417613
417791
|
const absolutePath = expandPath(filePath);
|
|
417614
|
-
const globalTheusFolderPath =
|
|
417792
|
+
const globalTheusFolderPath = join153(homedir42(), ".theus");
|
|
417615
417793
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
417616
417794
|
const normalizedGlobalTheusFolderPath = normalizeCaseForComparison(globalTheusFolderPath);
|
|
417617
417795
|
return normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + sep34.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + "/");
|
|
@@ -425849,7 +426027,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
425849
426027
|
function getSemverPart(version3) {
|
|
425850
426028
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
425851
426029
|
}
|
|
425852
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.
|
|
426030
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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) {
|
|
425853
426031
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react215.useState(() => getSemverPart(initialVersion));
|
|
425854
426032
|
if (!updatedVersion) {
|
|
425855
426033
|
return null;
|
|
@@ -425889,7 +426067,7 @@ function AutoUpdater({
|
|
|
425889
426067
|
return;
|
|
425890
426068
|
}
|
|
425891
426069
|
if (false) {}
|
|
425892
|
-
const currentVersion = { VERSION: "0.1.
|
|
426070
|
+
const currentVersion = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
425893
426071
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
425894
426072
|
let latestVersion = await getLatestVersion(channel2);
|
|
425895
426073
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -426025,7 +426203,7 @@ function AutoUpdater({
|
|
|
426025
426203
|
" ",
|
|
426026
426204
|
/* @__PURE__ */ jsx_runtime383.jsx(ThemedText, {
|
|
426027
426205
|
bold: true,
|
|
426028
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
426206
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
426029
426207
|
})
|
|
426030
426208
|
]
|
|
426031
426209
|
})
|
|
@@ -426102,12 +426280,12 @@ function NativeAutoUpdater({
|
|
|
426102
426280
|
logEvent("tengu_native_auto_updater_start", {});
|
|
426103
426281
|
try {
|
|
426104
426282
|
const maxVersion = await getMaxVersion();
|
|
426105
|
-
if (maxVersion && gt({ VERSION: "0.1.
|
|
426283
|
+
if (maxVersion && gt({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
426106
426284
|
const msg = await getMaxVersionMessage();
|
|
426107
426285
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
426108
426286
|
}
|
|
426109
426287
|
const result = await installLatest(channel2);
|
|
426110
|
-
const currentVersion = { VERSION: "0.1.
|
|
426288
|
+
const currentVersion = { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
426111
426289
|
const latencyMs = Date.now() - startTime2;
|
|
426112
426290
|
if (result.lockFailed) {
|
|
426113
426291
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -426244,17 +426422,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
426244
426422
|
const maxVersion = await getMaxVersion();
|
|
426245
426423
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
426246
426424
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
426247
|
-
if (gte({ VERSION: "0.1.
|
|
426248
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.
|
|
426425
|
+
if (gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
426426
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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`);
|
|
426249
426427
|
setUpdateAvailable(false);
|
|
426250
426428
|
return;
|
|
426251
426429
|
}
|
|
426252
426430
|
latest = maxVersion;
|
|
426253
426431
|
}
|
|
426254
|
-
const hasUpdate = latest && !gte({ VERSION: "0.1.
|
|
426432
|
+
const hasUpdate = latest && !gte({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
426255
426433
|
setUpdateAvailable(!!hasUpdate);
|
|
426256
426434
|
if (hasUpdate) {
|
|
426257
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.
|
|
426435
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
426258
426436
|
}
|
|
426259
426437
|
};
|
|
426260
426438
|
$2[0] = t1;
|
|
@@ -426288,7 +426466,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
426288
426466
|
wrap: "truncate",
|
|
426289
426467
|
children: [
|
|
426290
426468
|
"currentVersion: ",
|
|
426291
|
-
{ VERSION: "0.1.
|
|
426469
|
+
{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
426292
426470
|
]
|
|
426293
426471
|
});
|
|
426294
426472
|
$2[3] = verbose;
|
|
@@ -434161,7 +434339,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
434161
434339
|
project_dir: getOriginalCwd(),
|
|
434162
434340
|
added_dirs: addedDirs
|
|
434163
434341
|
},
|
|
434164
|
-
version: { VERSION: "0.1.
|
|
434342
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
434165
434343
|
output_style: {
|
|
434166
434344
|
name: outputStyleName
|
|
434167
434345
|
},
|
|
@@ -440291,9 +440469,9 @@ function initSkillImprovement() {
|
|
|
440291
440469
|
async function applySkillImprovement(skillName, updates) {
|
|
440292
440470
|
if (!skillName)
|
|
440293
440471
|
return;
|
|
440294
|
-
const { join:
|
|
440472
|
+
const { join: join154 } = await import("path");
|
|
440295
440473
|
const fs5 = await import("fs/promises");
|
|
440296
|
-
const filePath =
|
|
440474
|
+
const filePath = join154(getCwd(), ".theus", "skills", skillName, "SKILL.md");
|
|
440297
440475
|
let currentContent;
|
|
440298
440476
|
try {
|
|
440299
440477
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -440447,7 +440625,7 @@ function useMoreRight(_args) {
|
|
|
440447
440625
|
// utils/cleanup.ts
|
|
440448
440626
|
import * as fs5 from "fs/promises";
|
|
440449
440627
|
import { homedir as homedir43 } from "os";
|
|
440450
|
-
import { join as
|
|
440628
|
+
import { join as join154 } from "path";
|
|
440451
440629
|
function getCutoffDate() {
|
|
440452
440630
|
const settings = getSettings_DEPRECATED() || {};
|
|
440453
440631
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -440472,7 +440650,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
440472
440650
|
try {
|
|
440473
440651
|
const timestamp = convertFileNameToDate(file2.name);
|
|
440474
440652
|
if (timestamp < cutoffDate) {
|
|
440475
|
-
await getFsImplementation().unlink(
|
|
440653
|
+
await getFsImplementation().unlink(join154(dirPath, file2.name));
|
|
440476
440654
|
if (isMessagePath) {
|
|
440477
440655
|
result.messages++;
|
|
440478
440656
|
} else {
|
|
@@ -440503,7 +440681,7 @@ async function cleanupOldMessageFiles() {
|
|
|
440503
440681
|
} catch {
|
|
440504
440682
|
return result;
|
|
440505
440683
|
}
|
|
440506
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
440684
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join154(baseCachePath, dirent.name));
|
|
440507
440685
|
for (const mcpLogDir of mcpLogDirs) {
|
|
440508
440686
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
440509
440687
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -440542,7 +440720,7 @@ async function cleanupOldSessionFiles() {
|
|
|
440542
440720
|
for (const projectDirent of projectDirents) {
|
|
440543
440721
|
if (!projectDirent.isDirectory())
|
|
440544
440722
|
continue;
|
|
440545
|
-
const projectDir =
|
|
440723
|
+
const projectDir = join154(projectsDir, projectDirent.name);
|
|
440546
440724
|
let entries;
|
|
440547
440725
|
try {
|
|
440548
440726
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -440556,15 +440734,15 @@ async function cleanupOldSessionFiles() {
|
|
|
440556
440734
|
continue;
|
|
440557
440735
|
}
|
|
440558
440736
|
try {
|
|
440559
|
-
if (await unlinkIfOld(
|
|
440737
|
+
if (await unlinkIfOld(join154(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
440560
440738
|
result.messages++;
|
|
440561
440739
|
}
|
|
440562
440740
|
} catch {
|
|
440563
440741
|
result.errors++;
|
|
440564
440742
|
}
|
|
440565
440743
|
} else if (entry.isDirectory()) {
|
|
440566
|
-
const sessionDir =
|
|
440567
|
-
const toolResultsDir =
|
|
440744
|
+
const sessionDir = join154(projectDir, entry.name);
|
|
440745
|
+
const toolResultsDir = join154(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
440568
440746
|
let toolDirs;
|
|
440569
440747
|
try {
|
|
440570
440748
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -440575,14 +440753,14 @@ async function cleanupOldSessionFiles() {
|
|
|
440575
440753
|
for (const toolEntry of toolDirs) {
|
|
440576
440754
|
if (toolEntry.isFile()) {
|
|
440577
440755
|
try {
|
|
440578
|
-
if (await unlinkIfOld(
|
|
440756
|
+
if (await unlinkIfOld(join154(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
440579
440757
|
result.messages++;
|
|
440580
440758
|
}
|
|
440581
440759
|
} catch {
|
|
440582
440760
|
result.errors++;
|
|
440583
440761
|
}
|
|
440584
440762
|
} else if (toolEntry.isDirectory()) {
|
|
440585
|
-
const toolDirPath =
|
|
440763
|
+
const toolDirPath = join154(toolResultsDir, toolEntry.name);
|
|
440586
440764
|
let toolFiles;
|
|
440587
440765
|
try {
|
|
440588
440766
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -440593,7 +440771,7 @@ async function cleanupOldSessionFiles() {
|
|
|
440593
440771
|
if (!tf.isFile())
|
|
440594
440772
|
continue;
|
|
440595
440773
|
try {
|
|
440596
|
-
if (await unlinkIfOld(
|
|
440774
|
+
if (await unlinkIfOld(join154(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
440597
440775
|
result.messages++;
|
|
440598
440776
|
}
|
|
440599
440777
|
} catch {
|
|
@@ -440625,7 +440803,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
440625
440803
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
440626
440804
|
continue;
|
|
440627
440805
|
try {
|
|
440628
|
-
if (await unlinkIfOld(
|
|
440806
|
+
if (await unlinkIfOld(join154(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
440629
440807
|
result.messages++;
|
|
440630
440808
|
}
|
|
440631
440809
|
} catch {
|
|
@@ -440638,7 +440816,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
440638
440816
|
return result;
|
|
440639
440817
|
}
|
|
440640
440818
|
function cleanupOldPlanFiles() {
|
|
440641
|
-
const plansDir =
|
|
440819
|
+
const plansDir = join154(getTheusConfigHomeDir(), "plans");
|
|
440642
440820
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
440643
440821
|
}
|
|
440644
440822
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -440647,14 +440825,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
440647
440825
|
const fsImpl = getFsImplementation();
|
|
440648
440826
|
try {
|
|
440649
440827
|
const configDir = getTheusConfigHomeDir();
|
|
440650
|
-
const fileHistoryStorageDir =
|
|
440828
|
+
const fileHistoryStorageDir = join154(configDir, "file-history");
|
|
440651
440829
|
let dirents;
|
|
440652
440830
|
try {
|
|
440653
440831
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
440654
440832
|
} catch {
|
|
440655
440833
|
return result;
|
|
440656
440834
|
}
|
|
440657
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
440835
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join154(fileHistoryStorageDir, dirent.name));
|
|
440658
440836
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
440659
440837
|
try {
|
|
440660
440838
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -440681,14 +440859,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
440681
440859
|
const fsImpl = getFsImplementation();
|
|
440682
440860
|
try {
|
|
440683
440861
|
const configDir = getTheusConfigHomeDir();
|
|
440684
|
-
const sessionEnvBaseDir =
|
|
440862
|
+
const sessionEnvBaseDir = join154(configDir, "session-env");
|
|
440685
440863
|
let dirents;
|
|
440686
440864
|
try {
|
|
440687
440865
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
440688
440866
|
} catch {
|
|
440689
440867
|
return result;
|
|
440690
440868
|
}
|
|
440691
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
440869
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join154(sessionEnvBaseDir, dirent.name));
|
|
440692
440870
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
440693
440871
|
try {
|
|
440694
440872
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -440710,7 +440888,7 @@ async function cleanupOldDebugLogs() {
|
|
|
440710
440888
|
const cutoffDate = getCutoffDate();
|
|
440711
440889
|
const result = { messages: 0, errors: 0 };
|
|
440712
440890
|
const fsImpl = getFsImplementation();
|
|
440713
|
-
const debugDir =
|
|
440891
|
+
const debugDir = join154(getTheusConfigHomeDir(), "debug");
|
|
440714
440892
|
let dirents;
|
|
440715
440893
|
try {
|
|
440716
440894
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -440722,7 +440900,7 @@ async function cleanupOldDebugLogs() {
|
|
|
440722
440900
|
continue;
|
|
440723
440901
|
}
|
|
440724
440902
|
try {
|
|
440725
|
-
if (await unlinkIfOld(
|
|
440903
|
+
if (await unlinkIfOld(join154(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
440726
440904
|
result.messages++;
|
|
440727
440905
|
}
|
|
440728
440906
|
} catch {
|
|
@@ -440732,7 +440910,7 @@ async function cleanupOldDebugLogs() {
|
|
|
440732
440910
|
return result;
|
|
440733
440911
|
}
|
|
440734
440912
|
async function cleanupNpmCacheForTheusPackages() {
|
|
440735
|
-
const markerPath =
|
|
440913
|
+
const markerPath = join154(getTheusConfigHomeDir(), ".npm-cache-cleanup");
|
|
440736
440914
|
try {
|
|
440737
440915
|
const stat46 = await fs5.stat(markerPath);
|
|
440738
440916
|
if (Date.now() - stat46.mtimeMs < ONE_DAY_MS) {
|
|
@@ -440747,7 +440925,7 @@ async function cleanupNpmCacheForTheusPackages() {
|
|
|
440747
440925
|
return;
|
|
440748
440926
|
}
|
|
440749
440927
|
logForDebugging("npm cache cleanup: starting");
|
|
440750
|
-
const npmCachePath =
|
|
440928
|
+
const npmCachePath = join154(homedir43(), ".npm", "_cacache");
|
|
440751
440929
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
440752
440930
|
const startTime2 = Date.now();
|
|
440753
440931
|
try {
|
|
@@ -440802,7 +440980,7 @@ async function cleanupNpmCacheForTheusPackages() {
|
|
|
440802
440980
|
}
|
|
440803
440981
|
}
|
|
440804
440982
|
async function cleanupOldVersionsThrottled() {
|
|
440805
|
-
const markerPath =
|
|
440983
|
+
const markerPath = join154(getTheusConfigHomeDir(), ".version-cleanup");
|
|
440806
440984
|
try {
|
|
440807
440985
|
const stat46 = await fs5.stat(markerPath);
|
|
440808
440986
|
if (Date.now() - stat46.mtimeMs < ONE_DAY_MS) {
|
|
@@ -444033,7 +444211,7 @@ __export(exports_asciicast, {
|
|
|
444033
444211
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
444034
444212
|
});
|
|
444035
444213
|
import { appendFile as appendFile7, rename as rename10 } from "fs/promises";
|
|
444036
|
-
import { basename as basename56, dirname as
|
|
444214
|
+
import { basename as basename56, dirname as dirname64, join as join156 } from "path";
|
|
444037
444215
|
function getRecordFilePath() {
|
|
444038
444216
|
if (recordingState.filePath !== null) {
|
|
444039
444217
|
return recordingState.filePath;
|
|
@@ -444044,10 +444222,10 @@ function getRecordFilePath() {
|
|
|
444044
444222
|
if (!isEnvTruthy(process.env.THEUS_CODE_TERMINAL_RECORDING)) {
|
|
444045
444223
|
return null;
|
|
444046
444224
|
}
|
|
444047
|
-
const projectsDir =
|
|
444048
|
-
const projectDir =
|
|
444225
|
+
const projectsDir = join156(getTheusConfigHomeDir(), "projects");
|
|
444226
|
+
const projectDir = join156(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
444049
444227
|
recordingState.timestamp = Date.now();
|
|
444050
|
-
recordingState.filePath =
|
|
444228
|
+
recordingState.filePath = join156(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
444051
444229
|
return recordingState.filePath;
|
|
444052
444230
|
}
|
|
444053
444231
|
function _resetRecordingStateForTesting() {
|
|
@@ -444056,13 +444234,13 @@ function _resetRecordingStateForTesting() {
|
|
|
444056
444234
|
}
|
|
444057
444235
|
function getSessionRecordingPaths() {
|
|
444058
444236
|
const sessionId = getSessionId();
|
|
444059
|
-
const projectsDir =
|
|
444060
|
-
const projectDir =
|
|
444237
|
+
const projectsDir = join156(getTheusConfigHomeDir(), "projects");
|
|
444238
|
+
const projectDir = join156(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
444061
444239
|
try {
|
|
444062
444240
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
444063
444241
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
444064
444242
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
444065
|
-
return files2.map((f) =>
|
|
444243
|
+
return files2.map((f) => join156(projectDir, f));
|
|
444066
444244
|
} catch {
|
|
444067
444245
|
return [];
|
|
444068
444246
|
}
|
|
@@ -444072,9 +444250,9 @@ async function renameRecordingForSession() {
|
|
|
444072
444250
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
444073
444251
|
return;
|
|
444074
444252
|
}
|
|
444075
|
-
const projectsDir =
|
|
444076
|
-
const projectDir =
|
|
444077
|
-
const newPath =
|
|
444253
|
+
const projectsDir = join156(getTheusConfigHomeDir(), "projects");
|
|
444254
|
+
const projectDir = join156(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
444255
|
+
const newPath = join156(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
444078
444256
|
if (oldPath === newPath) {
|
|
444079
444257
|
return;
|
|
444080
444258
|
}
|
|
@@ -444115,7 +444293,7 @@ function installAsciicastRecorder() {
|
|
|
444115
444293
|
}
|
|
444116
444294
|
});
|
|
444117
444295
|
try {
|
|
444118
|
-
getFsImplementation().mkdirSync(
|
|
444296
|
+
getFsImplementation().mkdirSync(dirname64(filePath));
|
|
444119
444297
|
} catch {}
|
|
444120
444298
|
getFsImplementation().appendFileSync(filePath, header + `
|
|
444121
444299
|
`, { mode: 384 });
|
|
@@ -444184,7 +444362,7 @@ var init_asciicast = __esm(() => {
|
|
|
444184
444362
|
});
|
|
444185
444363
|
|
|
444186
444364
|
// utils/sessionRestore.ts
|
|
444187
|
-
import { dirname as
|
|
444365
|
+
import { dirname as dirname65 } from "path";
|
|
444188
444366
|
function extractTodosFromTranscript(messages) {
|
|
444189
444367
|
for (let i3 = messages.length - 1;i3 >= 0; i3--) {
|
|
444190
444368
|
const msg = messages[i3];
|
|
@@ -444309,7 +444487,7 @@ async function processResumedConversation(result, opts, context3) {
|
|
|
444309
444487
|
if (!opts.forkSession) {
|
|
444310
444488
|
const sid = opts.sessionIdOverride ?? result.sessionId;
|
|
444311
444489
|
if (sid) {
|
|
444312
|
-
switchSession(asSessionId(sid), opts.transcriptPath ?
|
|
444490
|
+
switchSession(asSessionId(sid), opts.transcriptPath ? dirname65(opts.transcriptPath) : null);
|
|
444313
444491
|
await renameRecordingForSession();
|
|
444314
444492
|
await resetSessionFilePointer();
|
|
444315
444493
|
restoreCostStateForSession(sid);
|
|
@@ -445724,7 +445902,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
445724
445902
|
} catch {}
|
|
445725
445903
|
const data = {
|
|
445726
445904
|
trigger,
|
|
445727
|
-
version: { VERSION: "0.1.
|
|
445905
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
445728
445906
|
platform: process.platform,
|
|
445729
445907
|
transcript,
|
|
445730
445908
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -446951,7 +447129,7 @@ var init_useAwaySummary = __esm(() => {
|
|
|
446951
447129
|
|
|
446952
447130
|
// utils/theusInChrome/setupPortable.ts
|
|
446953
447131
|
import { readdir as readdir31 } from "fs/promises";
|
|
446954
|
-
import { join as
|
|
447132
|
+
import { join as join157 } from "path";
|
|
446955
447133
|
function getExtensionIds() {
|
|
446956
447134
|
return process.env.USER_TYPE === "ant" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
|
|
446957
447135
|
}
|
|
@@ -446978,7 +447156,7 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
446978
447156
|
}
|
|
446979
447157
|
for (const profile of profileDirs) {
|
|
446980
447158
|
for (const extensionId of extensionIds) {
|
|
446981
|
-
const extensionPath =
|
|
447159
|
+
const extensionPath = join157(browserBasePath, profile, "Extensions", extensionId);
|
|
446982
447160
|
try {
|
|
446983
447161
|
await readdir31(extensionPath);
|
|
446984
447162
|
log2?.(`[Theus in Chrome] Extension ${extensionId} found in ${browser} ${profile}`);
|
|
@@ -447002,7 +447180,7 @@ var init_setupPortable = __esm(() => {
|
|
|
447002
447180
|
// utils/theusInChrome/setup.ts
|
|
447003
447181
|
import { chmod as chmod11, mkdir as mkdir48, readFile as readFile53, writeFile as writeFile50 } from "fs/promises";
|
|
447004
447182
|
import { homedir as homedir44 } from "os";
|
|
447005
|
-
import { join as
|
|
447183
|
+
import { join as join158 } from "path";
|
|
447006
447184
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
447007
447185
|
function shouldEnableTheusInChrome(chromeFlag) {
|
|
447008
447186
|
if (getIsNonInteractiveSession() && chromeFlag !== true) {
|
|
@@ -447059,8 +447237,8 @@ function setupTheusInChrome() {
|
|
|
447059
447237
|
};
|
|
447060
447238
|
} else {
|
|
447061
447239
|
const __filename3 = fileURLToPath7(import.meta.url);
|
|
447062
|
-
const __dirname3 =
|
|
447063
|
-
const cliPath =
|
|
447240
|
+
const __dirname3 = join158(__filename3, "..");
|
|
447241
|
+
const cliPath = join158(__dirname3, "cli.js");
|
|
447064
447242
|
createWrapperScript(`"${process.execPath}" "${cliPath}" --chrome-native-host`).then((manifestBinaryPath) => installChromeNativeHostManifest(manifestBinaryPath)).catch((e) => logForDebugging(`[Theus in Chrome] Failed to install native host: ${e}`, { level: "error" }));
|
|
447065
447243
|
const mcpConfig = {
|
|
447066
447244
|
[THEUS_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -447082,8 +447260,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
447082
447260
|
const platform6 = getPlatform();
|
|
447083
447261
|
if (platform6 === "windows") {
|
|
447084
447262
|
const home = homedir44();
|
|
447085
|
-
const appData = process.env.APPDATA ||
|
|
447086
|
-
return [
|
|
447263
|
+
const appData = process.env.APPDATA || join158(home, "AppData", "Local");
|
|
447264
|
+
return [join158(appData, "Theus", "ChromeNativeHost")];
|
|
447087
447265
|
}
|
|
447088
447266
|
return getAllNativeMessagingHostsDirs().map(({ path: path21 }) => path21);
|
|
447089
447267
|
}
|
|
@@ -447108,7 +447286,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
447108
447286
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
447109
447287
|
let anyManifestUpdated = false;
|
|
447110
447288
|
for (const manifestDir of manifestDirs) {
|
|
447111
|
-
const manifestPath =
|
|
447289
|
+
const manifestPath = join158(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
447112
447290
|
const existingContent = await readFile53(manifestPath, "utf-8").catch(() => null);
|
|
447113
447291
|
if (existingContent === manifestContent) {
|
|
447114
447292
|
continue;
|
|
@@ -447123,7 +447301,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
447123
447301
|
}
|
|
447124
447302
|
}
|
|
447125
447303
|
if (getPlatform() === "windows") {
|
|
447126
|
-
const manifestPath =
|
|
447304
|
+
const manifestPath = join158(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
447127
447305
|
registerWindowsNativeHosts(manifestPath);
|
|
447128
447306
|
}
|
|
447129
447307
|
if (anyManifestUpdated) {
|
|
@@ -447161,8 +447339,8 @@ function registerWindowsNativeHosts(manifestPath) {
|
|
|
447161
447339
|
}
|
|
447162
447340
|
async function createWrapperScript(command7) {
|
|
447163
447341
|
const platform6 = getPlatform();
|
|
447164
|
-
const chromeDir =
|
|
447165
|
-
const wrapperPath = platform6 === "windows" ?
|
|
447342
|
+
const chromeDir = join158(getTheusConfigHomeDir(), "chrome");
|
|
447343
|
+
const wrapperPath = platform6 === "windows" ? join158(chromeDir, "chrome-native-host.bat") : join158(chromeDir, "chrome-native-host");
|
|
447166
447344
|
const scriptContent = platform6 === "windows" ? `@echo off
|
|
447167
447345
|
REM Chrome native host wrapper script
|
|
447168
447346
|
REM Generated by Theus - do not edit manually
|
|
@@ -447285,7 +447463,7 @@ var init_useChromeExtensionNotification = __esm(() => {
|
|
|
447285
447463
|
});
|
|
447286
447464
|
|
|
447287
447465
|
// utils/plugins/officialMarketplaceStartupCheck.ts
|
|
447288
|
-
import { join as
|
|
447466
|
+
import { join as join159 } from "path";
|
|
447289
447467
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
447290
447468
|
if (isEnvTruthy(process.env.THEUS_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)) {
|
|
447291
447469
|
return true;
|
|
@@ -447360,7 +447538,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
447360
447538
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
447361
447539
|
}
|
|
447362
447540
|
const cacheDir = getMarketplacesCacheDir();
|
|
447363
|
-
const installLocation =
|
|
447541
|
+
const installLocation = join159(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
447364
447542
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
447365
447543
|
if (gcsSha !== null) {
|
|
447366
447544
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -450339,7 +450517,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
450339
450517
|
});
|
|
450340
450518
|
|
|
450341
450519
|
// hooks/useLspPluginRecommendation.tsx
|
|
450342
|
-
import { extname as extname16, join as
|
|
450520
|
+
import { extname as extname16, join as join160 } from "path";
|
|
450343
450521
|
function useLspPluginRecommendation() {
|
|
450344
450522
|
const $2 = c3(12);
|
|
450345
450523
|
const trackedFiles = useAppState(_temp200);
|
|
@@ -450424,7 +450602,7 @@ function useLspPluginRecommendation() {
|
|
|
450424
450602
|
case "yes": {
|
|
450425
450603
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
450426
450604
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
450427
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
450605
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join160(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
450428
450606
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
450429
450607
|
const settings = getSettingsForSource("userSettings");
|
|
450430
450608
|
updateSettingsForSource("userSettings", {
|
|
@@ -453419,8 +453597,8 @@ var exports_REPL = {};
|
|
|
453419
453597
|
__export(exports_REPL, {
|
|
453420
453598
|
REPL: () => REPL
|
|
453421
453599
|
});
|
|
453422
|
-
import { dirname as
|
|
453423
|
-
import { tmpdir as
|
|
453600
|
+
import { dirname as dirname66, join as join161 } from "path";
|
|
453601
|
+
import { tmpdir as tmpdir12 } from "os";
|
|
453424
453602
|
import { writeFile as writeFile51 } from "fs/promises";
|
|
453425
453603
|
import { randomUUID as randomUUID50 } from "crypto";
|
|
453426
453604
|
function TranscriptModeFooter(t0) {
|
|
@@ -454359,7 +454537,7 @@ function REPL({
|
|
|
454359
454537
|
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
454360
454538
|
saveCurrentSessionCosts();
|
|
454361
454539
|
resetCostState();
|
|
454362
|
-
switchSession(asSessionId(sessionId), log2.fullPath ?
|
|
454540
|
+
switchSession(asSessionId(sessionId), log2.fullPath ? dirname66(log2.fullPath) : null);
|
|
454363
454541
|
const {
|
|
454364
454542
|
renameRecordingForSession: renameRecordingForSession2
|
|
454365
454543
|
} = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
|
|
@@ -455998,7 +456176,7 @@ Note: ctrl + z now suspends Theus, ctrl + _ undoes input.
|
|
|
455998
456176
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
455999
456177
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
456000
456178
|
const text2 = raw.replace(/[ \t]+$/gm, "");
|
|
456001
|
-
const path21 =
|
|
456179
|
+
const path21 = join161(tmpdir12(), `cc-transcript-${Date.now()}.txt`);
|
|
456002
456180
|
await writeFile51(path21, text2);
|
|
456003
456181
|
const opened = openFileInExternalEditor(path21);
|
|
456004
456182
|
setStatus(opened ? `opening ${path21}` : `wrote ${path21} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -458514,7 +458692,7 @@ function Onboarding({
|
|
|
458514
458692
|
flexDirection: "column",
|
|
458515
458693
|
children: [
|
|
458516
458694
|
/* @__PURE__ */ jsx_runtime457.jsx(TheusBanner, {
|
|
458517
|
-
version: { VERSION: "0.1.
|
|
458695
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
458518
458696
|
}),
|
|
458519
458697
|
/* @__PURE__ */ jsx_runtime457.jsxs(ThemedBox_default, {
|
|
458520
458698
|
flexDirection: "column",
|
|
@@ -459385,7 +459563,7 @@ function completeOnboarding() {
|
|
|
459385
459563
|
saveGlobalConfig((current) => ({
|
|
459386
459564
|
...current,
|
|
459387
459565
|
hasCompletedOnboarding: true,
|
|
459388
|
-
lastOnboardingVersion: { VERSION: "0.1.
|
|
459566
|
+
lastOnboardingVersion: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
459389
459567
|
}));
|
|
459390
459568
|
}
|
|
459391
459569
|
function showDialog(root2, renderer) {
|
|
@@ -460792,7 +460970,7 @@ var exports_ResumeConversation = {};
|
|
|
460792
460970
|
__export(exports_ResumeConversation, {
|
|
460793
460971
|
ResumeConversation: () => ResumeConversation
|
|
460794
460972
|
});
|
|
460795
|
-
import { dirname as
|
|
460973
|
+
import { dirname as dirname67 } from "path";
|
|
460796
460974
|
function parsePrIdentifier(value) {
|
|
460797
460975
|
const directNumber = parseInt(value, 10);
|
|
460798
460976
|
if (!isNaN(directNumber) && directNumber > 0) {
|
|
@@ -460924,7 +461102,7 @@ function ResumeConversation({
|
|
|
460924
461102
|
}
|
|
460925
461103
|
if (false) {}
|
|
460926
461104
|
if (result_3.sessionId && !forkSession) {
|
|
460927
|
-
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ?
|
|
461105
|
+
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname67(log_0.fullPath) : null);
|
|
460928
461106
|
await renameRecordingForSession();
|
|
460929
461107
|
await resetSessionFilePointer();
|
|
460930
461108
|
restoreCostStateForSession(result_3.sessionId);
|
|
@@ -464058,12 +464236,12 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
464058
464236
|
});
|
|
464059
464237
|
|
|
464060
464238
|
// utils/errorLogSink.ts
|
|
464061
|
-
import { dirname as
|
|
464239
|
+
import { dirname as dirname68, join as join162 } from "path";
|
|
464062
464240
|
function getErrorsPath() {
|
|
464063
|
-
return
|
|
464241
|
+
return join162(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
464064
464242
|
}
|
|
464065
464243
|
function getMCPLogsPath(serverName) {
|
|
464066
|
-
return
|
|
464244
|
+
return join162(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
464067
464245
|
}
|
|
464068
464246
|
function createJsonlWriter(options2) {
|
|
464069
464247
|
const writer = createBufferedWriter(options2);
|
|
@@ -464079,7 +464257,7 @@ function createJsonlWriter(options2) {
|
|
|
464079
464257
|
function getLogWriter(path21) {
|
|
464080
464258
|
let writer = logWriters.get(path21);
|
|
464081
464259
|
if (!writer) {
|
|
464082
|
-
const dir =
|
|
464260
|
+
const dir = dirname68(path21);
|
|
464083
464261
|
writer = createJsonlWriter({
|
|
464084
464262
|
writeFn: (content) => {
|
|
464085
464263
|
try {
|
|
@@ -464107,7 +464285,7 @@ function appendToLog(path21, message) {
|
|
|
464107
464285
|
cwd: getFsImplementation().cwd(),
|
|
464108
464286
|
userType: process.env.USER_TYPE,
|
|
464109
464287
|
sessionId: getSessionId(),
|
|
464110
|
-
version: { VERSION: "0.1.
|
|
464288
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
464111
464289
|
};
|
|
464112
464290
|
getLogWriter(path21).write(messageWithTimestamp);
|
|
464113
464291
|
}
|
|
@@ -464212,7 +464390,7 @@ __export(exports_setup2, {
|
|
|
464212
464390
|
setupComputerUse: () => setupComputerUse,
|
|
464213
464391
|
COMPUTER_USE_SYSTEM_HINT: () => COMPUTER_USE_SYSTEM_HINT
|
|
464214
464392
|
});
|
|
464215
|
-
import { dirname as
|
|
464393
|
+
import { dirname as dirname69, join as join163 } from "path";
|
|
464216
464394
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
464217
464395
|
function setupComputerUse() {
|
|
464218
464396
|
const allowedTools = COMPUTER_USE_TOOL_NAMES.map((name) => buildMcpToolName(COMPUTER_USE_SERVER_NAME, name));
|
|
@@ -464239,11 +464417,11 @@ function resolveComputerUseLauncher() {
|
|
|
464239
464417
|
return { command: process.execPath, args: [entry, COMPUTER_USE_FLAG] };
|
|
464240
464418
|
}
|
|
464241
464419
|
if (entry) {
|
|
464242
|
-
const launcher =
|
|
464420
|
+
const launcher = join163(dirname69(entry), "..", "bin", "theus");
|
|
464243
464421
|
return { command: launcher, args: [COMPUTER_USE_FLAG] };
|
|
464244
464422
|
}
|
|
464245
464423
|
return {
|
|
464246
|
-
command:
|
|
464424
|
+
command: join163(fileURLToPath8(import.meta.url), "..", "..", "..", "bin", "theus"),
|
|
464247
464425
|
args: [COMPUTER_USE_FLAG]
|
|
464248
464426
|
};
|
|
464249
464427
|
}
|
|
@@ -464454,7 +464632,7 @@ var init_sessionMemory = __esm(() => {
|
|
|
464454
464632
|
// utils/iTermBackup.ts
|
|
464455
464633
|
import { copyFile as copyFile10, stat as stat48 } from "fs/promises";
|
|
464456
464634
|
import { homedir as homedir46 } from "os";
|
|
464457
|
-
import { join as
|
|
464635
|
+
import { join as join164 } from "path";
|
|
464458
464636
|
function markITerm2SetupComplete() {
|
|
464459
464637
|
saveGlobalConfig((current) => ({
|
|
464460
464638
|
...current,
|
|
@@ -464469,7 +464647,7 @@ function getIterm2RecoveryInfo() {
|
|
|
464469
464647
|
};
|
|
464470
464648
|
}
|
|
464471
464649
|
function getITerm2PlistPath() {
|
|
464472
|
-
return
|
|
464650
|
+
return join164(homedir46(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
464473
464651
|
}
|
|
464474
464652
|
async function checkAndRestoreITerm2Backup() {
|
|
464475
464653
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -467935,7 +468113,7 @@ var init_idleTimeout = __esm(() => {
|
|
|
467935
468113
|
// bridge/inboundAttachments.ts
|
|
467936
468114
|
import { randomUUID as randomUUID53 } from "crypto";
|
|
467937
468115
|
import { mkdir as mkdir49, writeFile as writeFile53 } from "fs/promises";
|
|
467938
|
-
import { basename as basename57, join as
|
|
468116
|
+
import { basename as basename57, join as join165 } from "path";
|
|
467939
468117
|
function debug(msg) {
|
|
467940
468118
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
467941
468119
|
}
|
|
@@ -467951,7 +468129,7 @@ function sanitizeFileName(name) {
|
|
|
467951
468129
|
return base2 || "attachment";
|
|
467952
468130
|
}
|
|
467953
468131
|
function uploadsDir() {
|
|
467954
|
-
return
|
|
468132
|
+
return join165(getTheusConfigHomeDir(), "uploads", getSessionId());
|
|
467955
468133
|
}
|
|
467956
468134
|
async function resolveOne(att) {
|
|
467957
468135
|
const token = getBridgeAccessToken();
|
|
@@ -467980,7 +468158,7 @@ async function resolveOne(att) {
|
|
|
467980
468158
|
const safeName = sanitizeFileName(att.file_name);
|
|
467981
468159
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID53().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
467982
468160
|
const dir = uploadsDir();
|
|
467983
|
-
const outPath =
|
|
468161
|
+
const outPath = join165(dir, `${prefix}-${safeName}`);
|
|
467984
468162
|
try {
|
|
467985
468163
|
await mkdir49(dir, { recursive: true });
|
|
467986
468164
|
await writeFile53(outPath, data);
|
|
@@ -468080,7 +468258,7 @@ var init_sessionUrl = __esm(() => {
|
|
|
468080
468258
|
|
|
468081
468259
|
// utils/plugins/zipCacheAdapters.ts
|
|
468082
468260
|
import { readFile as readFile54 } from "fs/promises";
|
|
468083
|
-
import { join as
|
|
468261
|
+
import { join as join166 } from "path";
|
|
468084
468262
|
async function readZipCacheKnownMarketplaces() {
|
|
468085
468263
|
try {
|
|
468086
468264
|
const content = await readFile54(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
@@ -468105,13 +468283,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
468105
468283
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
468106
468284
|
if (content !== null) {
|
|
468107
468285
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
468108
|
-
await atomicWriteToZipCache(
|
|
468286
|
+
await atomicWriteToZipCache(join166(zipCachePath, relPath), content);
|
|
468109
468287
|
}
|
|
468110
468288
|
}
|
|
468111
468289
|
async function readMarketplaceJsonContent(dir) {
|
|
468112
468290
|
const candidates = [
|
|
468113
|
-
|
|
468114
|
-
|
|
468291
|
+
join166(dir, ".theus-plugin", "marketplace.json"),
|
|
468292
|
+
join166(dir, "marketplace.json"),
|
|
468115
468293
|
dir
|
|
468116
468294
|
];
|
|
468117
468295
|
for (const candidate of candidates) {
|
|
@@ -468241,8 +468419,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
468241
468419
|
}
|
|
468242
468420
|
async function checkEnvLessBridgeMinVersion() {
|
|
468243
468421
|
const cfg = await getEnvLessBridgeConfig();
|
|
468244
|
-
if (cfg.min_version && lt({ VERSION: "0.1.
|
|
468245
|
-
return `Your version of Theus (${{ VERSION: "0.1.
|
|
468422
|
+
if (cfg.min_version && lt({ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)) {
|
|
468423
|
+
return `Your version of Theus (${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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.
|
|
468246
468424
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
468247
468425
|
}
|
|
468248
468426
|
return null;
|
|
@@ -468570,14 +468748,14 @@ __export(exports_bridgePointer, {
|
|
|
468570
468748
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
468571
468749
|
});
|
|
468572
468750
|
import { mkdir as mkdir50, readFile as readFile55, stat as stat49, unlink as unlink25, writeFile as writeFile54 } from "fs/promises";
|
|
468573
|
-
import { dirname as
|
|
468751
|
+
import { dirname as dirname70, join as join167 } from "path";
|
|
468574
468752
|
function getBridgePointerPath(dir) {
|
|
468575
|
-
return
|
|
468753
|
+
return join167(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
468576
468754
|
}
|
|
468577
468755
|
async function writeBridgePointer(dir, pointer) {
|
|
468578
468756
|
const path21 = getBridgePointerPath(dir);
|
|
468579
468757
|
try {
|
|
468580
|
-
await mkdir50(
|
|
468758
|
+
await mkdir50(dirname70(path21), { recursive: true });
|
|
468581
468759
|
await writeFile54(path21, jsonStringify(pointer), "utf8");
|
|
468582
468760
|
logForDebugging(`[bridge:pointer] wrote ${path21}`);
|
|
468583
468761
|
} catch (err2) {
|
|
@@ -468716,7 +468894,7 @@ async function initBridgeCore(params) {
|
|
|
468716
468894
|
const rawApi = createBridgeApiClient({
|
|
468717
468895
|
baseUrl,
|
|
468718
468896
|
getAccessToken,
|
|
468719
|
-
runnerVersion: { VERSION: "0.1.
|
|
468897
|
+
runnerVersion: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
468720
468898
|
onDebug: logForDebugging,
|
|
468721
468899
|
onAuth401,
|
|
468722
468900
|
getTrustedDeviceToken
|
|
@@ -470581,7 +470759,7 @@ __export(exports_print, {
|
|
|
470581
470759
|
canBatchWith: () => canBatchWith
|
|
470582
470760
|
});
|
|
470583
470761
|
import { readFile as readFile56, stat as stat50 } from "fs/promises";
|
|
470584
|
-
import { dirname as
|
|
470762
|
+
import { dirname as dirname71 } from "path";
|
|
470585
470763
|
import { cwd as cwd2 } from "process";
|
|
470586
470764
|
import { randomUUID as randomUUID56 } from "crypto";
|
|
470587
470765
|
function trackReceivedMessageUuid(uuid3) {
|
|
@@ -473036,7 +473214,7 @@ async function loadInitialMessages(setAppState, options2) {
|
|
|
473036
473214
|
if (false) {}
|
|
473037
473215
|
if (!options2.forkSession) {
|
|
473038
473216
|
if (result.sessionId) {
|
|
473039
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
473217
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname71(result.fullPath) : null);
|
|
473040
473218
|
if (persistSession) {
|
|
473041
473219
|
await resetSessionFilePointer();
|
|
473042
473220
|
}
|
|
@@ -473134,7 +473312,7 @@ async function loadInitialMessages(setAppState, options2) {
|
|
|
473134
473312
|
}
|
|
473135
473313
|
if (false) {}
|
|
473136
473314
|
if (!options2.forkSession && result.sessionId) {
|
|
473137
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
473315
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname71(result.fullPath) : null);
|
|
473138
473316
|
if (persistSession) {
|
|
473139
473317
|
await resetSessionFilePointer();
|
|
473140
473318
|
}
|
|
@@ -473982,7 +474160,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
|
|
|
473982
474160
|
setCwd(cwd3);
|
|
473983
474161
|
const server = new Server({
|
|
473984
474162
|
name: "theus/tengu",
|
|
473985
|
-
version: { VERSION: "0.1.
|
|
474163
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
473986
474164
|
}, {
|
|
473987
474165
|
capabilities: {
|
|
473988
474166
|
tools: {}
|
|
@@ -474114,14 +474292,14 @@ __export(exports_theusDesktop, {
|
|
|
474114
474292
|
});
|
|
474115
474293
|
import { readdir as readdir32, readFile as readFile57, stat as stat51 } from "fs/promises";
|
|
474116
474294
|
import { homedir as homedir47 } from "os";
|
|
474117
|
-
import { join as
|
|
474295
|
+
import { join as join168 } from "path";
|
|
474118
474296
|
async function getTheusDesktopConfigPath() {
|
|
474119
474297
|
const platform6 = getPlatform();
|
|
474120
474298
|
if (!SUPPORTED_PLATFORMS.includes(platform6)) {
|
|
474121
474299
|
throw new Error(`Unsupported platform: ${platform6} - Theus Desktop integration only works on macOS and WSL.`);
|
|
474122
474300
|
}
|
|
474123
474301
|
if (platform6 === "macos") {
|
|
474124
|
-
return
|
|
474302
|
+
return join168(homedir47(), "Library", "Application Support", "Theus", "theus_desktop_config.json");
|
|
474125
474303
|
}
|
|
474126
474304
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
474127
474305
|
if (windowsHome) {
|
|
@@ -474140,7 +474318,7 @@ async function getTheusDesktopConfigPath() {
|
|
|
474140
474318
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
474141
474319
|
continue;
|
|
474142
474320
|
}
|
|
474143
|
-
const potentialConfigPath =
|
|
474321
|
+
const potentialConfigPath = join168(usersDir, user.name, "AppData", "Roaming", "Theus", "theus_desktop_config.json");
|
|
474144
474322
|
try {
|
|
474145
474323
|
await stat51(potentialConfigPath);
|
|
474146
474324
|
return potentialConfigPath;
|
|
@@ -474536,7 +474714,7 @@ __export(exports_plugins, {
|
|
|
474536
474714
|
VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
|
|
474537
474715
|
VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
|
|
474538
474716
|
});
|
|
474539
|
-
import { basename as basename58, dirname as
|
|
474717
|
+
import { basename as basename58, dirname as dirname72 } from "path";
|
|
474540
474718
|
function handleMarketplaceError(error40, action2) {
|
|
474541
474719
|
logError2(error40);
|
|
474542
474720
|
cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error40)}`);
|
|
@@ -474569,9 +474747,9 @@ async function pluginValidateHandler(manifestPath, options2) {
|
|
|
474569
474747
|
printValidationResult(result);
|
|
474570
474748
|
let contentResults = [];
|
|
474571
474749
|
if (result.fileType === "plugin") {
|
|
474572
|
-
const manifestDir =
|
|
474750
|
+
const manifestDir = dirname72(result.filePath);
|
|
474573
474751
|
if (basename58(manifestDir) === ".theus-plugin") {
|
|
474574
|
-
contentResults = await validatePluginContents(
|
|
474752
|
+
contentResults = await validatePluginContents(dirname72(manifestDir));
|
|
474575
474753
|
for (const r of contentResults) {
|
|
474576
474754
|
console.log(`Validating ${r.fileType}: ${r.filePath}
|
|
474577
474755
|
`);
|
|
@@ -475049,12 +475227,12 @@ __export(exports_install, {
|
|
|
475049
475227
|
install: () => install
|
|
475050
475228
|
});
|
|
475051
475229
|
import { homedir as homedir48 } from "os";
|
|
475052
|
-
import { join as
|
|
475230
|
+
import { join as join169 } from "path";
|
|
475053
475231
|
function getInstallationPath2() {
|
|
475054
475232
|
const isWindows2 = env3.platform === "win32";
|
|
475055
475233
|
const homeDir = homedir48();
|
|
475056
475234
|
if (isWindows2) {
|
|
475057
|
-
const windowsPath =
|
|
475235
|
+
const windowsPath = join169(homeDir, ".local", "bin", "theus.exe");
|
|
475058
475236
|
return windowsPath.replace(/\//g, "\\");
|
|
475059
475237
|
}
|
|
475060
475238
|
return "~/.local/bin/theus";
|
|
@@ -475424,7 +475602,7 @@ async function setupTokenHandler(root2) {
|
|
|
475424
475602
|
gap: 1,
|
|
475425
475603
|
children: [
|
|
475426
475604
|
/* @__PURE__ */ jsx_runtime473.jsx(TheusBanner, {
|
|
475427
|
-
version: { VERSION: "0.1.
|
|
475605
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
475428
475606
|
}),
|
|
475429
475607
|
showAuthWarning && /* @__PURE__ */ jsx_runtime473.jsxs(ThemedBox_default, {
|
|
475430
475608
|
flexDirection: "column",
|
|
@@ -475594,7 +475772,7 @@ __export(exports_main2, {
|
|
|
475594
475772
|
startDeferredPrefetches: () => startDeferredPrefetches,
|
|
475595
475773
|
main: () => main
|
|
475596
475774
|
});
|
|
475597
|
-
import { readFileSync as
|
|
475775
|
+
import { readFileSync as readFileSync26 } from "fs";
|
|
475598
475776
|
import { resolve as resolve46 } from "path";
|
|
475599
475777
|
function logManagedSettings() {
|
|
475600
475778
|
try {
|
|
@@ -475750,7 +475928,7 @@ function loadSettingsFromFlag(settingsFile) {
|
|
|
475750
475928
|
resolvedPath: resolvedSettingsPath
|
|
475751
475929
|
} = safeResolvePath(getFsImplementation(), settingsFile);
|
|
475752
475930
|
try {
|
|
475753
|
-
|
|
475931
|
+
readFileSync26(resolvedSettingsPath, "utf8");
|
|
475754
475932
|
} catch (e) {
|
|
475755
475933
|
if (isENOENT(e)) {
|
|
475756
475934
|
process.stderr.write(source_default.red(`Error: Settings file not found: ${resolvedSettingsPath}
|
|
@@ -476155,7 +476333,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
476155
476333
|
}
|
|
476156
476334
|
try {
|
|
476157
476335
|
const filePath = resolve46(options2.systemPromptFile);
|
|
476158
|
-
systemPrompt =
|
|
476336
|
+
systemPrompt = readFileSync26(filePath, "utf8");
|
|
476159
476337
|
} catch (error40) {
|
|
476160
476338
|
const code = getErrnoCode(error40);
|
|
476161
476339
|
if (code === "ENOENT") {
|
|
@@ -476177,7 +476355,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
476177
476355
|
}
|
|
476178
476356
|
try {
|
|
476179
476357
|
const filePath = resolve46(options2.appendSystemPromptFile);
|
|
476180
|
-
appendSystemPrompt =
|
|
476358
|
+
appendSystemPrompt = readFileSync26(filePath, "utf8");
|
|
476181
476359
|
} catch (error40) {
|
|
476182
476360
|
const code = getErrnoCode(error40);
|
|
476183
476361
|
if (code === "ENOENT") {
|
|
@@ -476829,7 +477007,7 @@ ${customInstructions}` : customInstructions;
|
|
|
476829
477007
|
}
|
|
476830
477008
|
}
|
|
476831
477009
|
logForDiagnosticsNoPII("info", "started", {
|
|
476832
|
-
version: { VERSION: "0.1.
|
|
477010
|
+
version: { VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
476833
477011
|
is_native_binary: isInBundledMode()
|
|
476834
477012
|
});
|
|
476835
477013
|
registerCleanup(async () => {
|
|
@@ -477613,7 +477791,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
477613
477791
|
pendingHookMessages
|
|
477614
477792
|
}, renderAndRun);
|
|
477615
477793
|
}
|
|
477616
|
-
}).version(`${{ VERSION: "0.1.
|
|
477794
|
+
}).version(`${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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");
|
|
477617
477795
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
477618
477796
|
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.");
|
|
477619
477797
|
if (canUserConfigureAdvisor()) {
|
|
@@ -478127,7 +478305,7 @@ if (false) {}
|
|
|
478127
478305
|
async function main2() {
|
|
478128
478306
|
const args = process.argv.slice(2);
|
|
478129
478307
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
478130
|
-
console.log(`${{ VERSION: "0.1.
|
|
478308
|
+
console.log(`${{ VERSION: "0.1.18", BUILD_TIME: "1970-01-01T00:00:00.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)`);
|
|
478131
478309
|
return;
|
|
478132
478310
|
}
|
|
478133
478311
|
const {
|