theus-cli 0.2.72 → 0.2.74
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 +780 -504
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -57765,7 +57765,7 @@ async function _executeApiKeyHelper(isNonInteractiveSession) {
|
|
|
57765
57765
|
if (isApiKeyHelperFromProjectOrLocalSettings()) {
|
|
57766
57766
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
57767
57767
|
if (!hasTrust && !isNonInteractiveSession) {
|
|
57768
|
-
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
57768
|
+
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
57769
57769
|
logAntError("apiKeyHelper invoked before trust check", error40);
|
|
57770
57770
|
logEvent("theus_apiKeyHelper_missing_trust11", {});
|
|
57771
57771
|
return null;
|
|
@@ -57809,7 +57809,7 @@ async function runAwsAuthRefresh() {
|
|
|
57809
57809
|
if (isAwsAuthRefreshFromProjectSettings()) {
|
|
57810
57810
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
57811
57811
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
57812
|
-
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
57812
|
+
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
57813
57813
|
logAntError("awsAuthRefresh invoked before trust check", error40);
|
|
57814
57814
|
logEvent("theus_awsAuthRefresh_missing_trust", {});
|
|
57815
57815
|
return false;
|
|
@@ -57869,7 +57869,7 @@ async function getAwsCredsFromCredentialExport() {
|
|
|
57869
57869
|
if (isAwsCredentialExportFromProjectSettings()) {
|
|
57870
57870
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
57871
57871
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
57872
|
-
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
57872
|
+
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
57873
57873
|
logAntError("awsCredentialExport invoked before trust check", error40);
|
|
57874
57874
|
logEvent("theus_awsCredentialExport_missing_trust", {});
|
|
57875
57875
|
return null;
|
|
@@ -57954,7 +57954,7 @@ async function runGcpAuthRefresh() {
|
|
|
57954
57954
|
if (isGcpAuthRefreshFromProjectSettings()) {
|
|
57955
57955
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
57956
57956
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
57957
|
-
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
57957
|
+
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
57958
57958
|
logAntError("gcpAuthRefresh invoked before trust check", error40);
|
|
57959
57959
|
logEvent("theus_gcpAuthRefresh_missing_trust", {});
|
|
57960
57960
|
return false;
|
|
@@ -58673,7 +58673,7 @@ var init_auth = __esm(() => {
|
|
|
58673
58673
|
|
|
58674
58674
|
// utils/userAgent.ts
|
|
58675
58675
|
function getTheusCodeUserAgent() {
|
|
58676
|
-
return `theus-code/${{ VERSION: "0.2.
|
|
58676
|
+
return `theus-code/${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`;
|
|
58677
58677
|
}
|
|
58678
58678
|
|
|
58679
58679
|
// utils/workloadContext.ts
|
|
@@ -58695,7 +58695,7 @@ function getUserAgent() {
|
|
|
58695
58695
|
const clientApp = process.env.THEUS_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}` : "";
|
|
58696
58696
|
const workload = getWorkload();
|
|
58697
58697
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
58698
|
-
return `theus-cli/${{ VERSION: "0.2.
|
|
58698
|
+
return `theus-cli/${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (${"external"}, ${process.env.THEUS_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
58699
58699
|
}
|
|
58700
58700
|
function getMCPUserAgent() {
|
|
58701
58701
|
const parts = [];
|
|
@@ -58709,7 +58709,7 @@ function getMCPUserAgent() {
|
|
|
58709
58709
|
parts.push(`client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}`);
|
|
58710
58710
|
}
|
|
58711
58711
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
58712
|
-
return `theus-code/${{ VERSION: "0.2.
|
|
58712
|
+
return `theus-code/${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`;
|
|
58713
58713
|
}
|
|
58714
58714
|
function getWebFetchUserAgent() {
|
|
58715
58715
|
return `Theus-User (${getTheusCodeUserAgent()}; +https://support.theus.pe/)`;
|
|
@@ -58847,7 +58847,7 @@ var init_user = __esm(() => {
|
|
|
58847
58847
|
deviceId,
|
|
58848
58848
|
sessionId: getSessionId(),
|
|
58849
58849
|
email: getEmail(),
|
|
58850
|
-
appVersion: { VERSION: "0.2.
|
|
58850
|
+
appVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
58851
58851
|
platform: getHostPlatformForAnalytics(),
|
|
58852
58852
|
organizationUuid,
|
|
58853
58853
|
accountUuid,
|
|
@@ -60557,7 +60557,7 @@ var init_metadata = __esm(() => {
|
|
|
60557
60557
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
60558
60558
|
WHITESPACE_REGEX = /\s+/;
|
|
60559
60559
|
getVersionBase = memoize_default(() => {
|
|
60560
|
-
const match = { VERSION: "0.2.
|
|
60560
|
+
const match = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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]+)?/);
|
|
60561
60561
|
return match ? match[0] : undefined;
|
|
60562
60562
|
});
|
|
60563
60563
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -60597,9 +60597,9 @@ var init_metadata = __esm(() => {
|
|
|
60597
60597
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
60598
60598
|
isTheusCodeAction: isEnvTruthy(process.env.THEUS_CODE_ACTION),
|
|
60599
60599
|
isTheusAiAuth: isTheusAISubscriber(),
|
|
60600
|
-
version: { VERSION: "0.2.
|
|
60600
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
60601
60601
|
versionBase: getVersionBase(),
|
|
60602
|
-
buildTime: { VERSION: "0.2.
|
|
60602
|
+
buildTime: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
60603
60603
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
60604
60604
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
60605
60605
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -61215,7 +61215,7 @@ function initialize1PEventLogging() {
|
|
|
61215
61215
|
const platform2 = getPlatform();
|
|
61216
61216
|
const attributes = {
|
|
61217
61217
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
61218
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.
|
|
61218
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
61219
61219
|
};
|
|
61220
61220
|
if (platform2 === "wsl") {
|
|
61221
61221
|
const wslVersion = getWslVersion();
|
|
@@ -61242,7 +61242,7 @@ function initialize1PEventLogging() {
|
|
|
61242
61242
|
})
|
|
61243
61243
|
]
|
|
61244
61244
|
});
|
|
61245
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.2.
|
|
61245
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
61246
61246
|
}
|
|
61247
61247
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
61248
61248
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -91081,7 +91081,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
91081
91081
|
if (!isAttributionHeaderEnabled()) {
|
|
91082
91082
|
return "";
|
|
91083
91083
|
}
|
|
91084
|
-
const version2 = `${{ VERSION: "0.2.
|
|
91084
|
+
const version2 = `${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`;
|
|
91085
91085
|
const entrypoint = process.env.THEUS_CODE_ENTRYPOINT ?? "unknown";
|
|
91086
91086
|
const cch = "";
|
|
91087
91087
|
const workload = getWorkload();
|
|
@@ -104117,7 +104117,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
104117
104117
|
}
|
|
104118
104118
|
function getFeedbackGuideline() {
|
|
104119
104119
|
if (isUsing3PServices()) {
|
|
104120
|
-
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.2.
|
|
104120
|
+
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
104121
104121
|
}
|
|
104122
104122
|
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";
|
|
104123
104123
|
}
|
|
@@ -144301,7 +144301,7 @@ function getTelemetryAttributes() {
|
|
|
144301
144301
|
attributes["session.id"] = sessionId;
|
|
144302
144302
|
}
|
|
144303
144303
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
144304
|
-
attributes["app.version"] = { VERSION: "0.2.
|
|
144304
|
+
attributes["app.version"] = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
144305
144305
|
}
|
|
144306
144306
|
const oauthAccount = getOauthAccountInfo();
|
|
144307
144307
|
if (oauthAccount) {
|
|
@@ -220580,7 +220580,7 @@ async function getMcpHeadersFromHelper(serverName, config2) {
|
|
|
220580
220580
|
if ("scope" in config2 && isMcpServerFromProjectOrLocalSettings(config2) && !getIsNonInteractiveSession()) {
|
|
220581
220581
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
220582
220582
|
if (!hasTrust) {
|
|
220583
|
-
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
220583
|
+
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
220584
220584
|
logAntError("MCP headersHelper invoked before trust check", error40);
|
|
220585
220585
|
logEvent("theus_mcp_headersHelper_missing_trust", {});
|
|
220586
220586
|
return null;
|
|
@@ -221272,7 +221272,7 @@ function computeFingerprint(messageText, version2) {
|
|
|
221272
221272
|
}
|
|
221273
221273
|
function computeFingerprintFromMessages(messages) {
|
|
221274
221274
|
const firstMessageText = extractFirstMessageText(messages);
|
|
221275
|
-
return computeFingerprint(firstMessageText, { VERSION: "0.2.
|
|
221275
|
+
return computeFingerprint(firstMessageText, { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
221276
221276
|
}
|
|
221277
221277
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
221278
221278
|
var init_fingerprint = () => {};
|
|
@@ -221314,7 +221314,7 @@ async function sideQuery(opts) {
|
|
|
221314
221314
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
221315
221315
|
}
|
|
221316
221316
|
const messageText = extractFirstUserMessageText(messages);
|
|
221317
|
-
const fingerprint = computeFingerprint(messageText, { VERSION: "0.2.
|
|
221317
|
+
const fingerprint = computeFingerprint(messageText, { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
221318
221318
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
221319
221319
|
const systemBlocks = [
|
|
221320
221320
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -222438,7 +222438,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
222438
222438
|
const client2 = new Client({
|
|
222439
222439
|
name: "theus-code",
|
|
222440
222440
|
title: "Theus",
|
|
222441
|
-
version: { VERSION: "0.2.
|
|
222441
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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",
|
|
222442
222442
|
description: "Theus's agentic coding tool",
|
|
222443
222443
|
websiteUrl: PRODUCT_URL
|
|
222444
222444
|
}, {
|
|
@@ -222792,7 +222792,7 @@ var init_client5 = __esm(() => {
|
|
|
222792
222792
|
const client2 = new Client({
|
|
222793
222793
|
name: "theus-code",
|
|
222794
222794
|
title: "Theus",
|
|
222795
|
-
version: { VERSION: "0.2.
|
|
222795
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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",
|
|
222796
222796
|
description: "Theus's agentic coding tool",
|
|
222797
222797
|
websiteUrl: PRODUCT_URL
|
|
222798
222798
|
}, {
|
|
@@ -242640,7 +242640,7 @@ async function initializeBetaTracing(resource) {
|
|
|
242640
242640
|
});
|
|
242641
242641
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
242642
242642
|
setLoggerProvider(loggerProvider);
|
|
242643
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.
|
|
242643
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
242644
242644
|
setEventLogger(eventLogger);
|
|
242645
242645
|
process.on("beforeExit", async () => {
|
|
242646
242646
|
await loggerProvider?.forceFlush();
|
|
@@ -242680,7 +242680,7 @@ async function initializeTelemetry() {
|
|
|
242680
242680
|
const platform4 = getPlatform();
|
|
242681
242681
|
const baseAttributes = {
|
|
242682
242682
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
242683
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.
|
|
242683
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
242684
242684
|
};
|
|
242685
242685
|
if (platform4 === "wsl") {
|
|
242686
242686
|
const wslVersion = getWslVersion();
|
|
@@ -242725,7 +242725,7 @@ async function initializeTelemetry() {
|
|
|
242725
242725
|
} catch {}
|
|
242726
242726
|
};
|
|
242727
242727
|
registerCleanup(shutdownTelemetry2);
|
|
242728
|
-
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.2.
|
|
242728
|
+
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
242729
242729
|
}
|
|
242730
242730
|
const meterProvider = new MeterProvider({
|
|
242731
242731
|
resource,
|
|
@@ -242745,7 +242745,7 @@ async function initializeTelemetry() {
|
|
|
242745
242745
|
});
|
|
242746
242746
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
242747
242747
|
setLoggerProvider(loggerProvider);
|
|
242748
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.
|
|
242748
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
242749
242749
|
setEventLogger(eventLogger);
|
|
242750
242750
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
242751
242751
|
process.on("beforeExit", async () => {
|
|
@@ -242807,7 +242807,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
242807
242807
|
}
|
|
242808
242808
|
};
|
|
242809
242809
|
registerCleanup(shutdownTelemetry);
|
|
242810
|
-
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.2.
|
|
242810
|
+
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
242811
242811
|
}
|
|
242812
242812
|
async function flushTelemetry() {
|
|
242813
242813
|
const meterProvider = getMeterProvider();
|
|
@@ -243349,7 +243349,7 @@ async function installOrUpdateTheusPackage(channel2, specificVersion) {
|
|
|
243349
243349
|
return "install_failed";
|
|
243350
243350
|
}
|
|
243351
243351
|
const versionSpec = specificVersion ? specificVersion : channel2 === "stable" ? "stable" : "latest";
|
|
243352
|
-
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.2.
|
|
243352
|
+
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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 });
|
|
243353
243353
|
if (result.code !== 0) {
|
|
243354
243354
|
const error40 = new Error(`Failed to install Theus CLI package: ${result.stderr}`);
|
|
243355
243355
|
logError2(error40);
|
|
@@ -243495,9 +243495,9 @@ async function assertMinVersion() {
|
|
|
243495
243495
|
if (false) {}
|
|
243496
243496
|
try {
|
|
243497
243497
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("theus_version_config", { minVersion: "0.0.0" });
|
|
243498
|
-
if (versionConfig.minVersion && lt({ VERSION: "0.2.
|
|
243498
|
+
if (versionConfig.minVersion && lt({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
243499
243499
|
console.error(`
|
|
243500
|
-
It looks like your version of Theus (${{ VERSION: "0.2.
|
|
243500
|
+
It looks like your version of Theus (${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
243501
243501
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
243502
243502
|
|
|
243503
243503
|
To update, please run:
|
|
@@ -243634,7 +243634,7 @@ async function getInstallationPrefix() {
|
|
|
243634
243634
|
return prefixResult.stdout.trim();
|
|
243635
243635
|
}
|
|
243636
243636
|
function getGlobalInstallPackageManager() {
|
|
243637
|
-
if ({ VERSION: "0.2.
|
|
243637
|
+
if ({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
243638
243638
|
return "npm";
|
|
243639
243639
|
}
|
|
243640
243640
|
return env3.isRunningWithBun() ? "bun" : "npm";
|
|
@@ -243659,7 +243659,7 @@ async function checkGlobalInstallPermissions() {
|
|
|
243659
243659
|
}
|
|
243660
243660
|
async function getLatestVersion(channel2) {
|
|
243661
243661
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
243662
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.2.
|
|
243662
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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: homedir20() });
|
|
243663
243663
|
if (result.code !== 0) {
|
|
243664
243664
|
logForDebugging(`npm view failed with code ${result.code}`);
|
|
243665
243665
|
if (result.stderr) {
|
|
@@ -243675,7 +243675,7 @@ async function getLatestVersion(channel2) {
|
|
|
243675
243675
|
return result.stdout.trim();
|
|
243676
243676
|
}
|
|
243677
243677
|
async function getNpmDistTags() {
|
|
243678
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.2.
|
|
243678
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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: homedir20() });
|
|
243679
243679
|
if (result.code !== 0) {
|
|
243680
243680
|
logForDebugging(`npm view dist-tags failed with code ${result.code}`);
|
|
243681
243681
|
return { latest: null, stable: null };
|
|
@@ -243715,7 +243715,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
243715
243715
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
243716
243716
|
logEvent("theus_auto_updater_lock_contention", {
|
|
243717
243717
|
pid: process.pid,
|
|
243718
|
-
currentVersion: { VERSION: "0.2.
|
|
243718
|
+
currentVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
243719
243719
|
});
|
|
243720
243720
|
return "in_progress";
|
|
243721
243721
|
}
|
|
@@ -243724,7 +243724,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
243724
243724
|
if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
|
|
243725
243725
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
243726
243726
|
logEvent("theus_auto_updater_windows_npm_in_wsl", {
|
|
243727
|
-
currentVersion: { VERSION: "0.2.
|
|
243727
|
+
currentVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
243728
243728
|
});
|
|
243729
243729
|
console.error(`
|
|
243730
243730
|
Error: Windows NPM detected in WSL
|
|
@@ -243743,7 +243743,7 @@ To fix this issue:
|
|
|
243743
243743
|
if (!hasPermissions) {
|
|
243744
243744
|
return "no_permissions";
|
|
243745
243745
|
}
|
|
243746
|
-
const packageSpec = specificVersion ? `${{ VERSION: "0.2.
|
|
243746
|
+
const packageSpec = specificVersion ? `${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${specificVersion}` : { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
243747
243747
|
const packageManager = getGlobalInstallPackageManager();
|
|
243748
243748
|
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir20() });
|
|
243749
243749
|
if (installResult.code !== 0) {
|
|
@@ -244071,8 +244071,8 @@ async function detectMultipleInstallations() {
|
|
|
244071
244071
|
installations.push({ type: "npm-local", path: localPath });
|
|
244072
244072
|
}
|
|
244073
244073
|
const packagesToCheck = ["@theus-ai/theus-code"];
|
|
244074
|
-
if ({ VERSION: "0.2.
|
|
244075
|
-
packagesToCheck.push({ VERSION: "0.2.
|
|
244074
|
+
if ({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
244075
|
+
packagesToCheck.push({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
244076
244076
|
}
|
|
244077
244077
|
const npmResult = await execFileNoThrow("npm", [
|
|
244078
244078
|
"-g",
|
|
@@ -244255,7 +244255,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
244255
244255
|
}
|
|
244256
244256
|
async function getDoctorDiagnostic() {
|
|
244257
244257
|
const installationType = await getCurrentInstallationType();
|
|
244258
|
-
const version2 = { VERSION: "0.2.
|
|
244258
|
+
const version2 = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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";
|
|
244259
244259
|
const installationPath = await getInstallationPath();
|
|
244260
244260
|
const invokedBinary = getInvokedBinary();
|
|
244261
244261
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -244267,8 +244267,8 @@ async function getDoctorDiagnostic() {
|
|
|
244267
244267
|
for (const install of npmInstalls) {
|
|
244268
244268
|
if (install.type === "npm-global") {
|
|
244269
244269
|
let uninstallCmd = "npm -g uninstall @theus-ai/theus-code";
|
|
244270
|
-
if ({ VERSION: "0.2.
|
|
244271
|
-
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.2.
|
|
244270
|
+
if ({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
244271
|
+
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
244272
244272
|
}
|
|
244273
244273
|
warnings.push({
|
|
244274
244274
|
issue: `Leftover npm global installation at ${install.path}`,
|
|
@@ -245079,8 +245079,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
245079
245079
|
const maxVersion = await getMaxVersion();
|
|
245080
245080
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
245081
245081
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
245082
|
-
if (gte({ VERSION: "0.2.
|
|
245083
|
-
logForDebugging(`Native installer: current version ${{ VERSION: "0.2.
|
|
245082
|
+
if (gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
245083
|
+
logForDebugging(`Native installer: current version ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
245084
245084
|
logEvent("theus_native_update_skipped_max_version", {
|
|
245085
245085
|
latency_ms: Date.now() - startTime2,
|
|
245086
245086
|
max_version: maxVersion,
|
|
@@ -245091,7 +245091,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
245091
245091
|
version2 = maxVersion;
|
|
245092
245092
|
}
|
|
245093
245093
|
}
|
|
245094
|
-
if (!forceReinstall && version2 === { VERSION: "0.2.
|
|
245094
|
+
if (!forceReinstall && version2 === { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
245095
245095
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
245096
245096
|
logEvent("theus_native_update_complete", {
|
|
245097
245097
|
latency_ms: Date.now() - startTime2,
|
|
@@ -245841,8 +245841,8 @@ async function cleanupNpmInstallations() {
|
|
|
245841
245841
|
} else if (codePackageResult.error) {
|
|
245842
245842
|
errors4.push(codePackageResult.error);
|
|
245843
245843
|
}
|
|
245844
|
-
if ({ VERSION: "0.2.
|
|
245845
|
-
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.2.
|
|
245844
|
+
if ({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
245845
|
+
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
245846
245846
|
if (macroPackageResult.success) {
|
|
245847
245847
|
removed++;
|
|
245848
245848
|
if (macroPackageResult.warning) {
|
|
@@ -256259,6 +256259,25 @@ var init_ConsoleOAuthFlow = __esm(() => {
|
|
|
256259
256259
|
var NOVEDADES;
|
|
256260
256260
|
var init_data = __esm(() => {
|
|
256261
256261
|
NOVEDADES = [
|
|
256262
|
+
{
|
|
256263
|
+
version: "v0.2.74",
|
|
256264
|
+
fecha: "2026-08-14",
|
|
256265
|
+
titulo: "Al traer tu contexto, Theus tapa las claves que encuentre por el camino",
|
|
256266
|
+
puntos: [
|
|
256267
|
+
"Los historiales de trabajo llevan credenciales dentro. No por descuido: pegaste un .env para que te lo arreglaran, o un comando imprimi\xF3 una variable. Ahora Theus las tapa ANTES de que ese texto salga de tu equipo, y te dice cu\xE1ntas encontr\xF3 \u2014 enterarte de que las tienes sueltas te sirve tanto como el contexto.",
|
|
256268
|
+
"Tapa solo lo que de verdad es una credencial: reconoce la forma de las claves de los proveedores conocidos, los tokens, las claves privadas y las contrase\xF1as en cadenas de conexi\xF3n. Los identificadores de commit, las rutas y los nombres de variable se quedan como est\xE1n, porque son justo el contexto que estamos rescatando.",
|
|
256269
|
+
"Conserva una pista de qu\xE9 era (\xABuna clave de tal proveedor\xBB) sin el valor, para que Theus siga entendiendo la conversaci\xF3n."
|
|
256270
|
+
]
|
|
256271
|
+
},
|
|
256272
|
+
{
|
|
256273
|
+
version: "v0.2.73",
|
|
256274
|
+
fecha: "2026-08-13",
|
|
256275
|
+
titulo: "Theus reconoce el trabajo de cuatro agentes de c\xF3digo distintos",
|
|
256276
|
+
puntos: [
|
|
256277
|
+
"Se suma la detecci\xF3n del historial de un cuarto asistente. Su documentaci\xF3n p\xFAblica dice que las carpetas se nombran con un c\xF3digo derivado de la ruta del proyecto, pero eso cambi\xF3 a principios de a\xF1o: ahora Theus consulta el \xEDndice de la propia herramienta, que guarda las rutas en claro, y va directo a lo tuyo sin enumerar tus dem\xE1s proyectos.",
|
|
256278
|
+
"Corregido un fallo en la lectura del historial que algunos asistentes dejan dentro del repositorio: los mensajes del sistema (\xABarchivo modificado\xBB, \xABcommit creado\xBB) se estaban leyendo como si los hubiera dicho el asistente."
|
|
256279
|
+
]
|
|
256280
|
+
},
|
|
256262
256281
|
{
|
|
256263
256282
|
version: "v0.2.72",
|
|
256264
256283
|
fecha: "2026-08-13",
|
|
@@ -300121,9 +300140,9 @@ function getTheusEnvMetadata() {
|
|
|
300121
300140
|
};
|
|
300122
300141
|
}
|
|
300123
300142
|
function getBuildAgeMinutes() {
|
|
300124
|
-
if (!{ VERSION: "0.2.
|
|
300143
|
+
if (!{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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)
|
|
300125
300144
|
return;
|
|
300126
|
-
const buildTime = new Date({ VERSION: "0.2.
|
|
300145
|
+
const buildTime = new Date({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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();
|
|
300127
300146
|
if (isNaN(buildTime))
|
|
300128
300147
|
return;
|
|
300129
300148
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -318428,7 +318447,7 @@ function getSimpleDoingTasksSection() {
|
|
|
318428
318447
|
];
|
|
318429
318448
|
const userHelpSubitems = [
|
|
318430
318449
|
`/help: Get help with using Theus`,
|
|
318431
|
-
`To give feedback, users should ${{ VERSION: "0.2.
|
|
318450
|
+
`To give feedback, users should ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
318432
318451
|
];
|
|
318433
318452
|
const items = [
|
|
318434
318453
|
`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.`,
|
|
@@ -329564,7 +329583,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
329564
329583
|
} catch {}
|
|
329565
329584
|
const data = {
|
|
329566
329585
|
trigger,
|
|
329567
|
-
version: { VERSION: "0.2.
|
|
329586
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
329568
329587
|
platform: process.platform,
|
|
329569
329588
|
transcript,
|
|
329570
329589
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -329769,10 +329788,10 @@ Si el usuario indic\xF3 una duraci\xF3n, p\xE1sala en el par\xE1metro \`duration
|
|
|
329769
329788
|
|
|
329770
329789
|
// commands/issue/index.ts
|
|
329771
329790
|
function getCliVersion() {
|
|
329772
|
-
return { VERSION: "0.2.
|
|
329791
|
+
return { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "desconocida";
|
|
329773
329792
|
}
|
|
329774
329793
|
function getIssuesExplainer() {
|
|
329775
|
-
return { VERSION: "0.2.
|
|
329794
|
+
return { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER ? { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER : "report issues to the Theus maintainers";
|
|
329776
329795
|
}
|
|
329777
329796
|
function getActiveModelLabel() {
|
|
329778
329797
|
try {
|
|
@@ -332558,7 +332577,7 @@ function buildPrimarySection() {
|
|
|
332558
332577
|
});
|
|
332559
332578
|
return [{
|
|
332560
332579
|
label: "Version",
|
|
332561
|
-
value: { VERSION: "0.2.
|
|
332580
|
+
value: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
332562
332581
|
}, {
|
|
332563
332582
|
label: "Session name",
|
|
332564
332583
|
value: nameValue
|
|
@@ -336374,7 +336393,7 @@ function Config({
|
|
|
336374
336393
|
}
|
|
336375
336394
|
})
|
|
336376
336395
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime189.jsx(ChannelDowngradeDialog, {
|
|
336377
|
-
currentVersion: { VERSION: "0.2.
|
|
336396
|
+
currentVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
336378
336397
|
onChoice: (choice) => {
|
|
336379
336398
|
setShowSubmenu(null);
|
|
336380
336399
|
setTabsHidden(false);
|
|
@@ -336386,7 +336405,7 @@ function Config({
|
|
|
336386
336405
|
autoUpdatesChannel: "stable"
|
|
336387
336406
|
};
|
|
336388
336407
|
if (choice === "stay") {
|
|
336389
|
-
newSettings.minimumVersion = { VERSION: "0.2.
|
|
336408
|
+
newSettings.minimumVersion = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
336390
336409
|
}
|
|
336391
336410
|
updateSettingsForSource("userSettings", newSettings);
|
|
336392
336411
|
setSettingsData((prev_27) => ({
|
|
@@ -343745,7 +343764,7 @@ function HelpV2(t0) {
|
|
|
343745
343764
|
let t6;
|
|
343746
343765
|
if ($2[31] !== tabs) {
|
|
343747
343766
|
t6 = /* @__PURE__ */ jsx_runtime215.jsx(Tabs, {
|
|
343748
|
-
title: `Theus v${{ VERSION: "0.2.
|
|
343767
|
+
title: `Theus v${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
|
|
343749
343768
|
color: "professionalBlue",
|
|
343750
343769
|
defaultTab: "general",
|
|
343751
343770
|
children: tabs
|
|
@@ -362349,7 +362368,7 @@ function Onboarding({
|
|
|
362349
362368
|
flexDirection: "column",
|
|
362350
362369
|
children: [
|
|
362351
362370
|
/* @__PURE__ */ jsx_runtime250.jsx(TheusBanner, {
|
|
362352
|
-
version: { VERSION: "0.2.
|
|
362371
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
362353
362372
|
}),
|
|
362354
362373
|
/* @__PURE__ */ jsx_runtime250.jsxs(ThemedBox_default, {
|
|
362355
362374
|
flexDirection: "column",
|
|
@@ -367736,7 +367755,7 @@ var init_Messages = __esm(() => {
|
|
|
367736
367755
|
let t1;
|
|
367737
367756
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
367738
367757
|
t1 = /* @__PURE__ */ jsx_runtime263.jsx(TheusSessionHeader, {
|
|
367739
|
-
version: { VERSION: "0.2.
|
|
367758
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
367740
367759
|
});
|
|
367741
367760
|
$2[0] = t1;
|
|
367742
367761
|
} else {
|
|
@@ -377626,18 +377645,27 @@ function parsearHistorialAider(crudo, maxCharsPorMensaje) {
|
|
|
377626
377645
|
let rolActual = null;
|
|
377627
377646
|
let buffer = [];
|
|
377628
377647
|
const volcar = () => {
|
|
377629
|
-
if (!rolActual)
|
|
377648
|
+
if (!rolActual) {
|
|
377649
|
+
buffer = [];
|
|
377630
377650
|
return;
|
|
377651
|
+
}
|
|
377631
377652
|
const texto = buffer.join(`
|
|
377632
377653
|
`).trim();
|
|
377633
|
-
|
|
377654
|
+
const soloComando = rolActual === "user" && texto.startsWith("/") && !texto.includes(`
|
|
377655
|
+
`);
|
|
377656
|
+
if (texto && !soloComando) {
|
|
377634
377657
|
mensajes.push({ role: rolActual, text: texto.slice(0, maxCharsPorMensaje) });
|
|
377635
377658
|
}
|
|
377636
377659
|
buffer = [];
|
|
377637
377660
|
};
|
|
377638
377661
|
for (const linea of crudo.split(`
|
|
377639
377662
|
`)) {
|
|
377640
|
-
if (
|
|
377663
|
+
if (linea.startsWith("# ")) {
|
|
377664
|
+
volcar();
|
|
377665
|
+
rolActual = null;
|
|
377666
|
+
continue;
|
|
377667
|
+
}
|
|
377668
|
+
if (linea.startsWith("> ")) {
|
|
377641
377669
|
volcar();
|
|
377642
377670
|
rolActual = null;
|
|
377643
377671
|
continue;
|
|
@@ -377649,14 +377677,17 @@ function parsearHistorialAider(crudo, maxCharsPorMensaje) {
|
|
|
377649
377677
|
buffer.push(linea.slice(5));
|
|
377650
377678
|
continue;
|
|
377651
377679
|
}
|
|
377652
|
-
if (
|
|
377680
|
+
if (linea.trim() === "" && buffer.length === 0)
|
|
377681
|
+
continue;
|
|
377682
|
+
if (rolActual === "user") {
|
|
377653
377683
|
volcar();
|
|
377654
377684
|
rolActual = "assistant";
|
|
377655
|
-
}
|
|
377656
|
-
|
|
377685
|
+
} else if (rolActual === null) {
|
|
377686
|
+
if (linea.trim() === "")
|
|
377687
|
+
continue;
|
|
377657
377688
|
rolActual = "assistant";
|
|
377658
|
-
|
|
377659
|
-
|
|
377689
|
+
}
|
|
377690
|
+
buffer.push(linea);
|
|
377660
377691
|
}
|
|
377661
377692
|
volcar();
|
|
377662
377693
|
return mensajes;
|
|
@@ -377713,9 +377744,165 @@ var init_aider = __esm(() => {
|
|
|
377713
377744
|
};
|
|
377714
377745
|
});
|
|
377715
377746
|
|
|
377716
|
-
// services/import/detect/sources/
|
|
377717
|
-
import { readdir as readdir31, readFile as readFile49, stat as stat46 } from "fs/promises";
|
|
377747
|
+
// services/import/detect/sources/geminiCli.ts
|
|
377748
|
+
import { open as open17, readdir as readdir31, readFile as readFile49, stat as stat46 } from "fs/promises";
|
|
377718
377749
|
import { join as join136 } from "path";
|
|
377750
|
+
function directorioGemini(entorno) {
|
|
377751
|
+
const override = entorno.env.GEMINI_CLI_HOME?.trim();
|
|
377752
|
+
const home = override && override.length > 0 ? override : entorno.home;
|
|
377753
|
+
return join136(home, CARPETA);
|
|
377754
|
+
}
|
|
377755
|
+
async function slugDelIndice(dirGemini, proyecto) {
|
|
377756
|
+
let crudo;
|
|
377757
|
+
try {
|
|
377758
|
+
crudo = await readFile49(join136(dirGemini, "projects.json"), "utf8");
|
|
377759
|
+
} catch {
|
|
377760
|
+
return null;
|
|
377761
|
+
}
|
|
377762
|
+
try {
|
|
377763
|
+
const data = JSON.parse(crudo);
|
|
377764
|
+
const mapa = data.projects;
|
|
377765
|
+
if (!mapa || typeof mapa !== "object")
|
|
377766
|
+
return null;
|
|
377767
|
+
const slug = mapa[proyecto];
|
|
377768
|
+
return typeof slug === "string" && slug ? slug : null;
|
|
377769
|
+
} catch {
|
|
377770
|
+
return null;
|
|
377771
|
+
}
|
|
377772
|
+
}
|
|
377773
|
+
function textoDeContenido2(contenido, maxChars) {
|
|
377774
|
+
if (typeof contenido === "string")
|
|
377775
|
+
return contenido.slice(0, maxChars);
|
|
377776
|
+
if (!Array.isArray(contenido))
|
|
377777
|
+
return "";
|
|
377778
|
+
const partes = [];
|
|
377779
|
+
for (const parte of contenido) {
|
|
377780
|
+
if (typeof parte === "string") {
|
|
377781
|
+
partes.push(parte);
|
|
377782
|
+
continue;
|
|
377783
|
+
}
|
|
377784
|
+
if (!parte || typeof parte !== "object")
|
|
377785
|
+
continue;
|
|
377786
|
+
const p = parte;
|
|
377787
|
+
if (typeof p.text === "string" && p.text.trim())
|
|
377788
|
+
partes.push(p.text);
|
|
377789
|
+
}
|
|
377790
|
+
return partes.join(`
|
|
377791
|
+
`).slice(0, maxChars);
|
|
377792
|
+
}
|
|
377793
|
+
async function carpetaDeChats(entorno) {
|
|
377794
|
+
const dir = directorioGemini(entorno);
|
|
377795
|
+
const slug = await slugDelIndice(dir, entorno.proyecto);
|
|
377796
|
+
if (!slug)
|
|
377797
|
+
return null;
|
|
377798
|
+
return join136(dir, "tmp", slug, "chats");
|
|
377799
|
+
}
|
|
377800
|
+
var CARPETA = ".gemini", detectorGeminiCli;
|
|
377801
|
+
var init_geminiCli = __esm(() => {
|
|
377802
|
+
detectorGeminiCli = {
|
|
377803
|
+
herramienta: "gemini-cli",
|
|
377804
|
+
async explorar(entorno) {
|
|
377805
|
+
const ruta = await carpetaDeChats(entorno);
|
|
377806
|
+
if (!ruta)
|
|
377807
|
+
return null;
|
|
377808
|
+
let entradas;
|
|
377809
|
+
try {
|
|
377810
|
+
entradas = await readdir31(ruta);
|
|
377811
|
+
} catch {
|
|
377812
|
+
return null;
|
|
377813
|
+
}
|
|
377814
|
+
const sesiones = entradas.filter((n2) => n2.endsWith(".jsonl") || n2.endsWith(".json"));
|
|
377815
|
+
if (sesiones.length === 0)
|
|
377816
|
+
return null;
|
|
377817
|
+
let bytes = 0;
|
|
377818
|
+
let masReciente = 0;
|
|
377819
|
+
for (const nombre of sesiones) {
|
|
377820
|
+
try {
|
|
377821
|
+
const info = await stat46(join136(ruta, nombre));
|
|
377822
|
+
bytes += info.size;
|
|
377823
|
+
if (info.mtimeMs > masReciente)
|
|
377824
|
+
masReciente = info.mtimeMs;
|
|
377825
|
+
} catch {}
|
|
377826
|
+
}
|
|
377827
|
+
return {
|
|
377828
|
+
herramienta: "gemini-cli",
|
|
377829
|
+
etiqueta: "Otro asistente que usaste en esta carpeta",
|
|
377830
|
+
ruta,
|
|
377831
|
+
sesiones: sesiones.length,
|
|
377832
|
+
masReciente,
|
|
377833
|
+
bytes,
|
|
377834
|
+
proyectoConsultado: entorno.proyecto
|
|
377835
|
+
};
|
|
377836
|
+
},
|
|
377837
|
+
async leer(fuente, limites) {
|
|
377838
|
+
let entradas;
|
|
377839
|
+
try {
|
|
377840
|
+
entradas = await readdir31(fuente.ruta);
|
|
377841
|
+
} catch {
|
|
377842
|
+
return [];
|
|
377843
|
+
}
|
|
377844
|
+
const ficheros = [];
|
|
377845
|
+
for (const nombre of entradas) {
|
|
377846
|
+
if (!nombre.endsWith(".jsonl"))
|
|
377847
|
+
continue;
|
|
377848
|
+
try {
|
|
377849
|
+
const info = await stat46(join136(fuente.ruta, nombre));
|
|
377850
|
+
ficheros.push({ nombre, mtime: info.mtimeMs });
|
|
377851
|
+
} catch {}
|
|
377852
|
+
}
|
|
377853
|
+
ficheros.sort((a2, b) => b.mtime - a2.mtime);
|
|
377854
|
+
const salida = [];
|
|
377855
|
+
for (const { nombre, mtime } of ficheros.slice(0, limites.maxSesiones)) {
|
|
377856
|
+
let crudo;
|
|
377857
|
+
try {
|
|
377858
|
+
const fh = await open17(join136(fuente.ruta, nombre), "r");
|
|
377859
|
+
try {
|
|
377860
|
+
const buf = Buffer.alloc(limites.maxBytesPorSesion);
|
|
377861
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
377862
|
+
crudo = buf.subarray(0, bytesRead).toString("utf8");
|
|
377863
|
+
} finally {
|
|
377864
|
+
await fh.close();
|
|
377865
|
+
}
|
|
377866
|
+
} catch {
|
|
377867
|
+
continue;
|
|
377868
|
+
}
|
|
377869
|
+
const mensajes = [];
|
|
377870
|
+
for (const linea of crudo.split(`
|
|
377871
|
+
`)) {
|
|
377872
|
+
if (!linea.trim())
|
|
377873
|
+
continue;
|
|
377874
|
+
let obj;
|
|
377875
|
+
try {
|
|
377876
|
+
obj = JSON.parse(linea);
|
|
377877
|
+
} catch {
|
|
377878
|
+
continue;
|
|
377879
|
+
}
|
|
377880
|
+
const rol = obj.type === "user" ? "user" : obj.type === "gemini" ? "assistant" : null;
|
|
377881
|
+
if (!rol)
|
|
377882
|
+
continue;
|
|
377883
|
+
const text = textoDeContenido2(obj.content, limites.maxCharsPorMensaje);
|
|
377884
|
+
if (!text.trim())
|
|
377885
|
+
continue;
|
|
377886
|
+
mensajes.push({ role: rol, text });
|
|
377887
|
+
if (mensajes.length >= limites.maxMensajes)
|
|
377888
|
+
break;
|
|
377889
|
+
}
|
|
377890
|
+
if (mensajes.length > 0) {
|
|
377891
|
+
salida.push({
|
|
377892
|
+
titulo: `Sesi\xF3n del ${new Date(mtime).toISOString().slice(0, 10)}`,
|
|
377893
|
+
creadaEn: mtime,
|
|
377894
|
+
mensajes
|
|
377895
|
+
});
|
|
377896
|
+
}
|
|
377897
|
+
}
|
|
377898
|
+
return salida;
|
|
377899
|
+
}
|
|
377900
|
+
};
|
|
377901
|
+
});
|
|
377902
|
+
|
|
377903
|
+
// services/import/detect/sources/memoriaAgente.ts
|
|
377904
|
+
import { readdir as readdir32, readFile as readFile50, stat as stat47 } from "fs/promises";
|
|
377905
|
+
import { join as join137 } from "path";
|
|
377719
377906
|
function parsearFicheroMemoria(crudo, nombreFichero) {
|
|
377720
377907
|
const texto = crudo.trim();
|
|
377721
377908
|
if (!texto)
|
|
@@ -377743,10 +377930,10 @@ function parsearFicheroMemoria(crudo, nombreFichero) {
|
|
|
377743
377930
|
return { titulo, texto: cuerpo, ...categoria ? { categoria } : {} };
|
|
377744
377931
|
}
|
|
377745
377932
|
async function explorarMemoria(entorno) {
|
|
377746
|
-
const ruta =
|
|
377933
|
+
const ruta = join137(directorioConfig(entorno), "projects", slugDeProyecto(entorno.proyecto), "memory");
|
|
377747
377934
|
let ficheros;
|
|
377748
377935
|
try {
|
|
377749
|
-
ficheros = (await
|
|
377936
|
+
ficheros = (await readdir32(ruta)).filter((n2) => n2.toLowerCase().endsWith(".md"));
|
|
377750
377937
|
} catch {
|
|
377751
377938
|
return null;
|
|
377752
377939
|
}
|
|
@@ -377756,7 +377943,7 @@ async function explorarMemoria(entorno) {
|
|
|
377756
377943
|
let masReciente = 0;
|
|
377757
377944
|
for (const nombre of ficheros) {
|
|
377758
377945
|
try {
|
|
377759
|
-
const info = await
|
|
377946
|
+
const info = await stat47(join137(ruta, nombre));
|
|
377760
377947
|
bytes += info.size;
|
|
377761
377948
|
if (info.mtimeMs > masReciente)
|
|
377762
377949
|
masReciente = info.mtimeMs;
|
|
@@ -377775,7 +377962,7 @@ async function explorarMemoria(entorno) {
|
|
|
377775
377962
|
async function leerMemoria(fuente, maxHechos = 60) {
|
|
377776
377963
|
let ficheros;
|
|
377777
377964
|
try {
|
|
377778
|
-
ficheros = (await
|
|
377965
|
+
ficheros = (await readdir32(fuente.ruta)).filter((n2) => n2.toLowerCase().endsWith(".md"));
|
|
377779
377966
|
} catch {
|
|
377780
377967
|
return [];
|
|
377781
377968
|
}
|
|
@@ -377787,7 +377974,7 @@ async function leerMemoria(fuente, maxHechos = 60) {
|
|
|
377787
377974
|
break;
|
|
377788
377975
|
let crudo;
|
|
377789
377976
|
try {
|
|
377790
|
-
crudo = await
|
|
377977
|
+
crudo = await readFile50(join137(fuente.ruta, nombre), "utf8");
|
|
377791
377978
|
} catch {
|
|
377792
377979
|
continue;
|
|
377793
377980
|
}
|
|
@@ -377801,6 +377988,82 @@ var init_memoriaAgente = __esm(() => {
|
|
|
377801
377988
|
init_claudeCode();
|
|
377802
377989
|
});
|
|
377803
377990
|
|
|
377991
|
+
// services/import/detect/redactar.ts
|
|
377992
|
+
function tapar(coincidencia, conservar) {
|
|
377993
|
+
if (conservar <= 0 || coincidencia.length <= conservar)
|
|
377994
|
+
return OCULTO;
|
|
377995
|
+
return coincidencia.slice(0, conservar) + OCULTO;
|
|
377996
|
+
}
|
|
377997
|
+
function redactarSecretos(texto) {
|
|
377998
|
+
if (!texto)
|
|
377999
|
+
return { texto, redactados: 0, familias: [] };
|
|
378000
|
+
let salida = texto;
|
|
378001
|
+
let redactados = 0;
|
|
378002
|
+
const familias = new Set;
|
|
378003
|
+
for (const { nombre, re, conservar } of PATRONES) {
|
|
378004
|
+
salida = salida.replace(new RegExp(re.source, re.flags), (m) => {
|
|
378005
|
+
redactados++;
|
|
378006
|
+
familias.add(nombre);
|
|
378007
|
+
return tapar(m, conservar);
|
|
378008
|
+
});
|
|
378009
|
+
}
|
|
378010
|
+
salida = salida.replace(URL_CON_CREDENCIALES, (_m, prefijo) => {
|
|
378011
|
+
redactados++;
|
|
378012
|
+
familias.add("url-con-credenciales");
|
|
378013
|
+
return `${prefijo}${OCULTO}`;
|
|
378014
|
+
});
|
|
378015
|
+
salida = salida.replace(ASIGNACION, (_m, prefijo, comilla) => {
|
|
378016
|
+
redactados++;
|
|
378017
|
+
familias.add("asignacion");
|
|
378018
|
+
return `${prefijo}${comilla}${OCULTO}${comilla}`;
|
|
378019
|
+
});
|
|
378020
|
+
salida = salida.replace(AUTORIZACION, (_m, prefijo) => {
|
|
378021
|
+
redactados++;
|
|
378022
|
+
familias.add("autorizacion");
|
|
378023
|
+
return `${prefijo}${OCULTO}`;
|
|
378024
|
+
});
|
|
378025
|
+
return { texto: salida, redactados, familias: [...familias] };
|
|
378026
|
+
}
|
|
378027
|
+
function redactarMensajes(mensajes) {
|
|
378028
|
+
let redactados = 0;
|
|
378029
|
+
const salida = mensajes.map((m) => {
|
|
378030
|
+
const r = redactarSecretos(m.text);
|
|
378031
|
+
redactados += r.redactados;
|
|
378032
|
+
return r.redactados > 0 ? { ...m, text: r.texto } : m;
|
|
378033
|
+
});
|
|
378034
|
+
return { mensajes: salida, redactados };
|
|
378035
|
+
}
|
|
378036
|
+
var OCULTO = "\u2026[credencial oculta]", PATRONES, ASIGNACION, URL_CON_CREDENCIALES, AUTORIZACION;
|
|
378037
|
+
var init_redactar = __esm(() => {
|
|
378038
|
+
PATRONES = [
|
|
378039
|
+
{ nombre: "anthropic", re: /\bsk-ant-[A-Za-z0-9_-]{20,}/g, conservar: 7 },
|
|
378040
|
+
{ nombre: "openrouter", re: /\bsk-or-v1-[A-Za-z0-9]{32,}/g, conservar: 9 },
|
|
378041
|
+
{ nombre: "openai", re: /\bsk-(?:proj-|svcacct-)?[A-Za-z0-9_-]{20,}/g, conservar: 3 },
|
|
378042
|
+
{ nombre: "github-pat", re: /\bgithub_pat_[A-Za-z0-9_]{20,}/g, conservar: 11 },
|
|
378043
|
+
{ nombre: "github-token", re: /\bgh[pousr]_[A-Za-z0-9]{30,}/g, conservar: 4 },
|
|
378044
|
+
{ nombre: "gitlab", re: /\bglpat-[A-Za-z0-9_-]{16,}/g, conservar: 6 },
|
|
378045
|
+
{ nombre: "slack", re: /\bxox[abpsr]-[A-Za-z0-9-]{10,}/g, conservar: 5 },
|
|
378046
|
+
{ nombre: "stripe", re: /\b[rs]k_(?:live|test)_[A-Za-z0-9]{16,}/g, conservar: 11 },
|
|
378047
|
+
{ nombre: "sendgrid", re: /\bSG\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}/g, conservar: 3 },
|
|
378048
|
+
{ nombre: "google-api", re: /\bAIza[A-Za-z0-9_-]{30,}/g, conservar: 4 },
|
|
378049
|
+
{ nombre: "aws-access-key", re: /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g, conservar: 4 },
|
|
378050
|
+
{ nombre: "huggingface", re: /\bhf_[A-Za-z0-9]{30,}/g, conservar: 3 },
|
|
378051
|
+
{ nombre: "groq", re: /\bgsk_[A-Za-z0-9]{40,}/g, conservar: 4 },
|
|
378052
|
+
{ nombre: "replicate", re: /\br8_[A-Za-z0-9]{30,}/g, conservar: 3 },
|
|
378053
|
+
{ nombre: "npm", re: /\bnpm_[A-Za-z0-9]{30,}/g, conservar: 4 },
|
|
378054
|
+
{ nombre: "mercadopago", re: /\bAPP_USR-[A-Za-z0-9-]{20,}/g, conservar: 8 },
|
|
378055
|
+
{ nombre: "jwt", re: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g, conservar: 3 },
|
|
378056
|
+
{
|
|
378057
|
+
nombre: "clave-privada",
|
|
378058
|
+
re: /-----BEGIN[A-Z ]*PRIVATE KEY-----[\s\S]*?-----END[A-Z ]*PRIVATE KEY-----/g,
|
|
378059
|
+
conservar: 0
|
|
378060
|
+
}
|
|
378061
|
+
];
|
|
378062
|
+
ASIGNACION = /\b((?:export\s+)?[A-Z][A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD|PWD|CREDENTIAL|AUTH)[A-Z0-9_]*\s*[=:]\s*)(['"]?)([^\s'"]{8,})\2/g;
|
|
378063
|
+
URL_CON_CREDENCIALES = /(\b[a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:)[^\s@]+(?=@)/g;
|
|
378064
|
+
AUTORIZACION = /\b(Authorization\s*:\s*(?:Bearer|Basic|token)\s+)(\S{12,})/gi;
|
|
378065
|
+
});
|
|
378066
|
+
|
|
377804
378067
|
// services/import/detect/registry.ts
|
|
377805
378068
|
var exports_registry2 = {};
|
|
377806
378069
|
__export(exports_registry2, {
|
|
@@ -377835,6 +378098,7 @@ async function explorarFuentes(entorno) {
|
|
|
377835
378098
|
}
|
|
377836
378099
|
async function leerFuentes(fuentes, limites = LIMITES_POR_DEFECTO) {
|
|
377837
378100
|
const conversaciones = [];
|
|
378101
|
+
let totalRedactados = 0;
|
|
377838
378102
|
for (const fuente of fuentes) {
|
|
377839
378103
|
const detector = DETECTORES.find((d) => d.herramienta === fuente.herramienta);
|
|
377840
378104
|
if (!detector)
|
|
@@ -377846,9 +378110,11 @@ async function leerFuentes(fuentes, limites = LIMITES_POR_DEFECTO) {
|
|
|
377846
378110
|
continue;
|
|
377847
378111
|
}
|
|
377848
378112
|
for (const c5 of leidas) {
|
|
378113
|
+
const { mensajes, redactados } = redactarMensajes(c5.mensajes.map((m) => ({ role: m.role, text: m.text })));
|
|
378114
|
+
totalRedactados += redactados;
|
|
377849
378115
|
conversaciones.push({
|
|
377850
378116
|
title: c5.titulo,
|
|
377851
|
-
messages:
|
|
378117
|
+
messages: mensajes,
|
|
377852
378118
|
...c5.creadaEn !== undefined ? { createdAt: c5.creadaEn } : {}
|
|
377853
378119
|
});
|
|
377854
378120
|
}
|
|
@@ -377856,7 +378122,8 @@ async function leerFuentes(fuentes, limites = LIMITES_POR_DEFECTO) {
|
|
|
377856
378122
|
return {
|
|
377857
378123
|
source: "agente-local",
|
|
377858
378124
|
conversations: conversaciones,
|
|
377859
|
-
totalConversations: conversaciones.length
|
|
378125
|
+
totalConversations: conversaciones.length,
|
|
378126
|
+
credencialesTapadas: totalRedactados
|
|
377860
378127
|
};
|
|
377861
378128
|
}
|
|
377862
378129
|
async function leerHechosDirectos(fuentes) {
|
|
@@ -377865,7 +378132,9 @@ async function leerHechosDirectos(fuentes) {
|
|
|
377865
378132
|
if (!fuente.yaDestilado)
|
|
377866
378133
|
continue;
|
|
377867
378134
|
try {
|
|
377868
|
-
|
|
378135
|
+
for (const nota of await leerMemoria(fuente)) {
|
|
378136
|
+
hechos.push({ ...nota, texto: redactarSecretos(nota.texto).texto });
|
|
378137
|
+
}
|
|
377869
378138
|
} catch {
|
|
377870
378139
|
continue;
|
|
377871
378140
|
}
|
|
@@ -377904,10 +378173,13 @@ var init_registry4 = __esm(() => {
|
|
|
377904
378173
|
init_claudeCode();
|
|
377905
378174
|
init_codex();
|
|
377906
378175
|
init_aider();
|
|
378176
|
+
init_geminiCli();
|
|
377907
378177
|
init_memoriaAgente();
|
|
378178
|
+
init_redactar();
|
|
377908
378179
|
DETECTORES = [
|
|
377909
378180
|
detectorClaudeCode,
|
|
377910
378181
|
detectorCodex,
|
|
378182
|
+
detectorGeminiCli,
|
|
377911
378183
|
detectorAider
|
|
377912
378184
|
];
|
|
377913
378185
|
});
|
|
@@ -377918,7 +378190,7 @@ __export(exports_import, {
|
|
|
377918
378190
|
call: () => call42,
|
|
377919
378191
|
ImportContext: () => ImportContext
|
|
377920
378192
|
});
|
|
377921
|
-
import { readFile as
|
|
378193
|
+
import { readFile as readFile51 } from "fs/promises";
|
|
377922
378194
|
import { homedir as homedir36 } from "os";
|
|
377923
378195
|
import { resolve as resolve42 } from "path";
|
|
377924
378196
|
function resolvePath3(raw) {
|
|
@@ -377998,6 +378270,10 @@ function ImportContext({
|
|
|
377998
378270
|
setStatusLine("Leyendo el contexto de este proyecto\u2026");
|
|
377999
378271
|
const parsedExport = await leerFuentes(aceptadas);
|
|
378000
378272
|
setParsed(parsedExport);
|
|
378273
|
+
const tapadas = parsedExport.credencialesTapadas ?? 0;
|
|
378274
|
+
if (tapadas > 0) {
|
|
378275
|
+
setStatusLine(`Tap\xE9 ${tapadas} ${tapadas === 1 ? "credencial" : "credenciales"} que hab\xEDa en tu historial. Destilando\u2026`);
|
|
378276
|
+
}
|
|
378001
378277
|
const blocks = buildImportBlocks(parsedExport);
|
|
378002
378278
|
if (blocks.length === 0) {
|
|
378003
378279
|
setError("El historial encontrado no ten\xEDa conversaciones con contenido.");
|
|
@@ -378029,7 +378305,7 @@ function ImportContext({
|
|
|
378029
378305
|
const abs = resolvePath3(filePath);
|
|
378030
378306
|
let bytes;
|
|
378031
378307
|
try {
|
|
378032
|
-
bytes = await
|
|
378308
|
+
bytes = await readFile51(abs);
|
|
378033
378309
|
} catch {
|
|
378034
378310
|
setError(`No pude leer el archivo: ${abs}`);
|
|
378035
378311
|
setStep("error");
|
|
@@ -385011,7 +385287,7 @@ __export(exports_TheusHome, {
|
|
|
385011
385287
|
default: () => TheusHome_default,
|
|
385012
385288
|
TheusHome: () => TheusHome
|
|
385013
385289
|
});
|
|
385014
|
-
import { readFile as
|
|
385290
|
+
import { readFile as readFile52 } from "fs/promises";
|
|
385015
385291
|
function firstName() {
|
|
385016
385292
|
const info = getOauthAccountInfo();
|
|
385017
385293
|
if (info?.displayName)
|
|
@@ -385054,7 +385330,7 @@ function relativeWhen(iso) {
|
|
|
385054
385330
|
}
|
|
385055
385331
|
async function readMemory() {
|
|
385056
385332
|
try {
|
|
385057
|
-
const raw = await
|
|
385333
|
+
const raw = await readFile52(getGraphPath(getCwd()), "utf8");
|
|
385058
385334
|
const data = JSON.parse(raw);
|
|
385059
385335
|
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
385060
385336
|
let facts = 0;
|
|
@@ -385836,8 +386112,8 @@ __export(exports_thinkback, {
|
|
|
385836
386112
|
playAnimation: () => playAnimation,
|
|
385837
386113
|
call: () => call51
|
|
385838
386114
|
});
|
|
385839
|
-
import { readFile as
|
|
385840
|
-
import { join as
|
|
386115
|
+
import { readFile as readFile53 } from "fs/promises";
|
|
386116
|
+
import { join as join138 } from "path";
|
|
385841
386117
|
function getMarketplaceName() {
|
|
385842
386118
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
385843
386119
|
}
|
|
@@ -385855,17 +386131,17 @@ async function getThinkbackSkillDir() {
|
|
|
385855
386131
|
if (!thinkbackPlugin) {
|
|
385856
386132
|
return null;
|
|
385857
386133
|
}
|
|
385858
|
-
const skillDir =
|
|
386134
|
+
const skillDir = join138(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
385859
386135
|
if (await pathExists(skillDir)) {
|
|
385860
386136
|
return skillDir;
|
|
385861
386137
|
}
|
|
385862
386138
|
return null;
|
|
385863
386139
|
}
|
|
385864
386140
|
async function playAnimation(skillDir) {
|
|
385865
|
-
const dataPath =
|
|
385866
|
-
const playerPath =
|
|
386141
|
+
const dataPath = join138(skillDir, "year_in_review.js");
|
|
386142
|
+
const playerPath = join138(skillDir, "player.js");
|
|
385867
386143
|
try {
|
|
385868
|
-
await
|
|
386144
|
+
await readFile53(dataPath);
|
|
385869
386145
|
} catch (e) {
|
|
385870
386146
|
if (isENOENT(e)) {
|
|
385871
386147
|
return {
|
|
@@ -385880,7 +386156,7 @@ async function playAnimation(skillDir) {
|
|
|
385880
386156
|
};
|
|
385881
386157
|
}
|
|
385882
386158
|
try {
|
|
385883
|
-
await
|
|
386159
|
+
await readFile53(playerPath);
|
|
385884
386160
|
} catch (e) {
|
|
385885
386161
|
if (isENOENT(e)) {
|
|
385886
386162
|
return {
|
|
@@ -385911,7 +386187,7 @@ async function playAnimation(skillDir) {
|
|
|
385911
386187
|
} catch {} finally {
|
|
385912
386188
|
inkInstance.exitAlternateScreen();
|
|
385913
386189
|
}
|
|
385914
|
-
const htmlPath =
|
|
386190
|
+
const htmlPath = join138(skillDir, "year_in_review.html");
|
|
385915
386191
|
if (await pathExists(htmlPath)) {
|
|
385916
386192
|
const platform6 = getPlatform();
|
|
385917
386193
|
const openCmd = platform6 === "macos" ? "open" : platform6 === "windows" ? "start" : "xdg-open";
|
|
@@ -386247,7 +386523,7 @@ function ThinkbackFlow(t0) {
|
|
|
386247
386523
|
if (!skillDir) {
|
|
386248
386524
|
return;
|
|
386249
386525
|
}
|
|
386250
|
-
const dataPath =
|
|
386526
|
+
const dataPath = join138(skillDir, "year_in_review.js");
|
|
386251
386527
|
pathExists(dataPath).then((exists) => {
|
|
386252
386528
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
386253
386529
|
setHasGenerated(exists);
|
|
@@ -386421,7 +386697,7 @@ var exports_thinkback_play = {};
|
|
|
386421
386697
|
__export(exports_thinkback_play, {
|
|
386422
386698
|
call: () => call52
|
|
386423
386699
|
});
|
|
386424
|
-
import { join as
|
|
386700
|
+
import { join as join139 } from "path";
|
|
386425
386701
|
function getPluginId2() {
|
|
386426
386702
|
const marketplaceName = OFFICIAL_MARKETPLACE_NAME;
|
|
386427
386703
|
return `thinkback@${marketplaceName}`;
|
|
@@ -386443,7 +386719,7 @@ async function call52() {
|
|
|
386443
386719
|
value: "Thinkback plugin installation path not found."
|
|
386444
386720
|
};
|
|
386445
386721
|
}
|
|
386446
|
-
const skillDir =
|
|
386722
|
+
const skillDir = join139(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
386447
386723
|
const result = await playAnimation(skillDir);
|
|
386448
386724
|
return { type: "text", value: result.message };
|
|
386449
386725
|
}
|
|
@@ -392673,7 +392949,7 @@ __export(exports_branch, {
|
|
|
392673
392949
|
call: () => call60
|
|
392674
392950
|
});
|
|
392675
392951
|
import { randomUUID as randomUUID33 } from "crypto";
|
|
392676
|
-
import { mkdir as mkdir42, readFile as
|
|
392952
|
+
import { mkdir as mkdir42, readFile as readFile54, writeFile as writeFile46 } from "fs/promises";
|
|
392677
392953
|
function deriveFirstPrompt(firstUserMessage) {
|
|
392678
392954
|
const content = firstUserMessage?.message?.content;
|
|
392679
392955
|
if (!content)
|
|
@@ -392692,7 +392968,7 @@ async function createFork(customTitle) {
|
|
|
392692
392968
|
await mkdir42(projectDir, { recursive: true, mode: 448 });
|
|
392693
392969
|
let transcriptContent;
|
|
392694
392970
|
try {
|
|
392695
|
-
transcriptContent = await
|
|
392971
|
+
transcriptContent = await readFile54(currentTranscriptPath);
|
|
392696
392972
|
} catch {
|
|
392697
392973
|
throw new Error("No hay conversaci\xF3n que ramificar");
|
|
392698
392974
|
}
|
|
@@ -392945,8 +393221,8 @@ var init_types14 = __esm(() => {
|
|
|
392945
393221
|
});
|
|
392946
393222
|
|
|
392947
393223
|
// components/agents/agentFileUtils.ts
|
|
392948
|
-
import { mkdir as mkdir43, open as
|
|
392949
|
-
import { join as
|
|
393224
|
+
import { mkdir as mkdir43, open as open18, unlink as unlink20 } from "fs/promises";
|
|
393225
|
+
import { join as join140 } from "path";
|
|
392950
393226
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
392951
393227
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
392952
393228
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -392973,26 +393249,26 @@ function getAgentDirectoryPath(location) {
|
|
|
392973
393249
|
case "flagSettings":
|
|
392974
393250
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
392975
393251
|
case "userSettings":
|
|
392976
|
-
return
|
|
393252
|
+
return join140(getTheusConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
392977
393253
|
case "projectSettings":
|
|
392978
|
-
return
|
|
393254
|
+
return join140(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392979
393255
|
case "policySettings":
|
|
392980
|
-
return
|
|
393256
|
+
return join140(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392981
393257
|
case "localSettings":
|
|
392982
|
-
return
|
|
393258
|
+
return join140(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392983
393259
|
}
|
|
392984
393260
|
}
|
|
392985
393261
|
function getRelativeAgentDirectoryPath(location) {
|
|
392986
393262
|
switch (location) {
|
|
392987
393263
|
case "projectSettings":
|
|
392988
|
-
return
|
|
393264
|
+
return join140(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392989
393265
|
default:
|
|
392990
393266
|
return getAgentDirectoryPath(location);
|
|
392991
393267
|
}
|
|
392992
393268
|
}
|
|
392993
393269
|
function getNewAgentFilePath(agent) {
|
|
392994
393270
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
392995
|
-
return
|
|
393271
|
+
return join140(dirPath, `${agent.agentType}.md`);
|
|
392996
393272
|
}
|
|
392997
393273
|
function getActualAgentFilePath(agent) {
|
|
392998
393274
|
if (agent.source === "built-in") {
|
|
@@ -393003,14 +393279,14 @@ function getActualAgentFilePath(agent) {
|
|
|
393003
393279
|
}
|
|
393004
393280
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
393005
393281
|
const filename = agent.filename || agent.agentType;
|
|
393006
|
-
return
|
|
393282
|
+
return join140(dirPath, `${filename}.md`);
|
|
393007
393283
|
}
|
|
393008
393284
|
function getNewRelativeAgentFilePath(agent) {
|
|
393009
393285
|
if (agent.source === "built-in") {
|
|
393010
393286
|
return "Built-in";
|
|
393011
393287
|
}
|
|
393012
393288
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
393013
|
-
return
|
|
393289
|
+
return join140(dirPath, `${agent.agentType}.md`);
|
|
393014
393290
|
}
|
|
393015
393291
|
function getActualRelativeAgentFilePath(agent) {
|
|
393016
393292
|
if (isBuiltInAgent(agent)) {
|
|
@@ -393024,7 +393300,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
393024
393300
|
}
|
|
393025
393301
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
393026
393302
|
const filename = agent.filename || agent.agentType;
|
|
393027
|
-
return
|
|
393303
|
+
return join140(dirPath, `${filename}.md`);
|
|
393028
393304
|
}
|
|
393029
393305
|
async function ensureAgentDirectoryExists(source) {
|
|
393030
393306
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -393070,7 +393346,7 @@ async function deleteAgentFromFile(agent) {
|
|
|
393070
393346
|
}
|
|
393071
393347
|
}
|
|
393072
393348
|
async function writeFileAndFlush(filePath, content, flag = "w") {
|
|
393073
|
-
const handle2 = await
|
|
393349
|
+
const handle2 = await open18(filePath, flag);
|
|
393074
393350
|
try {
|
|
393075
393351
|
await handle2.writeFile(content, { encoding: "utf-8" });
|
|
393076
393352
|
await handle2.datasync();
|
|
@@ -399036,8 +399312,8 @@ var init_rewind = __esm(() => {
|
|
|
399036
399312
|
|
|
399037
399313
|
// utils/heapDumpService.ts
|
|
399038
399314
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync7 } from "fs";
|
|
399039
|
-
import { readdir as
|
|
399040
|
-
import { join as
|
|
399315
|
+
import { readdir as readdir33, readFile as readFile55, writeFile as writeFile47 } from "fs/promises";
|
|
399316
|
+
import { join as join141 } from "path";
|
|
399041
399317
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
399042
399318
|
import {
|
|
399043
399319
|
getHeapSnapshot,
|
|
@@ -399057,11 +399333,11 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
399057
399333
|
const activeRequests = process._getActiveRequests().length;
|
|
399058
399334
|
let openFileDescriptors;
|
|
399059
399335
|
try {
|
|
399060
|
-
openFileDescriptors = (await
|
|
399336
|
+
openFileDescriptors = (await readdir33("/proc/self/fd")).length;
|
|
399061
399337
|
} catch {}
|
|
399062
399338
|
let smapsRollup;
|
|
399063
399339
|
try {
|
|
399064
|
-
smapsRollup = await
|
|
399340
|
+
smapsRollup = await readFile55("/proc/self/smaps_rollup", "utf8");
|
|
399065
399341
|
} catch {}
|
|
399066
399342
|
const nativeMemory = usage2.rss - usage2.heapUsed;
|
|
399067
399343
|
const bytesPerSecond = uptimeSeconds > 0 ? usage2.rss / uptimeSeconds : 0;
|
|
@@ -399127,7 +399403,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
399127
399403
|
smapsRollup,
|
|
399128
399404
|
platform: process.platform,
|
|
399129
399405
|
nodeVersion: process.version,
|
|
399130
|
-
ccVersion: { VERSION: "0.2.
|
|
399406
|
+
ccVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
399131
399407
|
};
|
|
399132
399408
|
}
|
|
399133
399409
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -399145,8 +399421,8 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
399145
399421
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
399146
399422
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
399147
399423
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
399148
|
-
const heapPath =
|
|
399149
|
-
const diagPath =
|
|
399424
|
+
const heapPath = join141(dumpDir, heapFilename);
|
|
399425
|
+
const diagPath = join141(dumpDir, diagFilename);
|
|
399150
399426
|
await writeFile47(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
399151
399427
|
mode: 384
|
|
399152
399428
|
});
|
|
@@ -399888,7 +400164,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
399888
400164
|
var call68 = async () => {
|
|
399889
400165
|
return {
|
|
399890
400166
|
type: "text",
|
|
399891
|
-
value: { VERSION: "0.2.
|
|
400167
|
+
value: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME ? `${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (built ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME})` : { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
399892
400168
|
};
|
|
399893
400169
|
}, version2, version_default;
|
|
399894
400170
|
var init_version = __esm(() => {
|
|
@@ -402328,8 +402604,8 @@ var init_advisor2 = __esm(() => {
|
|
|
402328
402604
|
|
|
402329
402605
|
// skills/bundledSkills.ts
|
|
402330
402606
|
import { constants as fsConstants5 } from "fs";
|
|
402331
|
-
import { mkdir as mkdir44, open as
|
|
402332
|
-
import { dirname as dirname58, isAbsolute as isAbsolute28, join as
|
|
402607
|
+
import { mkdir as mkdir44, open as open19 } from "fs/promises";
|
|
402608
|
+
import { dirname as dirname58, isAbsolute as isAbsolute28, join as join142, normalize as normalize13, sep as pathSep2 } from "path";
|
|
402333
402609
|
function registerBundledSkill(definition) {
|
|
402334
402610
|
const { files: files2 } = definition;
|
|
402335
402611
|
let skillRoot;
|
|
@@ -402377,7 +402653,7 @@ function getBundledSkills() {
|
|
|
402377
402653
|
return [...bundledSkills];
|
|
402378
402654
|
}
|
|
402379
402655
|
function getBundledSkillExtractDir(skillName) {
|
|
402380
|
-
return
|
|
402656
|
+
return join142(getBundledSkillsRoot(), skillName);
|
|
402381
402657
|
}
|
|
402382
402658
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
402383
402659
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -402407,7 +402683,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
402407
402683
|
}));
|
|
402408
402684
|
}
|
|
402409
402685
|
async function safeWriteFile(p, content) {
|
|
402410
|
-
const fh = await
|
|
402686
|
+
const fh = await open19(p, SAFE_WRITE_FLAGS, 384);
|
|
402411
402687
|
try {
|
|
402412
402688
|
await fh.writeFile(content, "utf8");
|
|
402413
402689
|
} finally {
|
|
@@ -402419,7 +402695,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
402419
402695
|
if (isAbsolute28(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
402420
402696
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
402421
402697
|
}
|
|
402422
|
-
return
|
|
402698
|
+
return join142(baseDir, normalized);
|
|
402423
402699
|
}
|
|
402424
402700
|
function prependBaseDir(blocks, baseDir) {
|
|
402425
402701
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -402489,7 +402765,7 @@ var SECRET_NAME_PATTERN, EXTRA_ENV_ALLOWLIST, REDACTED2 = "\u2039oculto\u203A",
|
|
|
402489
402765
|
const lines = [];
|
|
402490
402766
|
lines.push("## Entorno de ejecuci\xF3n");
|
|
402491
402767
|
lines.push("");
|
|
402492
|
-
const version3 = { VERSION: "0.2.
|
|
402768
|
+
const version3 = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "desconocida";
|
|
402493
402769
|
lines.push(`- Versi\xF3n de Theus: ${version3}`);
|
|
402494
402770
|
lines.push(`- Directorio de trabajo: ${getCwd()}`);
|
|
402495
402771
|
lines.push(`- \xBFRepositorio git?: ${isGit ? "s\xED" : "no"}`);
|
|
@@ -402930,7 +403206,7 @@ var init_exit2 = __esm(() => {
|
|
|
402930
403206
|
});
|
|
402931
403207
|
|
|
402932
403208
|
// components/ExportDialog.tsx
|
|
402933
|
-
import { join as
|
|
403209
|
+
import { join as join143 } from "path";
|
|
402934
403210
|
function ExportDialog({
|
|
402935
403211
|
content,
|
|
402936
403212
|
defaultFilename,
|
|
@@ -402963,7 +403239,7 @@ function ExportDialog({
|
|
|
402963
403239
|
};
|
|
402964
403240
|
const handleFilenameSubmit = () => {
|
|
402965
403241
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
402966
|
-
const filepath =
|
|
403242
|
+
const filepath = join143(getCwd(), finalFilename);
|
|
402967
403243
|
try {
|
|
402968
403244
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
402969
403245
|
encoding: "utf-8",
|
|
@@ -403186,7 +403462,7 @@ __export(exports_export, {
|
|
|
403186
403462
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
403187
403463
|
call: () => call80
|
|
403188
403464
|
});
|
|
403189
|
-
import { join as
|
|
403465
|
+
import { join as join144 } from "path";
|
|
403190
403466
|
function formatTimestamp(date6) {
|
|
403191
403467
|
const year = date6.getFullYear();
|
|
403192
403468
|
const month = String(date6.getMonth() + 1).padStart(2, "0");
|
|
@@ -403230,7 +403506,7 @@ async function call80(onDone, context3, args) {
|
|
|
403230
403506
|
const filename = args.trim();
|
|
403231
403507
|
if (filename) {
|
|
403232
403508
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
403233
|
-
const filepath =
|
|
403509
|
+
const filepath = join144(getCwd(), finalFilename);
|
|
403234
403510
|
try {
|
|
403235
403511
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
403236
403512
|
encoding: "utf-8",
|
|
@@ -404860,7 +405136,7 @@ import {
|
|
|
404860
405136
|
writeFileSync as writeFileSync8
|
|
404861
405137
|
} from "fs";
|
|
404862
405138
|
import { tmpdir as tmpdir10 } from "os";
|
|
404863
|
-
import { dirname as dirname59, join as
|
|
405139
|
+
import { dirname as dirname59, join as join145 } from "path";
|
|
404864
405140
|
function naupaVersionOf(bin) {
|
|
404865
405141
|
try {
|
|
404866
405142
|
const out = spawnSync9(bin, ["--version"], {
|
|
@@ -404896,7 +405172,7 @@ function rescatarNaupaMalUbicado(binEnUso, options2 = {}) {
|
|
|
404896
405172
|
const platform6 = options2.platform ?? process.platform;
|
|
404897
405173
|
const versionOf = options2.versionOf ?? naupaVersionOf;
|
|
404898
405174
|
const nombre = platform6 === "win32" ? "naupa.exe" : "naupa";
|
|
404899
|
-
const rutaFija =
|
|
405175
|
+
const rutaFija = join145(home, ".local", "bin", nombre);
|
|
404900
405176
|
if (!existsSync22(rutaFija))
|
|
404901
405177
|
return;
|
|
404902
405178
|
try {
|
|
@@ -404986,7 +405262,7 @@ function isReleaseBundleInstall() {
|
|
|
404986
405262
|
return false;
|
|
404987
405263
|
if (real.includes("node_modules"))
|
|
404988
405264
|
return false;
|
|
404989
|
-
return existsSync22(
|
|
405265
|
+
return existsSync22(join145(dirname59(real), "bin", "theus"));
|
|
404990
405266
|
} catch {
|
|
404991
405267
|
return false;
|
|
404992
405268
|
}
|
|
@@ -405030,20 +405306,20 @@ async function updateReleaseBundle() {
|
|
|
405030
405306
|
await gracefulShutdown(1);
|
|
405031
405307
|
return;
|
|
405032
405308
|
}
|
|
405033
|
-
if (gte({ VERSION: "0.2.
|
|
405034
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405309
|
+
if (gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405310
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
405035
405311
|
`);
|
|
405036
405312
|
await gracefulShutdown(0);
|
|
405037
405313
|
return;
|
|
405038
405314
|
}
|
|
405039
|
-
writeToStdout(`Nueva versi\xF3n disponible: ${latest} (actual: ${{ VERSION: "0.2.
|
|
405315
|
+
writeToStdout(`Nueva versi\xF3n disponible: ${latest} (actual: ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
405040
405316
|
`);
|
|
405041
405317
|
writeToStdout(`Instalando la actualizaci\xF3n desde theus.pe/dl...
|
|
405042
405318
|
`);
|
|
405043
|
-
const tmp = mkdtempSync(
|
|
405319
|
+
const tmp = mkdtempSync(join145(tmpdir10(), "theus-update-"));
|
|
405044
405320
|
try {
|
|
405045
|
-
const tarPath =
|
|
405046
|
-
const sumsPath =
|
|
405321
|
+
const tarPath = join145(tmp, "theus-cli.tar.gz");
|
|
405322
|
+
const sumsPath = join145(tmp, "SHA256SUMS");
|
|
405047
405323
|
if (!await downloadToFile(`${DL_BASE}/theus-cli.tar.gz`, tarPath) || !await downloadToFile(`${DL_BASE}/SHA256SUMS`, sumsPath)) {
|
|
405048
405324
|
process.stderr.write(source_default.red(`Fall\xF3 la descarga del release desde theus.pe/dl.
|
|
405049
405325
|
`));
|
|
@@ -405062,15 +405338,15 @@ async function updateReleaseBundle() {
|
|
|
405062
405338
|
const ex = spawnSync9("tar", ["-xzf", tarPath, "-C", tmp], {
|
|
405063
405339
|
stdio: "ignore"
|
|
405064
405340
|
});
|
|
405065
|
-
const staged =
|
|
405066
|
-
if (ex.status !== 0 || !existsSync22(
|
|
405341
|
+
const staged = join145(tmp, "theus-cli");
|
|
405342
|
+
if (ex.status !== 0 || !existsSync22(join145(staged, "cli.js"))) {
|
|
405067
405343
|
process.stderr.write(source_default.red(`No pude extraer el release descargado (o vino incompleto).
|
|
405068
405344
|
`));
|
|
405069
405345
|
await gracefulShutdown(1);
|
|
405070
405346
|
return;
|
|
405071
405347
|
}
|
|
405072
405348
|
cpSync(staged, bundleDir, { recursive: true, force: true });
|
|
405073
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405349
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} a la versi\xF3n ${latest}`) + `
|
|
405074
405350
|
`);
|
|
405075
405351
|
await regenerateCompletionCache();
|
|
405076
405352
|
} finally {
|
|
@@ -405083,7 +405359,7 @@ async function updateReleaseBundle() {
|
|
|
405083
405359
|
async function update() {
|
|
405084
405360
|
logEvent("theus_update_check", {});
|
|
405085
405361
|
await updateNaupa();
|
|
405086
|
-
writeToStdout(`Versi\xF3n actual: ${{ VERSION: "0.2.
|
|
405362
|
+
writeToStdout(`Versi\xF3n actual: ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
405087
405363
|
`);
|
|
405088
405364
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
405089
405365
|
writeToStdout(`Buscando actualizaciones en el canal ${channel2}...
|
|
@@ -405162,8 +405438,8 @@ async function update() {
|
|
|
405162
405438
|
writeToStdout(`Theus est\xE1 gestionado por Homebrew.
|
|
405163
405439
|
`);
|
|
405164
405440
|
const latest = await getLatestVersion(channel2);
|
|
405165
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
405166
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405441
|
+
if (latest && !gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405442
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
405167
405443
|
`);
|
|
405168
405444
|
writeToStdout(`
|
|
405169
405445
|
`);
|
|
@@ -405179,8 +405455,8 @@ async function update() {
|
|
|
405179
405455
|
writeToStdout(`Theus est\xE1 gestionado por winget.
|
|
405180
405456
|
`);
|
|
405181
405457
|
const latest = await getLatestVersion(channel2);
|
|
405182
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
405183
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405458
|
+
if (latest && !gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405459
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
405184
405460
|
`);
|
|
405185
405461
|
writeToStdout(`
|
|
405186
405462
|
`);
|
|
@@ -405196,8 +405472,8 @@ async function update() {
|
|
|
405196
405472
|
writeToStdout(`Theus est\xE1 gestionado por apk.
|
|
405197
405473
|
`);
|
|
405198
405474
|
const latest = await getLatestVersion(channel2);
|
|
405199
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
405200
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405475
|
+
if (latest && !gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405476
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
405201
405477
|
`);
|
|
405202
405478
|
writeToStdout(`
|
|
405203
405479
|
`);
|
|
@@ -405262,11 +405538,11 @@ async function update() {
|
|
|
405262
405538
|
`);
|
|
405263
405539
|
await gracefulShutdown(1);
|
|
405264
405540
|
}
|
|
405265
|
-
if (result.latestVersion === { VERSION: "0.2.
|
|
405266
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405541
|
+
if (result.latestVersion === { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
405542
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
405267
405543
|
`);
|
|
405268
405544
|
} else {
|
|
405269
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405545
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} a la versi\xF3n ${result.latestVersion}`) + `
|
|
405270
405546
|
`);
|
|
405271
405547
|
await regenerateCompletionCache();
|
|
405272
405548
|
}
|
|
@@ -405285,9 +405561,9 @@ async function update() {
|
|
|
405285
405561
|
await removeInstalledSymlink();
|
|
405286
405562
|
}
|
|
405287
405563
|
logForDebugging("update: Checking npm registry for latest version");
|
|
405288
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.
|
|
405564
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
405289
405565
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
405290
|
-
const npmCommand = `npm view ${{ VERSION: "0.2.
|
|
405566
|
+
const npmCommand = `npm view ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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`;
|
|
405291
405567
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
405292
405568
|
const latestVersion = await getLatestVersion(channel2);
|
|
405293
405569
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -405307,7 +405583,7 @@ async function update() {
|
|
|
405307
405583
|
`);
|
|
405308
405584
|
process.stderr.write(` \u2022 Un proxy o firewall corporativo bloquea npm
|
|
405309
405585
|
`);
|
|
405310
|
-
if ({ VERSION: "0.2.
|
|
405586
|
+
if ({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && !{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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")) {
|
|
405311
405587
|
process.stderr.write(` \u2022 Compilaci\xF3n interna/de desarrollo no publicada en npm
|
|
405312
405588
|
`);
|
|
405313
405589
|
}
|
|
@@ -405319,19 +405595,19 @@ async function update() {
|
|
|
405319
405595
|
`);
|
|
405320
405596
|
process.stderr.write(` \u2022 Ejecuta con el flag --debug para m\xE1s detalle
|
|
405321
405597
|
`);
|
|
405322
|
-
const packageName = { VERSION: "0.2.
|
|
405598
|
+
const packageName = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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";
|
|
405323
405599
|
process.stderr.write(` \u2022 Comprueba a mano: npm view ${packageName} version
|
|
405324
405600
|
`);
|
|
405325
405601
|
process.stderr.write(` \u2022 Comprueba si te falta iniciar sesi\xF3n: npm whoami
|
|
405326
405602
|
`);
|
|
405327
405603
|
await gracefulShutdown(1);
|
|
405328
405604
|
}
|
|
405329
|
-
if (gte({ VERSION: "0.2.
|
|
405330
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405605
|
+
if (gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405606
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
405331
405607
|
`);
|
|
405332
405608
|
await gracefulShutdown(0);
|
|
405333
405609
|
}
|
|
405334
|
-
writeToStdout(`Nueva versi\xF3n disponible: ${latestVersion} (actual: ${{ VERSION: "0.2.
|
|
405610
|
+
writeToStdout(`Nueva versi\xF3n disponible: ${latestVersion} (actual: ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
405335
405611
|
`);
|
|
405336
405612
|
writeToStdout(`Instalando la actualizaci\xF3n...
|
|
405337
405613
|
`);
|
|
@@ -405376,7 +405652,7 @@ async function update() {
|
|
|
405376
405652
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
405377
405653
|
switch (status2) {
|
|
405378
405654
|
case "success":
|
|
405379
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405655
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} a la versi\xF3n ${latestVersion}`) + `
|
|
405380
405656
|
`);
|
|
405381
405657
|
await regenerateCompletionCache();
|
|
405382
405658
|
break;
|
|
@@ -405386,7 +405662,7 @@ async function update() {
|
|
|
405386
405662
|
if (useLocalUpdate) {
|
|
405387
405663
|
process.stderr.write(`Prueba a actualizar a mano con:
|
|
405388
405664
|
`);
|
|
405389
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
405665
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
405390
405666
|
`);
|
|
405391
405667
|
} else {
|
|
405392
405668
|
process.stderr.write(`Prueba con sudo o corrige los permisos de npm
|
|
@@ -405402,7 +405678,7 @@ async function update() {
|
|
|
405402
405678
|
if (useLocalUpdate) {
|
|
405403
405679
|
process.stderr.write(`Prueba a actualizar a mano con:
|
|
405404
405680
|
`);
|
|
405405
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
405681
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
405406
405682
|
`);
|
|
405407
405683
|
} else {
|
|
405408
405684
|
process.stderr.write(`O p\xE1sate a la instalaci\xF3n nativa con: theus install
|
|
@@ -405870,8 +406146,8 @@ var init_effort3 = __esm(() => {
|
|
|
405870
406146
|
|
|
405871
406147
|
// utils/statsCache.ts
|
|
405872
406148
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
405873
|
-
import { open as
|
|
405874
|
-
import { join as
|
|
406149
|
+
import { open as open20 } from "fs/promises";
|
|
406150
|
+
import { join as join146 } from "path";
|
|
405875
406151
|
async function withStatsCacheLock(fn) {
|
|
405876
406152
|
while (statsCacheLockPromise) {
|
|
405877
406153
|
await statsCacheLockPromise;
|
|
@@ -405888,7 +406164,7 @@ async function withStatsCacheLock(fn) {
|
|
|
405888
406164
|
}
|
|
405889
406165
|
}
|
|
405890
406166
|
function getStatsCachePath() {
|
|
405891
|
-
return
|
|
406167
|
+
return join146(getTheusConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
405892
406168
|
}
|
|
405893
406169
|
function getEmptyCache() {
|
|
405894
406170
|
return {
|
|
@@ -405966,7 +406242,7 @@ async function saveStatsCache(cache4) {
|
|
|
405966
406242
|
await fs5.mkdir(configDir);
|
|
405967
406243
|
} catch {}
|
|
405968
406244
|
const content = jsonStringify(cache4, null, 2);
|
|
405969
|
-
const handle2 = await
|
|
406245
|
+
const handle2 = await open20(tempPath, "w", 384);
|
|
405970
406246
|
try {
|
|
405971
406247
|
await handle2.writeFile(content, { encoding: "utf-8" });
|
|
405972
406248
|
await handle2.sync();
|
|
@@ -406558,12 +406834,12 @@ var init_ansiToPng = __esm(() => {
|
|
|
406558
406834
|
// utils/screenshotClipboard.ts
|
|
406559
406835
|
import { mkdir as mkdir45, unlink as unlink21, writeFile as writeFile48 } from "fs/promises";
|
|
406560
406836
|
import { tmpdir as tmpdir11 } from "os";
|
|
406561
|
-
import { join as
|
|
406837
|
+
import { join as join147 } from "path";
|
|
406562
406838
|
async function copyAnsiToClipboard(ansiText, options2) {
|
|
406563
406839
|
try {
|
|
406564
|
-
const tempDir =
|
|
406840
|
+
const tempDir = join147(tmpdir11(), "theus-code-screenshots");
|
|
406565
406841
|
await mkdir45(tempDir, { recursive: true });
|
|
406566
|
-
const pngPath =
|
|
406842
|
+
const pngPath = join147(tempDir, `screenshot-${Date.now()}.png`);
|
|
406567
406843
|
const pngBuffer = ansiToPng(ansiText, options2);
|
|
406568
406844
|
await writeFile48(pngPath, pngBuffer);
|
|
406569
406845
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -406633,8 +406909,8 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
406633
406909
|
});
|
|
406634
406910
|
|
|
406635
406911
|
// utils/stats.ts
|
|
406636
|
-
import { open as
|
|
406637
|
-
import { basename as basename45, join as
|
|
406912
|
+
import { open as open21 } from "fs/promises";
|
|
406913
|
+
import { basename as basename45, join as join148, sep as sep29 } from "path";
|
|
406638
406914
|
async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
406639
406915
|
const { fromDate, toDate } = options2;
|
|
406640
406916
|
const fs5 = getFsImplementation();
|
|
@@ -406812,17 +407088,17 @@ async function getAllSessionFiles() {
|
|
|
406812
407088
|
return [];
|
|
406813
407089
|
throw e;
|
|
406814
407090
|
}
|
|
406815
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
407091
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join148(projectsDir, dirent.name));
|
|
406816
407092
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
406817
407093
|
try {
|
|
406818
407094
|
const entries = await fs5.readdir(projectDir);
|
|
406819
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
407095
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join148(projectDir, dirent.name));
|
|
406820
407096
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
406821
407097
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
406822
|
-
const subagentsDir =
|
|
407098
|
+
const subagentsDir = join148(projectDir, sessionDir.name, "subagents");
|
|
406823
407099
|
try {
|
|
406824
407100
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
406825
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
407101
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join148(subagentsDir, dirent.name));
|
|
406826
407102
|
} catch {
|
|
406827
407103
|
return [];
|
|
406828
407104
|
}
|
|
@@ -407122,7 +407398,7 @@ function calculateStreaks(dailyActivity) {
|
|
|
407122
407398
|
}
|
|
407123
407399
|
async function readSessionStartDate(filePath) {
|
|
407124
407400
|
try {
|
|
407125
|
-
const fd2 = await
|
|
407401
|
+
const fd2 = await open21(filePath, "r");
|
|
407126
407402
|
try {
|
|
407127
407403
|
const buf = Buffer.allocUnsafe(4096);
|
|
407128
407404
|
const { bytesRead } = await fd2.read(buf, 0, buf.length, 0);
|
|
@@ -409577,7 +409853,7 @@ __export(exports_assistant, {
|
|
|
409577
409853
|
NewInstallWizard: () => NewInstallWizard
|
|
409578
409854
|
});
|
|
409579
409855
|
import { existsSync as existsSync23, mkdirSync as mkdirSync10, readFileSync as readFileSync29, writeFileSync as writeFileSync9 } from "fs";
|
|
409580
|
-
import { dirname as dirname61, join as
|
|
409856
|
+
import { dirname as dirname61, join as join149, resolve as resolve43 } from "path";
|
|
409581
409857
|
async function computeDefaultInstallDir() {
|
|
409582
409858
|
try {
|
|
409583
409859
|
return getOriginalCwd();
|
|
@@ -409602,16 +409878,16 @@ function writeJson(path17, value) {
|
|
|
409602
409878
|
}
|
|
409603
409879
|
function installAssistant(dir) {
|
|
409604
409880
|
const root2 = resolve43(dir);
|
|
409605
|
-
const theusDir =
|
|
409606
|
-
const settingsPath =
|
|
409881
|
+
const theusDir = join149(root2, ".theus");
|
|
409882
|
+
const settingsPath = join149(theusDir, "settings.json");
|
|
409607
409883
|
const settings = readJsonSafe(settingsPath);
|
|
409608
409884
|
settings.assistant = true;
|
|
409609
409885
|
writeJson(settingsPath, settings);
|
|
409610
|
-
const localPath =
|
|
409886
|
+
const localPath = join149(theusDir, "settings.local.json");
|
|
409611
409887
|
const local = readJsonSafe(localPath);
|
|
409612
409888
|
local.defaultView = "chat";
|
|
409613
409889
|
writeJson(localPath, local);
|
|
409614
|
-
const agentPath =
|
|
409890
|
+
const agentPath = join149(theusDir, "agents", "assistant.md");
|
|
409615
409891
|
mkdirSync10(dirname61(agentPath), { recursive: true });
|
|
409616
409892
|
writeFileSync9(agentPath, ASSISTANT_AGENT_MD, "utf8");
|
|
409617
409893
|
return root2;
|
|
@@ -411274,11 +411550,11 @@ function BuddyPanel({
|
|
|
411274
411550
|
/* @__PURE__ */ jsx_runtime369.jsx(ThemedBox_default, {
|
|
411275
411551
|
flexDirection: "column",
|
|
411276
411552
|
marginTop: 1,
|
|
411277
|
-
children: STAT_NAMES.map((
|
|
411278
|
-
label: STAT_ES[
|
|
411279
|
-
value: companion.stats[
|
|
411553
|
+
children: STAT_NAMES.map((stat48) => /* @__PURE__ */ jsx_runtime369.jsx(StatRow, {
|
|
411554
|
+
label: STAT_ES[stat48],
|
|
411555
|
+
value: companion.stats[stat48],
|
|
411280
411556
|
color: color3
|
|
411281
|
-
},
|
|
411557
|
+
}, stat48))
|
|
411282
411558
|
}),
|
|
411283
411559
|
muted && /* @__PURE__ */ jsx_runtime369.jsx(ThemedBox_default, {
|
|
411284
411560
|
marginTop: 1,
|
|
@@ -411995,13 +412271,13 @@ import {
|
|
|
411995
412271
|
appendFile as fsAppendFile,
|
|
411996
412272
|
open as fsOpen2,
|
|
411997
412273
|
mkdir as mkdir46,
|
|
411998
|
-
readdir as
|
|
411999
|
-
readFile as
|
|
412000
|
-
stat as
|
|
412274
|
+
readdir as readdir34,
|
|
412275
|
+
readFile as readFile56,
|
|
412276
|
+
stat as stat48,
|
|
412001
412277
|
unlink as unlink22,
|
|
412002
412278
|
writeFile as writeFile49
|
|
412003
412279
|
} from "fs/promises";
|
|
412004
|
-
import { basename as basename48, dirname as dirname62, join as
|
|
412280
|
+
import { basename as basename48, dirname as dirname62, join as join150 } from "path";
|
|
412005
412281
|
function isTranscriptMessage(entry) {
|
|
412006
412282
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
412007
412283
|
}
|
|
@@ -412015,18 +412291,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
412015
412291
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
412016
412292
|
}
|
|
412017
412293
|
function getProjectsDir2() {
|
|
412018
|
-
return
|
|
412294
|
+
return join150(getTheusConfigHomeDir(), "projects");
|
|
412019
412295
|
}
|
|
412020
412296
|
function getTranscriptPath() {
|
|
412021
412297
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
412022
|
-
return
|
|
412298
|
+
return join150(projectDir, `${getSessionId()}.jsonl`);
|
|
412023
412299
|
}
|
|
412024
412300
|
function getTranscriptPathForSession(sessionId) {
|
|
412025
412301
|
if (sessionId === getSessionId()) {
|
|
412026
412302
|
return getTranscriptPath();
|
|
412027
412303
|
}
|
|
412028
412304
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
412029
|
-
return
|
|
412305
|
+
return join150(projectDir, `${sessionId}.jsonl`);
|
|
412030
412306
|
}
|
|
412031
412307
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
412032
412308
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -412038,8 +412314,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
412038
412314
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
412039
412315
|
const sessionId = getSessionId();
|
|
412040
412316
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
412041
|
-
const base2 = subdir ?
|
|
412042
|
-
return
|
|
412317
|
+
const base2 = subdir ? join150(projectDir, sessionId, "subagents", subdir) : join150(projectDir, sessionId, "subagents");
|
|
412318
|
+
return join150(base2, `agent-${agentId}.jsonl`);
|
|
412043
412319
|
}
|
|
412044
412320
|
function getAgentMetadataPath(agentId) {
|
|
412045
412321
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -412052,7 +412328,7 @@ async function writeAgentMetadata(agentId, metadata) {
|
|
|
412052
412328
|
async function readAgentMetadata(agentId) {
|
|
412053
412329
|
const path17 = getAgentMetadataPath(agentId);
|
|
412054
412330
|
try {
|
|
412055
|
-
const raw = await
|
|
412331
|
+
const raw = await readFile56(path17, "utf-8");
|
|
412056
412332
|
return JSON.parse(raw);
|
|
412057
412333
|
} catch (e) {
|
|
412058
412334
|
if (isFsInaccessible(e))
|
|
@@ -412062,10 +412338,10 @@ async function readAgentMetadata(agentId) {
|
|
|
412062
412338
|
}
|
|
412063
412339
|
function getRemoteAgentsDir() {
|
|
412064
412340
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
412065
|
-
return
|
|
412341
|
+
return join150(projectDir, getSessionId(), "remote-agents");
|
|
412066
412342
|
}
|
|
412067
412343
|
function getRemoteAgentMetadataPath(taskId) {
|
|
412068
|
-
return
|
|
412344
|
+
return join150(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
412069
412345
|
}
|
|
412070
412346
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
412071
412347
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
@@ -412075,7 +412351,7 @@ async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
|
412075
412351
|
async function readRemoteAgentMetadata(taskId) {
|
|
412076
412352
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
412077
412353
|
try {
|
|
412078
|
-
const raw = await
|
|
412354
|
+
const raw = await readFile56(path17, "utf-8");
|
|
412079
412355
|
return JSON.parse(raw);
|
|
412080
412356
|
} catch (e) {
|
|
412081
412357
|
if (isFsInaccessible(e))
|
|
@@ -412097,7 +412373,7 @@ async function listRemoteAgentMetadata() {
|
|
|
412097
412373
|
const dir = getRemoteAgentsDir();
|
|
412098
412374
|
let entries;
|
|
412099
412375
|
try {
|
|
412100
|
-
entries = await
|
|
412376
|
+
entries = await readdir34(dir, { withFileTypes: true });
|
|
412101
412377
|
} catch (e) {
|
|
412102
412378
|
if (isFsInaccessible(e))
|
|
412103
412379
|
return [];
|
|
@@ -412108,7 +412384,7 @@ async function listRemoteAgentMetadata() {
|
|
|
412108
412384
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
412109
412385
|
continue;
|
|
412110
412386
|
try {
|
|
412111
|
-
const raw = await
|
|
412387
|
+
const raw = await readFile56(join150(dir, entry.name), "utf-8");
|
|
412112
412388
|
results.push(JSON.parse(raw));
|
|
412113
412389
|
} catch (e) {
|
|
412114
412390
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -412118,7 +412394,7 @@ async function listRemoteAgentMetadata() {
|
|
|
412118
412394
|
}
|
|
412119
412395
|
function sessionIdExists(sessionId) {
|
|
412120
412396
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
412121
|
-
const sessionFile =
|
|
412397
|
+
const sessionFile = join150(projectDir, `${sessionId}.jsonl`);
|
|
412122
412398
|
const fs5 = getFsImplementation();
|
|
412123
412399
|
try {
|
|
412124
412400
|
fs5.statSync(sessionFile);
|
|
@@ -412450,7 +412726,7 @@ class Project {
|
|
|
412450
412726
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
412451
412727
|
return;
|
|
412452
412728
|
}
|
|
412453
|
-
const content = await
|
|
412729
|
+
const content = await readFile56(this.sessionFile, { encoding: "utf-8" });
|
|
412454
412730
|
const lines = content.split(`
|
|
412455
412731
|
`).filter((line) => {
|
|
412456
412732
|
if (!line.trim())
|
|
@@ -412660,7 +412936,7 @@ class Project {
|
|
|
412660
412936
|
return cached3;
|
|
412661
412937
|
const targetFile = getTranscriptPathForSession(sessionId);
|
|
412662
412938
|
try {
|
|
412663
|
-
await
|
|
412939
|
+
await stat48(targetFile);
|
|
412664
412940
|
this.existingSessionFiles.set(sessionId, targetFile);
|
|
412665
412941
|
return targetFile;
|
|
412666
412942
|
} catch (e) {
|
|
@@ -413260,7 +413536,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
413260
413536
|
worktreeSession: worktreeStates.has(sessionId) ? worktreeStates.get(sessionId) : undefined
|
|
413261
413537
|
};
|
|
413262
413538
|
}
|
|
413263
|
-
const content = await
|
|
413539
|
+
const content = await readFile56(filePath, { encoding: "utf-8" });
|
|
413264
413540
|
let parsed;
|
|
413265
413541
|
try {
|
|
413266
413542
|
parsed = jsonParse(content);
|
|
@@ -413912,7 +414188,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413912
414188
|
let metadataLines = null;
|
|
413913
414189
|
let hasPreservedSegment = false;
|
|
413914
414190
|
if (!isEnvTruthy(process.env.THEUS_CODE_DISABLE_PRECOMPACT_SKIP)) {
|
|
413915
|
-
const { size } = await
|
|
414191
|
+
const { size } = await stat48(filePath);
|
|
413916
414192
|
if (size > SKIP_PRECOMPACT_THRESHOLD) {
|
|
413917
414193
|
const scan = await readTranscriptForLoad(filePath, size);
|
|
413918
414194
|
buf = scan.postBoundaryBuf;
|
|
@@ -413922,7 +414198,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413922
414198
|
}
|
|
413923
414199
|
}
|
|
413924
414200
|
}
|
|
413925
|
-
buf ??= await
|
|
414201
|
+
buf ??= await readFile56(filePath);
|
|
413926
414202
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.THEUS_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
413927
414203
|
buf = walkChainBeforeParse(buf);
|
|
413928
414204
|
}
|
|
@@ -414087,7 +414363,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
414087
414363
|
};
|
|
414088
414364
|
}
|
|
414089
414365
|
async function loadSessionFile(sessionId) {
|
|
414090
|
-
const sessionFile =
|
|
414366
|
+
const sessionFile = join150(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
414091
414367
|
return loadTranscriptFile(sessionFile);
|
|
414092
414368
|
}
|
|
414093
414369
|
function clearSessionMessagesCache() {
|
|
@@ -414151,11 +414427,11 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
414151
414427
|
const projectsDir = getProjectsDir2();
|
|
414152
414428
|
let dirents;
|
|
414153
414429
|
try {
|
|
414154
|
-
dirents = await
|
|
414430
|
+
dirents = await readdir34(projectsDir, { withFileTypes: true });
|
|
414155
414431
|
} catch {
|
|
414156
414432
|
return [];
|
|
414157
414433
|
}
|
|
414158
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
414434
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join150(projectsDir, dirent.name));
|
|
414159
414435
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
414160
414436
|
const allLogs = logsPerProject.flat();
|
|
414161
414437
|
const deduped = new Map;
|
|
@@ -414176,11 +414452,11 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
414176
414452
|
const projectsDir = getProjectsDir2();
|
|
414177
414453
|
let dirents;
|
|
414178
414454
|
try {
|
|
414179
|
-
dirents = await
|
|
414455
|
+
dirents = await readdir34(projectsDir, { withFileTypes: true });
|
|
414180
414456
|
} catch {
|
|
414181
414457
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
414182
414458
|
}
|
|
414183
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
414459
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join150(projectsDir, dirent.name));
|
|
414184
414460
|
const rawLogs = [];
|
|
414185
414461
|
for (const projectDir of projectDirs) {
|
|
414186
414462
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -414226,7 +414502,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
414226
414502
|
const seenDirs = new Set;
|
|
414227
414503
|
let allDirents;
|
|
414228
414504
|
try {
|
|
414229
|
-
allDirents = await
|
|
414505
|
+
allDirents = await readdir34(projectsDir, { withFileTypes: true });
|
|
414230
414506
|
} catch (e) {
|
|
414231
414507
|
logForDebugging(`Failed to read projects dir ${projectsDir}, falling back to current project: ${e}`);
|
|
414232
414508
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
@@ -414241,7 +414517,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
414241
414517
|
for (const { path: wtPath, prefix } of indexed) {
|
|
414242
414518
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
414243
414519
|
seenDirs.add(dirName);
|
|
414244
|
-
allLogs.push(...await getSessionFilesLite(
|
|
414520
|
+
allLogs.push(...await getSessionFilesLite(join150(projectsDir, dirent.name), undefined, wtPath));
|
|
414245
414521
|
break;
|
|
414246
414522
|
}
|
|
414247
414523
|
}
|
|
@@ -414310,10 +414586,10 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
414310
414586
|
return transcripts;
|
|
414311
414587
|
}
|
|
414312
414588
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
414313
|
-
const subagentsDir =
|
|
414589
|
+
const subagentsDir = join150(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), getSessionId(), "subagents");
|
|
414314
414590
|
let entries;
|
|
414315
414591
|
try {
|
|
414316
|
-
entries = await
|
|
414592
|
+
entries = await readdir34(subagentsDir, { withFileTypes: true });
|
|
414317
414593
|
} catch {
|
|
414318
414594
|
return {};
|
|
414319
414595
|
}
|
|
@@ -414427,7 +414703,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
414427
414703
|
const sessionFilesMap = new Map;
|
|
414428
414704
|
let dirents;
|
|
414429
414705
|
try {
|
|
414430
|
-
dirents = await
|
|
414706
|
+
dirents = await readdir34(projectDir, { withFileTypes: true });
|
|
414431
414707
|
} catch {
|
|
414432
414708
|
return sessionFilesMap;
|
|
414433
414709
|
}
|
|
@@ -414438,11 +414714,11 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
414438
414714
|
const sessionId = validateUuid2(basename48(dirent.name, ".jsonl"));
|
|
414439
414715
|
if (!sessionId)
|
|
414440
414716
|
continue;
|
|
414441
|
-
candidates.push({ sessionId, filePath:
|
|
414717
|
+
candidates.push({ sessionId, filePath: join150(projectDir, dirent.name) });
|
|
414442
414718
|
}
|
|
414443
414719
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
414444
414720
|
try {
|
|
414445
|
-
const st = await
|
|
414721
|
+
const st = await stat48(filePath);
|
|
414446
414722
|
sessionFilesMap.set(sessionId, {
|
|
414447
414723
|
path: filePath,
|
|
414448
414724
|
mtime: st.mtime.getTime(),
|
|
@@ -414825,7 +415101,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
414825
415101
|
init_settings2();
|
|
414826
415102
|
init_slowOperations();
|
|
414827
415103
|
init_uuid();
|
|
414828
|
-
VERSION4 = { VERSION: "0.2.
|
|
415104
|
+
VERSION4 = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
414829
415105
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
414830
415106
|
SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
414831
415107
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -414837,7 +415113,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
414837
415113
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
414838
415114
|
agentTranscriptSubdirs = new Map;
|
|
414839
415115
|
getProjectDir3 = memoize_default((projectDir) => {
|
|
414840
|
-
return
|
|
415116
|
+
return join150(getProjectsDir2(), sanitizePath2(projectDir));
|
|
414841
415117
|
});
|
|
414842
415118
|
METADATA_TYPE_MARKERS = [
|
|
414843
415119
|
'"type":"summary"',
|
|
@@ -415075,41 +415351,41 @@ var init_memdir = __esm(() => {
|
|
|
415075
415351
|
});
|
|
415076
415352
|
|
|
415077
415353
|
// tools/AgentTool/agentMemory.ts
|
|
415078
|
-
import { join as
|
|
415354
|
+
import { join as join151, normalize as normalize14, sep as sep30 } from "path";
|
|
415079
415355
|
function sanitizeAgentTypeForPath(agentType) {
|
|
415080
415356
|
return agentType.replace(/:/g, "-");
|
|
415081
415357
|
}
|
|
415082
415358
|
function getLocalAgentMemoryDir(dirName) {
|
|
415083
415359
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
415084
|
-
return
|
|
415360
|
+
return join151(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep30;
|
|
415085
415361
|
}
|
|
415086
|
-
return
|
|
415362
|
+
return join151(getCwd(), ".theus", "agent-memory-local", dirName) + sep30;
|
|
415087
415363
|
}
|
|
415088
415364
|
function getAgentMemoryDir(agentType, scope) {
|
|
415089
415365
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
415090
415366
|
switch (scope) {
|
|
415091
415367
|
case "project":
|
|
415092
|
-
return
|
|
415368
|
+
return join151(getCwd(), ".theus", "agent-memory", dirName) + sep30;
|
|
415093
415369
|
case "local":
|
|
415094
415370
|
return getLocalAgentMemoryDir(dirName);
|
|
415095
415371
|
case "user":
|
|
415096
|
-
return
|
|
415372
|
+
return join151(getMemoryBaseDir(), "agent-memory", dirName) + sep30;
|
|
415097
415373
|
}
|
|
415098
415374
|
}
|
|
415099
415375
|
function isAgentMemoryPath(absolutePath) {
|
|
415100
415376
|
const normalizedPath = normalize14(absolutePath);
|
|
415101
415377
|
const memoryBase = getMemoryBaseDir();
|
|
415102
|
-
if (normalizedPath.startsWith(
|
|
415378
|
+
if (normalizedPath.startsWith(join151(memoryBase, "agent-memory") + sep30)) {
|
|
415103
415379
|
return true;
|
|
415104
415380
|
}
|
|
415105
|
-
if (normalizedPath.startsWith(
|
|
415381
|
+
if (normalizedPath.startsWith(join151(getCwd(), ".theus", "agent-memory") + sep30)) {
|
|
415106
415382
|
return true;
|
|
415107
415383
|
}
|
|
415108
415384
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
415109
|
-
if (normalizedPath.includes(sep30 + "agent-memory-local" + sep30) && normalizedPath.startsWith(
|
|
415385
|
+
if (normalizedPath.includes(sep30 + "agent-memory-local" + sep30) && normalizedPath.startsWith(join151(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects") + sep30)) {
|
|
415110
415386
|
return true;
|
|
415111
415387
|
}
|
|
415112
|
-
} else if (normalizedPath.startsWith(
|
|
415388
|
+
} else if (normalizedPath.startsWith(join151(getCwd(), ".theus", "agent-memory-local") + sep30)) {
|
|
415113
415389
|
return true;
|
|
415114
415390
|
}
|
|
415115
415391
|
return false;
|
|
@@ -415117,7 +415393,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
415117
415393
|
function getMemoryScopeDisplay(memory2) {
|
|
415118
415394
|
switch (memory2) {
|
|
415119
415395
|
case "user":
|
|
415120
|
-
return `User (${
|
|
415396
|
+
return `User (${join151(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
415121
415397
|
case "project":
|
|
415122
415398
|
return "Project (.theus/agent-memory/)";
|
|
415123
415399
|
case "local":
|
|
@@ -415160,7 +415436,7 @@ var init_agentMemory = __esm(() => {
|
|
|
415160
415436
|
// utils/permissions/filesystem.ts
|
|
415161
415437
|
import { randomBytes as randomBytes21 } from "crypto";
|
|
415162
415438
|
import { homedir as homedir39, tmpdir as tmpdir12 } from "os";
|
|
415163
|
-
import { join as
|
|
415439
|
+
import { join as join152, normalize as normalize15, posix as posix7, sep as sep31 } from "path";
|
|
415164
415440
|
function normalizeCaseForComparison(path17) {
|
|
415165
415441
|
return path17.toLowerCase();
|
|
415166
415442
|
}
|
|
@@ -415169,11 +415445,11 @@ function getTheusSkillScope(filePath) {
|
|
|
415169
415445
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
415170
415446
|
const bases = [
|
|
415171
415447
|
{
|
|
415172
|
-
dir: expandPath(
|
|
415448
|
+
dir: expandPath(join152(getOriginalCwd(), ".theus", "skills")),
|
|
415173
415449
|
prefix: "/.theus/skills/"
|
|
415174
415450
|
},
|
|
415175
415451
|
{
|
|
415176
|
-
dir: expandPath(
|
|
415452
|
+
dir: expandPath(join152(homedir39(), ".theus", "skills")),
|
|
415177
415453
|
prefix: "~/.theus/skills/"
|
|
415178
415454
|
}
|
|
415179
415455
|
];
|
|
@@ -415228,21 +415504,21 @@ function isTheusConfigFilePath(filePath) {
|
|
|
415228
415504
|
if (isTheusSettingsPath(filePath)) {
|
|
415229
415505
|
return true;
|
|
415230
415506
|
}
|
|
415231
|
-
const commandsDir =
|
|
415232
|
-
const agentsDir =
|
|
415233
|
-
const skillsDir =
|
|
415507
|
+
const commandsDir = join152(getOriginalCwd(), ".theus", "commands");
|
|
415508
|
+
const agentsDir = join152(getOriginalCwd(), ".theus", "agents");
|
|
415509
|
+
const skillsDir = join152(getOriginalCwd(), ".theus", "skills");
|
|
415234
415510
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
415235
415511
|
}
|
|
415236
415512
|
function isSessionPlanFile(absolutePath) {
|
|
415237
|
-
const expectedPrefix =
|
|
415513
|
+
const expectedPrefix = join152(getPlansDirectory(), getPlanSlug());
|
|
415238
415514
|
const normalizedPath = normalize15(absolutePath);
|
|
415239
415515
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
415240
415516
|
}
|
|
415241
415517
|
function getSessionMemoryDir() {
|
|
415242
|
-
return
|
|
415518
|
+
return join152(getProjectDir3(getCwd()), getSessionId(), "session-memory") + sep31;
|
|
415243
415519
|
}
|
|
415244
415520
|
function getSessionMemoryPath() {
|
|
415245
|
-
return
|
|
415521
|
+
return join152(getSessionMemoryDir(), "summary.md");
|
|
415246
415522
|
}
|
|
415247
415523
|
function isSessionMemoryPath(absolutePath) {
|
|
415248
415524
|
const normalizedPath = normalize15(absolutePath);
|
|
@@ -415264,10 +415540,10 @@ function getTheusTempDirName() {
|
|
|
415264
415540
|
return `theus-${uid}`;
|
|
415265
415541
|
}
|
|
415266
415542
|
function getProjectTempDir() {
|
|
415267
|
-
return
|
|
415543
|
+
return join152(getTheusTempDir(), sanitizePath2(getOriginalCwd())) + sep31;
|
|
415268
415544
|
}
|
|
415269
415545
|
function getScratchpadDir() {
|
|
415270
|
-
return
|
|
415546
|
+
return join152(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
415271
415547
|
}
|
|
415272
415548
|
async function ensureScratchpadDir() {
|
|
415273
415549
|
if (!isScratchpadEnabled()) {
|
|
@@ -415845,7 +416121,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
415845
416121
|
}
|
|
415846
416122
|
};
|
|
415847
416123
|
}
|
|
415848
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
416124
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join152(getOriginalCwd(), ".theus", "launch.json"))) {
|
|
415849
416125
|
return {
|
|
415850
416126
|
behavior: "allow",
|
|
415851
416127
|
updatedInput: input,
|
|
@@ -415942,7 +416218,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
415942
416218
|
}
|
|
415943
416219
|
};
|
|
415944
416220
|
}
|
|
415945
|
-
const tasksDir =
|
|
416221
|
+
const tasksDir = join152(getTheusConfigHomeDir(), "tasks") + sep31;
|
|
415946
416222
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
415947
416223
|
return {
|
|
415948
416224
|
behavior: "allow",
|
|
@@ -415953,7 +416229,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
415953
416229
|
}
|
|
415954
416230
|
};
|
|
415955
416231
|
}
|
|
415956
|
-
const teamsReadDir =
|
|
416232
|
+
const teamsReadDir = join152(getTheusConfigHomeDir(), "teams") + sep31;
|
|
415957
416233
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
415958
416234
|
return {
|
|
415959
416235
|
behavior: "allow",
|
|
@@ -416026,11 +416302,11 @@ var init_filesystem = __esm(() => {
|
|
|
416026
416302
|
try {
|
|
416027
416303
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
416028
416304
|
} catch {}
|
|
416029
|
-
return
|
|
416305
|
+
return join152(resolvedBaseTmpDir, getTheusTempDirName()) + sep31;
|
|
416030
416306
|
});
|
|
416031
416307
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
416032
416308
|
const nonce = randomBytes21(16).toString("hex");
|
|
416033
|
-
return
|
|
416309
|
+
return join152(getTheusTempDir(), "bundled-skills", { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
416034
416310
|
});
|
|
416035
416311
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
416036
416312
|
});
|
|
@@ -416039,15 +416315,15 @@ var init_filesystem = __esm(() => {
|
|
|
416039
416315
|
import { constants as fsConstants6 } from "fs";
|
|
416040
416316
|
import {
|
|
416041
416317
|
mkdir as mkdir47,
|
|
416042
|
-
open as
|
|
416043
|
-
stat as
|
|
416318
|
+
open as open22,
|
|
416319
|
+
stat as stat49,
|
|
416044
416320
|
symlink as symlink6,
|
|
416045
416321
|
unlink as unlink23
|
|
416046
416322
|
} from "fs/promises";
|
|
416047
|
-
import { join as
|
|
416323
|
+
import { join as join153 } from "path";
|
|
416048
416324
|
function getTaskOutputDir() {
|
|
416049
416325
|
if (_taskOutputDir === undefined) {
|
|
416050
|
-
_taskOutputDir =
|
|
416326
|
+
_taskOutputDir = join153(getProjectTempDir(), getSessionId(), "tasks");
|
|
416051
416327
|
}
|
|
416052
416328
|
return _taskOutputDir;
|
|
416053
416329
|
}
|
|
@@ -416055,7 +416331,7 @@ async function ensureOutputDir() {
|
|
|
416055
416331
|
await mkdir47(getTaskOutputDir(), { recursive: true });
|
|
416056
416332
|
}
|
|
416057
416333
|
function getTaskOutputPath(taskId) {
|
|
416058
|
-
return
|
|
416334
|
+
return join153(getTaskOutputDir(), `${taskId}.output`);
|
|
416059
416335
|
}
|
|
416060
416336
|
function track(p) {
|
|
416061
416337
|
_pendingOps.add(p);
|
|
@@ -416105,7 +416381,7 @@ class DiskTaskOutput {
|
|
|
416105
416381
|
try {
|
|
416106
416382
|
if (!this.#fileHandle) {
|
|
416107
416383
|
await ensureOutputDir();
|
|
416108
|
-
this.#fileHandle = await
|
|
416384
|
+
this.#fileHandle = await open22(this.#path, process.platform === "win32" ? "a" : fsConstants6.O_WRONLY | fsConstants6.O_APPEND | fsConstants6.O_CREAT | O_NOFOLLOW2);
|
|
416109
416385
|
}
|
|
416110
416386
|
while (true) {
|
|
416111
416387
|
await this.#writeAllChunks();
|
|
@@ -416222,7 +416498,7 @@ function initTaskOutput(taskId) {
|
|
|
416222
416498
|
return track((async () => {
|
|
416223
416499
|
await ensureOutputDir();
|
|
416224
416500
|
const outputPath = getTaskOutputPath(taskId);
|
|
416225
|
-
const fh = await
|
|
416501
|
+
const fh = await open22(outputPath, process.platform === "win32" ? "wx" : fsConstants6.O_WRONLY | fsConstants6.O_CREAT | fsConstants6.O_EXCL | O_NOFOLLOW2);
|
|
416226
416502
|
await fh.close();
|
|
416227
416503
|
return outputPath;
|
|
416228
416504
|
})());
|
|
@@ -416304,7 +416580,7 @@ var init_Task = __esm(() => {
|
|
|
416304
416580
|
});
|
|
416305
416581
|
|
|
416306
416582
|
// utils/ShellCommand.ts
|
|
416307
|
-
import { stat as
|
|
416583
|
+
import { stat as stat50 } from "fs/promises";
|
|
416308
416584
|
function prependStderr(prefix, stderr) {
|
|
416309
416585
|
return stderr ? `${prefix} ${stderr}` : prefix;
|
|
416310
416586
|
}
|
|
@@ -416428,7 +416704,7 @@ class ShellCommandImpl {
|
|
|
416428
416704
|
}
|
|
416429
416705
|
#startSizeWatchdog() {
|
|
416430
416706
|
this.#sizeWatchdog = setInterval(() => {
|
|
416431
|
-
|
|
416707
|
+
stat50(this.taskOutput.path).then((s) => {
|
|
416432
416708
|
if (s.size > this.#maxOutputBytes && this.#status === "backgrounded" && this.#sizeWatchdog !== null) {
|
|
416433
416709
|
this.#killedForSize = true;
|
|
416434
416710
|
this.#clearSizeWatchdog();
|
|
@@ -420291,7 +420567,7 @@ var init_hooks5 = __esm(() => {
|
|
|
420291
420567
|
});
|
|
420292
420568
|
|
|
420293
420569
|
// utils/settings/changeDetector.ts
|
|
420294
|
-
import { stat as
|
|
420570
|
+
import { stat as stat51 } from "fs/promises";
|
|
420295
420571
|
import * as platformPath from "path";
|
|
420296
420572
|
async function initialize() {
|
|
420297
420573
|
if (getIsRemoteMode())
|
|
@@ -420371,7 +420647,7 @@ async function getWatchTargets() {
|
|
|
420371
420647
|
}
|
|
420372
420648
|
dirToSettingsFiles.get(dir).add(path17);
|
|
420373
420649
|
try {
|
|
420374
|
-
const stats2 = await
|
|
420650
|
+
const stats2 = await stat51(path17);
|
|
420375
420651
|
if (stats2.isFile()) {
|
|
420376
420652
|
dirsWithExistingFiles.add(dir);
|
|
420377
420653
|
}
|
|
@@ -420389,7 +420665,7 @@ async function getWatchTargets() {
|
|
|
420389
420665
|
let dropInDir = null;
|
|
420390
420666
|
const managedDropIn = getManagedSettingsDropInDir();
|
|
420391
420667
|
try {
|
|
420392
|
-
const stats2 = await
|
|
420668
|
+
const stats2 = await stat51(managedDropIn);
|
|
420393
420669
|
if (stats2.isDirectory()) {
|
|
420394
420670
|
dirsWithExistingFiles.add(managedDropIn);
|
|
420395
420671
|
dropInDir = managedDropIn;
|
|
@@ -420569,8 +420845,8 @@ __export(exports_sandbox_adapter, {
|
|
|
420569
420845
|
SandboxManager: () => SandboxManager2
|
|
420570
420846
|
});
|
|
420571
420847
|
import { rmSync as rmSync5, statSync as statSync13 } from "fs";
|
|
420572
|
-
import { readFile as
|
|
420573
|
-
import { join as
|
|
420848
|
+
import { readFile as readFile57 } from "fs/promises";
|
|
420849
|
+
import { join as join154, resolve as resolve46, sep as sep33 } from "path";
|
|
420574
420850
|
function permissionRuleValueFromString2(ruleString) {
|
|
420575
420851
|
const matches = ruleString.match(/^([^(]+)\(([^)]+)\)$/);
|
|
420576
420852
|
if (!matches) {
|
|
@@ -420752,9 +421028,9 @@ function scrubBareGitRepoFiles() {
|
|
|
420752
421028
|
}
|
|
420753
421029
|
}
|
|
420754
421030
|
async function detectWorktreeMainRepoPath(cwd2) {
|
|
420755
|
-
const gitPath =
|
|
421031
|
+
const gitPath = join154(cwd2, ".git");
|
|
420756
421032
|
try {
|
|
420757
|
-
const gitContent = await
|
|
421033
|
+
const gitContent = await readFile57(gitPath, { encoding: "utf8" });
|
|
420758
421034
|
const gitdirMatch = gitContent.match(/^gitdir:\s*(.+)$/m);
|
|
420759
421035
|
if (!gitdirMatch?.[1]) {
|
|
420760
421036
|
return null;
|
|
@@ -421279,8 +421555,8 @@ var init_pathValidation3 = __esm(() => {
|
|
|
421279
421555
|
|
|
421280
421556
|
// utils/plugins/pluginDirectories.ts
|
|
421281
421557
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
421282
|
-
import { readdir as
|
|
421283
|
-
import { delimiter as delimiter3, join as
|
|
421558
|
+
import { readdir as readdir35, rm as rm10, stat as stat52 } from "fs/promises";
|
|
421559
|
+
import { delimiter as delimiter3, join as join155 } from "path";
|
|
421284
421560
|
function getPluginsDirectoryName() {
|
|
421285
421561
|
if (getUseCoworkPlugins()) {
|
|
421286
421562
|
return COWORK_PLUGINS_DIR;
|
|
@@ -421295,7 +421571,7 @@ function getPluginsDirectory() {
|
|
|
421295
421571
|
if (envOverride) {
|
|
421296
421572
|
return expandTilde2(envOverride);
|
|
421297
421573
|
}
|
|
421298
|
-
return
|
|
421574
|
+
return join155(getTheusConfigHomeDir(), getPluginsDirectoryName());
|
|
421299
421575
|
}
|
|
421300
421576
|
function getPluginSeedDirs() {
|
|
421301
421577
|
const raw = process.env.THEUS_CODE_PLUGIN_SEED_DIR;
|
|
@@ -421307,7 +421583,7 @@ function sanitizePluginId(pluginId) {
|
|
|
421307
421583
|
return pluginId.replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
421308
421584
|
}
|
|
421309
421585
|
function pluginDataDirPath(pluginId) {
|
|
421310
|
-
return
|
|
421586
|
+
return join155(getPluginsDirectory(), "data", sanitizePluginId(pluginId));
|
|
421311
421587
|
}
|
|
421312
421588
|
function getPluginDataDir(pluginId) {
|
|
421313
421589
|
const dir = pluginDataDirPath(pluginId);
|
|
@@ -421318,13 +421594,13 @@ async function getPluginDataDirSize(pluginId) {
|
|
|
421318
421594
|
const dir = pluginDataDirPath(pluginId);
|
|
421319
421595
|
let bytes = 0;
|
|
421320
421596
|
const walk = async (p) => {
|
|
421321
|
-
for (const entry of await
|
|
421322
|
-
const full =
|
|
421597
|
+
for (const entry of await readdir35(p, { withFileTypes: true })) {
|
|
421598
|
+
const full = join155(p, entry.name);
|
|
421323
421599
|
if (entry.isDirectory()) {
|
|
421324
421600
|
await walk(full);
|
|
421325
421601
|
} else {
|
|
421326
421602
|
try {
|
|
421327
|
-
bytes += (await
|
|
421603
|
+
bytes += (await stat52(full)).size;
|
|
421328
421604
|
} catch {}
|
|
421329
421605
|
}
|
|
421330
421606
|
}
|
|
@@ -421359,8 +421635,8 @@ var init_pluginDirectories = __esm(() => {
|
|
|
421359
421635
|
});
|
|
421360
421636
|
|
|
421361
421637
|
// utils/plugins/lspPluginIntegration.ts
|
|
421362
|
-
import { readFile as
|
|
421363
|
-
import { join as
|
|
421638
|
+
import { readFile as readFile58 } from "fs/promises";
|
|
421639
|
+
import { join as join156, relative as relative31, resolve as resolve48 } from "path";
|
|
421364
421640
|
function validatePathWithinPlugin(pluginPath, relativePath2) {
|
|
421365
421641
|
const resolvedPluginPath = resolve48(pluginPath);
|
|
421366
421642
|
const resolvedFilePath = resolve48(pluginPath, relativePath2);
|
|
@@ -421372,9 +421648,9 @@ function validatePathWithinPlugin(pluginPath, relativePath2) {
|
|
|
421372
421648
|
}
|
|
421373
421649
|
async function loadPluginLspServers(plugin2, errors4 = []) {
|
|
421374
421650
|
const servers = {};
|
|
421375
|
-
const lspJsonPath =
|
|
421651
|
+
const lspJsonPath = join156(plugin2.path, ".lsp.json");
|
|
421376
421652
|
try {
|
|
421377
|
-
const content = await
|
|
421653
|
+
const content = await readFile58(lspJsonPath, "utf-8");
|
|
421378
421654
|
const parsed = jsonParse(content);
|
|
421379
421655
|
const result = exports_external.record(exports_external.string(), LspServerConfigSchema()).safeParse(parsed);
|
|
421380
421656
|
if (result.success) {
|
|
@@ -421431,7 +421707,7 @@ async function loadLspServersFromManifest(declaration, pluginPath, pluginName, e
|
|
|
421431
421707
|
continue;
|
|
421432
421708
|
}
|
|
421433
421709
|
try {
|
|
421434
|
-
const content = await
|
|
421710
|
+
const content = await readFile58(validatedPath, "utf-8");
|
|
421435
421711
|
const parsed = jsonParse(content);
|
|
421436
421712
|
const result = exports_external.record(exports_external.string(), LspServerConfigSchema()).safeParse(parsed);
|
|
421437
421713
|
if (result.success) {
|
|
@@ -426631,9 +426907,9 @@ __export(exports_upstreamproxy, {
|
|
|
426631
426907
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
426632
426908
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
426633
426909
|
});
|
|
426634
|
-
import { mkdir as mkdir48, readFile as
|
|
426910
|
+
import { mkdir as mkdir48, readFile as readFile59, unlink as unlink24, writeFile as writeFile50 } from "fs/promises";
|
|
426635
426911
|
import { homedir as homedir41 } from "os";
|
|
426636
|
-
import { join as
|
|
426912
|
+
import { join as join157 } from "path";
|
|
426637
426913
|
async function initUpstreamProxy(opts) {
|
|
426638
426914
|
if (!isEnvTruthy(process.env.THEUS_CODE_REMOTE)) {
|
|
426639
426915
|
return state;
|
|
@@ -426654,7 +426930,7 @@ async function initUpstreamProxy(opts) {
|
|
|
426654
426930
|
}
|
|
426655
426931
|
setNonDumpable();
|
|
426656
426932
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.THEUS_BASE_URL ?? "https://api.theus.pe";
|
|
426657
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
426933
|
+
const caBundlePath = opts?.caBundlePath ?? join157(homedir41(), ".ccr", "ca-bundle.crt");
|
|
426658
426934
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
426659
426935
|
if (!caOk)
|
|
426660
426936
|
return state;
|
|
@@ -426712,7 +426988,7 @@ function resetUpstreamProxyForTests() {
|
|
|
426712
426988
|
}
|
|
426713
426989
|
async function readToken(path19) {
|
|
426714
426990
|
try {
|
|
426715
|
-
const raw = await
|
|
426991
|
+
const raw = await readFile59(path19, "utf8");
|
|
426716
426992
|
return raw.trim() || null;
|
|
426717
426993
|
} catch (err2) {
|
|
426718
426994
|
if (isENOENT(err2))
|
|
@@ -426754,8 +427030,8 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
426754
427030
|
return false;
|
|
426755
427031
|
}
|
|
426756
427032
|
const ccrCa = await resp.text();
|
|
426757
|
-
const systemCa = await
|
|
426758
|
-
await mkdir48(
|
|
427033
|
+
const systemCa = await readFile59(systemCaPath, "utf8").catch(() => "");
|
|
427034
|
+
await mkdir48(join157(outPath, ".."), { recursive: true });
|
|
426759
427035
|
await writeFile50(outPath, systemCa + `
|
|
426760
427036
|
` + ccrCa, "utf8");
|
|
426761
427037
|
return true;
|
|
@@ -427184,14 +427460,14 @@ import {
|
|
|
427184
427460
|
appendFile as appendFile7,
|
|
427185
427461
|
chmod as chmod12,
|
|
427186
427462
|
mkdir as mkdir49,
|
|
427187
|
-
readdir as
|
|
427463
|
+
readdir as readdir36,
|
|
427188
427464
|
rmdir as rmdir3,
|
|
427189
|
-
stat as
|
|
427465
|
+
stat as stat53,
|
|
427190
427466
|
unlink as unlink25
|
|
427191
427467
|
} from "fs/promises";
|
|
427192
427468
|
import { createServer as createServer9 } from "net";
|
|
427193
427469
|
import { platform as platform6 } from "os";
|
|
427194
|
-
import { join as
|
|
427470
|
+
import { join as join158 } from "path";
|
|
427195
427471
|
function log(message, ...args) {
|
|
427196
427472
|
if (LOG_FILE) {
|
|
427197
427473
|
const timestamp2 = new Date().toISOString();
|
|
@@ -427238,7 +427514,7 @@ class ChromeNativeHost {
|
|
|
427238
427514
|
if (platform6() !== "win32") {
|
|
427239
427515
|
const socketDir = getSocketDir();
|
|
427240
427516
|
try {
|
|
427241
|
-
const dirStats = await
|
|
427517
|
+
const dirStats = await stat53(socketDir);
|
|
427242
427518
|
if (!dirStats.isDirectory()) {
|
|
427243
427519
|
await unlink25(socketDir);
|
|
427244
427520
|
}
|
|
@@ -427246,7 +427522,7 @@ class ChromeNativeHost {
|
|
|
427246
427522
|
await mkdir49(socketDir, { recursive: true, mode: 448 });
|
|
427247
427523
|
await chmod12(socketDir, 448).catch(() => {});
|
|
427248
427524
|
try {
|
|
427249
|
-
const files2 = await
|
|
427525
|
+
const files2 = await readdir36(socketDir);
|
|
427250
427526
|
for (const file2 of files2) {
|
|
427251
427527
|
if (!file2.endsWith(".sock")) {
|
|
427252
427528
|
continue;
|
|
@@ -427258,7 +427534,7 @@ class ChromeNativeHost {
|
|
|
427258
427534
|
try {
|
|
427259
427535
|
process.kill(pid, 0);
|
|
427260
427536
|
} catch {
|
|
427261
|
-
await unlink25(
|
|
427537
|
+
await unlink25(join158(socketDir, file2)).catch(() => {});
|
|
427262
427538
|
log(`Removed stale socket for PID ${pid}`);
|
|
427263
427539
|
}
|
|
427264
427540
|
}
|
|
@@ -427307,7 +427583,7 @@ class ChromeNativeHost {
|
|
|
427307
427583
|
} catch {}
|
|
427308
427584
|
try {
|
|
427309
427585
|
const socketDir = getSocketDir();
|
|
427310
|
-
const remaining = await
|
|
427586
|
+
const remaining = await readdir36(socketDir);
|
|
427311
427587
|
if (remaining.length === 0) {
|
|
427312
427588
|
await rmdir3(socketDir);
|
|
427313
427589
|
log("Removed empty socket directory");
|
|
@@ -428207,7 +428483,7 @@ async function handleMemories(state2) {
|
|
|
428207
428483
|
async function runProjectContextMcpServer() {
|
|
428208
428484
|
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
428209
428485
|
const state2 = new ProjectContextState(projectRoot);
|
|
428210
|
-
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.
|
|
428486
|
+
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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: {} } });
|
|
428211
428487
|
server2.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
428212
428488
|
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
428213
428489
|
name: t.name,
|
|
@@ -428335,10 +428611,10 @@ var init_server3 = __esm(() => {
|
|
|
428335
428611
|
import { execFile as execFile8 } from "child_process";
|
|
428336
428612
|
import { existsSync as existsSync26, mkdirSync as mkdirSync12, readFileSync as readFileSync30, statSync as statSync14, unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "fs";
|
|
428337
428613
|
import { homedir as homedir43, tmpdir as tmpdir13 } from "os";
|
|
428338
|
-
import { join as
|
|
428614
|
+
import { join as join159 } from "path";
|
|
428339
428615
|
import { promisify as promisify6 } from "util";
|
|
428340
428616
|
function cuDir() {
|
|
428341
|
-
const dir =
|
|
428617
|
+
const dir = join159(homedir43(), ".theus", "cu");
|
|
428342
428618
|
if (!existsSync26(dir))
|
|
428343
428619
|
mkdirSync12(dir, { recursive: true });
|
|
428344
428620
|
return dir;
|
|
@@ -428386,7 +428662,7 @@ async function getScreenGeometry(force = false) {
|
|
|
428386
428662
|
return cachedGeometry;
|
|
428387
428663
|
}
|
|
428388
428664
|
async function checkPermissions() {
|
|
428389
|
-
const probe =
|
|
428665
|
+
const probe = join159(tmpdir13(), `theus-cu-probe-${process.pid}.jpg`);
|
|
428390
428666
|
const cap = await run6(SCREENCAPTURE, ["-x", "-t", "jpg", probe], { timeoutMs: 8000 });
|
|
428391
428667
|
const screenRecording = existsSync26(probe) && (() => {
|
|
428392
428668
|
try {
|
|
@@ -428415,8 +428691,8 @@ async function checkPermissions() {
|
|
|
428415
428691
|
async function captureScreenshot(opts = {}) {
|
|
428416
428692
|
const maxSide = opts.maxSide ?? 1400;
|
|
428417
428693
|
const quality = Math.min(Math.max(opts.quality ?? 72, 1), 100);
|
|
428418
|
-
const raw =
|
|
428419
|
-
const out =
|
|
428694
|
+
const raw = join159(cuDir(), `shot-${process.pid}.png`);
|
|
428695
|
+
const out = join159(cuDir(), `shot-${process.pid}.jpg`);
|
|
428420
428696
|
const capArgs = ["-x", "-t", "png", "-o"];
|
|
428421
428697
|
if (opts.displayIndex && opts.displayIndex > 0)
|
|
428422
428698
|
capArgs.push("-D", String(opts.displayIndex));
|
|
@@ -428580,8 +428856,8 @@ async function ensureScrollHelper() {
|
|
|
428580
428856
|
return scrollBinPromise;
|
|
428581
428857
|
scrollBinPromise = (async () => {
|
|
428582
428858
|
if (!existsSync26(SWIFTC) && SWIFTC === "swiftc") {}
|
|
428583
|
-
const src =
|
|
428584
|
-
const bin =
|
|
428859
|
+
const src = join159(cuDir(), "scroll.swift");
|
|
428860
|
+
const bin = join159(cuDir(), "theus-cu-scroll");
|
|
428585
428861
|
if (existsSync26(bin))
|
|
428586
428862
|
return bin;
|
|
428587
428863
|
try {
|
|
@@ -428912,7 +429188,7 @@ __export(exports_selftest, {
|
|
|
428912
429188
|
runComputerUseSelfTest: () => runComputerUseSelfTest
|
|
428913
429189
|
});
|
|
428914
429190
|
import { existsSync as existsSync27, writeFileSync as writeFileSync11 } from "fs";
|
|
428915
|
-
import { join as
|
|
429191
|
+
import { join as join160 } from "path";
|
|
428916
429192
|
import { homedir as homedir44 } from "os";
|
|
428917
429193
|
async function runComputerUseSelfTest() {
|
|
428918
429194
|
let pass = 0;
|
|
@@ -428964,7 +429240,7 @@ Geometr\xEDa y captura:`);
|
|
|
428964
429240
|
let captureOk = false;
|
|
428965
429241
|
try {
|
|
428966
429242
|
const shot = await captureScreenshot();
|
|
428967
|
-
const outPath =
|
|
429243
|
+
const outPath = join160(homedir44(), ".theus", "cu", "selftest-shot.jpg");
|
|
428968
429244
|
writeFileSync11(outPath, Buffer.from(shot.base64, "base64"));
|
|
428969
429245
|
ok2(`Captura ${shot.width}\xD7${shot.height} px, ${Math.round(shot.base64.length * 0.75 / 1024)} KB \u2192 ${outPath}`);
|
|
428970
429246
|
captureOk = true;
|
|
@@ -429816,8 +430092,8 @@ import {
|
|
|
429816
430092
|
chmod as chmod13,
|
|
429817
430093
|
lstat as lstat7,
|
|
429818
430094
|
mkdir as mkdir50,
|
|
429819
|
-
open as
|
|
429820
|
-
readFile as
|
|
430095
|
+
open as open23,
|
|
430096
|
+
readFile as readFile60,
|
|
429821
430097
|
rename as rename10,
|
|
429822
430098
|
unlink as unlink26
|
|
429823
430099
|
} from "fs/promises";
|
|
@@ -429827,21 +430103,21 @@ function defaultFleetCredentialsPath() {
|
|
|
429827
430103
|
return resolve52(homedir45(), ".theus", "titan", "fleet-worker.json");
|
|
429828
430104
|
}
|
|
429829
430105
|
async function rejectSymlink(path19) {
|
|
429830
|
-
const
|
|
430106
|
+
const stat54 = await lstat7(path19).catch((error40) => {
|
|
429831
430107
|
if (error40.code === "ENOENT")
|
|
429832
430108
|
return;
|
|
429833
430109
|
throw error40;
|
|
429834
430110
|
});
|
|
429835
|
-
if (
|
|
430111
|
+
if (stat54?.isSymbolicLink()) {
|
|
429836
430112
|
throw new Error("Se rechaz\xF3 un symlink como almac\xE9n de credenciales Fleet");
|
|
429837
430113
|
}
|
|
429838
|
-
if (
|
|
430114
|
+
if (stat54 && !stat54.isFile()) {
|
|
429839
430115
|
throw new Error("El almac\xE9n de credenciales Fleet no es un archivo regular");
|
|
429840
430116
|
}
|
|
429841
430117
|
}
|
|
429842
430118
|
async function loadFleetCredentials(path19 = defaultFleetCredentialsPath()) {
|
|
429843
430119
|
await rejectSymlink(path19);
|
|
429844
|
-
const raw = await
|
|
430120
|
+
const raw = await readFile60(path19, "utf8").catch((error40) => {
|
|
429845
430121
|
if (error40.code === "ENOENT")
|
|
429846
430122
|
return;
|
|
429847
430123
|
throw error40;
|
|
@@ -429867,7 +430143,7 @@ async function saveFleetCredentials(value, path19 = defaultFleetCredentialsPath(
|
|
|
429867
430143
|
await rejectSymlink(path19);
|
|
429868
430144
|
const temp = `${path19}.tmp-${process.pid}-${randomUUID38()}`;
|
|
429869
430145
|
const flags = constants5.O_WRONLY | constants5.O_CREAT | constants5.O_EXCL | (constants5.O_NOFOLLOW ?? 0);
|
|
429870
|
-
const handle2 = await
|
|
430146
|
+
const handle2 = await open23(temp, flags, 384);
|
|
429871
430147
|
try {
|
|
429872
430148
|
await handle2.writeFile(`${JSON.stringify(parsed, null, 2)}
|
|
429873
430149
|
`, "utf8");
|
|
@@ -429904,10 +430180,10 @@ import {
|
|
|
429904
430180
|
chmod as chmod14,
|
|
429905
430181
|
lstat as lstat8,
|
|
429906
430182
|
mkdir as mkdir51,
|
|
429907
|
-
open as
|
|
429908
|
-
readFile as
|
|
430183
|
+
open as open24,
|
|
430184
|
+
readFile as readFile61,
|
|
429909
430185
|
rename as rename11,
|
|
429910
|
-
stat as
|
|
430186
|
+
stat as stat54,
|
|
429911
430187
|
unlink as unlink27
|
|
429912
430188
|
} from "fs/promises";
|
|
429913
430189
|
import { homedir as homedir46 } from "os";
|
|
@@ -429977,7 +430253,7 @@ async function rejectSymlink2(path19) {
|
|
|
429977
430253
|
}
|
|
429978
430254
|
async function readRecords(path19) {
|
|
429979
430255
|
await rejectSymlink2(path19);
|
|
429980
|
-
const info = await
|
|
430256
|
+
const info = await stat54(path19).catch((error40) => {
|
|
429981
430257
|
if (error40.code === "ENOENT")
|
|
429982
430258
|
return;
|
|
429983
430259
|
throw error40;
|
|
@@ -429994,7 +430270,7 @@ async function readRecords(path19) {
|
|
|
429994
430270
|
throw new FleetOutboxCorruptError("El outbox Fleet excede el l\xEDmite de bytes");
|
|
429995
430271
|
}
|
|
429996
430272
|
try {
|
|
429997
|
-
const parsed = outboxFileSchema.parse(JSON.parse(await
|
|
430273
|
+
const parsed = outboxFileSchema.parse(JSON.parse(await readFile61(path19, "utf8")));
|
|
429998
430274
|
const ids = new Set;
|
|
429999
430275
|
return parsed.records.map((record3) => {
|
|
430000
430276
|
const checked = validateRecord(record3);
|
|
@@ -430034,7 +430310,7 @@ async function writeRecords(path19, records) {
|
|
|
430034
430310
|
await chmod14(directory, 448);
|
|
430035
430311
|
await rejectSymlink2(path19);
|
|
430036
430312
|
const temp = `${path19}.tmp-${process.pid}-${randomUUID39()}`;
|
|
430037
|
-
const handle2 = await
|
|
430313
|
+
const handle2 = await open24(temp, constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | (constants6.O_NOFOLLOW ?? 0), 384);
|
|
430038
430314
|
try {
|
|
430039
430315
|
await handle2.writeFile(serialized, "utf8");
|
|
430040
430316
|
await handle2.sync();
|
|
@@ -430045,7 +430321,7 @@ async function writeRecords(path19, records) {
|
|
|
430045
430321
|
await chmod14(temp, 384);
|
|
430046
430322
|
await rename11(temp, path19);
|
|
430047
430323
|
await chmod14(path19, 384);
|
|
430048
|
-
const directoryHandle = await
|
|
430324
|
+
const directoryHandle = await open24(directory, constants6.O_RDONLY);
|
|
430049
430325
|
try {
|
|
430050
430326
|
await directoryHandle.sync();
|
|
430051
430327
|
} finally {
|
|
@@ -430884,7 +431160,7 @@ async function runTitanFleetWorker(args) {
|
|
|
430884
431160
|
max_concurrency: maxConcurrency,
|
|
430885
431161
|
runtime: {
|
|
430886
431162
|
name: "theus-cli",
|
|
430887
|
-
version: { VERSION: "0.2.
|
|
431163
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
430888
431164
|
}
|
|
430889
431165
|
});
|
|
430890
431166
|
const client2 = new TitanFleetClient({
|
|
@@ -431412,7 +431688,7 @@ __export(exports_titan_fleet_run, {
|
|
|
431412
431688
|
parseFleetPlanFile: () => parseFleetPlanFile,
|
|
431413
431689
|
describeFleetRunError: () => describeFleetRunError
|
|
431414
431690
|
});
|
|
431415
|
-
import { readFile as
|
|
431691
|
+
import { readFile as readFile62 } from "fs/promises";
|
|
431416
431692
|
import { resolve as resolve55 } from "path";
|
|
431417
431693
|
function valuesAfter(args, name) {
|
|
431418
431694
|
const found = [];
|
|
@@ -431523,7 +431799,7 @@ async function runTitanFleetRun(args) {
|
|
|
431523
431799
|
process.stdout.write(HELP3);
|
|
431524
431800
|
return;
|
|
431525
431801
|
}
|
|
431526
|
-
const build = options2.planPath ? parseFleetPlanFile(await
|
|
431802
|
+
const build = options2.planPath ? parseFleetPlanFile(await readFile62(resolve55(options2.planPath), "utf8")) : options2.build;
|
|
431527
431803
|
if (!build) {
|
|
431528
431804
|
throw new FleetProducerError("No hay nada que encolar");
|
|
431529
431805
|
}
|
|
@@ -431605,15 +431881,15 @@ var init_titan_fleet_run = __esm(() => {
|
|
|
431605
431881
|
});
|
|
431606
431882
|
|
|
431607
431883
|
// utils/cronTasksLock.ts
|
|
431608
|
-
import { mkdir as mkdir52, readFile as
|
|
431609
|
-
import { dirname as dirname67, join as
|
|
431884
|
+
import { mkdir as mkdir52, readFile as readFile63, unlink as unlink28, writeFile as writeFile51 } from "fs/promises";
|
|
431885
|
+
import { dirname as dirname67, join as join161 } from "path";
|
|
431610
431886
|
function getLockPath(dir) {
|
|
431611
|
-
return
|
|
431887
|
+
return join161(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
431612
431888
|
}
|
|
431613
431889
|
async function readLock(dir) {
|
|
431614
431890
|
let raw;
|
|
431615
431891
|
try {
|
|
431616
|
-
raw = await
|
|
431892
|
+
raw = await readFile63(getLockPath(dir), "utf8");
|
|
431617
431893
|
} catch {
|
|
431618
431894
|
return;
|
|
431619
431895
|
}
|
|
@@ -431714,7 +431990,7 @@ var init_cronTasksLock = __esm(() => {
|
|
|
431714
431990
|
init_genericProcessUtils();
|
|
431715
431991
|
init_json();
|
|
431716
431992
|
init_slowOperations();
|
|
431717
|
-
LOCK_FILE_REL =
|
|
431993
|
+
LOCK_FILE_REL = join161(".theus", "scheduled_tasks.lock");
|
|
431718
431994
|
schedulerLockSchema = lazySchema(() => exports_external.object({
|
|
431719
431995
|
sessionId: exports_external.string(),
|
|
431720
431996
|
pid: exports_external.number(),
|
|
@@ -432022,10 +432298,10 @@ import {
|
|
|
432022
432298
|
writeFileSync as writeFileSync12
|
|
432023
432299
|
} from "fs";
|
|
432024
432300
|
import { homedir as homedir47 } from "os";
|
|
432025
|
-
import { dirname as dirname68, join as
|
|
432301
|
+
import { dirname as dirname68, join as join162 } from "path";
|
|
432026
432302
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
432027
432303
|
function projectsConfigPath() {
|
|
432028
|
-
return
|
|
432304
|
+
return join162(homedir47(), ".theus", "daemon", "projects.json");
|
|
432029
432305
|
}
|
|
432030
432306
|
function readEnabledProjects() {
|
|
432031
432307
|
let raw;
|
|
@@ -432044,17 +432320,17 @@ function readEnabledProjects() {
|
|
|
432044
432320
|
return list3.filter((p) => p && typeof p.dir === "string" && p.enabled !== false);
|
|
432045
432321
|
}
|
|
432046
432322
|
function daemonDir2() {
|
|
432047
|
-
return
|
|
432323
|
+
return join162(homedir47(), ".theus", "daemon");
|
|
432048
432324
|
}
|
|
432049
432325
|
function daemonLogPath() {
|
|
432050
|
-
return
|
|
432326
|
+
return join162(daemonDir2(), "daemon.log");
|
|
432051
432327
|
}
|
|
432052
432328
|
function resolveWorkerBin() {
|
|
432053
432329
|
const override = process.env.THEUS_DAEMON_WORKER_BIN;
|
|
432054
432330
|
if (typeof override === "string" && override.length > 0)
|
|
432055
432331
|
return override;
|
|
432056
432332
|
const here = dirname68(fileURLToPath7(import.meta.url));
|
|
432057
|
-
return
|
|
432333
|
+
return join162(here, "..", "bin", "theus");
|
|
432058
432334
|
}
|
|
432059
432335
|
function turnTimeoutMs() {
|
|
432060
432336
|
const raw = process.env.THEUS_DAEMON_TURN_TIMEOUT_MS;
|
|
@@ -432087,10 +432363,10 @@ function logDaemonLine(line) {
|
|
|
432087
432363
|
}
|
|
432088
432364
|
function writeRunHistory(record3) {
|
|
432089
432365
|
try {
|
|
432090
|
-
const dir =
|
|
432366
|
+
const dir = join162(daemonDir2(), "runs", record3.taskId);
|
|
432091
432367
|
mkdirSync13(dir, { recursive: true });
|
|
432092
432368
|
const stamp2 = record3.startedAt.replace(/:/g, "-");
|
|
432093
|
-
writeFileSync12(
|
|
432369
|
+
writeFileSync12(join162(dir, `${stamp2}.json`), JSON.stringify(record3, null, 2), "utf8");
|
|
432094
432370
|
pruneRunHistory(record3.taskId);
|
|
432095
432371
|
} catch (e) {
|
|
432096
432372
|
logDaemonLine(`[daemon:cron] ERROR guardando historial task=${record3.taskId}: ${e?.message}`);
|
|
@@ -432101,13 +432377,13 @@ function pruneRunHistory(taskId) {
|
|
|
432101
432377
|
const raw = process.env.THEUS_DAEMON_RUNS_KEEP;
|
|
432102
432378
|
const parsed = raw ? Number.parseInt(raw, 10) : NaN;
|
|
432103
432379
|
const keep = Number.isInteger(parsed) && parsed > 0 ? parsed : 50;
|
|
432104
|
-
const dir =
|
|
432380
|
+
const dir = join162(daemonDir2(), "runs", taskId);
|
|
432105
432381
|
const files2 = readdirSync5(dir).filter((f) => f.endsWith(".json")).sort();
|
|
432106
432382
|
if (files2.length <= keep)
|
|
432107
432383
|
return;
|
|
432108
432384
|
for (const f of files2.slice(0, files2.length - keep)) {
|
|
432109
432385
|
try {
|
|
432110
|
-
unlinkSync4(
|
|
432386
|
+
unlinkSync4(join162(dir, f));
|
|
432111
432387
|
} catch {}
|
|
432112
432388
|
}
|
|
432113
432389
|
} catch {}
|
|
@@ -432297,15 +432573,15 @@ import {
|
|
|
432297
432573
|
writeFileSync as writeFileSync13
|
|
432298
432574
|
} from "fs";
|
|
432299
432575
|
import { homedir as homedir48 } from "os";
|
|
432300
|
-
import { dirname as dirname69, join as
|
|
432576
|
+
import { dirname as dirname69, join as join163 } from "path";
|
|
432301
432577
|
function daemonDir3() {
|
|
432302
|
-
return
|
|
432578
|
+
return join163(homedir48(), ".theus", "daemon");
|
|
432303
432579
|
}
|
|
432304
432580
|
function pidFilePath() {
|
|
432305
|
-
return
|
|
432581
|
+
return join163(daemonDir3(), "theus-daemon.pid");
|
|
432306
432582
|
}
|
|
432307
432583
|
function logFilePath() {
|
|
432308
|
-
return
|
|
432584
|
+
return join163(daemonDir3(), "daemon.log");
|
|
432309
432585
|
}
|
|
432310
432586
|
function ensureDaemonDir() {
|
|
432311
432587
|
mkdirSync14(daemonDir3(), { recursive: true });
|
|
@@ -432403,7 +432679,7 @@ function resolveTheusBin() {
|
|
|
432403
432679
|
return "theus";
|
|
432404
432680
|
}
|
|
432405
432681
|
function macosServiceSpec() {
|
|
432406
|
-
const path19 =
|
|
432682
|
+
const path19 = join163(homedir48(), "Library", "LaunchAgents", "pe.theus.daemon.plist");
|
|
432407
432683
|
const bin = resolveTheusBin();
|
|
432408
432684
|
const logDir = daemonDir3();
|
|
432409
432685
|
const content = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -432430,9 +432706,9 @@ function macosServiceSpec() {
|
|
|
432430
432706
|
<key>KeepAlive</key>
|
|
432431
432707
|
<true/>
|
|
432432
432708
|
<key>StandardOutPath</key>
|
|
432433
|
-
<string>${
|
|
432709
|
+
<string>${join163(logDir, "launchd.out.log")}</string>
|
|
432434
432710
|
<key>StandardErrorPath</key>
|
|
432435
|
-
<string>${
|
|
432711
|
+
<string>${join163(logDir, "launchd.err.log")}</string>
|
|
432436
432712
|
</dict>
|
|
432437
432713
|
</plist>
|
|
432438
432714
|
`;
|
|
@@ -432447,7 +432723,7 @@ function macosServiceSpec() {
|
|
|
432447
432723
|
};
|
|
432448
432724
|
}
|
|
432449
432725
|
function linuxServiceSpec() {
|
|
432450
|
-
const path19 =
|
|
432726
|
+
const path19 = join163(homedir48(), ".config", "systemd", "user", "theus-daemon.service");
|
|
432451
432727
|
const bin = resolveTheusBin();
|
|
432452
432728
|
const content = `[Unit]
|
|
432453
432729
|
Description=Theus daemon (cron/agent supervisor)
|
|
@@ -432775,7 +433051,7 @@ function createBridgeLogger(options2) {
|
|
|
432775
433051
|
connectUrl = buildBridgeConnectUrl(environmentId, cachedIngressUrl);
|
|
432776
433052
|
regenerateQr(connectUrl);
|
|
432777
433053
|
if (verbose) {
|
|
432778
|
-
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.
|
|
433054
|
+
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
432779
433055
|
`);
|
|
432780
433056
|
}
|
|
432781
433057
|
if (verbose) {
|
|
@@ -433183,7 +433459,7 @@ var init_pollConfig = __esm(() => {
|
|
|
433183
433459
|
import { spawn as spawn13 } from "child_process";
|
|
433184
433460
|
import { createWriteStream as createWriteStream4 } from "fs";
|
|
433185
433461
|
import { tmpdir as tmpdir14 } from "os";
|
|
433186
|
-
import { dirname as dirname70, join as
|
|
433462
|
+
import { dirname as dirname70, join as join164 } from "path";
|
|
433187
433463
|
import { createInterface } from "readline";
|
|
433188
433464
|
function safeFilenameId(id2) {
|
|
433189
433465
|
return id2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -433316,12 +433592,12 @@ function createSessionSpawner(deps) {
|
|
|
433316
433592
|
debugFile = `${deps.debugFile}-${safeId}`;
|
|
433317
433593
|
}
|
|
433318
433594
|
} else if (deps.verbose || false) {
|
|
433319
|
-
debugFile =
|
|
433595
|
+
debugFile = join164(tmpdir14(), "theus", `bridge-session-${safeId}.log`);
|
|
433320
433596
|
}
|
|
433321
433597
|
let transcriptStream = null;
|
|
433322
433598
|
let transcriptPath;
|
|
433323
433599
|
if (deps.debugFile) {
|
|
433324
|
-
transcriptPath =
|
|
433600
|
+
transcriptPath = join164(dirname70(deps.debugFile), `bridge-transcript-${safeId}.jsonl`);
|
|
433325
433601
|
transcriptStream = createWriteStream4(transcriptPath, { flags: "a" });
|
|
433326
433602
|
transcriptStream.on("error", (err2) => {
|
|
433327
433603
|
deps.onDebug(`[bridge:session] Transcript write error: ${err2.message}`);
|
|
@@ -433594,10 +433870,10 @@ __export(exports_bridgePointer, {
|
|
|
433594
433870
|
clearBridgePointer: () => clearBridgePointer,
|
|
433595
433871
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
433596
433872
|
});
|
|
433597
|
-
import { mkdir as mkdir53, readFile as
|
|
433598
|
-
import { dirname as dirname71, join as
|
|
433873
|
+
import { mkdir as mkdir53, readFile as readFile64, stat as stat55, unlink as unlink29, writeFile as writeFile52 } from "fs/promises";
|
|
433874
|
+
import { dirname as dirname71, join as join165 } from "path";
|
|
433599
433875
|
function getBridgePointerPath(dir) {
|
|
433600
|
-
return
|
|
433876
|
+
return join165(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
433601
433877
|
}
|
|
433602
433878
|
async function writeBridgePointer(dir, pointer) {
|
|
433603
433879
|
const path19 = getBridgePointerPath(dir);
|
|
@@ -433614,8 +433890,8 @@ async function readBridgePointer(dir) {
|
|
|
433614
433890
|
let raw;
|
|
433615
433891
|
let mtimeMs;
|
|
433616
433892
|
try {
|
|
433617
|
-
mtimeMs = (await
|
|
433618
|
-
raw = await
|
|
433893
|
+
mtimeMs = (await stat55(path19)).mtimeMs;
|
|
433894
|
+
raw = await readFile64(path19, "utf8");
|
|
433619
433895
|
} catch {
|
|
433620
433896
|
return null;
|
|
433621
433897
|
}
|
|
@@ -433699,12 +433975,12 @@ var init_bridgePointer = __esm(() => {
|
|
|
433699
433975
|
});
|
|
433700
433976
|
|
|
433701
433977
|
// utils/errorLogSink.ts
|
|
433702
|
-
import { dirname as dirname72, join as
|
|
433978
|
+
import { dirname as dirname72, join as join166 } from "path";
|
|
433703
433979
|
function getErrorsPath() {
|
|
433704
|
-
return
|
|
433980
|
+
return join166(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
433705
433981
|
}
|
|
433706
433982
|
function getMCPLogsPath(serverName) {
|
|
433707
|
-
return
|
|
433983
|
+
return join166(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
433708
433984
|
}
|
|
433709
433985
|
function createJsonlWriter(options2) {
|
|
433710
433986
|
const writer = createBufferedWriter(options2);
|
|
@@ -433748,7 +434024,7 @@ function appendToLog(path19, message) {
|
|
|
433748
434024
|
cwd: getFsImplementation().cwd(),
|
|
433749
434025
|
userType: "external",
|
|
433750
434026
|
sessionId: getSessionId(),
|
|
433751
|
-
version: { VERSION: "0.2.
|
|
434027
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
433752
434028
|
};
|
|
433753
434029
|
getLogWriter(path19).write(messageWithTimestamp);
|
|
433754
434030
|
}
|
|
@@ -433860,7 +434136,7 @@ __export(exports_bridgeMain, {
|
|
|
433860
434136
|
});
|
|
433861
434137
|
import { randomUUID as randomUUID42 } from "crypto";
|
|
433862
434138
|
import { hostname as hostname4, tmpdir as tmpdir15 } from "os";
|
|
433863
|
-
import { basename as basename51, join as
|
|
434139
|
+
import { basename as basename51, join as join167, resolve as resolve56 } from "path";
|
|
433864
434140
|
async function isMultiSessionSpawnEnabled() {
|
|
433865
434141
|
return checkGate_CACHED_OR_BLOCKING("theus_ccr_bridge_multi_session");
|
|
433866
434142
|
}
|
|
@@ -434373,7 +434649,7 @@ async function runBridgeLoop(config3, environmentId, environmentSecret, api2, sp
|
|
|
434373
434649
|
sessionDebugFile = `${config3.debugFile}-${safeId}`;
|
|
434374
434650
|
}
|
|
434375
434651
|
} else if (config3.verbose || false) {
|
|
434376
|
-
sessionDebugFile =
|
|
434652
|
+
sessionDebugFile = join167(tmpdir15(), "theus", `bridge-session-${safeId}.log`);
|
|
434377
434653
|
}
|
|
434378
434654
|
if (sessionDebugFile) {
|
|
434379
434655
|
logger.logVerbose(`Debug log: ${sessionDebugFile}`);
|
|
@@ -435009,7 +435285,7 @@ Spawn mode for this project:
|
|
|
435009
435285
|
const api2 = createBridgeApiClient({
|
|
435010
435286
|
baseUrl,
|
|
435011
435287
|
getAccessToken: getBridgeAccessToken2,
|
|
435012
|
-
runnerVersion: { VERSION: "0.2.
|
|
435288
|
+
runnerVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
435013
435289
|
onDebug: logForDebugging,
|
|
435014
435290
|
onAuth401: handleOAuth401Error2,
|
|
435015
435291
|
getTrustedDeviceToken
|
|
@@ -435247,7 +435523,7 @@ async function runBridgeHeadless(opts, signal) {
|
|
|
435247
435523
|
const api2 = createBridgeApiClient({
|
|
435248
435524
|
baseUrl,
|
|
435249
435525
|
getAccessToken: opts.getAccessToken,
|
|
435250
|
-
runnerVersion: { VERSION: "0.2.
|
|
435526
|
+
runnerVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
435251
435527
|
onDebug: log2,
|
|
435252
435528
|
onAuth401: opts.onAuth401,
|
|
435253
435529
|
getTrustedDeviceToken
|
|
@@ -438344,7 +438620,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
438344
438620
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
438345
438621
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
438346
438622
|
betas: getSdkBetas(),
|
|
438347
|
-
theus_code_version: { VERSION: "0.2.
|
|
438623
|
+
theus_code_version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
438348
438624
|
output_style: outputStyle2,
|
|
438349
438625
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
438350
438626
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -438384,8 +438660,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
438384
438660
|
}
|
|
438385
438661
|
async function checkEnvLessBridgeMinVersion() {
|
|
438386
438662
|
const cfg = await getEnvLessBridgeConfig();
|
|
438387
|
-
if (cfg.min_version && lt({ VERSION: "0.2.
|
|
438388
|
-
return `Your version of Theus (${{ VERSION: "0.2.
|
|
438663
|
+
if (cfg.min_version && lt({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
438664
|
+
return `Your version of Theus (${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
438389
438665
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
438390
438666
|
}
|
|
438391
438667
|
return null;
|
|
@@ -440709,7 +440985,7 @@ async function initBridgeCore(params) {
|
|
|
440709
440985
|
const rawApi = createBridgeApiClient({
|
|
440710
440986
|
baseUrl,
|
|
440711
440987
|
getAccessToken,
|
|
440712
|
-
runnerVersion: { VERSION: "0.2.
|
|
440988
|
+
runnerVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
440713
440989
|
onDebug: logForDebugging,
|
|
440714
440990
|
onAuth401,
|
|
440715
440991
|
getTrustedDeviceToken
|
|
@@ -442543,7 +442819,7 @@ __export(exports_inboundAttachments, {
|
|
|
442543
442819
|
});
|
|
442544
442820
|
import { randomUUID as randomUUID47 } from "crypto";
|
|
442545
442821
|
import { mkdir as mkdir54, writeFile as writeFile53 } from "fs/promises";
|
|
442546
|
-
import { basename as basename52, join as
|
|
442822
|
+
import { basename as basename52, join as join168 } from "path";
|
|
442547
442823
|
function debug2(msg) {
|
|
442548
442824
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
442549
442825
|
}
|
|
@@ -442559,7 +442835,7 @@ function sanitizeFileName(name) {
|
|
|
442559
442835
|
return base2 || "attachment";
|
|
442560
442836
|
}
|
|
442561
442837
|
function uploadsDir() {
|
|
442562
|
-
return
|
|
442838
|
+
return join168(getTheusConfigHomeDir(), "uploads", getSessionId());
|
|
442563
442839
|
}
|
|
442564
442840
|
async function resolveOne(att) {
|
|
442565
442841
|
const token = getBridgeAccessToken();
|
|
@@ -442588,7 +442864,7 @@ async function resolveOne(att) {
|
|
|
442588
442864
|
const safeName = sanitizeFileName(att.file_name);
|
|
442589
442865
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID47().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
442590
442866
|
const dir = uploadsDir();
|
|
442591
|
-
const outPath =
|
|
442867
|
+
const outPath = join168(dir, `${prefix}-${safeName}`);
|
|
442592
442868
|
try {
|
|
442593
442869
|
await mkdir54(dir, { recursive: true });
|
|
442594
442870
|
await writeFile53(outPath, data);
|
|
@@ -449448,7 +449724,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
449448
449724
|
|
|
449449
449725
|
// components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
449450
449726
|
import { homedir as homedir49 } from "os";
|
|
449451
|
-
import { basename as basename56, join as
|
|
449727
|
+
import { basename as basename56, join as join169, sep as sep34 } from "path";
|
|
449452
449728
|
function isInTheusFolder(filePath) {
|
|
449453
449729
|
const absolutePath = expandPath(filePath);
|
|
449454
449730
|
const theusFolderPath = expandPath(`${getOriginalCwd()}/.theus`);
|
|
@@ -449458,7 +449734,7 @@ function isInTheusFolder(filePath) {
|
|
|
449458
449734
|
}
|
|
449459
449735
|
function isInGlobalTheusFolder(filePath) {
|
|
449460
449736
|
const absolutePath = expandPath(filePath);
|
|
449461
|
-
const globalTheusFolderPath =
|
|
449737
|
+
const globalTheusFolderPath = join169(homedir49(), ".theus");
|
|
449462
449738
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
449463
449739
|
const normalizedGlobalTheusFolderPath = normalizeCaseForComparison(globalTheusFolderPath);
|
|
449464
449740
|
return normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + sep34.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + "/");
|
|
@@ -457350,7 +457626,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
457350
457626
|
function getSemverPart(version3) {
|
|
457351
457627
|
return `${import_semver11.major(version3, { loose: true })}.${import_semver11.minor(version3, { loose: true })}.${import_semver11.patch(version3, { loose: true })}`;
|
|
457352
457628
|
}
|
|
457353
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.
|
|
457629
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
457354
457630
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react235.useState(() => getSemverPart(initialVersion));
|
|
457355
457631
|
if (!updatedVersion) {
|
|
457356
457632
|
return null;
|
|
@@ -457390,7 +457666,7 @@ function AutoUpdater({
|
|
|
457390
457666
|
return;
|
|
457391
457667
|
}
|
|
457392
457668
|
if (false) {}
|
|
457393
|
-
const currentVersion = { VERSION: "0.2.
|
|
457669
|
+
const currentVersion = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
457394
457670
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
457395
457671
|
let latestVersion = await getLatestVersion(channel2);
|
|
457396
457672
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -457525,7 +457801,7 @@ function AutoUpdater({
|
|
|
457525
457801
|
" ",
|
|
457526
457802
|
/* @__PURE__ */ jsx_runtime414.jsx(ThemedText, {
|
|
457527
457803
|
bold: true,
|
|
457528
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
457804
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}` : `npm i -g ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
457529
457805
|
})
|
|
457530
457806
|
]
|
|
457531
457807
|
})
|
|
@@ -457602,12 +457878,12 @@ function NativeAutoUpdater({
|
|
|
457602
457878
|
logEvent("theus_native_auto_updater_start", {});
|
|
457603
457879
|
try {
|
|
457604
457880
|
const maxVersion = await getMaxVersion();
|
|
457605
|
-
if (maxVersion && gt({ VERSION: "0.2.
|
|
457881
|
+
if (maxVersion && gt({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
457606
457882
|
const msg = await getMaxVersionMessage();
|
|
457607
457883
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
457608
457884
|
}
|
|
457609
457885
|
const result = await installLatest(channel2);
|
|
457610
|
-
const currentVersion = { VERSION: "0.2.
|
|
457886
|
+
const currentVersion = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
457611
457887
|
const latencyMs = Date.now() - startTime2;
|
|
457612
457888
|
if (result.lockFailed) {
|
|
457613
457889
|
logEvent("theus_native_auto_updater_lock_contention", {
|
|
@@ -457744,17 +458020,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
457744
458020
|
const maxVersion = await getMaxVersion();
|
|
457745
458021
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
457746
458022
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
457747
|
-
if (gte({ VERSION: "0.2.
|
|
457748
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.
|
|
458023
|
+
if (gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
458024
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
457749
458025
|
setUpdateAvailable(false);
|
|
457750
458026
|
return;
|
|
457751
458027
|
}
|
|
457752
458028
|
latest = maxVersion;
|
|
457753
458029
|
}
|
|
457754
|
-
const hasUpdate = latest && !gte({ VERSION: "0.2.
|
|
458030
|
+
const hasUpdate = latest && !gte({ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
457755
458031
|
setUpdateAvailable(!!hasUpdate);
|
|
457756
458032
|
if (hasUpdate) {
|
|
457757
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.
|
|
458033
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`);
|
|
457758
458034
|
}
|
|
457759
458035
|
};
|
|
457760
458036
|
$2[0] = t1;
|
|
@@ -457788,7 +458064,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
457788
458064
|
wrap: "truncate",
|
|
457789
458065
|
children: [
|
|
457790
458066
|
"versi\xF3n actual: ",
|
|
457791
|
-
{ VERSION: "0.2.
|
|
458067
|
+
{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
457792
458068
|
]
|
|
457793
458069
|
});
|
|
457794
458070
|
$2[3] = verbose;
|
|
@@ -464426,8 +464702,8 @@ function findTextObject(text2, offset, objectType2, isInner) {
|
|
|
464426
464702
|
return findWordObject(text2, offset, isInner, (ch2) => !isVimWhitespace(ch2));
|
|
464427
464703
|
const pair = PAIRS[objectType2];
|
|
464428
464704
|
if (pair) {
|
|
464429
|
-
const [
|
|
464430
|
-
return
|
|
464705
|
+
const [open25, close] = pair;
|
|
464706
|
+
return open25 === close ? findQuoteObject(text2, offset, open25, isInner) : findBracketObject(text2, offset, open25, close, isInner);
|
|
464431
464707
|
}
|
|
464432
464708
|
return null;
|
|
464433
464709
|
}
|
|
@@ -464502,13 +464778,13 @@ function findQuoteObject(text2, offset, quote2, isInner) {
|
|
|
464502
464778
|
}
|
|
464503
464779
|
return null;
|
|
464504
464780
|
}
|
|
464505
|
-
function findBracketObject(text2, offset,
|
|
464781
|
+
function findBracketObject(text2, offset, open25, close, isInner) {
|
|
464506
464782
|
let depth = 0;
|
|
464507
464783
|
let start = -1;
|
|
464508
464784
|
for (let i3 = offset;i3 >= 0; i3--) {
|
|
464509
464785
|
if (text2[i3] === close && i3 !== offset)
|
|
464510
464786
|
depth++;
|
|
464511
|
-
else if (text2[i3] ===
|
|
464787
|
+
else if (text2[i3] === open25) {
|
|
464512
464788
|
if (depth === 0) {
|
|
464513
464789
|
start = i3;
|
|
464514
464790
|
break;
|
|
@@ -464521,7 +464797,7 @@ function findBracketObject(text2, offset, open24, close, isInner) {
|
|
|
464521
464797
|
depth = 0;
|
|
464522
464798
|
let end = -1;
|
|
464523
464799
|
for (let i3 = start + 1;i3 < text2.length; i3++) {
|
|
464524
|
-
if (text2[i3] ===
|
|
464800
|
+
if (text2[i3] === open25)
|
|
464525
464801
|
depth++;
|
|
464526
464802
|
else if (text2[i3] === close) {
|
|
464527
464803
|
if (depth === 0) {
|
|
@@ -465651,7 +465927,7 @@ function buildStatusLineCommandInput(permissionMode2, exceeds200kTokens, setting
|
|
|
465651
465927
|
project_dir: getOriginalCwd(),
|
|
465652
465928
|
added_dirs: addedDirs
|
|
465653
465929
|
},
|
|
465654
|
-
version: { VERSION: "0.2.
|
|
465930
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
465655
465931
|
output_style: {
|
|
465656
465932
|
name: outputStyleName
|
|
465657
465933
|
},
|
|
@@ -471639,9 +471915,9 @@ function initSkillImprovement() {
|
|
|
471639
471915
|
async function applySkillImprovement(skillName, updates) {
|
|
471640
471916
|
if (!skillName)
|
|
471641
471917
|
return;
|
|
471642
|
-
const { join:
|
|
471918
|
+
const { join: join170 } = await import("path");
|
|
471643
471919
|
const fs5 = await import("fs/promises");
|
|
471644
|
-
const filePath =
|
|
471920
|
+
const filePath = join170(getCwd(), ".theus", "skills", skillName, "SKILL.md");
|
|
471645
471921
|
let currentContent;
|
|
471646
471922
|
try {
|
|
471647
471923
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -471793,7 +472069,7 @@ function useMoreRight(_args) {
|
|
|
471793
472069
|
}
|
|
471794
472070
|
|
|
471795
472071
|
// utils/cleanup.ts
|
|
471796
|
-
import { join as
|
|
472072
|
+
import { join as join170 } from "path";
|
|
471797
472073
|
function getCutoffDate() {
|
|
471798
472074
|
const settings = getSettings_DEPRECATED() || {};
|
|
471799
472075
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -471818,7 +472094,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
471818
472094
|
try {
|
|
471819
472095
|
const timestamp2 = convertFileNameToDate(file2.name);
|
|
471820
472096
|
if (timestamp2 < cutoffDate) {
|
|
471821
|
-
await getFsImplementation().unlink(
|
|
472097
|
+
await getFsImplementation().unlink(join170(dirPath, file2.name));
|
|
471822
472098
|
if (isMessagePath) {
|
|
471823
472099
|
result.messages++;
|
|
471824
472100
|
} else {
|
|
@@ -471849,7 +472125,7 @@ async function cleanupOldMessageFiles() {
|
|
|
471849
472125
|
} catch {
|
|
471850
472126
|
return result;
|
|
471851
472127
|
}
|
|
471852
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
472128
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join170(baseCachePath, dirent.name));
|
|
471853
472129
|
for (const mcpLogDir of mcpLogDirs) {
|
|
471854
472130
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
471855
472131
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -471888,7 +472164,7 @@ async function cleanupOldSessionFiles() {
|
|
|
471888
472164
|
for (const projectDirent of projectDirents) {
|
|
471889
472165
|
if (!projectDirent.isDirectory())
|
|
471890
472166
|
continue;
|
|
471891
|
-
const projectDir =
|
|
472167
|
+
const projectDir = join170(projectsDir, projectDirent.name);
|
|
471892
472168
|
let entries;
|
|
471893
472169
|
try {
|
|
471894
472170
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -471902,15 +472178,15 @@ async function cleanupOldSessionFiles() {
|
|
|
471902
472178
|
continue;
|
|
471903
472179
|
}
|
|
471904
472180
|
try {
|
|
471905
|
-
if (await unlinkIfOld(
|
|
472181
|
+
if (await unlinkIfOld(join170(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
471906
472182
|
result.messages++;
|
|
471907
472183
|
}
|
|
471908
472184
|
} catch {
|
|
471909
472185
|
result.errors++;
|
|
471910
472186
|
}
|
|
471911
472187
|
} else if (entry.isDirectory()) {
|
|
471912
|
-
const sessionDir =
|
|
471913
|
-
const toolResultsDir =
|
|
472188
|
+
const sessionDir = join170(projectDir, entry.name);
|
|
472189
|
+
const toolResultsDir = join170(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
471914
472190
|
let toolDirs;
|
|
471915
472191
|
try {
|
|
471916
472192
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -471921,14 +472197,14 @@ async function cleanupOldSessionFiles() {
|
|
|
471921
472197
|
for (const toolEntry of toolDirs) {
|
|
471922
472198
|
if (toolEntry.isFile()) {
|
|
471923
472199
|
try {
|
|
471924
|
-
if (await unlinkIfOld(
|
|
472200
|
+
if (await unlinkIfOld(join170(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
471925
472201
|
result.messages++;
|
|
471926
472202
|
}
|
|
471927
472203
|
} catch {
|
|
471928
472204
|
result.errors++;
|
|
471929
472205
|
}
|
|
471930
472206
|
} else if (toolEntry.isDirectory()) {
|
|
471931
|
-
const toolDirPath =
|
|
472207
|
+
const toolDirPath = join170(toolResultsDir, toolEntry.name);
|
|
471932
472208
|
let toolFiles;
|
|
471933
472209
|
try {
|
|
471934
472210
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -471939,7 +472215,7 @@ async function cleanupOldSessionFiles() {
|
|
|
471939
472215
|
if (!tf.isFile())
|
|
471940
472216
|
continue;
|
|
471941
472217
|
try {
|
|
471942
|
-
if (await unlinkIfOld(
|
|
472218
|
+
if (await unlinkIfOld(join170(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
471943
472219
|
result.messages++;
|
|
471944
472220
|
}
|
|
471945
472221
|
} catch {
|
|
@@ -471971,7 +472247,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
471971
472247
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
471972
472248
|
continue;
|
|
471973
472249
|
try {
|
|
471974
|
-
if (await unlinkIfOld(
|
|
472250
|
+
if (await unlinkIfOld(join170(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
471975
472251
|
result.messages++;
|
|
471976
472252
|
}
|
|
471977
472253
|
} catch {
|
|
@@ -471984,7 +472260,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
471984
472260
|
return result;
|
|
471985
472261
|
}
|
|
471986
472262
|
function cleanupOldPlanFiles() {
|
|
471987
|
-
const plansDir =
|
|
472263
|
+
const plansDir = join170(getTheusConfigHomeDir(), "plans");
|
|
471988
472264
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
471989
472265
|
}
|
|
471990
472266
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -471993,14 +472269,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
471993
472269
|
const fsImpl = getFsImplementation();
|
|
471994
472270
|
try {
|
|
471995
472271
|
const configDir = getTheusConfigHomeDir();
|
|
471996
|
-
const fileHistoryStorageDir =
|
|
472272
|
+
const fileHistoryStorageDir = join170(configDir, "file-history");
|
|
471997
472273
|
let dirents;
|
|
471998
472274
|
try {
|
|
471999
472275
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
472000
472276
|
} catch {
|
|
472001
472277
|
return result;
|
|
472002
472278
|
}
|
|
472003
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
472279
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join170(fileHistoryStorageDir, dirent.name));
|
|
472004
472280
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
472005
472281
|
try {
|
|
472006
472282
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -472027,14 +472303,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
472027
472303
|
const fsImpl = getFsImplementation();
|
|
472028
472304
|
try {
|
|
472029
472305
|
const configDir = getTheusConfigHomeDir();
|
|
472030
|
-
const sessionEnvBaseDir =
|
|
472306
|
+
const sessionEnvBaseDir = join170(configDir, "session-env");
|
|
472031
472307
|
let dirents;
|
|
472032
472308
|
try {
|
|
472033
472309
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
472034
472310
|
} catch {
|
|
472035
472311
|
return result;
|
|
472036
472312
|
}
|
|
472037
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
472313
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join170(sessionEnvBaseDir, dirent.name));
|
|
472038
472314
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
472039
472315
|
try {
|
|
472040
472316
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -472056,7 +472332,7 @@ async function cleanupOldDebugLogs() {
|
|
|
472056
472332
|
const cutoffDate = getCutoffDate();
|
|
472057
472333
|
const result = { messages: 0, errors: 0 };
|
|
472058
472334
|
const fsImpl = getFsImplementation();
|
|
472059
|
-
const debugDir =
|
|
472335
|
+
const debugDir = join170(getTheusConfigHomeDir(), "debug");
|
|
472060
472336
|
let dirents;
|
|
472061
472337
|
try {
|
|
472062
472338
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -472068,7 +472344,7 @@ async function cleanupOldDebugLogs() {
|
|
|
472068
472344
|
continue;
|
|
472069
472345
|
}
|
|
472070
472346
|
try {
|
|
472071
|
-
if (await unlinkIfOld(
|
|
472347
|
+
if (await unlinkIfOld(join170(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
472072
472348
|
result.messages++;
|
|
472073
472349
|
}
|
|
472074
472350
|
} catch {
|
|
@@ -475280,7 +475556,7 @@ __export(exports_asciicast, {
|
|
|
475280
475556
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
475281
475557
|
});
|
|
475282
475558
|
import { appendFile as appendFile8, rename as rename12 } from "fs/promises";
|
|
475283
|
-
import { basename as basename65, dirname as dirname73, join as
|
|
475559
|
+
import { basename as basename65, dirname as dirname73, join as join172 } from "path";
|
|
475284
475560
|
function getRecordFilePath() {
|
|
475285
475561
|
if (recordingState.filePath !== null) {
|
|
475286
475562
|
return recordingState.filePath;
|
|
@@ -475291,10 +475567,10 @@ function getRecordFilePath() {
|
|
|
475291
475567
|
if (!isEnvTruthy(process.env.THEUS_CODE_TERMINAL_RECORDING)) {
|
|
475292
475568
|
return null;
|
|
475293
475569
|
}
|
|
475294
|
-
const projectsDir =
|
|
475295
|
-
const projectDir =
|
|
475570
|
+
const projectsDir = join172(getTheusConfigHomeDir(), "projects");
|
|
475571
|
+
const projectDir = join172(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
475296
475572
|
recordingState.timestamp = Date.now();
|
|
475297
|
-
recordingState.filePath =
|
|
475573
|
+
recordingState.filePath = join172(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
475298
475574
|
return recordingState.filePath;
|
|
475299
475575
|
}
|
|
475300
475576
|
function _resetRecordingStateForTesting() {
|
|
@@ -475303,13 +475579,13 @@ function _resetRecordingStateForTesting() {
|
|
|
475303
475579
|
}
|
|
475304
475580
|
function getSessionRecordingPaths() {
|
|
475305
475581
|
const sessionId = getSessionId();
|
|
475306
|
-
const projectsDir =
|
|
475307
|
-
const projectDir =
|
|
475582
|
+
const projectsDir = join172(getTheusConfigHomeDir(), "projects");
|
|
475583
|
+
const projectDir = join172(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
475308
475584
|
try {
|
|
475309
475585
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
475310
475586
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
475311
475587
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
475312
|
-
return files2.map((f) =>
|
|
475588
|
+
return files2.map((f) => join172(projectDir, f));
|
|
475313
475589
|
} catch {
|
|
475314
475590
|
return [];
|
|
475315
475591
|
}
|
|
@@ -475319,9 +475595,9 @@ async function renameRecordingForSession() {
|
|
|
475319
475595
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
475320
475596
|
return;
|
|
475321
475597
|
}
|
|
475322
|
-
const projectsDir =
|
|
475323
|
-
const projectDir =
|
|
475324
|
-
const newPath =
|
|
475598
|
+
const projectsDir = join172(getTheusConfigHomeDir(), "projects");
|
|
475599
|
+
const projectDir = join172(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
475600
|
+
const newPath = join172(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
475325
475601
|
if (oldPath === newPath) {
|
|
475326
475602
|
return;
|
|
475327
475603
|
}
|
|
@@ -476931,7 +477207,7 @@ function useSurveyState({
|
|
|
476931
477207
|
setState("submitted");
|
|
476932
477208
|
setTimeout(setState, hideThanksAfterMs, "closed");
|
|
476933
477209
|
}, [hideThanksAfterMs]);
|
|
476934
|
-
const
|
|
477210
|
+
const open25 = import_react301.useCallback(() => {
|
|
476935
477211
|
if (state2 !== "closed") {
|
|
476936
477212
|
return;
|
|
476937
477213
|
}
|
|
@@ -476982,7 +477258,7 @@ function useSurveyState({
|
|
|
476982
477258
|
return {
|
|
476983
477259
|
state: state2,
|
|
476984
477260
|
lastResponse,
|
|
476985
|
-
open:
|
|
477261
|
+
open: open25,
|
|
476986
477262
|
handleSelect,
|
|
476987
477263
|
handleTranscriptSelect
|
|
476988
477264
|
};
|
|
@@ -477118,7 +477394,7 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
477118
477394
|
const {
|
|
477119
477395
|
state: state2,
|
|
477120
477396
|
lastResponse,
|
|
477121
|
-
open:
|
|
477397
|
+
open: open25,
|
|
477122
477398
|
handleSelect,
|
|
477123
477399
|
handleTranscriptSelect
|
|
477124
477400
|
} = useSurveyState({
|
|
@@ -477199,9 +477475,9 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
477199
477475
|
}, [state2, isLoading, hasActivePrompt, isModelAllowed2, feedbackSurvey.timeLastShown, feedbackSurvey.submitCountAtLastAppearance, submitCount, config3.minTimeBetweenFeedbackMs, config3.minTimeBetweenGlobalFeedbackMs, config3.minUserTurnsBetweenFeedback, config3.minTimeBeforeFeedbackMs, config3.minUserTurnsBeforeFeedback, config3.probability, settingsRate]);
|
|
477200
477476
|
import_react302.useEffect(() => {
|
|
477201
477477
|
if (shouldOpen) {
|
|
477202
|
-
|
|
477478
|
+
open25();
|
|
477203
477479
|
}
|
|
477204
|
-
}, [shouldOpen,
|
|
477480
|
+
}, [shouldOpen, open25]);
|
|
477205
477481
|
return {
|
|
477206
477482
|
state: state2,
|
|
477207
477483
|
lastResponse,
|
|
@@ -477345,7 +477621,7 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
477345
477621
|
const {
|
|
477346
477622
|
state: state2,
|
|
477347
477623
|
lastResponse,
|
|
477348
|
-
open:
|
|
477624
|
+
open: open25,
|
|
477349
477625
|
handleSelect,
|
|
477350
477626
|
handleTranscriptSelect
|
|
477351
477627
|
} = useSurveyState({
|
|
@@ -477398,9 +477674,9 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
477398
477674
|
return;
|
|
477399
477675
|
}
|
|
477400
477676
|
if (Math.random() < SURVEY_PROBABILITY) {
|
|
477401
|
-
|
|
477677
|
+
open25();
|
|
477402
477678
|
}
|
|
477403
|
-
}, [enabled, state2, isLoading, hasActivePrompt, lastAssistant, messages,
|
|
477679
|
+
}, [enabled, state2, isLoading, hasActivePrompt, lastAssistant, messages, open25]);
|
|
477404
477680
|
return {
|
|
477405
477681
|
state: state2,
|
|
477406
477682
|
lastResponse,
|
|
@@ -477482,7 +477758,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477482
477758
|
const {
|
|
477483
477759
|
state: state2,
|
|
477484
477760
|
lastResponse,
|
|
477485
|
-
open:
|
|
477761
|
+
open: open25,
|
|
477486
477762
|
handleSelect
|
|
477487
477763
|
} = useSurveyState(t5);
|
|
477488
477764
|
let t6;
|
|
@@ -477514,7 +477790,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477514
477790
|
const currentCompactBoundaries = t8;
|
|
477515
477791
|
let t10;
|
|
477516
477792
|
let t9;
|
|
477517
|
-
if ($2[9] !== currentCompactBoundaries || $2[10] !== enabled || $2[11] !== gateEnabled || $2[12] !== hasActivePrompt || $2[13] !== isLoading || $2[14] !== messages || $2[15] !==
|
|
477793
|
+
if ($2[9] !== currentCompactBoundaries || $2[10] !== enabled || $2[11] !== gateEnabled || $2[12] !== hasActivePrompt || $2[13] !== isLoading || $2[14] !== messages || $2[15] !== open25 || $2[16] !== state2) {
|
|
477518
477794
|
t9 = () => {
|
|
477519
477795
|
if (!enabled) {
|
|
477520
477796
|
return;
|
|
@@ -477538,7 +477814,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477538
477814
|
if (hasMessageAfterBoundary(messages, pendingCompactBoundaryUuid.current)) {
|
|
477539
477815
|
pendingCompactBoundaryUuid.current = null;
|
|
477540
477816
|
if (Math.random() < SURVEY_PROBABILITY2) {
|
|
477541
|
-
|
|
477817
|
+
open25();
|
|
477542
477818
|
}
|
|
477543
477819
|
return;
|
|
477544
477820
|
}
|
|
@@ -477549,14 +477825,14 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477549
477825
|
pendingCompactBoundaryUuid.current = newBoundaries[newBoundaries.length - 1];
|
|
477550
477826
|
}
|
|
477551
477827
|
};
|
|
477552
|
-
t10 = [enabled, currentCompactBoundaries, state2, isLoading, hasActivePrompt, gateEnabled, messages,
|
|
477828
|
+
t10 = [enabled, currentCompactBoundaries, state2, isLoading, hasActivePrompt, gateEnabled, messages, open25];
|
|
477553
477829
|
$2[9] = currentCompactBoundaries;
|
|
477554
477830
|
$2[10] = enabled;
|
|
477555
477831
|
$2[11] = gateEnabled;
|
|
477556
477832
|
$2[12] = hasActivePrompt;
|
|
477557
477833
|
$2[13] = isLoading;
|
|
477558
477834
|
$2[14] = messages;
|
|
477559
|
-
$2[15] =
|
|
477835
|
+
$2[15] = open25;
|
|
477560
477836
|
$2[16] = state2;
|
|
477561
477837
|
$2[17] = t10;
|
|
477562
477838
|
$2[18] = t9;
|
|
@@ -478083,8 +478359,8 @@ var init_useAwaySummary = __esm(() => {
|
|
|
478083
478359
|
});
|
|
478084
478360
|
|
|
478085
478361
|
// utils/theusInChrome/setupPortable.ts
|
|
478086
|
-
import { readdir as
|
|
478087
|
-
import { join as
|
|
478362
|
+
import { readdir as readdir37 } from "fs/promises";
|
|
478363
|
+
import { join as join173 } from "path";
|
|
478088
478364
|
function getExtensionIds() {
|
|
478089
478365
|
return [THEUS_BROWSER_EXTENSION_ID];
|
|
478090
478366
|
}
|
|
@@ -478097,7 +478373,7 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
478097
478373
|
for (const { browser, path: browserBasePath } of browserPaths) {
|
|
478098
478374
|
let browserProfileEntries = [];
|
|
478099
478375
|
try {
|
|
478100
|
-
browserProfileEntries = await
|
|
478376
|
+
browserProfileEntries = await readdir37(browserBasePath, {
|
|
478101
478377
|
withFileTypes: true
|
|
478102
478378
|
});
|
|
478103
478379
|
} catch (e) {
|
|
@@ -478111,9 +478387,9 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
478111
478387
|
}
|
|
478112
478388
|
for (const profile of profileDirs) {
|
|
478113
478389
|
for (const extensionId of extensionIds) {
|
|
478114
|
-
const extensionPath =
|
|
478390
|
+
const extensionPath = join173(browserBasePath, profile, "Extensions", extensionId);
|
|
478115
478391
|
try {
|
|
478116
|
-
await
|
|
478392
|
+
await readdir37(extensionPath);
|
|
478117
478393
|
log2?.(`[Theus in Chrome] Extension ${extensionId} found in ${browser} ${profile}`);
|
|
478118
478394
|
return { isInstalled: true, browser };
|
|
478119
478395
|
} catch {}
|
|
@@ -478133,9 +478409,9 @@ var init_setupPortable = __esm(() => {
|
|
|
478133
478409
|
});
|
|
478134
478410
|
|
|
478135
478411
|
// utils/theusInChrome/setup.ts
|
|
478136
|
-
import { chmod as chmod15, mkdir as mkdir55, readFile as
|
|
478412
|
+
import { chmod as chmod15, mkdir as mkdir55, readFile as readFile65, writeFile as writeFile54 } from "fs/promises";
|
|
478137
478413
|
import { homedir as homedir50 } from "os";
|
|
478138
|
-
import { join as
|
|
478414
|
+
import { join as join174 } from "path";
|
|
478139
478415
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
478140
478416
|
function isTheusInChromeEngineAvailable() {
|
|
478141
478417
|
return Array.isArray(BROWSER_TOOLS);
|
|
@@ -478199,8 +478475,8 @@ function setupTheusInChrome() {
|
|
|
478199
478475
|
};
|
|
478200
478476
|
} else {
|
|
478201
478477
|
const __filename3 = fileURLToPath8(import.meta.url);
|
|
478202
|
-
const __dirname3 =
|
|
478203
|
-
const cliPath =
|
|
478478
|
+
const __dirname3 = join174(__filename3, "..");
|
|
478479
|
+
const cliPath = join174(__dirname3, "cli.js");
|
|
478204
478480
|
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" }));
|
|
478205
478481
|
const mcpConfig = {
|
|
478206
478482
|
[THEUS_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -478222,8 +478498,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
478222
478498
|
const platform7 = getPlatform();
|
|
478223
478499
|
if (platform7 === "windows") {
|
|
478224
478500
|
const home = homedir50();
|
|
478225
|
-
const appData = process.env.APPDATA ||
|
|
478226
|
-
return [
|
|
478501
|
+
const appData = process.env.APPDATA || join174(home, "AppData", "Local");
|
|
478502
|
+
return [join174(appData, "Theus", "ChromeNativeHost")];
|
|
478227
478503
|
}
|
|
478228
478504
|
return getAllNativeMessagingHostsDirs().map(({ path: path21 }) => path21);
|
|
478229
478505
|
}
|
|
@@ -478242,8 +478518,8 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
478242
478518
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
478243
478519
|
let anyManifestUpdated = false;
|
|
478244
478520
|
for (const manifestDir of manifestDirs) {
|
|
478245
|
-
const manifestPath =
|
|
478246
|
-
const existingContent = await
|
|
478521
|
+
const manifestPath = join174(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
478522
|
+
const existingContent = await readFile65(manifestPath, "utf-8").catch(() => null);
|
|
478247
478523
|
if (existingContent === manifestContent) {
|
|
478248
478524
|
continue;
|
|
478249
478525
|
}
|
|
@@ -478257,7 +478533,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
478257
478533
|
}
|
|
478258
478534
|
}
|
|
478259
478535
|
if (getPlatform() === "windows") {
|
|
478260
|
-
const manifestPath =
|
|
478536
|
+
const manifestPath = join174(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
478261
478537
|
registerWindowsNativeHosts(manifestPath);
|
|
478262
478538
|
}
|
|
478263
478539
|
if (anyManifestUpdated) {
|
|
@@ -478295,8 +478571,8 @@ function registerWindowsNativeHosts(manifestPath) {
|
|
|
478295
478571
|
}
|
|
478296
478572
|
async function createWrapperScript(command9) {
|
|
478297
478573
|
const platform7 = getPlatform();
|
|
478298
|
-
const chromeDir =
|
|
478299
|
-
const wrapperPath = platform7 === "windows" ?
|
|
478574
|
+
const chromeDir = join174(getTheusConfigHomeDir(), "chrome");
|
|
478575
|
+
const wrapperPath = platform7 === "windows" ? join174(chromeDir, "chrome-native-host.bat") : join174(chromeDir, "chrome-native-host");
|
|
478300
478576
|
const scriptContent = platform7 === "windows" ? `@echo off
|
|
478301
478577
|
REM Chrome native host wrapper script
|
|
478302
478578
|
REM Generated by Theus - do not edit manually
|
|
@@ -478306,7 +478582,7 @@ ${command9}
|
|
|
478306
478582
|
# Generated by Theus - do not edit manually
|
|
478307
478583
|
exec ${command9}
|
|
478308
478584
|
`;
|
|
478309
|
-
const existingContent = await
|
|
478585
|
+
const existingContent = await readFile65(wrapperPath, "utf-8").catch(() => null);
|
|
478310
478586
|
if (existingContent === scriptContent) {
|
|
478311
478587
|
return wrapperPath;
|
|
478312
478588
|
}
|
|
@@ -478425,7 +478701,7 @@ var init_useChromeExtensionNotification = __esm(() => {
|
|
|
478425
478701
|
});
|
|
478426
478702
|
|
|
478427
478703
|
// utils/plugins/officialMarketplaceStartupCheck.ts
|
|
478428
|
-
import { join as
|
|
478704
|
+
import { join as join175 } from "path";
|
|
478429
478705
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
478430
478706
|
if (isEnvTruthy(process.env.THEUS_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)) {
|
|
478431
478707
|
return true;
|
|
@@ -478503,7 +478779,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
478503
478779
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
478504
478780
|
}
|
|
478505
478781
|
const cacheDir = getMarketplacesCacheDir();
|
|
478506
|
-
const installLocation =
|
|
478782
|
+
const installLocation = join175(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
478507
478783
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
478508
478784
|
if (gcsSha !== null) {
|
|
478509
478785
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -481287,7 +481563,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
481287
481563
|
});
|
|
481288
481564
|
|
|
481289
481565
|
// hooks/useLspPluginRecommendation.tsx
|
|
481290
|
-
import { extname as extname20, join as
|
|
481566
|
+
import { extname as extname20, join as join176 } from "path";
|
|
481291
481567
|
function useLspPluginRecommendation() {
|
|
481292
481568
|
const $2 = c3(12);
|
|
481293
481569
|
const trackedFiles = useAppState(_temp202);
|
|
@@ -481372,7 +481648,7 @@ function useLspPluginRecommendation() {
|
|
|
481372
481648
|
case "yes": {
|
|
481373
481649
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
481374
481650
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
481375
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
481651
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join176(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
481376
481652
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
481377
481653
|
const settings = getSettingsForSource("userSettings");
|
|
481378
481654
|
updateSettingsForSource("userSettings", {
|
|
@@ -484576,7 +484852,7 @@ var exports_REPL = {};
|
|
|
484576
484852
|
__export(exports_REPL, {
|
|
484577
484853
|
REPL: () => REPL
|
|
484578
484854
|
});
|
|
484579
|
-
import { dirname as dirname75, join as
|
|
484855
|
+
import { dirname as dirname75, join as join177 } from "path";
|
|
484580
484856
|
import { tmpdir as tmpdir16 } from "os";
|
|
484581
484857
|
import { writeFile as writeFile55 } from "fs/promises";
|
|
484582
484858
|
import { randomUUID as randomUUID61 } from "crypto";
|
|
@@ -487210,7 +487486,7 @@ Note: ctrl + z now suspends Theus, ctrl + _ undoes input.
|
|
|
487210
487486
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
487211
487487
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
487212
487488
|
const text2 = raw.replace(/[ \t]+$/gm, "");
|
|
487213
|
-
const path21 =
|
|
487489
|
+
const path21 = join177(tmpdir16(), `cc-transcript-${Date.now()}.txt`);
|
|
487214
487490
|
await writeFile55(path21, text2);
|
|
487215
487491
|
const opened = openFileInExternalEditor(path21);
|
|
487216
487492
|
setStatus(opened ? `opening ${path21}` : `wrote ${path21} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -489974,7 +490250,7 @@ function completeOnboarding() {
|
|
|
489974
490250
|
saveGlobalConfig((current) => ({
|
|
489975
490251
|
...current,
|
|
489976
490252
|
hasCompletedOnboarding: true,
|
|
489977
|
-
lastOnboardingVersion: { VERSION: "0.2.
|
|
490253
|
+
lastOnboardingVersion: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
489978
490254
|
}));
|
|
489979
490255
|
}
|
|
489980
490256
|
function showDialog(root2, renderer) {
|
|
@@ -490205,15 +490481,15 @@ var init_interactiveHelpers = __esm(() => {
|
|
|
490205
490481
|
|
|
490206
490482
|
// components/Theus/arsenalStats.ts
|
|
490207
490483
|
import { existsSync as existsSync30, readdirSync as readdirSync6 } from "fs";
|
|
490208
|
-
import { dirname as dirname76, join as
|
|
490484
|
+
import { dirname as dirname76, join as join178 } from "path";
|
|
490209
490485
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
490210
490486
|
function countBundledArsenalSkills() {
|
|
490211
490487
|
try {
|
|
490212
490488
|
const here = dirname76(fileURLToPath9(import.meta.url));
|
|
490213
490489
|
for (const dir of [
|
|
490214
|
-
|
|
490215
|
-
|
|
490216
|
-
|
|
490490
|
+
join178(here, "..", "..", "vendor", "theus-arsenal", "skills"),
|
|
490491
|
+
join178(here, "vendor", "theus-arsenal", "skills"),
|
|
490492
|
+
join178(here, "..", "vendor", "theus-arsenal", "skills")
|
|
490217
490493
|
]) {
|
|
490218
490494
|
if (!existsSync30(dir))
|
|
490219
490495
|
continue;
|
|
@@ -490296,12 +490572,12 @@ var init_arsenalStats = __esm(() => {
|
|
|
490296
490572
|
|
|
490297
490573
|
// services/import/detect/global.ts
|
|
490298
490574
|
import { existsSync as existsSync31 } from "fs";
|
|
490299
|
-
import { open as
|
|
490300
|
-
import { join as
|
|
490575
|
+
import { open as open25, readdir as readdir38, stat as stat56 } from "fs/promises";
|
|
490576
|
+
import { join as join179 } from "path";
|
|
490301
490577
|
async function rutaDelTranscript(fichero) {
|
|
490302
490578
|
let crudo;
|
|
490303
490579
|
try {
|
|
490304
|
-
const fh = await
|
|
490580
|
+
const fh = await open25(fichero, "r");
|
|
490305
490581
|
try {
|
|
490306
490582
|
const buf = Buffer.alloc(65536);
|
|
490307
490583
|
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
@@ -490328,19 +490604,19 @@ async function rutaDelTranscript(fichero) {
|
|
|
490328
490604
|
return null;
|
|
490329
490605
|
}
|
|
490330
490606
|
async function explorarTodoElTrabajo(entorno) {
|
|
490331
|
-
const raiz =
|
|
490607
|
+
const raiz = join179(directorioConfig(entorno), "projects");
|
|
490332
490608
|
let directorios;
|
|
490333
490609
|
try {
|
|
490334
|
-
directorios = await
|
|
490610
|
+
directorios = await readdir38(raiz);
|
|
490335
490611
|
} catch {
|
|
490336
490612
|
return [];
|
|
490337
490613
|
}
|
|
490338
490614
|
const salida = [];
|
|
490339
490615
|
for (const dir of directorios) {
|
|
490340
|
-
const ruta =
|
|
490616
|
+
const ruta = join179(raiz, dir);
|
|
490341
490617
|
let sesiones;
|
|
490342
490618
|
try {
|
|
490343
|
-
sesiones = (await
|
|
490619
|
+
sesiones = (await readdir38(ruta)).filter((n3) => n3.endsWith(".jsonl"));
|
|
490344
490620
|
} catch {
|
|
490345
490621
|
continue;
|
|
490346
490622
|
}
|
|
@@ -490351,7 +490627,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
490351
490627
|
let ficheroMasReciente = sesiones[0];
|
|
490352
490628
|
for (const nombre of sesiones) {
|
|
490353
490629
|
try {
|
|
490354
|
-
const info = await
|
|
490630
|
+
const info = await stat56(join179(ruta, nombre));
|
|
490355
490631
|
bytes += info.size;
|
|
490356
490632
|
if (info.mtimeMs > masReciente) {
|
|
490357
490633
|
masReciente = info.mtimeMs;
|
|
@@ -490359,7 +490635,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
490359
490635
|
}
|
|
490360
490636
|
} catch {}
|
|
490361
490637
|
}
|
|
490362
|
-
const proyecto = await rutaDelTranscript(
|
|
490638
|
+
const proyecto = await rutaDelTranscript(join179(ruta, ficheroMasReciente));
|
|
490363
490639
|
if (!proyecto)
|
|
490364
490640
|
continue;
|
|
490365
490641
|
salida.push({
|
|
@@ -490463,7 +490739,7 @@ __export(exports_OnboardingWizard, {
|
|
|
490463
490739
|
OnboardingWizard: () => OnboardingWizard
|
|
490464
490740
|
});
|
|
490465
490741
|
import { existsSync as existsSync32, mkdirSync as mkdirSync15, writeFileSync as writeFileSync14 } from "fs";
|
|
490466
|
-
import { join as
|
|
490742
|
+
import { join as join180 } from "path";
|
|
490467
490743
|
function hasSeenOnboardingWizard() {
|
|
490468
490744
|
if (isEnvTruthy(process.env.THEUS_FORCE_ONBOARDING_WIZARD))
|
|
490469
490745
|
return false;
|
|
@@ -490471,7 +490747,7 @@ function hasSeenOnboardingWizard() {
|
|
|
490471
490747
|
return true;
|
|
490472
490748
|
}
|
|
490473
490749
|
try {
|
|
490474
|
-
return existsSync32(
|
|
490750
|
+
return existsSync32(join180(getTheusConfigHome(), WIZARD_MARKER));
|
|
490475
490751
|
} catch {
|
|
490476
490752
|
return true;
|
|
490477
490753
|
}
|
|
@@ -490480,7 +490756,7 @@ function markOnboardingWizardSeen() {
|
|
|
490480
490756
|
try {
|
|
490481
490757
|
const home = getTheusConfigHome();
|
|
490482
490758
|
mkdirSync15(home, { recursive: true });
|
|
490483
|
-
writeFileSync14(
|
|
490759
|
+
writeFileSync14(join180(home, WIZARD_MARKER), `${JSON.stringify({
|
|
490484
490760
|
seenAt: new Date().toISOString(),
|
|
490485
490761
|
version: globalThis.MACRO?.VERSION ?? null
|
|
490486
490762
|
})}
|
|
@@ -491846,7 +492122,7 @@ var init_TheusMissionLaunch = __esm(() => {
|
|
|
491846
492122
|
});
|
|
491847
492123
|
|
|
491848
492124
|
// replLauncher.tsx
|
|
491849
|
-
import { readFile as
|
|
492125
|
+
import { readFile as readFile66 } from "fs/promises";
|
|
491850
492126
|
function shouldShowStartMenu(replProps) {
|
|
491851
492127
|
return !!process.stdin.isTTY && !!process.stdout.isTTY && process.env.THEUS_START_MENU !== "0" && process.env.THEUS_NO_START_MENU !== "1" && !replProps.disabled && !(replProps.initialMessages && replProps.initialMessages.length > 0) && !replProps.taskListId && !replProps.remoteSessionConfig && !replProps.directConnectConfig;
|
|
491852
492128
|
}
|
|
@@ -491878,7 +492154,7 @@ function withTimeout2(promise3, ms, fallback) {
|
|
|
491878
492154
|
async function readMemoryFacts() {
|
|
491879
492155
|
try {
|
|
491880
492156
|
const { getGraphPath: getGraphPath2 } = await Promise.resolve().then(() => (init_paths2(), exports_paths));
|
|
491881
|
-
const raw = await
|
|
492157
|
+
const raw = await readFile66(getGraphPath2(getCwd()), "utf8");
|
|
491882
492158
|
const data = JSON.parse(raw);
|
|
491883
492159
|
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
491884
492160
|
let facts = 0;
|
|
@@ -493960,7 +494236,7 @@ var init_theusInChrome = __esm(() => {
|
|
|
493960
494236
|
});
|
|
493961
494237
|
|
|
493962
494238
|
// skills/bundled/debug.ts
|
|
493963
|
-
import { open as
|
|
494239
|
+
import { open as open26, stat as stat57 } from "fs/promises";
|
|
493964
494240
|
function registerDebugSkill() {
|
|
493965
494241
|
registerBundledSkill({
|
|
493966
494242
|
name: "debug",
|
|
@@ -493974,10 +494250,10 @@ function registerDebugSkill() {
|
|
|
493974
494250
|
const debugLogPath = getDebugLogPath();
|
|
493975
494251
|
let logInfo;
|
|
493976
494252
|
try {
|
|
493977
|
-
const stats2 = await
|
|
494253
|
+
const stats2 = await stat57(debugLogPath);
|
|
493978
494254
|
const readSize = Math.min(stats2.size, TAIL_READ_BYTES);
|
|
493979
494255
|
const startOffset = stats2.size - readSize;
|
|
493980
|
-
const fd2 = await
|
|
494256
|
+
const fd2 = await open26(debugLogPath, "r");
|
|
493981
494257
|
try {
|
|
493982
494258
|
const { buffer, bytesRead } = await fd2.read({
|
|
493983
494259
|
buffer: Buffer.alloc(readSize),
|
|
@@ -496560,10 +496836,10 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
496560
496836
|
});
|
|
496561
496837
|
|
|
496562
496838
|
// utils/releaseNotes.ts
|
|
496563
|
-
import { mkdir as mkdir56, readFile as
|
|
496564
|
-
import { dirname as dirname78, join as
|
|
496839
|
+
import { mkdir as mkdir56, readFile as readFile67, writeFile as writeFile56 } from "fs/promises";
|
|
496840
|
+
import { dirname as dirname78, join as join181 } from "path";
|
|
496565
496841
|
function getChangelogCachePath() {
|
|
496566
|
-
return
|
|
496842
|
+
return join181(getTheusConfigHomeDir(), "cache", "changelog.md");
|
|
496567
496843
|
}
|
|
496568
496844
|
async function migrateChangelogFromConfig() {
|
|
496569
496845
|
const config3 = getGlobalConfig();
|
|
@@ -496610,7 +496886,7 @@ async function getStoredChangelog() {
|
|
|
496610
496886
|
}
|
|
496611
496887
|
const cachePath2 = getChangelogCachePath();
|
|
496612
496888
|
try {
|
|
496613
|
-
const content = await
|
|
496889
|
+
const content = await readFile67(cachePath2, "utf-8");
|
|
496614
496890
|
changelogMemoryCache = content;
|
|
496615
496891
|
return content;
|
|
496616
496892
|
} catch {
|
|
@@ -496663,7 +496939,7 @@ function getRecentReleaseNotes(currentVersion, previousVersion, changelogContent
|
|
|
496663
496939
|
}
|
|
496664
496940
|
return [];
|
|
496665
496941
|
}
|
|
496666
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.
|
|
496942
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
496667
496943
|
if (false) {}
|
|
496668
496944
|
const cachedChangelog = await getStoredChangelog();
|
|
496669
496945
|
if (lastSeenVersion !== currentVersion || !cachedChangelog) {
|
|
@@ -496761,7 +497037,7 @@ __export(exports_setup2, {
|
|
|
496761
497037
|
setupComputerUse: () => setupComputerUse,
|
|
496762
497038
|
COMPUTER_USE_SYSTEM_HINT: () => COMPUTER_USE_SYSTEM_HINT
|
|
496763
497039
|
});
|
|
496764
|
-
import { dirname as dirname79, join as
|
|
497040
|
+
import { dirname as dirname79, join as join182 } from "path";
|
|
496765
497041
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
496766
497042
|
function setupComputerUse() {
|
|
496767
497043
|
const allowedTools = COMPUTER_USE_TOOL_NAMES.map((name) => buildMcpToolName(COMPUTER_USE_SERVER_NAME, name));
|
|
@@ -496788,11 +497064,11 @@ function resolveComputerUseLauncher() {
|
|
|
496788
497064
|
return { command: process.execPath, args: [entry, COMPUTER_USE_FLAG] };
|
|
496789
497065
|
}
|
|
496790
497066
|
if (entry) {
|
|
496791
|
-
const launcher =
|
|
497067
|
+
const launcher = join182(dirname79(entry), "..", "bin", "theus");
|
|
496792
497068
|
return { command: launcher, args: [COMPUTER_USE_FLAG] };
|
|
496793
497069
|
}
|
|
496794
497070
|
return {
|
|
496795
|
-
command:
|
|
497071
|
+
command: join182(fileURLToPath10(import.meta.url), "..", "..", "..", "bin", "theus"),
|
|
496796
497072
|
args: [COMPUTER_USE_FLAG]
|
|
496797
497073
|
};
|
|
496798
497074
|
}
|
|
@@ -496810,7 +497086,7 @@ __export(exports_arsenalBundled, {
|
|
|
496810
497086
|
ensureBundledArsenalInstalled: () => ensureBundledArsenalInstalled
|
|
496811
497087
|
});
|
|
496812
497088
|
import { existsSync as existsSync33, readFileSync as readFileSync33 } from "fs";
|
|
496813
|
-
import { dirname as dirname80, join as
|
|
497089
|
+
import { dirname as dirname80, join as join183 } from "path";
|
|
496814
497090
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
496815
497091
|
function isArsenalAutoInstallEnabled() {
|
|
496816
497092
|
return process.env.THEUS_NO_ARSENAL !== "1";
|
|
@@ -496818,10 +497094,10 @@ function isArsenalAutoInstallEnabled() {
|
|
|
496818
497094
|
function findBundledArsenalDir() {
|
|
496819
497095
|
const here = dirname80(fileURLToPath11(import.meta.url));
|
|
496820
497096
|
for (const candidate of [
|
|
496821
|
-
|
|
496822
|
-
|
|
497097
|
+
join183(here, "vendor", "theus-arsenal"),
|
|
497098
|
+
join183(here, "..", "vendor", "theus-arsenal")
|
|
496823
497099
|
]) {
|
|
496824
|
-
if (existsSync33(
|
|
497100
|
+
if (existsSync33(join183(candidate, ".theus-plugin", "plugin.json"))) {
|
|
496825
497101
|
return candidate;
|
|
496826
497102
|
}
|
|
496827
497103
|
}
|
|
@@ -496829,7 +497105,7 @@ function findBundledArsenalDir() {
|
|
|
496829
497105
|
}
|
|
496830
497106
|
function readBundledVersion(bundledDir) {
|
|
496831
497107
|
try {
|
|
496832
|
-
const manifest = JSON.parse(readFileSync33(
|
|
497108
|
+
const manifest = JSON.parse(readFileSync33(join183(bundledDir, ".theus-plugin", "plugin.json"), "utf8"));
|
|
496833
497109
|
return typeof manifest.version === "string" ? manifest.version : null;
|
|
496834
497110
|
} catch {
|
|
496835
497111
|
return null;
|
|
@@ -497067,9 +497343,9 @@ var init_sessionMemory = __esm(() => {
|
|
|
497067
497343
|
});
|
|
497068
497344
|
|
|
497069
497345
|
// utils/iTermBackup.ts
|
|
497070
|
-
import { copyFile as copyFile10, stat as
|
|
497346
|
+
import { copyFile as copyFile10, stat as stat58 } from "fs/promises";
|
|
497071
497347
|
import { homedir as homedir52 } from "os";
|
|
497072
|
-
import { join as
|
|
497348
|
+
import { join as join184 } from "path";
|
|
497073
497349
|
function markITerm2SetupComplete() {
|
|
497074
497350
|
saveGlobalConfig((current) => ({
|
|
497075
497351
|
...current,
|
|
@@ -497084,7 +497360,7 @@ function getIterm2RecoveryInfo() {
|
|
|
497084
497360
|
};
|
|
497085
497361
|
}
|
|
497086
497362
|
function getITerm2PlistPath() {
|
|
497087
|
-
return
|
|
497363
|
+
return join184(homedir52(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
497088
497364
|
}
|
|
497089
497365
|
async function checkAndRestoreITerm2Backup() {
|
|
497090
497366
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -497096,7 +497372,7 @@ async function checkAndRestoreITerm2Backup() {
|
|
|
497096
497372
|
return { status: "no_backup" };
|
|
497097
497373
|
}
|
|
497098
497374
|
try {
|
|
497099
|
-
await
|
|
497375
|
+
await stat58(backupPath);
|
|
497100
497376
|
} catch {
|
|
497101
497377
|
markITerm2SetupComplete();
|
|
497102
497378
|
return { status: "no_backup" };
|
|
@@ -498591,11 +498867,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
498591
498867
|
});
|
|
498592
498868
|
|
|
498593
498869
|
// utils/plugins/zipCacheAdapters.ts
|
|
498594
|
-
import { readFile as
|
|
498595
|
-
import { join as
|
|
498870
|
+
import { readFile as readFile68 } from "fs/promises";
|
|
498871
|
+
import { join as join185 } from "path";
|
|
498596
498872
|
async function readZipCacheKnownMarketplaces() {
|
|
498597
498873
|
try {
|
|
498598
|
-
const content = await
|
|
498874
|
+
const content = await readFile68(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
498599
498875
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
498600
498876
|
if (!parsed.success) {
|
|
498601
498877
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -498617,18 +498893,18 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
498617
498893
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
498618
498894
|
if (content !== null) {
|
|
498619
498895
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
498620
|
-
await atomicWriteToZipCache(
|
|
498896
|
+
await atomicWriteToZipCache(join185(zipCachePath, relPath), content);
|
|
498621
498897
|
}
|
|
498622
498898
|
}
|
|
498623
498899
|
async function readMarketplaceJsonContent(dir) {
|
|
498624
498900
|
const candidates = [
|
|
498625
|
-
|
|
498626
|
-
|
|
498901
|
+
join185(dir, ".theus-plugin", "marketplace.json"),
|
|
498902
|
+
join185(dir, "marketplace.json"),
|
|
498627
498903
|
dir
|
|
498628
498904
|
];
|
|
498629
498905
|
for (const candidate of candidates) {
|
|
498630
498906
|
try {
|
|
498631
|
-
return await
|
|
498907
|
+
return await readFile68(candidate, "utf-8");
|
|
498632
498908
|
} catch {}
|
|
498633
498909
|
}
|
|
498634
498910
|
return null;
|
|
@@ -498758,7 +499034,7 @@ __export(exports_print, {
|
|
|
498758
499034
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
498759
499035
|
canBatchWith: () => canBatchWith
|
|
498760
499036
|
});
|
|
498761
|
-
import { readFile as
|
|
499037
|
+
import { readFile as readFile69, stat as stat59 } from "fs/promises";
|
|
498762
499038
|
import { dirname as dirname81 } from "path";
|
|
498763
499039
|
import { cwd as cwd2 } from "process";
|
|
498764
499040
|
import { randomUUID as randomUUID64 } from "crypto";
|
|
@@ -500147,9 +500423,9 @@ ${m.text}
|
|
|
500147
500423
|
} else if (request.subtype === "seed_read_state") {
|
|
500148
500424
|
try {
|
|
500149
500425
|
const normalizedPath = expandPath(request.path);
|
|
500150
|
-
const diskMtime = Math.floor((await
|
|
500426
|
+
const diskMtime = Math.floor((await stat59(normalizedPath)).mtimeMs);
|
|
500151
500427
|
if (diskMtime <= request.mtime) {
|
|
500152
|
-
const raw = await
|
|
500428
|
+
const raw = await readFile69(normalizedPath, "utf-8");
|
|
500153
500429
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
500154
500430
|
`, `
|
|
500155
500431
|
`);
|
|
@@ -502196,7 +502472,7 @@ async function startMCPServer(cwd3, debug3, verbose) {
|
|
|
502196
502472
|
setCwd(cwd3);
|
|
502197
502473
|
const server2 = new Server({
|
|
502198
502474
|
name: "theus/tengu",
|
|
502199
|
-
version: { VERSION: "0.2.
|
|
502475
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
502200
502476
|
}, {
|
|
502201
502477
|
capabilities: {
|
|
502202
502478
|
tools: {}
|
|
@@ -502326,37 +502602,37 @@ __export(exports_theusDesktop, {
|
|
|
502326
502602
|
readTheusDesktopMcpServers: () => readTheusDesktopMcpServers,
|
|
502327
502603
|
getTheusDesktopConfigPath: () => getTheusDesktopConfigPath
|
|
502328
502604
|
});
|
|
502329
|
-
import { readdir as
|
|
502605
|
+
import { readdir as readdir39, readFile as readFile70, stat as stat60 } from "fs/promises";
|
|
502330
502606
|
import { homedir as homedir53 } from "os";
|
|
502331
|
-
import { join as
|
|
502607
|
+
import { join as join186 } from "path";
|
|
502332
502608
|
async function getTheusDesktopConfigPath() {
|
|
502333
502609
|
const platform7 = getPlatform();
|
|
502334
502610
|
if (!SUPPORTED_PLATFORMS.includes(platform7)) {
|
|
502335
502611
|
throw new Error(`Unsupported platform: ${platform7} - Theus Desktop integration only works on macOS and WSL.`);
|
|
502336
502612
|
}
|
|
502337
502613
|
if (platform7 === "macos") {
|
|
502338
|
-
return
|
|
502614
|
+
return join186(homedir53(), "Library", "Application Support", "Theus", "theus_desktop_config.json");
|
|
502339
502615
|
}
|
|
502340
502616
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
502341
502617
|
if (windowsHome) {
|
|
502342
502618
|
const wslPath = windowsHome.replace(/^[A-Z]:/, "");
|
|
502343
502619
|
const configPath2 = `/mnt/c${wslPath}/AppData/Roaming/Theus/theus_desktop_config.json`;
|
|
502344
502620
|
try {
|
|
502345
|
-
await
|
|
502621
|
+
await stat60(configPath2);
|
|
502346
502622
|
return configPath2;
|
|
502347
502623
|
} catch {}
|
|
502348
502624
|
}
|
|
502349
502625
|
try {
|
|
502350
502626
|
const usersDir = "/mnt/c/Users";
|
|
502351
502627
|
try {
|
|
502352
|
-
const userDirs = await
|
|
502628
|
+
const userDirs = await readdir39(usersDir, { withFileTypes: true });
|
|
502353
502629
|
for (const user of userDirs) {
|
|
502354
502630
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
502355
502631
|
continue;
|
|
502356
502632
|
}
|
|
502357
|
-
const potentialConfigPath =
|
|
502633
|
+
const potentialConfigPath = join186(usersDir, user.name, "AppData", "Roaming", "Theus", "theus_desktop_config.json");
|
|
502358
502634
|
try {
|
|
502359
|
-
await
|
|
502635
|
+
await stat60(potentialConfigPath);
|
|
502360
502636
|
return potentialConfigPath;
|
|
502361
502637
|
} catch {}
|
|
502362
502638
|
}
|
|
@@ -502374,7 +502650,7 @@ async function readTheusDesktopMcpServers() {
|
|
|
502374
502650
|
const configPath2 = await getTheusDesktopConfigPath();
|
|
502375
502651
|
let configContent;
|
|
502376
502652
|
try {
|
|
502377
|
-
configContent = await
|
|
502653
|
+
configContent = await readFile70(configPath2, { encoding: "utf8" });
|
|
502378
502654
|
} catch (e) {
|
|
502379
502655
|
const code = getErrnoCode(e);
|
|
502380
502656
|
if (code === "ENOENT") {
|
|
@@ -502425,7 +502701,7 @@ __export(exports_mcp3, {
|
|
|
502425
502701
|
mcpAddJsonHandler: () => mcpAddJsonHandler,
|
|
502426
502702
|
mcpAddFromDesktopHandler: () => mcpAddFromDesktopHandler
|
|
502427
502703
|
});
|
|
502428
|
-
import { stat as
|
|
502704
|
+
import { stat as stat61 } from "fs/promises";
|
|
502429
502705
|
import { cwd as cwd3 } from "process";
|
|
502430
502706
|
async function checkMcpServerHealth(name, server2) {
|
|
502431
502707
|
try {
|
|
@@ -502448,7 +502724,7 @@ async function mcpServeHandler({
|
|
|
502448
502724
|
const providedCwd = cwd3();
|
|
502449
502725
|
logEvent("theus_mcp_start", {});
|
|
502450
502726
|
try {
|
|
502451
|
-
await
|
|
502727
|
+
await stat61(providedCwd);
|
|
502452
502728
|
} catch (error40) {
|
|
502453
502729
|
if (isFsInaccessible(error40)) {
|
|
502454
502730
|
cliError(`Error: Directory ${providedCwd} does not exist`);
|
|
@@ -503263,12 +503539,12 @@ __export(exports_install, {
|
|
|
503263
503539
|
install: () => install
|
|
503264
503540
|
});
|
|
503265
503541
|
import { homedir as homedir54 } from "os";
|
|
503266
|
-
import { join as
|
|
503542
|
+
import { join as join187 } from "path";
|
|
503267
503543
|
function getInstallationPath2() {
|
|
503268
503544
|
const isWindows2 = env3.platform === "win32";
|
|
503269
503545
|
const homeDir = homedir54();
|
|
503270
503546
|
if (isWindows2) {
|
|
503271
|
-
const windowsPath =
|
|
503547
|
+
const windowsPath = join187(homeDir, ".local", "bin", "theus.exe");
|
|
503272
503548
|
return windowsPath.replace(/\//g, "\\");
|
|
503273
503549
|
}
|
|
503274
503550
|
return "~/.local/bin/theus";
|
|
@@ -503638,7 +503914,7 @@ async function setupTokenHandler(root2) {
|
|
|
503638
503914
|
gap: 1,
|
|
503639
503915
|
children: [
|
|
503640
503916
|
/* @__PURE__ */ jsx_runtime502.jsx(TheusBanner, {
|
|
503641
|
-
version: { VERSION: "0.2.
|
|
503917
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
503642
503918
|
}),
|
|
503643
503919
|
showAuthWarning && /* @__PURE__ */ jsx_runtime502.jsxs(ThemedBox_default, {
|
|
503644
503920
|
flexDirection: "column",
|
|
@@ -503807,7 +504083,7 @@ var exports_import2 = {};
|
|
|
503807
504083
|
__export(exports_import2, {
|
|
503808
504084
|
importHandler: () => importHandler
|
|
503809
504085
|
});
|
|
503810
|
-
import { readFile as
|
|
504086
|
+
import { readFile as readFile71 } from "fs/promises";
|
|
503811
504087
|
import { homedir as homedir55 } from "os";
|
|
503812
504088
|
import { resolve as resolve59 } from "path";
|
|
503813
504089
|
function resolvePath4(raw) {
|
|
@@ -503829,7 +504105,7 @@ async function importHandler(file2, options2 = {}) {
|
|
|
503829
504105
|
const abs = resolvePath4(file2);
|
|
503830
504106
|
let bytes;
|
|
503831
504107
|
try {
|
|
503832
|
-
bytes = await
|
|
504108
|
+
bytes = await readFile71(abs);
|
|
503833
504109
|
} catch {
|
|
503834
504110
|
process.stderr.write(`\u2717 No pude leer el archivo: ${abs}
|
|
503835
504111
|
`);
|
|
@@ -505223,7 +505499,7 @@ ${assistantAddendum}` : assistantAddendum;
|
|
|
505223
505499
|
}
|
|
505224
505500
|
}
|
|
505225
505501
|
logForDiagnosticsNoPII("info", "started", {
|
|
505226
|
-
version: { VERSION: "0.2.
|
|
505502
|
+
version: { VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
505227
505503
|
is_native_binary: isInBundledMode()
|
|
505228
505504
|
});
|
|
505229
505505
|
registerCleanup(async () => {
|
|
@@ -506091,7 +506367,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
506091
506367
|
pendingHookMessages
|
|
506092
506368
|
}, renderAndRun);
|
|
506093
506369
|
}
|
|
506094
|
-
}).version(`${{ VERSION: "0.2.
|
|
506370
|
+
}).version(`${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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");
|
|
506095
506371
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
506096
506372
|
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.");
|
|
506097
506373
|
if (canUserConfigureAdvisor()) {
|
|
@@ -506692,7 +506968,7 @@ if (false) {}
|
|
|
506692
506968
|
async function main2() {
|
|
506693
506969
|
const args = process.argv.slice(2);
|
|
506694
506970
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
506695
|
-
console.log(`${{ VERSION: "0.2.
|
|
506971
|
+
console.log(`${{ VERSION: "0.2.74", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)`);
|
|
506696
506972
|
return;
|
|
506697
506973
|
}
|
|
506698
506974
|
if (args[0] === "login" || args[0] === "signin" || args[0] === "entrar" || args[0] === "iniciar-sesion") {
|