theus-cli 0.2.71 → 0.2.72
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 +1020 -582
- 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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,16 @@ var init_ConsoleOAuthFlow = __esm(() => {
|
|
|
256259
256259
|
var NOVEDADES;
|
|
256260
256260
|
var init_data = __esm(() => {
|
|
256261
256261
|
NOVEDADES = [
|
|
256262
|
+
{
|
|
256263
|
+
version: "v0.2.72",
|
|
256264
|
+
fecha: "2026-08-13",
|
|
256265
|
+
titulo: "Theus reconoce m\xE1s agentes de c\xF3digo, y por fin puedes ver lo que recuerda",
|
|
256266
|
+
puntos: [
|
|
256267
|
+
"La detecci\xF3n de contexto ya no mira solo un agente: reconoce el historial de tres, incluidos los que guardan sus sesiones por fecha en vez de por carpeta. En ese caso Theus consulta el \xEDndice de la propia herramienta filtrando por tu proyecto, as\xED que las sesiones de tus otros proyectos ni siquiera se leen.",
|
|
256268
|
+
"Tambi\xE9n detecta el historial que algunos asistentes dejan dentro del propio repositorio. Ese ni siquiera hay que buscarlo en tu equipo: o est\xE1 en el proyecto o no est\xE1.",
|
|
256269
|
+
"/memoria ahora te ense\xF1a lo que Theus recuerda de este proyecto, marcando lo que vino de otra IA. Antes solo abr\xEDa los archivos de instrucciones, as\xED que importabas tu contexto y no hab\xEDa manera de verlo."
|
|
256270
|
+
]
|
|
256271
|
+
},
|
|
256262
256272
|
{
|
|
256263
256273
|
version: "v0.2.71",
|
|
256264
256274
|
fecha: "2026-08-13",
|
|
@@ -300111,9 +300121,9 @@ function getTheusEnvMetadata() {
|
|
|
300111
300121
|
};
|
|
300112
300122
|
}
|
|
300113
300123
|
function getBuildAgeMinutes() {
|
|
300114
|
-
if (!{ VERSION: "0.2.
|
|
300124
|
+
if (!{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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)
|
|
300115
300125
|
return;
|
|
300116
|
-
const buildTime = new Date({ VERSION: "0.2.
|
|
300126
|
+
const buildTime = new Date({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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();
|
|
300117
300127
|
if (isNaN(buildTime))
|
|
300118
300128
|
return;
|
|
300119
300129
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -318418,7 +318428,7 @@ function getSimpleDoingTasksSection() {
|
|
|
318418
318428
|
];
|
|
318419
318429
|
const userHelpSubitems = [
|
|
318420
318430
|
`/help: Get help with using Theus`,
|
|
318421
|
-
`To give feedback, users should ${{ VERSION: "0.2.
|
|
318431
|
+
`To give feedback, users should ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
318422
318432
|
];
|
|
318423
318433
|
const items = [
|
|
318424
318434
|
`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.`,
|
|
@@ -329554,7 +329564,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
329554
329564
|
} catch {}
|
|
329555
329565
|
const data = {
|
|
329556
329566
|
trigger,
|
|
329557
|
-
version: { VERSION: "0.2.
|
|
329567
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
329558
329568
|
platform: process.platform,
|
|
329559
329569
|
transcript,
|
|
329560
329570
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -329759,10 +329769,10 @@ Si el usuario indic\xF3 una duraci\xF3n, p\xE1sala en el par\xE1metro \`duration
|
|
|
329759
329769
|
|
|
329760
329770
|
// commands/issue/index.ts
|
|
329761
329771
|
function getCliVersion() {
|
|
329762
|
-
return { VERSION: "0.2.
|
|
329772
|
+
return { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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";
|
|
329763
329773
|
}
|
|
329764
329774
|
function getIssuesExplainer() {
|
|
329765
|
-
return { VERSION: "0.2.
|
|
329775
|
+
return { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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";
|
|
329766
329776
|
}
|
|
329767
329777
|
function getActiveModelLabel() {
|
|
329768
329778
|
try {
|
|
@@ -332548,7 +332558,7 @@ function buildPrimarySection() {
|
|
|
332548
332558
|
});
|
|
332549
332559
|
return [{
|
|
332550
332560
|
label: "Version",
|
|
332551
|
-
value: { VERSION: "0.2.
|
|
332561
|
+
value: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
332552
332562
|
}, {
|
|
332553
332563
|
label: "Session name",
|
|
332554
332564
|
value: nameValue
|
|
@@ -336364,7 +336374,7 @@ function Config({
|
|
|
336364
336374
|
}
|
|
336365
336375
|
})
|
|
336366
336376
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime189.jsx(ChannelDowngradeDialog, {
|
|
336367
|
-
currentVersion: { VERSION: "0.2.
|
|
336377
|
+
currentVersion: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
336368
336378
|
onChoice: (choice) => {
|
|
336369
336379
|
setShowSubmenu(null);
|
|
336370
336380
|
setTabsHidden(false);
|
|
@@ -336376,7 +336386,7 @@ function Config({
|
|
|
336376
336386
|
autoUpdatesChannel: "stable"
|
|
336377
336387
|
};
|
|
336378
336388
|
if (choice === "stay") {
|
|
336379
|
-
newSettings.minimumVersion = { VERSION: "0.2.
|
|
336389
|
+
newSettings.minimumVersion = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
336380
336390
|
}
|
|
336381
336391
|
updateSettingsForSource("userSettings", newSettings);
|
|
336382
336392
|
setSettingsData((prev_27) => ({
|
|
@@ -342753,6 +342763,79 @@ var init_MemoryUpdateNotification = __esm(() => {
|
|
|
342753
342763
|
jsx_runtime210 = __toESM(require_jsx_runtime(), 1);
|
|
342754
342764
|
});
|
|
342755
342765
|
|
|
342766
|
+
// services/knowledge/leerMemorias.ts
|
|
342767
|
+
var exports_leerMemorias = {};
|
|
342768
|
+
__export(exports_leerMemorias, {
|
|
342769
|
+
resumirRecuerdos: () => resumirRecuerdos,
|
|
342770
|
+
leerRecuerdos: () => leerRecuerdos
|
|
342771
|
+
});
|
|
342772
|
+
import { readFile as readFile44 } from "fs/promises";
|
|
342773
|
+
function comoLista(valor) {
|
|
342774
|
+
return Array.isArray(valor) ? valor.filter((x2) => typeof x2 === "string") : [];
|
|
342775
|
+
}
|
|
342776
|
+
function comoFecha(valor) {
|
|
342777
|
+
if (typeof valor === "number" && Number.isFinite(valor))
|
|
342778
|
+
return valor;
|
|
342779
|
+
if (typeof valor === "string") {
|
|
342780
|
+
const t = Date.parse(valor);
|
|
342781
|
+
if (!Number.isNaN(t))
|
|
342782
|
+
return t;
|
|
342783
|
+
}
|
|
342784
|
+
return;
|
|
342785
|
+
}
|
|
342786
|
+
async function leerRecuerdos(projectRoot) {
|
|
342787
|
+
let crudo;
|
|
342788
|
+
try {
|
|
342789
|
+
crudo = await readFile44(getGraphPath(projectRoot), "utf8");
|
|
342790
|
+
} catch {
|
|
342791
|
+
return [];
|
|
342792
|
+
}
|
|
342793
|
+
let nodos;
|
|
342794
|
+
try {
|
|
342795
|
+
const data = JSON.parse(crudo);
|
|
342796
|
+
nodos = Array.isArray(data.nodes) ? data.nodes : [];
|
|
342797
|
+
} catch {
|
|
342798
|
+
return [];
|
|
342799
|
+
}
|
|
342800
|
+
const salida = [];
|
|
342801
|
+
for (const nodo of nodos) {
|
|
342802
|
+
if (nodo?.type !== "memory")
|
|
342803
|
+
continue;
|
|
342804
|
+
const texto = typeof nodo.text === "string" ? nodo.text : "";
|
|
342805
|
+
const titulo = typeof nodo.label === "string" && nodo.label.trim() ? nodo.label : texto.slice(0, 80);
|
|
342806
|
+
if (!texto.trim() && !titulo.trim())
|
|
342807
|
+
continue;
|
|
342808
|
+
const etiquetas = comoLista(nodo.meta?.tags);
|
|
342809
|
+
const cuando = comoFecha(nodo.meta?.importedAt) ?? comoFecha(nodo.meta?.createdAt);
|
|
342810
|
+
salida.push({
|
|
342811
|
+
titulo,
|
|
342812
|
+
texto,
|
|
342813
|
+
etiquetas,
|
|
342814
|
+
importado: etiquetas.includes("imported"),
|
|
342815
|
+
...cuando !== undefined ? { cuando } : {}
|
|
342816
|
+
});
|
|
342817
|
+
}
|
|
342818
|
+
return salida.sort((a2, b) => {
|
|
342819
|
+
if (a2.importado !== b.importado)
|
|
342820
|
+
return a2.importado ? -1 : 1;
|
|
342821
|
+
return (b.cuando ?? 0) - (a2.cuando ?? 0);
|
|
342822
|
+
});
|
|
342823
|
+
}
|
|
342824
|
+
function resumirRecuerdos(recuerdos) {
|
|
342825
|
+
if (recuerdos.length === 0)
|
|
342826
|
+
return "Todav\xEDa no hay nada guardado de este proyecto.";
|
|
342827
|
+
const importados = recuerdos.filter((r) => r.importado).length;
|
|
342828
|
+
const total = recuerdos.length === 1 ? "1 recuerdo" : `${recuerdos.length} recuerdos`;
|
|
342829
|
+
if (importados === 0)
|
|
342830
|
+
return `${total} de este proyecto.`;
|
|
342831
|
+
if (importados === recuerdos.length)
|
|
342832
|
+
return `${total}, tra\xEDdos de otra IA.`;
|
|
342833
|
+
return `${total} \xB7 ${importados} tra\xEDdos de otra IA.`;
|
|
342834
|
+
}
|
|
342835
|
+
var init_leerMemorias = __esm(() => {
|
|
342836
|
+
init_paths2();
|
|
342837
|
+
});
|
|
342838
|
+
|
|
342756
342839
|
// utils/editor.ts
|
|
342757
342840
|
import {
|
|
342758
342841
|
spawn as spawn7,
|
|
@@ -343027,11 +343110,69 @@ ${editorHint}`, {
|
|
|
343027
343110
|
onDone(`Error al abrir el archivo de memoria: ${error40}`);
|
|
343028
343111
|
}
|
|
343029
343112
|
};
|
|
343113
|
+
const [vista, setVista] = React60.useState("menu");
|
|
343114
|
+
const [recuerdos, setRecuerdos] = React60.useState([]);
|
|
343115
|
+
React60.useEffect(() => {
|
|
343116
|
+
let vivo = true;
|
|
343117
|
+
Promise.resolve().then(() => (init_leerMemorias(), exports_leerMemorias)).then(async (m) => {
|
|
343118
|
+
const { getCwd: getCwd3 } = await Promise.resolve().then(() => (init_cwd2(), exports_cwd));
|
|
343119
|
+
const lista = await m.leerRecuerdos(getCwd3());
|
|
343120
|
+
if (vivo)
|
|
343121
|
+
setRecuerdos(lista);
|
|
343122
|
+
}).catch(() => {});
|
|
343123
|
+
return () => {
|
|
343124
|
+
vivo = false;
|
|
343125
|
+
};
|
|
343126
|
+
}, []);
|
|
343030
343127
|
const handleCancel = () => {
|
|
343031
343128
|
onDone("Edici\xF3n de memoria cancelada", {
|
|
343032
343129
|
display: "system"
|
|
343033
343130
|
});
|
|
343034
343131
|
};
|
|
343132
|
+
if (vista === "recuerdos") {
|
|
343133
|
+
return /* @__PURE__ */ jsx_runtime211.jsx(Dialog, {
|
|
343134
|
+
title: "Lo que Theus recuerda",
|
|
343135
|
+
onCancel: handleCancel,
|
|
343136
|
+
color: "remember",
|
|
343137
|
+
children: /* @__PURE__ */ jsx_runtime211.jsxs(ThemedBox_default, {
|
|
343138
|
+
flexDirection: "column",
|
|
343139
|
+
children: [
|
|
343140
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedText, {
|
|
343141
|
+
dimColor: true,
|
|
343142
|
+
children: resumirRecuerdos(recuerdos)
|
|
343143
|
+
}),
|
|
343144
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343145
|
+
flexDirection: "column",
|
|
343146
|
+
marginTop: 1,
|
|
343147
|
+
children: recuerdos.slice(0, 15).map((r, i3) => /* @__PURE__ */ jsx_runtime211.jsxs(ThemedText, {
|
|
343148
|
+
children: [
|
|
343149
|
+
r.importado ? "\u2193 " : "\xB7 ",
|
|
343150
|
+
r.titulo.slice(0, 90)
|
|
343151
|
+
]
|
|
343152
|
+
}, i3))
|
|
343153
|
+
}),
|
|
343154
|
+
recuerdos.length > 15 && /* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343155
|
+
marginTop: 1,
|
|
343156
|
+
children: /* @__PURE__ */ jsx_runtime211.jsxs(ThemedText, {
|
|
343157
|
+
dimColor: true,
|
|
343158
|
+
children: [
|
|
343159
|
+
"\u2026y ",
|
|
343160
|
+
recuerdos.length - 15,
|
|
343161
|
+
" m\xE1s."
|
|
343162
|
+
]
|
|
343163
|
+
})
|
|
343164
|
+
}),
|
|
343165
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343166
|
+
marginTop: 1,
|
|
343167
|
+
children: /* @__PURE__ */ jsx_runtime211.jsx(ThemedText, {
|
|
343168
|
+
dimColor: true,
|
|
343169
|
+
children: "Los marcados con \u2193 vinieron de otra IA. Theus los usa al responder sobre este proyecto."
|
|
343170
|
+
})
|
|
343171
|
+
})
|
|
343172
|
+
]
|
|
343173
|
+
})
|
|
343174
|
+
});
|
|
343175
|
+
}
|
|
343035
343176
|
return /* @__PURE__ */ jsx_runtime211.jsx(Dialog, {
|
|
343036
343177
|
title: "Memoria",
|
|
343037
343178
|
onCancel: handleCancel,
|
|
@@ -343039,7 +343180,29 @@ ${editorHint}`, {
|
|
|
343039
343180
|
children: /* @__PURE__ */ jsx_runtime211.jsxs(ThemedBox_default, {
|
|
343040
343181
|
flexDirection: "column",
|
|
343041
343182
|
children: [
|
|
343042
|
-
/* @__PURE__ */ jsx_runtime211.jsx(
|
|
343183
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343184
|
+
flexDirection: "column",
|
|
343185
|
+
marginBottom: 1,
|
|
343186
|
+
children: /* @__PURE__ */ jsx_runtime211.jsx(ThemedText, {
|
|
343187
|
+
dimColor: true,
|
|
343188
|
+
children: resumirRecuerdos(recuerdos)
|
|
343189
|
+
})
|
|
343190
|
+
}),
|
|
343191
|
+
recuerdos.length > 0 && /* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343192
|
+
marginBottom: 1,
|
|
343193
|
+
children: /* @__PURE__ */ jsx_runtime211.jsx(Select, {
|
|
343194
|
+
options: [{
|
|
343195
|
+
label: `Ver lo que Theus recuerda (${recuerdos.length})`,
|
|
343196
|
+
value: "recuerdos"
|
|
343197
|
+
}, {
|
|
343198
|
+
label: "Editar los archivos de memoria",
|
|
343199
|
+
value: "archivos"
|
|
343200
|
+
}],
|
|
343201
|
+
onChange: (v) => v === "recuerdos" ? setVista("recuerdos") : setVista("archivos"),
|
|
343202
|
+
onCancel: handleCancel
|
|
343203
|
+
})
|
|
343204
|
+
}),
|
|
343205
|
+
(vista === "archivos" || recuerdos.length === 0) && /* @__PURE__ */ jsx_runtime211.jsx(React60.Suspense, {
|
|
343043
343206
|
fallback: null,
|
|
343044
343207
|
children: /* @__PURE__ */ jsx_runtime211.jsx(MemoryFileSelector, {
|
|
343045
343208
|
onSelect: handleSelectMemoryFile,
|
|
@@ -343053,7 +343216,7 @@ ${editorHint}`, {
|
|
|
343053
343216
|
children: [
|
|
343054
343217
|
"M\xE1s informaci\xF3n: ",
|
|
343055
343218
|
/* @__PURE__ */ jsx_runtime211.jsx(Link, {
|
|
343056
|
-
url: "https://docs.theus.pe/docs/
|
|
343219
|
+
url: "https://docs.theus.pe/docs/memoria"
|
|
343057
343220
|
})
|
|
343058
343221
|
]
|
|
343059
343222
|
})
|
|
@@ -343074,6 +343237,8 @@ var init_memory2 = __esm(() => {
|
|
|
343074
343237
|
init_MemoryFileSelector();
|
|
343075
343238
|
init_MemoryUpdateNotification();
|
|
343076
343239
|
init_ink2();
|
|
343240
|
+
init_select();
|
|
343241
|
+
init_leerMemorias();
|
|
343077
343242
|
init_theusmd();
|
|
343078
343243
|
init_envUtils();
|
|
343079
343244
|
init_errors();
|
|
@@ -343580,7 +343745,7 @@ function HelpV2(t0) {
|
|
|
343580
343745
|
let t6;
|
|
343581
343746
|
if ($2[31] !== tabs) {
|
|
343582
343747
|
t6 = /* @__PURE__ */ jsx_runtime215.jsx(Tabs, {
|
|
343583
|
-
title: `Theus v${{ VERSION: "0.2.
|
|
343748
|
+
title: `Theus v${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
|
|
343584
343749
|
color: "professionalBlue",
|
|
343585
343750
|
defaultTab: "general",
|
|
343586
343751
|
children: tabs
|
|
@@ -350583,7 +350748,7 @@ var init_AddMarketplace = __esm(() => {
|
|
|
350583
350748
|
|
|
350584
350749
|
// utils/plugins/installCounts.ts
|
|
350585
350750
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
350586
|
-
import { readFile as
|
|
350751
|
+
import { readFile as readFile45, rename as rename7, unlink as unlink18, writeFile as writeFile44 } from "fs/promises";
|
|
350587
350752
|
import { join as join128 } from "path";
|
|
350588
350753
|
function getInstallCountsCachePath() {
|
|
350589
350754
|
return join128(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
@@ -350591,7 +350756,7 @@ function getInstallCountsCachePath() {
|
|
|
350591
350756
|
async function loadInstallCountsCache() {
|
|
350592
350757
|
const cachePath2 = getInstallCountsCachePath();
|
|
350593
350758
|
try {
|
|
350594
|
-
const content = await
|
|
350759
|
+
const content = await readFile45(cachePath2, { encoding: "utf-8" });
|
|
350595
350760
|
const parsed = jsonParse(content);
|
|
350596
350761
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("fetchedAt" in parsed) || !("counts" in parsed)) {
|
|
350597
350762
|
logForDebugging("Install counts cache has invalid structure");
|
|
@@ -355058,7 +355223,7 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
355058
355223
|
|
|
355059
355224
|
// utils/plugins/pluginFlagging.ts
|
|
355060
355225
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
355061
|
-
import { readFile as
|
|
355226
|
+
import { readFile as readFile46, rename as rename8, unlink as unlink19, writeFile as writeFile45 } from "fs/promises";
|
|
355062
355227
|
import { join as join130 } from "path";
|
|
355063
355228
|
function getFlaggedPluginsPath() {
|
|
355064
355229
|
return join130(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
@@ -355085,7 +355250,7 @@ function parsePluginsData(content) {
|
|
|
355085
355250
|
}
|
|
355086
355251
|
async function readFromDisk() {
|
|
355087
355252
|
try {
|
|
355088
|
-
const content = await
|
|
355253
|
+
const content = await readFile46(getFlaggedPluginsPath(), {
|
|
355089
355254
|
encoding: "utf-8"
|
|
355090
355255
|
});
|
|
355091
355256
|
return parsePluginsData(content);
|
|
@@ -358354,7 +358519,7 @@ function parsePluginArgs(args) {
|
|
|
358354
358519
|
}
|
|
358355
358520
|
|
|
358356
358521
|
// utils/plugins/validatePlugin.ts
|
|
358357
|
-
import { readdir as readdir28, readFile as
|
|
358522
|
+
import { readdir as readdir28, readFile as readFile48, stat as stat42 } from "fs/promises";
|
|
358358
358523
|
import * as path16 from "path";
|
|
358359
358524
|
function detectManifestType(filePath) {
|
|
358360
358525
|
const fileName = path16.basename(filePath);
|
|
@@ -358394,7 +358559,7 @@ async function validatePluginManifest(filePath) {
|
|
|
358394
358559
|
const absolutePath = path16.resolve(filePath);
|
|
358395
358560
|
let content;
|
|
358396
358561
|
try {
|
|
358397
|
-
content = await
|
|
358562
|
+
content = await readFile48(absolutePath, { encoding: "utf-8" });
|
|
358398
358563
|
} catch (error40) {
|
|
358399
358564
|
const code = getErrnoCode(error40);
|
|
358400
358565
|
let message;
|
|
@@ -358518,7 +358683,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
358518
358683
|
const absolutePath = path16.resolve(filePath);
|
|
358519
358684
|
let content;
|
|
358520
358685
|
try {
|
|
358521
|
-
content = await
|
|
358686
|
+
content = await readFile48(absolutePath, { encoding: "utf-8" });
|
|
358522
358687
|
} catch (error40) {
|
|
358523
358688
|
const code = getErrnoCode(error40);
|
|
358524
358689
|
let message;
|
|
@@ -358604,7 +358769,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
358604
358769
|
const pluginJsonPath = path16.join(marketplaceRoot, entry.source, ".theus-plugin", "plugin.json");
|
|
358605
358770
|
let manifestVersion;
|
|
358606
358771
|
try {
|
|
358607
|
-
const raw = await
|
|
358772
|
+
const raw = await readFile48(pluginJsonPath, { encoding: "utf-8" });
|
|
358608
358773
|
const parsed2 = jsonParse(raw);
|
|
358609
358774
|
if (typeof parsed2.version === "string") {
|
|
358610
358775
|
manifestVersion = parsed2.version;
|
|
@@ -358721,7 +358886,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
358721
358886
|
async function validateHooksJson(filePath) {
|
|
358722
358887
|
let content;
|
|
358723
358888
|
try {
|
|
358724
|
-
content = await
|
|
358889
|
+
content = await readFile48(filePath, { encoding: "utf-8" });
|
|
358725
358890
|
} catch (e) {
|
|
358726
358891
|
const code = getErrnoCode(e);
|
|
358727
358892
|
if (code === "ENOENT") {
|
|
@@ -358814,7 +358979,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
358814
358979
|
for (const filePath of files) {
|
|
358815
358980
|
let content;
|
|
358816
358981
|
try {
|
|
358817
|
-
content = await
|
|
358982
|
+
content = await readFile48(filePath, { encoding: "utf-8" });
|
|
358818
358983
|
} catch (e) {
|
|
358819
358984
|
if (isENOENT(e))
|
|
358820
358985
|
continue;
|
|
@@ -358883,7 +359048,7 @@ async function validateManifest2(filePath) {
|
|
|
358883
359048
|
return validateMarketplaceManifest(filePath);
|
|
358884
359049
|
case "unknown": {
|
|
358885
359050
|
try {
|
|
358886
|
-
const content = await
|
|
359051
|
+
const content = await readFile48(absolutePath, { encoding: "utf-8" });
|
|
358887
359052
|
const parsed = jsonParse(content);
|
|
358888
359053
|
if (Array.isArray(parsed.plugins)) {
|
|
358889
359054
|
return validateMarketplaceManifest(filePath);
|
|
@@ -362184,7 +362349,7 @@ function Onboarding({
|
|
|
362184
362349
|
flexDirection: "column",
|
|
362185
362350
|
children: [
|
|
362186
362351
|
/* @__PURE__ */ jsx_runtime250.jsx(TheusBanner, {
|
|
362187
|
-
version: { VERSION: "0.2.
|
|
362352
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
362188
362353
|
}),
|
|
362189
362354
|
/* @__PURE__ */ jsx_runtime250.jsxs(ThemedBox_default, {
|
|
362190
362355
|
flexDirection: "column",
|
|
@@ -367571,7 +367736,7 @@ var init_Messages = __esm(() => {
|
|
|
367571
367736
|
let t1;
|
|
367572
367737
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
367573
367738
|
t1 = /* @__PURE__ */ jsx_runtime263.jsx(TheusSessionHeader, {
|
|
367574
|
-
version: { VERSION: "0.2.
|
|
367739
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
367575
367740
|
});
|
|
367576
367741
|
$2[0] = t1;
|
|
367577
367742
|
} else {
|
|
@@ -377281,9 +377446,276 @@ var init_claudeCode = __esm(() => {
|
|
|
377281
377446
|
};
|
|
377282
377447
|
});
|
|
377283
377448
|
|
|
377284
|
-
// services/import/detect/sources/
|
|
377285
|
-
import {
|
|
377449
|
+
// services/import/detect/sources/codex.ts
|
|
377450
|
+
import { open as open15, readdir as readdir30, stat as stat44 } from "fs/promises";
|
|
377286
377451
|
import { join as join134 } from "path";
|
|
377452
|
+
function directorioCodex(entorno) {
|
|
377453
|
+
const override = entorno.env.CODEX_HOME?.trim();
|
|
377454
|
+
return override && override.length > 0 ? override : join134(entorno.home, ".codex");
|
|
377455
|
+
}
|
|
377456
|
+
async function indiceMasReciente(dirCodex) {
|
|
377457
|
+
let entradas;
|
|
377458
|
+
try {
|
|
377459
|
+
entradas = await readdir30(dirCodex);
|
|
377460
|
+
} catch {
|
|
377461
|
+
return null;
|
|
377462
|
+
}
|
|
377463
|
+
let mejor = null;
|
|
377464
|
+
for (const nombre of entradas) {
|
|
377465
|
+
const m = /^state_(\d+)\.sqlite$/.exec(nombre);
|
|
377466
|
+
if (!m?.[1])
|
|
377467
|
+
continue;
|
|
377468
|
+
const n2 = Number(m[1]);
|
|
377469
|
+
if (!mejor || n2 > mejor.n)
|
|
377470
|
+
mejor = { nombre, n: n2 };
|
|
377471
|
+
}
|
|
377472
|
+
return mejor ? join134(dirCodex, mejor.nombre) : null;
|
|
377473
|
+
}
|
|
377474
|
+
async function hilosDelProyecto(indice, proyecto) {
|
|
377475
|
+
try {
|
|
377476
|
+
const { Database } = await import("bun:sqlite");
|
|
377477
|
+
const db = new Database(indice, { readonly: true });
|
|
377478
|
+
try {
|
|
377479
|
+
const filas = db.query(`SELECT rollout_path, updated_at FROM ${TABLA}
|
|
377480
|
+
WHERE cwd = ? AND (archived IS NULL OR archived = 0)
|
|
377481
|
+
ORDER BY updated_at DESC`).all(proyecto);
|
|
377482
|
+
return filas.map((f) => typeof f.rollout_path === "string" ? f.rollout_path : "").filter(Boolean);
|
|
377483
|
+
} finally {
|
|
377484
|
+
db.close();
|
|
377485
|
+
}
|
|
377486
|
+
} catch {
|
|
377487
|
+
return [];
|
|
377488
|
+
}
|
|
377489
|
+
}
|
|
377490
|
+
function textoDePayload(payload, maxChars) {
|
|
377491
|
+
if (!payload || typeof payload !== "object")
|
|
377492
|
+
return "";
|
|
377493
|
+
const p = payload;
|
|
377494
|
+
const contenido = p.content ?? p.message;
|
|
377495
|
+
if (typeof contenido === "string")
|
|
377496
|
+
return contenido.slice(0, maxChars);
|
|
377497
|
+
if (!Array.isArray(contenido))
|
|
377498
|
+
return "";
|
|
377499
|
+
const partes = [];
|
|
377500
|
+
for (const bloque of contenido) {
|
|
377501
|
+
if (!bloque || typeof bloque !== "object")
|
|
377502
|
+
continue;
|
|
377503
|
+
const b = bloque;
|
|
377504
|
+
if (typeof b.text === "string" && b.text.trim())
|
|
377505
|
+
partes.push(b.text);
|
|
377506
|
+
}
|
|
377507
|
+
return partes.join(`
|
|
377508
|
+
`).slice(0, maxChars);
|
|
377509
|
+
}
|
|
377510
|
+
var TABLA = "threads", detectorCodex;
|
|
377511
|
+
var init_codex = __esm(() => {
|
|
377512
|
+
detectorCodex = {
|
|
377513
|
+
herramienta: "codex",
|
|
377514
|
+
async explorar(entorno) {
|
|
377515
|
+
const dir = directorioCodex(entorno);
|
|
377516
|
+
const indice = await indiceMasReciente(dir);
|
|
377517
|
+
if (!indice)
|
|
377518
|
+
return null;
|
|
377519
|
+
const rutas = await hilosDelProyecto(indice, entorno.proyecto);
|
|
377520
|
+
if (rutas.length === 0)
|
|
377521
|
+
return null;
|
|
377522
|
+
let bytes = 0;
|
|
377523
|
+
let masReciente = 0;
|
|
377524
|
+
for (const ruta of rutas) {
|
|
377525
|
+
try {
|
|
377526
|
+
const info = await stat44(ruta);
|
|
377527
|
+
bytes += info.size;
|
|
377528
|
+
if (info.mtimeMs > masReciente)
|
|
377529
|
+
masReciente = info.mtimeMs;
|
|
377530
|
+
} catch {}
|
|
377531
|
+
}
|
|
377532
|
+
if (masReciente === 0)
|
|
377533
|
+
return null;
|
|
377534
|
+
return {
|
|
377535
|
+
herramienta: "codex",
|
|
377536
|
+
etiqueta: "Otro agente de c\xF3digo que usaste aqu\xED",
|
|
377537
|
+
ruta: indice,
|
|
377538
|
+
sesiones: rutas.length,
|
|
377539
|
+
masReciente,
|
|
377540
|
+
bytes,
|
|
377541
|
+
proyectoConsultado: entorno.proyecto
|
|
377542
|
+
};
|
|
377543
|
+
},
|
|
377544
|
+
async leer(fuente, limites) {
|
|
377545
|
+
const proyecto = fuente.proyectoConsultado;
|
|
377546
|
+
if (!proyecto)
|
|
377547
|
+
return [];
|
|
377548
|
+
const rutas = await hilosDelProyecto(fuente.ruta, proyecto);
|
|
377549
|
+
const conFecha = [];
|
|
377550
|
+
for (const ruta of rutas) {
|
|
377551
|
+
try {
|
|
377552
|
+
const info = await stat44(ruta);
|
|
377553
|
+
conFecha.push({ ruta, mtime: info.mtimeMs });
|
|
377554
|
+
} catch {}
|
|
377555
|
+
}
|
|
377556
|
+
conFecha.sort((a2, b) => b.mtime - a2.mtime);
|
|
377557
|
+
const salida = [];
|
|
377558
|
+
for (const { ruta, mtime } of conFecha.slice(0, limites.maxSesiones)) {
|
|
377559
|
+
let crudo;
|
|
377560
|
+
try {
|
|
377561
|
+
const fh = await open15(ruta, "r");
|
|
377562
|
+
try {
|
|
377563
|
+
const buf = Buffer.alloc(limites.maxBytesPorSesion);
|
|
377564
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
377565
|
+
crudo = buf.subarray(0, bytesRead).toString("utf8");
|
|
377566
|
+
} finally {
|
|
377567
|
+
await fh.close();
|
|
377568
|
+
}
|
|
377569
|
+
} catch {
|
|
377570
|
+
continue;
|
|
377571
|
+
}
|
|
377572
|
+
const mensajes = [];
|
|
377573
|
+
for (const linea of crudo.split(`
|
|
377574
|
+
`)) {
|
|
377575
|
+
if (!linea.trim())
|
|
377576
|
+
continue;
|
|
377577
|
+
let obj;
|
|
377578
|
+
try {
|
|
377579
|
+
obj = JSON.parse(linea);
|
|
377580
|
+
} catch {
|
|
377581
|
+
continue;
|
|
377582
|
+
}
|
|
377583
|
+
if (obj.type !== "response_item")
|
|
377584
|
+
continue;
|
|
377585
|
+
const rol = obj.payload?.role;
|
|
377586
|
+
if (rol !== "user" && rol !== "assistant")
|
|
377587
|
+
continue;
|
|
377588
|
+
const text = textoDePayload(obj.payload, limites.maxCharsPorMensaje);
|
|
377589
|
+
if (!text.trim())
|
|
377590
|
+
continue;
|
|
377591
|
+
mensajes.push({ role: rol, text });
|
|
377592
|
+
if (mensajes.length >= limites.maxMensajes)
|
|
377593
|
+
break;
|
|
377594
|
+
}
|
|
377595
|
+
if (mensajes.length > 0) {
|
|
377596
|
+
salida.push({
|
|
377597
|
+
titulo: `Sesi\xF3n del ${new Date(mtime).toISOString().slice(0, 10)}`,
|
|
377598
|
+
creadaEn: mtime,
|
|
377599
|
+
mensajes
|
|
377600
|
+
});
|
|
377601
|
+
}
|
|
377602
|
+
}
|
|
377603
|
+
return salida;
|
|
377604
|
+
}
|
|
377605
|
+
};
|
|
377606
|
+
});
|
|
377607
|
+
|
|
377608
|
+
// services/import/detect/sources/aider.ts
|
|
377609
|
+
import { open as open16, stat as stat45 } from "fs/promises";
|
|
377610
|
+
import { dirname as dirname57, join as join135 } from "path";
|
|
377611
|
+
import { existsSync as existsSync20 } from "fs";
|
|
377612
|
+
function raizDelRepo(desde) {
|
|
377613
|
+
let actual = desde;
|
|
377614
|
+
for (let i3 = 0;i3 < 40; i3++) {
|
|
377615
|
+
if (existsSync20(join135(actual, ".git")))
|
|
377616
|
+
return actual;
|
|
377617
|
+
const padre = dirname57(actual);
|
|
377618
|
+
if (padre === actual)
|
|
377619
|
+
break;
|
|
377620
|
+
actual = padre;
|
|
377621
|
+
}
|
|
377622
|
+
return desde;
|
|
377623
|
+
}
|
|
377624
|
+
function parsearHistorialAider(crudo, maxCharsPorMensaje) {
|
|
377625
|
+
const mensajes = [];
|
|
377626
|
+
let rolActual = null;
|
|
377627
|
+
let buffer = [];
|
|
377628
|
+
const volcar = () => {
|
|
377629
|
+
if (!rolActual)
|
|
377630
|
+
return;
|
|
377631
|
+
const texto = buffer.join(`
|
|
377632
|
+
`).trim();
|
|
377633
|
+
if (texto) {
|
|
377634
|
+
mensajes.push({ role: rolActual, text: texto.slice(0, maxCharsPorMensaje) });
|
|
377635
|
+
}
|
|
377636
|
+
buffer = [];
|
|
377637
|
+
};
|
|
377638
|
+
for (const linea of crudo.split(`
|
|
377639
|
+
`)) {
|
|
377640
|
+
if (/^#\s+aider chat started at/i.test(linea)) {
|
|
377641
|
+
volcar();
|
|
377642
|
+
rolActual = null;
|
|
377643
|
+
continue;
|
|
377644
|
+
}
|
|
377645
|
+
if (linea.startsWith("#### ")) {
|
|
377646
|
+
if (rolActual !== "user")
|
|
377647
|
+
volcar();
|
|
377648
|
+
rolActual = "user";
|
|
377649
|
+
buffer.push(linea.slice(5));
|
|
377650
|
+
continue;
|
|
377651
|
+
}
|
|
377652
|
+
if (rolActual === "user" && linea.trim() !== "" && !linea.startsWith("#### ")) {
|
|
377653
|
+
volcar();
|
|
377654
|
+
rolActual = "assistant";
|
|
377655
|
+
}
|
|
377656
|
+
if (rolActual === null && linea.trim() !== "")
|
|
377657
|
+
rolActual = "assistant";
|
|
377658
|
+
if (rolActual)
|
|
377659
|
+
buffer.push(linea);
|
|
377660
|
+
}
|
|
377661
|
+
volcar();
|
|
377662
|
+
return mensajes;
|
|
377663
|
+
}
|
|
377664
|
+
var FICHERO = ".aider.chat.history.md", detectorAider;
|
|
377665
|
+
var init_aider = __esm(() => {
|
|
377666
|
+
detectorAider = {
|
|
377667
|
+
herramienta: "aider",
|
|
377668
|
+
async explorar(entorno) {
|
|
377669
|
+
const ruta = join135(raizDelRepo(entorno.proyecto), FICHERO);
|
|
377670
|
+
let info;
|
|
377671
|
+
try {
|
|
377672
|
+
info = await stat45(ruta);
|
|
377673
|
+
} catch {
|
|
377674
|
+
return null;
|
|
377675
|
+
}
|
|
377676
|
+
if (!info.isFile() || info.size === 0)
|
|
377677
|
+
return null;
|
|
377678
|
+
return {
|
|
377679
|
+
herramienta: "aider",
|
|
377680
|
+
etiqueta: "Historial de otro asistente en este repo",
|
|
377681
|
+
ruta,
|
|
377682
|
+
sesiones: 1,
|
|
377683
|
+
masReciente: info.mtimeMs,
|
|
377684
|
+
bytes: info.size,
|
|
377685
|
+
proyectoConsultado: entorno.proyecto
|
|
377686
|
+
};
|
|
377687
|
+
},
|
|
377688
|
+
async leer(fuente, limites) {
|
|
377689
|
+
let crudo;
|
|
377690
|
+
try {
|
|
377691
|
+
const fh = await open16(fuente.ruta, "r");
|
|
377692
|
+
try {
|
|
377693
|
+
const buf = Buffer.alloc(limites.maxBytesPorSesion);
|
|
377694
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
377695
|
+
crudo = buf.subarray(0, bytesRead).toString("utf8");
|
|
377696
|
+
} finally {
|
|
377697
|
+
await fh.close();
|
|
377698
|
+
}
|
|
377699
|
+
} catch {
|
|
377700
|
+
return [];
|
|
377701
|
+
}
|
|
377702
|
+
const mensajes = parsearHistorialAider(crudo, limites.maxCharsPorMensaje).slice(0, limites.maxMensajes);
|
|
377703
|
+
if (mensajes.length === 0)
|
|
377704
|
+
return [];
|
|
377705
|
+
return [
|
|
377706
|
+
{
|
|
377707
|
+
titulo: "Historial en este repositorio",
|
|
377708
|
+
creadaEn: fuente.masReciente,
|
|
377709
|
+
mensajes
|
|
377710
|
+
}
|
|
377711
|
+
];
|
|
377712
|
+
}
|
|
377713
|
+
};
|
|
377714
|
+
});
|
|
377715
|
+
|
|
377716
|
+
// services/import/detect/sources/memoriaAgente.ts
|
|
377717
|
+
import { readdir as readdir31, readFile as readFile49, stat as stat46 } from "fs/promises";
|
|
377718
|
+
import { join as join136 } from "path";
|
|
377287
377719
|
function parsearFicheroMemoria(crudo, nombreFichero) {
|
|
377288
377720
|
const texto = crudo.trim();
|
|
377289
377721
|
if (!texto)
|
|
@@ -377311,10 +377743,10 @@ function parsearFicheroMemoria(crudo, nombreFichero) {
|
|
|
377311
377743
|
return { titulo, texto: cuerpo, ...categoria ? { categoria } : {} };
|
|
377312
377744
|
}
|
|
377313
377745
|
async function explorarMemoria(entorno) {
|
|
377314
|
-
const ruta =
|
|
377746
|
+
const ruta = join136(directorioConfig(entorno), "projects", slugDeProyecto(entorno.proyecto), "memory");
|
|
377315
377747
|
let ficheros;
|
|
377316
377748
|
try {
|
|
377317
|
-
ficheros = (await
|
|
377749
|
+
ficheros = (await readdir31(ruta)).filter((n2) => n2.toLowerCase().endsWith(".md"));
|
|
377318
377750
|
} catch {
|
|
377319
377751
|
return null;
|
|
377320
377752
|
}
|
|
@@ -377324,7 +377756,7 @@ async function explorarMemoria(entorno) {
|
|
|
377324
377756
|
let masReciente = 0;
|
|
377325
377757
|
for (const nombre of ficheros) {
|
|
377326
377758
|
try {
|
|
377327
|
-
const info = await
|
|
377759
|
+
const info = await stat46(join136(ruta, nombre));
|
|
377328
377760
|
bytes += info.size;
|
|
377329
377761
|
if (info.mtimeMs > masReciente)
|
|
377330
377762
|
masReciente = info.mtimeMs;
|
|
@@ -377343,7 +377775,7 @@ async function explorarMemoria(entorno) {
|
|
|
377343
377775
|
async function leerMemoria(fuente, maxHechos = 60) {
|
|
377344
377776
|
let ficheros;
|
|
377345
377777
|
try {
|
|
377346
|
-
ficheros = (await
|
|
377778
|
+
ficheros = (await readdir31(fuente.ruta)).filter((n2) => n2.toLowerCase().endsWith(".md"));
|
|
377347
377779
|
} catch {
|
|
377348
377780
|
return [];
|
|
377349
377781
|
}
|
|
@@ -377355,7 +377787,7 @@ async function leerMemoria(fuente, maxHechos = 60) {
|
|
|
377355
377787
|
break;
|
|
377356
377788
|
let crudo;
|
|
377357
377789
|
try {
|
|
377358
|
-
crudo = await
|
|
377790
|
+
crudo = await readFile49(join136(fuente.ruta, nombre), "utf8");
|
|
377359
377791
|
} catch {
|
|
377360
377792
|
continue;
|
|
377361
377793
|
}
|
|
@@ -377470,8 +377902,14 @@ var DETECTORES;
|
|
|
377470
377902
|
var init_registry4 = __esm(() => {
|
|
377471
377903
|
init_types12();
|
|
377472
377904
|
init_claudeCode();
|
|
377905
|
+
init_codex();
|
|
377906
|
+
init_aider();
|
|
377473
377907
|
init_memoriaAgente();
|
|
377474
|
-
DETECTORES = [
|
|
377908
|
+
DETECTORES = [
|
|
377909
|
+
detectorClaudeCode,
|
|
377910
|
+
detectorCodex,
|
|
377911
|
+
detectorAider
|
|
377912
|
+
];
|
|
377475
377913
|
});
|
|
377476
377914
|
|
|
377477
377915
|
// commands/import/import.tsx
|
|
@@ -377480,7 +377918,7 @@ __export(exports_import, {
|
|
|
377480
377918
|
call: () => call42,
|
|
377481
377919
|
ImportContext: () => ImportContext
|
|
377482
377920
|
});
|
|
377483
|
-
import { readFile as
|
|
377921
|
+
import { readFile as readFile50 } from "fs/promises";
|
|
377484
377922
|
import { homedir as homedir36 } from "os";
|
|
377485
377923
|
import { resolve as resolve42 } from "path";
|
|
377486
377924
|
function resolvePath3(raw) {
|
|
@@ -377591,7 +378029,7 @@ function ImportContext({
|
|
|
377591
378029
|
const abs = resolvePath3(filePath);
|
|
377592
378030
|
let bytes;
|
|
377593
378031
|
try {
|
|
377594
|
-
bytes = await
|
|
378032
|
+
bytes = await readFile50(abs);
|
|
377595
378033
|
} catch {
|
|
377596
378034
|
setError(`No pude leer el archivo: ${abs}`);
|
|
377597
378035
|
setStep("error");
|
|
@@ -384573,7 +385011,7 @@ __export(exports_TheusHome, {
|
|
|
384573
385011
|
default: () => TheusHome_default,
|
|
384574
385012
|
TheusHome: () => TheusHome
|
|
384575
385013
|
});
|
|
384576
|
-
import { readFile as
|
|
385014
|
+
import { readFile as readFile51 } from "fs/promises";
|
|
384577
385015
|
function firstName() {
|
|
384578
385016
|
const info = getOauthAccountInfo();
|
|
384579
385017
|
if (info?.displayName)
|
|
@@ -384616,7 +385054,7 @@ function relativeWhen(iso) {
|
|
|
384616
385054
|
}
|
|
384617
385055
|
async function readMemory() {
|
|
384618
385056
|
try {
|
|
384619
|
-
const raw = await
|
|
385057
|
+
const raw = await readFile51(getGraphPath(getCwd()), "utf8");
|
|
384620
385058
|
const data = JSON.parse(raw);
|
|
384621
385059
|
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
384622
385060
|
let facts = 0;
|
|
@@ -385398,8 +385836,8 @@ __export(exports_thinkback, {
|
|
|
385398
385836
|
playAnimation: () => playAnimation,
|
|
385399
385837
|
call: () => call51
|
|
385400
385838
|
});
|
|
385401
|
-
import { readFile as
|
|
385402
|
-
import { join as
|
|
385839
|
+
import { readFile as readFile52 } from "fs/promises";
|
|
385840
|
+
import { join as join137 } from "path";
|
|
385403
385841
|
function getMarketplaceName() {
|
|
385404
385842
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
385405
385843
|
}
|
|
@@ -385417,17 +385855,17 @@ async function getThinkbackSkillDir() {
|
|
|
385417
385855
|
if (!thinkbackPlugin) {
|
|
385418
385856
|
return null;
|
|
385419
385857
|
}
|
|
385420
|
-
const skillDir =
|
|
385858
|
+
const skillDir = join137(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
385421
385859
|
if (await pathExists(skillDir)) {
|
|
385422
385860
|
return skillDir;
|
|
385423
385861
|
}
|
|
385424
385862
|
return null;
|
|
385425
385863
|
}
|
|
385426
385864
|
async function playAnimation(skillDir) {
|
|
385427
|
-
const dataPath =
|
|
385428
|
-
const playerPath =
|
|
385865
|
+
const dataPath = join137(skillDir, "year_in_review.js");
|
|
385866
|
+
const playerPath = join137(skillDir, "player.js");
|
|
385429
385867
|
try {
|
|
385430
|
-
await
|
|
385868
|
+
await readFile52(dataPath);
|
|
385431
385869
|
} catch (e) {
|
|
385432
385870
|
if (isENOENT(e)) {
|
|
385433
385871
|
return {
|
|
@@ -385442,7 +385880,7 @@ async function playAnimation(skillDir) {
|
|
|
385442
385880
|
};
|
|
385443
385881
|
}
|
|
385444
385882
|
try {
|
|
385445
|
-
await
|
|
385883
|
+
await readFile52(playerPath);
|
|
385446
385884
|
} catch (e) {
|
|
385447
385885
|
if (isENOENT(e)) {
|
|
385448
385886
|
return {
|
|
@@ -385473,7 +385911,7 @@ async function playAnimation(skillDir) {
|
|
|
385473
385911
|
} catch {} finally {
|
|
385474
385912
|
inkInstance.exitAlternateScreen();
|
|
385475
385913
|
}
|
|
385476
|
-
const htmlPath =
|
|
385914
|
+
const htmlPath = join137(skillDir, "year_in_review.html");
|
|
385477
385915
|
if (await pathExists(htmlPath)) {
|
|
385478
385916
|
const platform6 = getPlatform();
|
|
385479
385917
|
const openCmd = platform6 === "macos" ? "open" : platform6 === "windows" ? "start" : "xdg-open";
|
|
@@ -385809,7 +386247,7 @@ function ThinkbackFlow(t0) {
|
|
|
385809
386247
|
if (!skillDir) {
|
|
385810
386248
|
return;
|
|
385811
386249
|
}
|
|
385812
|
-
const dataPath =
|
|
386250
|
+
const dataPath = join137(skillDir, "year_in_review.js");
|
|
385813
386251
|
pathExists(dataPath).then((exists) => {
|
|
385814
386252
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
385815
386253
|
setHasGenerated(exists);
|
|
@@ -385983,7 +386421,7 @@ var exports_thinkback_play = {};
|
|
|
385983
386421
|
__export(exports_thinkback_play, {
|
|
385984
386422
|
call: () => call52
|
|
385985
386423
|
});
|
|
385986
|
-
import { join as
|
|
386424
|
+
import { join as join138 } from "path";
|
|
385987
386425
|
function getPluginId2() {
|
|
385988
386426
|
const marketplaceName = OFFICIAL_MARKETPLACE_NAME;
|
|
385989
386427
|
return `thinkback@${marketplaceName}`;
|
|
@@ -386005,7 +386443,7 @@ async function call52() {
|
|
|
386005
386443
|
value: "Thinkback plugin installation path not found."
|
|
386006
386444
|
};
|
|
386007
386445
|
}
|
|
386008
|
-
const skillDir =
|
|
386446
|
+
const skillDir = join138(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
386009
386447
|
const result = await playAnimation(skillDir);
|
|
386010
386448
|
return { type: "text", value: result.message };
|
|
386011
386449
|
}
|
|
@@ -392235,7 +392673,7 @@ __export(exports_branch, {
|
|
|
392235
392673
|
call: () => call60
|
|
392236
392674
|
});
|
|
392237
392675
|
import { randomUUID as randomUUID33 } from "crypto";
|
|
392238
|
-
import { mkdir as mkdir42, readFile as
|
|
392676
|
+
import { mkdir as mkdir42, readFile as readFile53, writeFile as writeFile46 } from "fs/promises";
|
|
392239
392677
|
function deriveFirstPrompt(firstUserMessage) {
|
|
392240
392678
|
const content = firstUserMessage?.message?.content;
|
|
392241
392679
|
if (!content)
|
|
@@ -392254,7 +392692,7 @@ async function createFork(customTitle) {
|
|
|
392254
392692
|
await mkdir42(projectDir, { recursive: true, mode: 448 });
|
|
392255
392693
|
let transcriptContent;
|
|
392256
392694
|
try {
|
|
392257
|
-
transcriptContent = await
|
|
392695
|
+
transcriptContent = await readFile53(currentTranscriptPath);
|
|
392258
392696
|
} catch {
|
|
392259
392697
|
throw new Error("No hay conversaci\xF3n que ramificar");
|
|
392260
392698
|
}
|
|
@@ -392507,8 +392945,8 @@ var init_types14 = __esm(() => {
|
|
|
392507
392945
|
});
|
|
392508
392946
|
|
|
392509
392947
|
// components/agents/agentFileUtils.ts
|
|
392510
|
-
import { mkdir as mkdir43, open as
|
|
392511
|
-
import { join as
|
|
392948
|
+
import { mkdir as mkdir43, open as open17, unlink as unlink20 } from "fs/promises";
|
|
392949
|
+
import { join as join139 } from "path";
|
|
392512
392950
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
392513
392951
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
392514
392952
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -392535,26 +392973,26 @@ function getAgentDirectoryPath(location) {
|
|
|
392535
392973
|
case "flagSettings":
|
|
392536
392974
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
392537
392975
|
case "userSettings":
|
|
392538
|
-
return
|
|
392976
|
+
return join139(getTheusConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
392539
392977
|
case "projectSettings":
|
|
392540
|
-
return
|
|
392978
|
+
return join139(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392541
392979
|
case "policySettings":
|
|
392542
|
-
return
|
|
392980
|
+
return join139(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392543
392981
|
case "localSettings":
|
|
392544
|
-
return
|
|
392982
|
+
return join139(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392545
392983
|
}
|
|
392546
392984
|
}
|
|
392547
392985
|
function getRelativeAgentDirectoryPath(location) {
|
|
392548
392986
|
switch (location) {
|
|
392549
392987
|
case "projectSettings":
|
|
392550
|
-
return
|
|
392988
|
+
return join139(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392551
392989
|
default:
|
|
392552
392990
|
return getAgentDirectoryPath(location);
|
|
392553
392991
|
}
|
|
392554
392992
|
}
|
|
392555
392993
|
function getNewAgentFilePath(agent) {
|
|
392556
392994
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
392557
|
-
return
|
|
392995
|
+
return join139(dirPath, `${agent.agentType}.md`);
|
|
392558
392996
|
}
|
|
392559
392997
|
function getActualAgentFilePath(agent) {
|
|
392560
392998
|
if (agent.source === "built-in") {
|
|
@@ -392565,14 +393003,14 @@ function getActualAgentFilePath(agent) {
|
|
|
392565
393003
|
}
|
|
392566
393004
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
392567
393005
|
const filename = agent.filename || agent.agentType;
|
|
392568
|
-
return
|
|
393006
|
+
return join139(dirPath, `${filename}.md`);
|
|
392569
393007
|
}
|
|
392570
393008
|
function getNewRelativeAgentFilePath(agent) {
|
|
392571
393009
|
if (agent.source === "built-in") {
|
|
392572
393010
|
return "Built-in";
|
|
392573
393011
|
}
|
|
392574
393012
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
392575
|
-
return
|
|
393013
|
+
return join139(dirPath, `${agent.agentType}.md`);
|
|
392576
393014
|
}
|
|
392577
393015
|
function getActualRelativeAgentFilePath(agent) {
|
|
392578
393016
|
if (isBuiltInAgent(agent)) {
|
|
@@ -392586,7 +393024,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
392586
393024
|
}
|
|
392587
393025
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
392588
393026
|
const filename = agent.filename || agent.agentType;
|
|
392589
|
-
return
|
|
393027
|
+
return join139(dirPath, `${filename}.md`);
|
|
392590
393028
|
}
|
|
392591
393029
|
async function ensureAgentDirectoryExists(source) {
|
|
392592
393030
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -392632,7 +393070,7 @@ async function deleteAgentFromFile(agent) {
|
|
|
392632
393070
|
}
|
|
392633
393071
|
}
|
|
392634
393072
|
async function writeFileAndFlush(filePath, content, flag = "w") {
|
|
392635
|
-
const handle2 = await
|
|
393073
|
+
const handle2 = await open17(filePath, flag);
|
|
392636
393074
|
try {
|
|
392637
393075
|
await handle2.writeFile(content, { encoding: "utf-8" });
|
|
392638
393076
|
await handle2.datasync();
|
|
@@ -398598,8 +399036,8 @@ var init_rewind = __esm(() => {
|
|
|
398598
399036
|
|
|
398599
399037
|
// utils/heapDumpService.ts
|
|
398600
399038
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync7 } from "fs";
|
|
398601
|
-
import { readdir as
|
|
398602
|
-
import { join as
|
|
399039
|
+
import { readdir as readdir32, readFile as readFile54, writeFile as writeFile47 } from "fs/promises";
|
|
399040
|
+
import { join as join140 } from "path";
|
|
398603
399041
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
398604
399042
|
import {
|
|
398605
399043
|
getHeapSnapshot,
|
|
@@ -398619,11 +399057,11 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
398619
399057
|
const activeRequests = process._getActiveRequests().length;
|
|
398620
399058
|
let openFileDescriptors;
|
|
398621
399059
|
try {
|
|
398622
|
-
openFileDescriptors = (await
|
|
399060
|
+
openFileDescriptors = (await readdir32("/proc/self/fd")).length;
|
|
398623
399061
|
} catch {}
|
|
398624
399062
|
let smapsRollup;
|
|
398625
399063
|
try {
|
|
398626
|
-
smapsRollup = await
|
|
399064
|
+
smapsRollup = await readFile54("/proc/self/smaps_rollup", "utf8");
|
|
398627
399065
|
} catch {}
|
|
398628
399066
|
const nativeMemory = usage2.rss - usage2.heapUsed;
|
|
398629
399067
|
const bytesPerSecond = uptimeSeconds > 0 ? usage2.rss / uptimeSeconds : 0;
|
|
@@ -398689,7 +399127,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
398689
399127
|
smapsRollup,
|
|
398690
399128
|
platform: process.platform,
|
|
398691
399129
|
nodeVersion: process.version,
|
|
398692
|
-
ccVersion: { VERSION: "0.2.
|
|
399130
|
+
ccVersion: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
398693
399131
|
};
|
|
398694
399132
|
}
|
|
398695
399133
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -398707,8 +399145,8 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
398707
399145
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
398708
399146
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
398709
399147
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
398710
|
-
const heapPath =
|
|
398711
|
-
const diagPath =
|
|
399148
|
+
const heapPath = join140(dumpDir, heapFilename);
|
|
399149
|
+
const diagPath = join140(dumpDir, diagFilename);
|
|
398712
399150
|
await writeFile47(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
398713
399151
|
mode: 384
|
|
398714
399152
|
});
|
|
@@ -399450,7 +399888,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
399450
399888
|
var call68 = async () => {
|
|
399451
399889
|
return {
|
|
399452
399890
|
type: "text",
|
|
399453
|
-
value: { VERSION: "0.2.
|
|
399891
|
+
value: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
399454
399892
|
};
|
|
399455
399893
|
}, version2, version_default;
|
|
399456
399894
|
var init_version = __esm(() => {
|
|
@@ -401890,8 +402328,8 @@ var init_advisor2 = __esm(() => {
|
|
|
401890
402328
|
|
|
401891
402329
|
// skills/bundledSkills.ts
|
|
401892
402330
|
import { constants as fsConstants5 } from "fs";
|
|
401893
|
-
import { mkdir as mkdir44, open as
|
|
401894
|
-
import { dirname as
|
|
402331
|
+
import { mkdir as mkdir44, open as open18 } from "fs/promises";
|
|
402332
|
+
import { dirname as dirname58, isAbsolute as isAbsolute28, join as join141, normalize as normalize13, sep as pathSep2 } from "path";
|
|
401895
402333
|
function registerBundledSkill(definition) {
|
|
401896
402334
|
const { files: files2 } = definition;
|
|
401897
402335
|
let skillRoot;
|
|
@@ -401939,7 +402377,7 @@ function getBundledSkills() {
|
|
|
401939
402377
|
return [...bundledSkills];
|
|
401940
402378
|
}
|
|
401941
402379
|
function getBundledSkillExtractDir(skillName) {
|
|
401942
|
-
return
|
|
402380
|
+
return join141(getBundledSkillsRoot(), skillName);
|
|
401943
402381
|
}
|
|
401944
402382
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
401945
402383
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -401955,7 +402393,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
401955
402393
|
const byParent = new Map;
|
|
401956
402394
|
for (const [relPath, content] of Object.entries(files2)) {
|
|
401957
402395
|
const target = resolveSkillFilePath(dir, relPath);
|
|
401958
|
-
const parent2 =
|
|
402396
|
+
const parent2 = dirname58(target);
|
|
401959
402397
|
const entry = [target, content];
|
|
401960
402398
|
const group = byParent.get(parent2);
|
|
401961
402399
|
if (group)
|
|
@@ -401969,7 +402407,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
401969
402407
|
}));
|
|
401970
402408
|
}
|
|
401971
402409
|
async function safeWriteFile(p, content) {
|
|
401972
|
-
const fh = await
|
|
402410
|
+
const fh = await open18(p, SAFE_WRITE_FLAGS, 384);
|
|
401973
402411
|
try {
|
|
401974
402412
|
await fh.writeFile(content, "utf8");
|
|
401975
402413
|
} finally {
|
|
@@ -401981,7 +402419,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
401981
402419
|
if (isAbsolute28(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
401982
402420
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
401983
402421
|
}
|
|
401984
|
-
return
|
|
402422
|
+
return join141(baseDir, normalized);
|
|
401985
402423
|
}
|
|
401986
402424
|
function prependBaseDir(blocks, baseDir) {
|
|
401987
402425
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -402051,7 +402489,7 @@ var SECRET_NAME_PATTERN, EXTRA_ENV_ALLOWLIST, REDACTED2 = "\u2039oculto\u203A",
|
|
|
402051
402489
|
const lines = [];
|
|
402052
402490
|
lines.push("## Entorno de ejecuci\xF3n");
|
|
402053
402491
|
lines.push("");
|
|
402054
|
-
const version3 = { VERSION: "0.2.
|
|
402492
|
+
const version3 = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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";
|
|
402055
402493
|
lines.push(`- Versi\xF3n de Theus: ${version3}`);
|
|
402056
402494
|
lines.push(`- Directorio de trabajo: ${getCwd()}`);
|
|
402057
402495
|
lines.push(`- \xBFRepositorio git?: ${isGit ? "s\xED" : "no"}`);
|
|
@@ -402492,7 +402930,7 @@ var init_exit2 = __esm(() => {
|
|
|
402492
402930
|
});
|
|
402493
402931
|
|
|
402494
402932
|
// components/ExportDialog.tsx
|
|
402495
|
-
import { join as
|
|
402933
|
+
import { join as join142 } from "path";
|
|
402496
402934
|
function ExportDialog({
|
|
402497
402935
|
content,
|
|
402498
402936
|
defaultFilename,
|
|
@@ -402525,7 +402963,7 @@ function ExportDialog({
|
|
|
402525
402963
|
};
|
|
402526
402964
|
const handleFilenameSubmit = () => {
|
|
402527
402965
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
402528
|
-
const filepath =
|
|
402966
|
+
const filepath = join142(getCwd(), finalFilename);
|
|
402529
402967
|
try {
|
|
402530
402968
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
402531
402969
|
encoding: "utf-8",
|
|
@@ -402748,7 +403186,7 @@ __export(exports_export, {
|
|
|
402748
403186
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
402749
403187
|
call: () => call80
|
|
402750
403188
|
});
|
|
402751
|
-
import { join as
|
|
403189
|
+
import { join as join143 } from "path";
|
|
402752
403190
|
function formatTimestamp(date6) {
|
|
402753
403191
|
const year = date6.getFullYear();
|
|
402754
403192
|
const month = String(date6.getMonth() + 1).padStart(2, "0");
|
|
@@ -402792,7 +403230,7 @@ async function call80(onDone, context3, args) {
|
|
|
402792
403230
|
const filename = args.trim();
|
|
402793
403231
|
if (filename) {
|
|
402794
403232
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
402795
|
-
const filepath =
|
|
403233
|
+
const filepath = join143(getCwd(), finalFilename);
|
|
402796
403234
|
try {
|
|
402797
403235
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
402798
403236
|
encoding: "utf-8",
|
|
@@ -402845,10 +403283,10 @@ var init_export2 = __esm(() => {
|
|
|
402845
403283
|
});
|
|
402846
403284
|
|
|
402847
403285
|
// services/providers/sessionCatalog.ts
|
|
402848
|
-
import { existsSync as
|
|
403286
|
+
import { existsSync as existsSync21, readFileSync as readFileSync27 } from "fs";
|
|
402849
403287
|
function loadConfig2() {
|
|
402850
403288
|
const path17 = defaultProvidersConfigPath();
|
|
402851
|
-
if (!
|
|
403289
|
+
if (!existsSync21(path17))
|
|
402852
403290
|
return null;
|
|
402853
403291
|
try {
|
|
402854
403292
|
const parsed = JSON.parse(readFileSync27(path17, "utf8"));
|
|
@@ -404414,7 +404852,7 @@ import { spawn as spawn8, spawnSync as spawnSync9 } from "child_process";
|
|
|
404414
404852
|
import { createHash as createHash31 } from "crypto";
|
|
404415
404853
|
import {
|
|
404416
404854
|
cpSync,
|
|
404417
|
-
existsSync as
|
|
404855
|
+
existsSync as existsSync22,
|
|
404418
404856
|
mkdtempSync,
|
|
404419
404857
|
readFileSync as readFileSync28,
|
|
404420
404858
|
realpathSync as realpathSync5,
|
|
@@ -404422,7 +404860,7 @@ import {
|
|
|
404422
404860
|
writeFileSync as writeFileSync8
|
|
404423
404861
|
} from "fs";
|
|
404424
404862
|
import { tmpdir as tmpdir10 } from "os";
|
|
404425
|
-
import { dirname as
|
|
404863
|
+
import { dirname as dirname59, join as join144 } from "path";
|
|
404426
404864
|
function naupaVersionOf(bin) {
|
|
404427
404865
|
try {
|
|
404428
404866
|
const out = spawnSync9(bin, ["--version"], {
|
|
@@ -404437,13 +404875,13 @@ function naupaVersionOf(bin) {
|
|
|
404437
404875
|
}
|
|
404438
404876
|
function rescatarNaupaBorrado(binEnUso) {
|
|
404439
404877
|
try {
|
|
404440
|
-
if (
|
|
404878
|
+
if (existsSync22(binEnUso))
|
|
404441
404879
|
return;
|
|
404442
404880
|
const apartado = `${binEnUso}.old`;
|
|
404443
|
-
if (!
|
|
404881
|
+
if (!existsSync22(apartado))
|
|
404444
404882
|
return;
|
|
404445
404883
|
cpSync(apartado, binEnUso, { force: true });
|
|
404446
|
-
if (!
|
|
404884
|
+
if (!existsSync22(binEnUso))
|
|
404447
404885
|
return;
|
|
404448
404886
|
writeToStdout(source_default.yellow("\xD1aupa: la actualizaci\xF3n se interrumpi\xF3 y dej\xF3 el motor sin binario. " + "Restaur\xE9 la versi\xF3n anterior desde la copia de seguridad, as\xED que " + "sigue funcionando. Vuelve a intentar \xABtheus update\xBB m\xE1s tarde.") + `
|
|
404449
404887
|
`);
|
|
@@ -404458,8 +404896,8 @@ function rescatarNaupaMalUbicado(binEnUso, options2 = {}) {
|
|
|
404458
404896
|
const platform6 = options2.platform ?? process.platform;
|
|
404459
404897
|
const versionOf = options2.versionOf ?? naupaVersionOf;
|
|
404460
404898
|
const nombre = platform6 === "win32" ? "naupa.exe" : "naupa";
|
|
404461
|
-
const rutaFija =
|
|
404462
|
-
if (!
|
|
404899
|
+
const rutaFija = join144(home, ".local", "bin", nombre);
|
|
404900
|
+
if (!existsSync22(rutaFija))
|
|
404463
404901
|
return;
|
|
404464
404902
|
try {
|
|
404465
404903
|
if (realpathSync5(rutaFija) === realpathSync5(binEnUso))
|
|
@@ -404548,7 +404986,7 @@ function isReleaseBundleInstall() {
|
|
|
404548
404986
|
return false;
|
|
404549
404987
|
if (real.includes("node_modules"))
|
|
404550
404988
|
return false;
|
|
404551
|
-
return
|
|
404989
|
+
return existsSync22(join144(dirname59(real), "bin", "theus"));
|
|
404552
404990
|
} catch {
|
|
404553
404991
|
return false;
|
|
404554
404992
|
}
|
|
@@ -404582,7 +405020,7 @@ async function downloadToFile(url3, dest) {
|
|
|
404582
405020
|
}
|
|
404583
405021
|
}
|
|
404584
405022
|
async function updateReleaseBundle() {
|
|
404585
|
-
const bundleDir =
|
|
405023
|
+
const bundleDir = dirname59(realpathSync5(process.argv[1]));
|
|
404586
405024
|
const latest = await fetchReleaseChannelVersion();
|
|
404587
405025
|
if (!latest) {
|
|
404588
405026
|
process.stderr.write(source_default.red(`No pude comprobar la \xFAltima versi\xF3n en theus.pe/dl.
|
|
@@ -404592,20 +405030,20 @@ async function updateReleaseBundle() {
|
|
|
404592
405030
|
await gracefulShutdown(1);
|
|
404593
405031
|
return;
|
|
404594
405032
|
}
|
|
404595
|
-
if (gte({ VERSION: "0.2.
|
|
404596
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405033
|
+
if (gte({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405034
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
404597
405035
|
`);
|
|
404598
405036
|
await gracefulShutdown(0);
|
|
404599
405037
|
return;
|
|
404600
405038
|
}
|
|
404601
|
-
writeToStdout(`Nueva versi\xF3n disponible: ${latest} (actual: ${{ VERSION: "0.2.
|
|
405039
|
+
writeToStdout(`Nueva versi\xF3n disponible: ${latest} (actual: ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
404602
405040
|
`);
|
|
404603
405041
|
writeToStdout(`Instalando la actualizaci\xF3n desde theus.pe/dl...
|
|
404604
405042
|
`);
|
|
404605
|
-
const tmp = mkdtempSync(
|
|
405043
|
+
const tmp = mkdtempSync(join144(tmpdir10(), "theus-update-"));
|
|
404606
405044
|
try {
|
|
404607
|
-
const tarPath =
|
|
404608
|
-
const sumsPath =
|
|
405045
|
+
const tarPath = join144(tmp, "theus-cli.tar.gz");
|
|
405046
|
+
const sumsPath = join144(tmp, "SHA256SUMS");
|
|
404609
405047
|
if (!await downloadToFile(`${DL_BASE}/theus-cli.tar.gz`, tarPath) || !await downloadToFile(`${DL_BASE}/SHA256SUMS`, sumsPath)) {
|
|
404610
405048
|
process.stderr.write(source_default.red(`Fall\xF3 la descarga del release desde theus.pe/dl.
|
|
404611
405049
|
`));
|
|
@@ -404624,15 +405062,15 @@ async function updateReleaseBundle() {
|
|
|
404624
405062
|
const ex = spawnSync9("tar", ["-xzf", tarPath, "-C", tmp], {
|
|
404625
405063
|
stdio: "ignore"
|
|
404626
405064
|
});
|
|
404627
|
-
const staged =
|
|
404628
|
-
if (ex.status !== 0 || !
|
|
405065
|
+
const staged = join144(tmp, "theus-cli");
|
|
405066
|
+
if (ex.status !== 0 || !existsSync22(join144(staged, "cli.js"))) {
|
|
404629
405067
|
process.stderr.write(source_default.red(`No pude extraer el release descargado (o vino incompleto).
|
|
404630
405068
|
`));
|
|
404631
405069
|
await gracefulShutdown(1);
|
|
404632
405070
|
return;
|
|
404633
405071
|
}
|
|
404634
405072
|
cpSync(staged, bundleDir, { recursive: true, force: true });
|
|
404635
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405073
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
404636
405074
|
`);
|
|
404637
405075
|
await regenerateCompletionCache();
|
|
404638
405076
|
} finally {
|
|
@@ -404645,7 +405083,7 @@ async function updateReleaseBundle() {
|
|
|
404645
405083
|
async function update() {
|
|
404646
405084
|
logEvent("theus_update_check", {});
|
|
404647
405085
|
await updateNaupa();
|
|
404648
|
-
writeToStdout(`Versi\xF3n actual: ${{ VERSION: "0.2.
|
|
405086
|
+
writeToStdout(`Versi\xF3n actual: ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
404649
405087
|
`);
|
|
404650
405088
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
404651
405089
|
writeToStdout(`Buscando actualizaciones en el canal ${channel2}...
|
|
@@ -404724,8 +405162,8 @@ async function update() {
|
|
|
404724
405162
|
writeToStdout(`Theus est\xE1 gestionado por Homebrew.
|
|
404725
405163
|
`);
|
|
404726
405164
|
const latest = await getLatestVersion(channel2);
|
|
404727
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
404728
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405165
|
+
if (latest && !gte({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405166
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
404729
405167
|
`);
|
|
404730
405168
|
writeToStdout(`
|
|
404731
405169
|
`);
|
|
@@ -404741,8 +405179,8 @@ async function update() {
|
|
|
404741
405179
|
writeToStdout(`Theus est\xE1 gestionado por winget.
|
|
404742
405180
|
`);
|
|
404743
405181
|
const latest = await getLatestVersion(channel2);
|
|
404744
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
404745
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405182
|
+
if (latest && !gte({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405183
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
404746
405184
|
`);
|
|
404747
405185
|
writeToStdout(`
|
|
404748
405186
|
`);
|
|
@@ -404758,8 +405196,8 @@ async function update() {
|
|
|
404758
405196
|
writeToStdout(`Theus est\xE1 gestionado por apk.
|
|
404759
405197
|
`);
|
|
404760
405198
|
const latest = await getLatestVersion(channel2);
|
|
404761
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
404762
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405199
|
+
if (latest && !gte({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405200
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
404763
405201
|
`);
|
|
404764
405202
|
writeToStdout(`
|
|
404765
405203
|
`);
|
|
@@ -404824,11 +405262,11 @@ async function update() {
|
|
|
404824
405262
|
`);
|
|
404825
405263
|
await gracefulShutdown(1);
|
|
404826
405264
|
}
|
|
404827
|
-
if (result.latestVersion === { VERSION: "0.2.
|
|
404828
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405265
|
+
if (result.latestVersion === { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
405266
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
404829
405267
|
`);
|
|
404830
405268
|
} else {
|
|
404831
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405269
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
404832
405270
|
`);
|
|
404833
405271
|
await regenerateCompletionCache();
|
|
404834
405272
|
}
|
|
@@ -404847,9 +405285,9 @@ async function update() {
|
|
|
404847
405285
|
await removeInstalledSymlink();
|
|
404848
405286
|
}
|
|
404849
405287
|
logForDebugging("update: Checking npm registry for latest version");
|
|
404850
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.
|
|
405288
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
404851
405289
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
404852
|
-
const npmCommand = `npm view ${{ VERSION: "0.2.
|
|
405290
|
+
const npmCommand = `npm view ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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`;
|
|
404853
405291
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
404854
405292
|
const latestVersion = await getLatestVersion(channel2);
|
|
404855
405293
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -404869,7 +405307,7 @@ async function update() {
|
|
|
404869
405307
|
`);
|
|
404870
405308
|
process.stderr.write(` \u2022 Un proxy o firewall corporativo bloquea npm
|
|
404871
405309
|
`);
|
|
404872
|
-
if ({ VERSION: "0.2.
|
|
405310
|
+
if ({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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")) {
|
|
404873
405311
|
process.stderr.write(` \u2022 Compilaci\xF3n interna/de desarrollo no publicada en npm
|
|
404874
405312
|
`);
|
|
404875
405313
|
}
|
|
@@ -404881,19 +405319,19 @@ async function update() {
|
|
|
404881
405319
|
`);
|
|
404882
405320
|
process.stderr.write(` \u2022 Ejecuta con el flag --debug para m\xE1s detalle
|
|
404883
405321
|
`);
|
|
404884
|
-
const packageName = { VERSION: "0.2.
|
|
405322
|
+
const packageName = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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";
|
|
404885
405323
|
process.stderr.write(` \u2022 Comprueba a mano: npm view ${packageName} version
|
|
404886
405324
|
`);
|
|
404887
405325
|
process.stderr.write(` \u2022 Comprueba si te falta iniciar sesi\xF3n: npm whoami
|
|
404888
405326
|
`);
|
|
404889
405327
|
await gracefulShutdown(1);
|
|
404890
405328
|
}
|
|
404891
|
-
if (gte({ VERSION: "0.2.
|
|
404892
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405329
|
+
if (gte({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405330
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
404893
405331
|
`);
|
|
404894
405332
|
await gracefulShutdown(0);
|
|
404895
405333
|
}
|
|
404896
|
-
writeToStdout(`Nueva versi\xF3n disponible: ${latestVersion} (actual: ${{ VERSION: "0.2.
|
|
405334
|
+
writeToStdout(`Nueva versi\xF3n disponible: ${latestVersion} (actual: ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
404897
405335
|
`);
|
|
404898
405336
|
writeToStdout(`Instalando la actualizaci\xF3n...
|
|
404899
405337
|
`);
|
|
@@ -404938,7 +405376,7 @@ async function update() {
|
|
|
404938
405376
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
404939
405377
|
switch (status2) {
|
|
404940
405378
|
case "success":
|
|
404941
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405379
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
404942
405380
|
`);
|
|
404943
405381
|
await regenerateCompletionCache();
|
|
404944
405382
|
break;
|
|
@@ -404948,7 +405386,7 @@ async function update() {
|
|
|
404948
405386
|
if (useLocalUpdate) {
|
|
404949
405387
|
process.stderr.write(`Prueba a actualizar a mano con:
|
|
404950
405388
|
`);
|
|
404951
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
405389
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
404952
405390
|
`);
|
|
404953
405391
|
} else {
|
|
404954
405392
|
process.stderr.write(`Prueba con sudo o corrige los permisos de npm
|
|
@@ -404964,7 +405402,7 @@ async function update() {
|
|
|
404964
405402
|
if (useLocalUpdate) {
|
|
404965
405403
|
process.stderr.write(`Prueba a actualizar a mano con:
|
|
404966
405404
|
`);
|
|
404967
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
405405
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
404968
405406
|
`);
|
|
404969
405407
|
} else {
|
|
404970
405408
|
process.stderr.write(`O p\xE1sate a la instalaci\xF3n nativa con: theus install
|
|
@@ -405432,8 +405870,8 @@ var init_effort3 = __esm(() => {
|
|
|
405432
405870
|
|
|
405433
405871
|
// utils/statsCache.ts
|
|
405434
405872
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
405435
|
-
import { open as
|
|
405436
|
-
import { join as
|
|
405873
|
+
import { open as open19 } from "fs/promises";
|
|
405874
|
+
import { join as join145 } from "path";
|
|
405437
405875
|
async function withStatsCacheLock(fn) {
|
|
405438
405876
|
while (statsCacheLockPromise) {
|
|
405439
405877
|
await statsCacheLockPromise;
|
|
@@ -405450,7 +405888,7 @@ async function withStatsCacheLock(fn) {
|
|
|
405450
405888
|
}
|
|
405451
405889
|
}
|
|
405452
405890
|
function getStatsCachePath() {
|
|
405453
|
-
return
|
|
405891
|
+
return join145(getTheusConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
405454
405892
|
}
|
|
405455
405893
|
function getEmptyCache() {
|
|
405456
405894
|
return {
|
|
@@ -405528,7 +405966,7 @@ async function saveStatsCache(cache4) {
|
|
|
405528
405966
|
await fs5.mkdir(configDir);
|
|
405529
405967
|
} catch {}
|
|
405530
405968
|
const content = jsonStringify(cache4, null, 2);
|
|
405531
|
-
const handle2 = await
|
|
405969
|
+
const handle2 = await open19(tempPath, "w", 384);
|
|
405532
405970
|
try {
|
|
405533
405971
|
await handle2.writeFile(content, { encoding: "utf-8" });
|
|
405534
405972
|
await handle2.sync();
|
|
@@ -406120,12 +406558,12 @@ var init_ansiToPng = __esm(() => {
|
|
|
406120
406558
|
// utils/screenshotClipboard.ts
|
|
406121
406559
|
import { mkdir as mkdir45, unlink as unlink21, writeFile as writeFile48 } from "fs/promises";
|
|
406122
406560
|
import { tmpdir as tmpdir11 } from "os";
|
|
406123
|
-
import { join as
|
|
406561
|
+
import { join as join146 } from "path";
|
|
406124
406562
|
async function copyAnsiToClipboard(ansiText, options2) {
|
|
406125
406563
|
try {
|
|
406126
|
-
const tempDir =
|
|
406564
|
+
const tempDir = join146(tmpdir11(), "theus-code-screenshots");
|
|
406127
406565
|
await mkdir45(tempDir, { recursive: true });
|
|
406128
|
-
const pngPath =
|
|
406566
|
+
const pngPath = join146(tempDir, `screenshot-${Date.now()}.png`);
|
|
406129
406567
|
const pngBuffer = ansiToPng(ansiText, options2);
|
|
406130
406568
|
await writeFile48(pngPath, pngBuffer);
|
|
406131
406569
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -406195,8 +406633,8 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
406195
406633
|
});
|
|
406196
406634
|
|
|
406197
406635
|
// utils/stats.ts
|
|
406198
|
-
import { open as
|
|
406199
|
-
import { basename as basename45, join as
|
|
406636
|
+
import { open as open20 } from "fs/promises";
|
|
406637
|
+
import { basename as basename45, join as join147, sep as sep29 } from "path";
|
|
406200
406638
|
async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
406201
406639
|
const { fromDate, toDate } = options2;
|
|
406202
406640
|
const fs5 = getFsImplementation();
|
|
@@ -406374,17 +406812,17 @@ async function getAllSessionFiles() {
|
|
|
406374
406812
|
return [];
|
|
406375
406813
|
throw e;
|
|
406376
406814
|
}
|
|
406377
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
406815
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join147(projectsDir, dirent.name));
|
|
406378
406816
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
406379
406817
|
try {
|
|
406380
406818
|
const entries = await fs5.readdir(projectDir);
|
|
406381
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
406819
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join147(projectDir, dirent.name));
|
|
406382
406820
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
406383
406821
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
406384
|
-
const subagentsDir =
|
|
406822
|
+
const subagentsDir = join147(projectDir, sessionDir.name, "subagents");
|
|
406385
406823
|
try {
|
|
406386
406824
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
406387
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
406825
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join147(subagentsDir, dirent.name));
|
|
406388
406826
|
} catch {
|
|
406389
406827
|
return [];
|
|
406390
406828
|
}
|
|
@@ -406684,7 +407122,7 @@ function calculateStreaks(dailyActivity) {
|
|
|
406684
407122
|
}
|
|
406685
407123
|
async function readSessionStartDate(filePath) {
|
|
406686
407124
|
try {
|
|
406687
|
-
const fd2 = await
|
|
407125
|
+
const fd2 = await open20(filePath, "r");
|
|
406688
407126
|
try {
|
|
406689
407127
|
const buf = Buffer.allocUnsafe(4096);
|
|
406690
407128
|
const { bytesRead } = await fd2.read(buf, 0, buf.length, 0);
|
|
@@ -409138,8 +409576,8 @@ __export(exports_assistant, {
|
|
|
409138
409576
|
call: () => call93,
|
|
409139
409577
|
NewInstallWizard: () => NewInstallWizard
|
|
409140
409578
|
});
|
|
409141
|
-
import { existsSync as
|
|
409142
|
-
import { dirname as
|
|
409579
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync10, readFileSync as readFileSync29, writeFileSync as writeFileSync9 } from "fs";
|
|
409580
|
+
import { dirname as dirname61, join as join148, resolve as resolve43 } from "path";
|
|
409143
409581
|
async function computeDefaultInstallDir() {
|
|
409144
409582
|
try {
|
|
409145
409583
|
return getOriginalCwd();
|
|
@@ -409149,7 +409587,7 @@ async function computeDefaultInstallDir() {
|
|
|
409149
409587
|
}
|
|
409150
409588
|
function readJsonSafe(path17) {
|
|
409151
409589
|
try {
|
|
409152
|
-
if (!
|
|
409590
|
+
if (!existsSync23(path17))
|
|
409153
409591
|
return {};
|
|
409154
409592
|
const parsed = JSON.parse(readFileSync29(path17, "utf8"));
|
|
409155
409593
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
@@ -409158,23 +409596,23 @@ function readJsonSafe(path17) {
|
|
|
409158
409596
|
}
|
|
409159
409597
|
}
|
|
409160
409598
|
function writeJson(path17, value) {
|
|
409161
|
-
mkdirSync10(
|
|
409599
|
+
mkdirSync10(dirname61(path17), { recursive: true });
|
|
409162
409600
|
writeFileSync9(path17, `${JSON.stringify(value, null, 2)}
|
|
409163
409601
|
`, "utf8");
|
|
409164
409602
|
}
|
|
409165
409603
|
function installAssistant(dir) {
|
|
409166
409604
|
const root2 = resolve43(dir);
|
|
409167
|
-
const theusDir =
|
|
409168
|
-
const settingsPath =
|
|
409605
|
+
const theusDir = join148(root2, ".theus");
|
|
409606
|
+
const settingsPath = join148(theusDir, "settings.json");
|
|
409169
409607
|
const settings = readJsonSafe(settingsPath);
|
|
409170
409608
|
settings.assistant = true;
|
|
409171
409609
|
writeJson(settingsPath, settings);
|
|
409172
|
-
const localPath =
|
|
409610
|
+
const localPath = join148(theusDir, "settings.local.json");
|
|
409173
409611
|
const local = readJsonSafe(localPath);
|
|
409174
409612
|
local.defaultView = "chat";
|
|
409175
409613
|
writeJson(localPath, local);
|
|
409176
|
-
const agentPath =
|
|
409177
|
-
mkdirSync10(
|
|
409614
|
+
const agentPath = join148(theusDir, "agents", "assistant.md");
|
|
409615
|
+
mkdirSync10(dirname61(agentPath), { recursive: true });
|
|
409178
409616
|
writeFileSync9(agentPath, ASSISTANT_AGENT_MD, "utf8");
|
|
409179
409617
|
return root2;
|
|
409180
409618
|
}
|
|
@@ -409347,7 +409785,7 @@ var exports_workflows = {};
|
|
|
409347
409785
|
__export(exports_workflows, {
|
|
409348
409786
|
default: () => workflows_default
|
|
409349
409787
|
});
|
|
409350
|
-
import { existsSync as
|
|
409788
|
+
import { existsSync as existsSync24, readdirSync as readdirSync3, statSync as statSync11 } from "fs";
|
|
409351
409789
|
import { homedir as homedir37 } from "os";
|
|
409352
409790
|
import { basename as basename46, extname as extname16, resolve as resolve44 } from "path";
|
|
409353
409791
|
function safeCwd2() {
|
|
@@ -409366,7 +409804,7 @@ function workflowDirs(cwd2) {
|
|
|
409366
409804
|
function scanDir(dir) {
|
|
409367
409805
|
const out = [];
|
|
409368
409806
|
try {
|
|
409369
|
-
if (!
|
|
409807
|
+
if (!existsSync24(dir))
|
|
409370
409808
|
return out;
|
|
409371
409809
|
for (const entry of readdirSync3(dir)) {
|
|
409372
409810
|
const ext = extname16(entry);
|
|
@@ -410836,11 +411274,11 @@ function BuddyPanel({
|
|
|
410836
411274
|
/* @__PURE__ */ jsx_runtime369.jsx(ThemedBox_default, {
|
|
410837
411275
|
flexDirection: "column",
|
|
410838
411276
|
marginTop: 1,
|
|
410839
|
-
children: STAT_NAMES.map((
|
|
410840
|
-
label: STAT_ES[
|
|
410841
|
-
value: companion.stats[
|
|
411277
|
+
children: STAT_NAMES.map((stat47) => /* @__PURE__ */ jsx_runtime369.jsx(StatRow, {
|
|
411278
|
+
label: STAT_ES[stat47],
|
|
411279
|
+
value: companion.stats[stat47],
|
|
410842
411280
|
color: color3
|
|
410843
|
-
},
|
|
411281
|
+
}, stat47))
|
|
410844
411282
|
}),
|
|
410845
411283
|
muted && /* @__PURE__ */ jsx_runtime369.jsx(ThemedBox_default, {
|
|
410846
411284
|
marginTop: 1,
|
|
@@ -410921,12 +411359,12 @@ __export(exports_createWorkflowCommand, {
|
|
|
410921
411359
|
getWorkflowCommands: () => getWorkflowCommands,
|
|
410922
411360
|
default: () => createWorkflowCommand_default
|
|
410923
411361
|
});
|
|
410924
|
-
import { existsSync as
|
|
411362
|
+
import { existsSync as existsSync25, readdirSync as readdirSync4, statSync as statSync12 } from "fs";
|
|
410925
411363
|
import { homedir as homedir38 } from "os";
|
|
410926
411364
|
import { basename as basename47, extname as extname17, resolve as resolve45 } from "path";
|
|
410927
411365
|
function listWorkflowFiles(dir) {
|
|
410928
411366
|
try {
|
|
410929
|
-
if (!
|
|
411367
|
+
if (!existsSync25(dir))
|
|
410930
411368
|
return [];
|
|
410931
411369
|
const out = [];
|
|
410932
411370
|
for (const entry of readdirSync4(dir)) {
|
|
@@ -411557,13 +411995,13 @@ import {
|
|
|
411557
411995
|
appendFile as fsAppendFile,
|
|
411558
411996
|
open as fsOpen2,
|
|
411559
411997
|
mkdir as mkdir46,
|
|
411560
|
-
readdir as
|
|
411561
|
-
readFile as
|
|
411562
|
-
stat as
|
|
411998
|
+
readdir as readdir33,
|
|
411999
|
+
readFile as readFile55,
|
|
412000
|
+
stat as stat47,
|
|
411563
412001
|
unlink as unlink22,
|
|
411564
412002
|
writeFile as writeFile49
|
|
411565
412003
|
} from "fs/promises";
|
|
411566
|
-
import { basename as basename48, dirname as
|
|
412004
|
+
import { basename as basename48, dirname as dirname62, join as join149 } from "path";
|
|
411567
412005
|
function isTranscriptMessage(entry) {
|
|
411568
412006
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
411569
412007
|
}
|
|
@@ -411577,18 +412015,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
411577
412015
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
411578
412016
|
}
|
|
411579
412017
|
function getProjectsDir2() {
|
|
411580
|
-
return
|
|
412018
|
+
return join149(getTheusConfigHomeDir(), "projects");
|
|
411581
412019
|
}
|
|
411582
412020
|
function getTranscriptPath() {
|
|
411583
412021
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
411584
|
-
return
|
|
412022
|
+
return join149(projectDir, `${getSessionId()}.jsonl`);
|
|
411585
412023
|
}
|
|
411586
412024
|
function getTranscriptPathForSession(sessionId) {
|
|
411587
412025
|
if (sessionId === getSessionId()) {
|
|
411588
412026
|
return getTranscriptPath();
|
|
411589
412027
|
}
|
|
411590
412028
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
411591
|
-
return
|
|
412029
|
+
return join149(projectDir, `${sessionId}.jsonl`);
|
|
411592
412030
|
}
|
|
411593
412031
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
411594
412032
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -411600,21 +412038,21 @@ function getAgentTranscriptPath(agentId) {
|
|
|
411600
412038
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
411601
412039
|
const sessionId = getSessionId();
|
|
411602
412040
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
411603
|
-
const base2 = subdir ?
|
|
411604
|
-
return
|
|
412041
|
+
const base2 = subdir ? join149(projectDir, sessionId, "subagents", subdir) : join149(projectDir, sessionId, "subagents");
|
|
412042
|
+
return join149(base2, `agent-${agentId}.jsonl`);
|
|
411605
412043
|
}
|
|
411606
412044
|
function getAgentMetadataPath(agentId) {
|
|
411607
412045
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
411608
412046
|
}
|
|
411609
412047
|
async function writeAgentMetadata(agentId, metadata) {
|
|
411610
412048
|
const path17 = getAgentMetadataPath(agentId);
|
|
411611
|
-
await mkdir46(
|
|
412049
|
+
await mkdir46(dirname62(path17), { recursive: true });
|
|
411612
412050
|
await writeFile49(path17, JSON.stringify(metadata));
|
|
411613
412051
|
}
|
|
411614
412052
|
async function readAgentMetadata(agentId) {
|
|
411615
412053
|
const path17 = getAgentMetadataPath(agentId);
|
|
411616
412054
|
try {
|
|
411617
|
-
const raw = await
|
|
412055
|
+
const raw = await readFile55(path17, "utf-8");
|
|
411618
412056
|
return JSON.parse(raw);
|
|
411619
412057
|
} catch (e) {
|
|
411620
412058
|
if (isFsInaccessible(e))
|
|
@@ -411624,20 +412062,20 @@ async function readAgentMetadata(agentId) {
|
|
|
411624
412062
|
}
|
|
411625
412063
|
function getRemoteAgentsDir() {
|
|
411626
412064
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
411627
|
-
return
|
|
412065
|
+
return join149(projectDir, getSessionId(), "remote-agents");
|
|
411628
412066
|
}
|
|
411629
412067
|
function getRemoteAgentMetadataPath(taskId) {
|
|
411630
|
-
return
|
|
412068
|
+
return join149(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
411631
412069
|
}
|
|
411632
412070
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
411633
412071
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
411634
|
-
await mkdir46(
|
|
412072
|
+
await mkdir46(dirname62(path17), { recursive: true });
|
|
411635
412073
|
await writeFile49(path17, JSON.stringify(metadata));
|
|
411636
412074
|
}
|
|
411637
412075
|
async function readRemoteAgentMetadata(taskId) {
|
|
411638
412076
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
411639
412077
|
try {
|
|
411640
|
-
const raw = await
|
|
412078
|
+
const raw = await readFile55(path17, "utf-8");
|
|
411641
412079
|
return JSON.parse(raw);
|
|
411642
412080
|
} catch (e) {
|
|
411643
412081
|
if (isFsInaccessible(e))
|
|
@@ -411659,7 +412097,7 @@ async function listRemoteAgentMetadata() {
|
|
|
411659
412097
|
const dir = getRemoteAgentsDir();
|
|
411660
412098
|
let entries;
|
|
411661
412099
|
try {
|
|
411662
|
-
entries = await
|
|
412100
|
+
entries = await readdir33(dir, { withFileTypes: true });
|
|
411663
412101
|
} catch (e) {
|
|
411664
412102
|
if (isFsInaccessible(e))
|
|
411665
412103
|
return [];
|
|
@@ -411670,7 +412108,7 @@ async function listRemoteAgentMetadata() {
|
|
|
411670
412108
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
411671
412109
|
continue;
|
|
411672
412110
|
try {
|
|
411673
|
-
const raw = await
|
|
412111
|
+
const raw = await readFile55(join149(dir, entry.name), "utf-8");
|
|
411674
412112
|
results.push(JSON.parse(raw));
|
|
411675
412113
|
} catch (e) {
|
|
411676
412114
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -411680,7 +412118,7 @@ async function listRemoteAgentMetadata() {
|
|
|
411680
412118
|
}
|
|
411681
412119
|
function sessionIdExists(sessionId) {
|
|
411682
412120
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
411683
|
-
const sessionFile =
|
|
412121
|
+
const sessionFile = join149(projectDir, `${sessionId}.jsonl`);
|
|
411684
412122
|
const fs5 = getFsImplementation();
|
|
411685
412123
|
try {
|
|
411686
412124
|
fs5.statSync(sessionFile);
|
|
@@ -411820,7 +412258,7 @@ class Project {
|
|
|
411820
412258
|
try {
|
|
411821
412259
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
411822
412260
|
} catch {
|
|
411823
|
-
await mkdir46(
|
|
412261
|
+
await mkdir46(dirname62(filePath), { recursive: true, mode: 448 });
|
|
411824
412262
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
411825
412263
|
}
|
|
411826
412264
|
}
|
|
@@ -412012,7 +412450,7 @@ class Project {
|
|
|
412012
412450
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
412013
412451
|
return;
|
|
412014
412452
|
}
|
|
412015
|
-
const content = await
|
|
412453
|
+
const content = await readFile55(this.sessionFile, { encoding: "utf-8" });
|
|
412016
412454
|
const lines = content.split(`
|
|
412017
412455
|
`).filter((line) => {
|
|
412018
412456
|
if (!line.trim())
|
|
@@ -412222,7 +412660,7 @@ class Project {
|
|
|
412222
412660
|
return cached3;
|
|
412223
412661
|
const targetFile = getTranscriptPathForSession(sessionId);
|
|
412224
412662
|
try {
|
|
412225
|
-
await
|
|
412663
|
+
await stat47(targetFile);
|
|
412226
412664
|
this.existingSessionFiles.set(sessionId, targetFile);
|
|
412227
412665
|
return targetFile;
|
|
412228
412666
|
} catch (e) {
|
|
@@ -412419,7 +412857,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
412419
412857
|
}
|
|
412420
412858
|
for (const [agentId, entries] of byAgent) {
|
|
412421
412859
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
412422
|
-
await mkdir46(
|
|
412860
|
+
await mkdir46(dirname62(agentFile), { recursive: true, mode: 448 });
|
|
412423
412861
|
const agentContent = entries.map((p) => jsonStringify(p) + `
|
|
412424
412862
|
`).join("");
|
|
412425
412863
|
await writeFile49(agentFile, agentContent, {
|
|
@@ -412822,7 +413260,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
412822
413260
|
worktreeSession: worktreeStates.has(sessionId) ? worktreeStates.get(sessionId) : undefined
|
|
412823
413261
|
};
|
|
412824
413262
|
}
|
|
412825
|
-
const content = await
|
|
413263
|
+
const content = await readFile55(filePath, { encoding: "utf-8" });
|
|
412826
413264
|
let parsed;
|
|
412827
413265
|
try {
|
|
412828
413266
|
parsed = jsonParse(content);
|
|
@@ -412956,7 +413394,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
412956
413394
|
try {
|
|
412957
413395
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
412958
413396
|
} catch {
|
|
412959
|
-
fs5.mkdirSync(
|
|
413397
|
+
fs5.mkdirSync(dirname62(fullPath), { mode: 448 });
|
|
412960
413398
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
412961
413399
|
}
|
|
412962
413400
|
}
|
|
@@ -413474,7 +413912,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413474
413912
|
let metadataLines = null;
|
|
413475
413913
|
let hasPreservedSegment = false;
|
|
413476
413914
|
if (!isEnvTruthy(process.env.THEUS_CODE_DISABLE_PRECOMPACT_SKIP)) {
|
|
413477
|
-
const { size } = await
|
|
413915
|
+
const { size } = await stat47(filePath);
|
|
413478
413916
|
if (size > SKIP_PRECOMPACT_THRESHOLD) {
|
|
413479
413917
|
const scan = await readTranscriptForLoad(filePath, size);
|
|
413480
413918
|
buf = scan.postBoundaryBuf;
|
|
@@ -413484,7 +413922,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413484
413922
|
}
|
|
413485
413923
|
}
|
|
413486
413924
|
}
|
|
413487
|
-
buf ??= await
|
|
413925
|
+
buf ??= await readFile55(filePath);
|
|
413488
413926
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.THEUS_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
413489
413927
|
buf = walkChainBeforeParse(buf);
|
|
413490
413928
|
}
|
|
@@ -413649,7 +414087,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413649
414087
|
};
|
|
413650
414088
|
}
|
|
413651
414089
|
async function loadSessionFile(sessionId) {
|
|
413652
|
-
const sessionFile =
|
|
414090
|
+
const sessionFile = join149(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
413653
414091
|
return loadTranscriptFile(sessionFile);
|
|
413654
414092
|
}
|
|
413655
414093
|
function clearSessionMessagesCache() {
|
|
@@ -413713,11 +414151,11 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
413713
414151
|
const projectsDir = getProjectsDir2();
|
|
413714
414152
|
let dirents;
|
|
413715
414153
|
try {
|
|
413716
|
-
dirents = await
|
|
414154
|
+
dirents = await readdir33(projectsDir, { withFileTypes: true });
|
|
413717
414155
|
} catch {
|
|
413718
414156
|
return [];
|
|
413719
414157
|
}
|
|
413720
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
414158
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join149(projectsDir, dirent.name));
|
|
413721
414159
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
413722
414160
|
const allLogs = logsPerProject.flat();
|
|
413723
414161
|
const deduped = new Map;
|
|
@@ -413738,11 +414176,11 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
413738
414176
|
const projectsDir = getProjectsDir2();
|
|
413739
414177
|
let dirents;
|
|
413740
414178
|
try {
|
|
413741
|
-
dirents = await
|
|
414179
|
+
dirents = await readdir33(projectsDir, { withFileTypes: true });
|
|
413742
414180
|
} catch {
|
|
413743
414181
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
413744
414182
|
}
|
|
413745
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
414183
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join149(projectsDir, dirent.name));
|
|
413746
414184
|
const rawLogs = [];
|
|
413747
414185
|
for (const projectDir of projectDirs) {
|
|
413748
414186
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -413788,7 +414226,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
413788
414226
|
const seenDirs = new Set;
|
|
413789
414227
|
let allDirents;
|
|
413790
414228
|
try {
|
|
413791
|
-
allDirents = await
|
|
414229
|
+
allDirents = await readdir33(projectsDir, { withFileTypes: true });
|
|
413792
414230
|
} catch (e) {
|
|
413793
414231
|
logForDebugging(`Failed to read projects dir ${projectsDir}, falling back to current project: ${e}`);
|
|
413794
414232
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
@@ -413803,7 +414241,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
413803
414241
|
for (const { path: wtPath, prefix } of indexed) {
|
|
413804
414242
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
413805
414243
|
seenDirs.add(dirName);
|
|
413806
|
-
allLogs.push(...await getSessionFilesLite(
|
|
414244
|
+
allLogs.push(...await getSessionFilesLite(join149(projectsDir, dirent.name), undefined, wtPath));
|
|
413807
414245
|
break;
|
|
413808
414246
|
}
|
|
413809
414247
|
}
|
|
@@ -413872,10 +414310,10 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
413872
414310
|
return transcripts;
|
|
413873
414311
|
}
|
|
413874
414312
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
413875
|
-
const subagentsDir =
|
|
414313
|
+
const subagentsDir = join149(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), getSessionId(), "subagents");
|
|
413876
414314
|
let entries;
|
|
413877
414315
|
try {
|
|
413878
|
-
entries = await
|
|
414316
|
+
entries = await readdir33(subagentsDir, { withFileTypes: true });
|
|
413879
414317
|
} catch {
|
|
413880
414318
|
return {};
|
|
413881
414319
|
}
|
|
@@ -413989,7 +414427,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
413989
414427
|
const sessionFilesMap = new Map;
|
|
413990
414428
|
let dirents;
|
|
413991
414429
|
try {
|
|
413992
|
-
dirents = await
|
|
414430
|
+
dirents = await readdir33(projectDir, { withFileTypes: true });
|
|
413993
414431
|
} catch {
|
|
413994
414432
|
return sessionFilesMap;
|
|
413995
414433
|
}
|
|
@@ -414000,11 +414438,11 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
414000
414438
|
const sessionId = validateUuid2(basename48(dirent.name, ".jsonl"));
|
|
414001
414439
|
if (!sessionId)
|
|
414002
414440
|
continue;
|
|
414003
|
-
candidates.push({ sessionId, filePath:
|
|
414441
|
+
candidates.push({ sessionId, filePath: join149(projectDir, dirent.name) });
|
|
414004
414442
|
}
|
|
414005
414443
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
414006
414444
|
try {
|
|
414007
|
-
const st = await
|
|
414445
|
+
const st = await stat47(filePath);
|
|
414008
414446
|
sessionFilesMap.set(sessionId, {
|
|
414009
414447
|
path: filePath,
|
|
414010
414448
|
mtime: st.mtime.getTime(),
|
|
@@ -414387,7 +414825,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
414387
414825
|
init_settings2();
|
|
414388
414826
|
init_slowOperations();
|
|
414389
414827
|
init_uuid();
|
|
414390
|
-
VERSION4 = { VERSION: "0.2.
|
|
414828
|
+
VERSION4 = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
414391
414829
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
414392
414830
|
SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
414393
414831
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -414399,7 +414837,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
414399
414837
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
414400
414838
|
agentTranscriptSubdirs = new Map;
|
|
414401
414839
|
getProjectDir3 = memoize_default((projectDir) => {
|
|
414402
|
-
return
|
|
414840
|
+
return join149(getProjectsDir2(), sanitizePath2(projectDir));
|
|
414403
414841
|
});
|
|
414404
414842
|
METADATA_TYPE_MARKERS = [
|
|
414405
414843
|
'"type":"summary"',
|
|
@@ -414637,41 +415075,41 @@ var init_memdir = __esm(() => {
|
|
|
414637
415075
|
});
|
|
414638
415076
|
|
|
414639
415077
|
// tools/AgentTool/agentMemory.ts
|
|
414640
|
-
import { join as
|
|
415078
|
+
import { join as join150, normalize as normalize14, sep as sep30 } from "path";
|
|
414641
415079
|
function sanitizeAgentTypeForPath(agentType) {
|
|
414642
415080
|
return agentType.replace(/:/g, "-");
|
|
414643
415081
|
}
|
|
414644
415082
|
function getLocalAgentMemoryDir(dirName) {
|
|
414645
415083
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
414646
|
-
return
|
|
415084
|
+
return join150(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep30;
|
|
414647
415085
|
}
|
|
414648
|
-
return
|
|
415086
|
+
return join150(getCwd(), ".theus", "agent-memory-local", dirName) + sep30;
|
|
414649
415087
|
}
|
|
414650
415088
|
function getAgentMemoryDir(agentType, scope) {
|
|
414651
415089
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
414652
415090
|
switch (scope) {
|
|
414653
415091
|
case "project":
|
|
414654
|
-
return
|
|
415092
|
+
return join150(getCwd(), ".theus", "agent-memory", dirName) + sep30;
|
|
414655
415093
|
case "local":
|
|
414656
415094
|
return getLocalAgentMemoryDir(dirName);
|
|
414657
415095
|
case "user":
|
|
414658
|
-
return
|
|
415096
|
+
return join150(getMemoryBaseDir(), "agent-memory", dirName) + sep30;
|
|
414659
415097
|
}
|
|
414660
415098
|
}
|
|
414661
415099
|
function isAgentMemoryPath(absolutePath) {
|
|
414662
415100
|
const normalizedPath = normalize14(absolutePath);
|
|
414663
415101
|
const memoryBase = getMemoryBaseDir();
|
|
414664
|
-
if (normalizedPath.startsWith(
|
|
415102
|
+
if (normalizedPath.startsWith(join150(memoryBase, "agent-memory") + sep30)) {
|
|
414665
415103
|
return true;
|
|
414666
415104
|
}
|
|
414667
|
-
if (normalizedPath.startsWith(
|
|
415105
|
+
if (normalizedPath.startsWith(join150(getCwd(), ".theus", "agent-memory") + sep30)) {
|
|
414668
415106
|
return true;
|
|
414669
415107
|
}
|
|
414670
415108
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
414671
|
-
if (normalizedPath.includes(sep30 + "agent-memory-local" + sep30) && normalizedPath.startsWith(
|
|
415109
|
+
if (normalizedPath.includes(sep30 + "agent-memory-local" + sep30) && normalizedPath.startsWith(join150(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects") + sep30)) {
|
|
414672
415110
|
return true;
|
|
414673
415111
|
}
|
|
414674
|
-
} else if (normalizedPath.startsWith(
|
|
415112
|
+
} else if (normalizedPath.startsWith(join150(getCwd(), ".theus", "agent-memory-local") + sep30)) {
|
|
414675
415113
|
return true;
|
|
414676
415114
|
}
|
|
414677
415115
|
return false;
|
|
@@ -414679,7 +415117,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
414679
415117
|
function getMemoryScopeDisplay(memory2) {
|
|
414680
415118
|
switch (memory2) {
|
|
414681
415119
|
case "user":
|
|
414682
|
-
return `User (${
|
|
415120
|
+
return `User (${join150(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
414683
415121
|
case "project":
|
|
414684
415122
|
return "Project (.theus/agent-memory/)";
|
|
414685
415123
|
case "local":
|
|
@@ -414722,7 +415160,7 @@ var init_agentMemory = __esm(() => {
|
|
|
414722
415160
|
// utils/permissions/filesystem.ts
|
|
414723
415161
|
import { randomBytes as randomBytes21 } from "crypto";
|
|
414724
415162
|
import { homedir as homedir39, tmpdir as tmpdir12 } from "os";
|
|
414725
|
-
import { join as
|
|
415163
|
+
import { join as join151, normalize as normalize15, posix as posix7, sep as sep31 } from "path";
|
|
414726
415164
|
function normalizeCaseForComparison(path17) {
|
|
414727
415165
|
return path17.toLowerCase();
|
|
414728
415166
|
}
|
|
@@ -414731,11 +415169,11 @@ function getTheusSkillScope(filePath) {
|
|
|
414731
415169
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
414732
415170
|
const bases = [
|
|
414733
415171
|
{
|
|
414734
|
-
dir: expandPath(
|
|
415172
|
+
dir: expandPath(join151(getOriginalCwd(), ".theus", "skills")),
|
|
414735
415173
|
prefix: "/.theus/skills/"
|
|
414736
415174
|
},
|
|
414737
415175
|
{
|
|
414738
|
-
dir: expandPath(
|
|
415176
|
+
dir: expandPath(join151(homedir39(), ".theus", "skills")),
|
|
414739
415177
|
prefix: "~/.theus/skills/"
|
|
414740
415178
|
}
|
|
414741
415179
|
];
|
|
@@ -414790,21 +415228,21 @@ function isTheusConfigFilePath(filePath) {
|
|
|
414790
415228
|
if (isTheusSettingsPath(filePath)) {
|
|
414791
415229
|
return true;
|
|
414792
415230
|
}
|
|
414793
|
-
const commandsDir =
|
|
414794
|
-
const agentsDir =
|
|
414795
|
-
const skillsDir =
|
|
415231
|
+
const commandsDir = join151(getOriginalCwd(), ".theus", "commands");
|
|
415232
|
+
const agentsDir = join151(getOriginalCwd(), ".theus", "agents");
|
|
415233
|
+
const skillsDir = join151(getOriginalCwd(), ".theus", "skills");
|
|
414796
415234
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
414797
415235
|
}
|
|
414798
415236
|
function isSessionPlanFile(absolutePath) {
|
|
414799
|
-
const expectedPrefix =
|
|
415237
|
+
const expectedPrefix = join151(getPlansDirectory(), getPlanSlug());
|
|
414800
415238
|
const normalizedPath = normalize15(absolutePath);
|
|
414801
415239
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
414802
415240
|
}
|
|
414803
415241
|
function getSessionMemoryDir() {
|
|
414804
|
-
return
|
|
415242
|
+
return join151(getProjectDir3(getCwd()), getSessionId(), "session-memory") + sep31;
|
|
414805
415243
|
}
|
|
414806
415244
|
function getSessionMemoryPath() {
|
|
414807
|
-
return
|
|
415245
|
+
return join151(getSessionMemoryDir(), "summary.md");
|
|
414808
415246
|
}
|
|
414809
415247
|
function isSessionMemoryPath(absolutePath) {
|
|
414810
415248
|
const normalizedPath = normalize15(absolutePath);
|
|
@@ -414826,10 +415264,10 @@ function getTheusTempDirName() {
|
|
|
414826
415264
|
return `theus-${uid}`;
|
|
414827
415265
|
}
|
|
414828
415266
|
function getProjectTempDir() {
|
|
414829
|
-
return
|
|
415267
|
+
return join151(getTheusTempDir(), sanitizePath2(getOriginalCwd())) + sep31;
|
|
414830
415268
|
}
|
|
414831
415269
|
function getScratchpadDir() {
|
|
414832
|
-
return
|
|
415270
|
+
return join151(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
414833
415271
|
}
|
|
414834
415272
|
async function ensureScratchpadDir() {
|
|
414835
415273
|
if (!isScratchpadEnabled()) {
|
|
@@ -415407,7 +415845,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
415407
415845
|
}
|
|
415408
415846
|
};
|
|
415409
415847
|
}
|
|
415410
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
415848
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join151(getOriginalCwd(), ".theus", "launch.json"))) {
|
|
415411
415849
|
return {
|
|
415412
415850
|
behavior: "allow",
|
|
415413
415851
|
updatedInput: input,
|
|
@@ -415504,7 +415942,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
415504
415942
|
}
|
|
415505
415943
|
};
|
|
415506
415944
|
}
|
|
415507
|
-
const tasksDir =
|
|
415945
|
+
const tasksDir = join151(getTheusConfigHomeDir(), "tasks") + sep31;
|
|
415508
415946
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
415509
415947
|
return {
|
|
415510
415948
|
behavior: "allow",
|
|
@@ -415515,7 +415953,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
415515
415953
|
}
|
|
415516
415954
|
};
|
|
415517
415955
|
}
|
|
415518
|
-
const teamsReadDir =
|
|
415956
|
+
const teamsReadDir = join151(getTheusConfigHomeDir(), "teams") + sep31;
|
|
415519
415957
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
415520
415958
|
return {
|
|
415521
415959
|
behavior: "allow",
|
|
@@ -415588,11 +416026,11 @@ var init_filesystem = __esm(() => {
|
|
|
415588
416026
|
try {
|
|
415589
416027
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
415590
416028
|
} catch {}
|
|
415591
|
-
return
|
|
416029
|
+
return join151(resolvedBaseTmpDir, getTheusTempDirName()) + sep31;
|
|
415592
416030
|
});
|
|
415593
416031
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
415594
416032
|
const nonce = randomBytes21(16).toString("hex");
|
|
415595
|
-
return
|
|
416033
|
+
return join151(getTheusTempDir(), "bundled-skills", { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
415596
416034
|
});
|
|
415597
416035
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
415598
416036
|
});
|
|
@@ -415601,15 +416039,15 @@ var init_filesystem = __esm(() => {
|
|
|
415601
416039
|
import { constants as fsConstants6 } from "fs";
|
|
415602
416040
|
import {
|
|
415603
416041
|
mkdir as mkdir47,
|
|
415604
|
-
open as
|
|
415605
|
-
stat as
|
|
416042
|
+
open as open21,
|
|
416043
|
+
stat as stat48,
|
|
415606
416044
|
symlink as symlink6,
|
|
415607
416045
|
unlink as unlink23
|
|
415608
416046
|
} from "fs/promises";
|
|
415609
|
-
import { join as
|
|
416047
|
+
import { join as join152 } from "path";
|
|
415610
416048
|
function getTaskOutputDir() {
|
|
415611
416049
|
if (_taskOutputDir === undefined) {
|
|
415612
|
-
_taskOutputDir =
|
|
416050
|
+
_taskOutputDir = join152(getProjectTempDir(), getSessionId(), "tasks");
|
|
415613
416051
|
}
|
|
415614
416052
|
return _taskOutputDir;
|
|
415615
416053
|
}
|
|
@@ -415617,7 +416055,7 @@ async function ensureOutputDir() {
|
|
|
415617
416055
|
await mkdir47(getTaskOutputDir(), { recursive: true });
|
|
415618
416056
|
}
|
|
415619
416057
|
function getTaskOutputPath(taskId) {
|
|
415620
|
-
return
|
|
416058
|
+
return join152(getTaskOutputDir(), `${taskId}.output`);
|
|
415621
416059
|
}
|
|
415622
416060
|
function track(p) {
|
|
415623
416061
|
_pendingOps.add(p);
|
|
@@ -415667,7 +416105,7 @@ class DiskTaskOutput {
|
|
|
415667
416105
|
try {
|
|
415668
416106
|
if (!this.#fileHandle) {
|
|
415669
416107
|
await ensureOutputDir();
|
|
415670
|
-
this.#fileHandle = await
|
|
416108
|
+
this.#fileHandle = await open21(this.#path, process.platform === "win32" ? "a" : fsConstants6.O_WRONLY | fsConstants6.O_APPEND | fsConstants6.O_CREAT | O_NOFOLLOW2);
|
|
415671
416109
|
}
|
|
415672
416110
|
while (true) {
|
|
415673
416111
|
await this.#writeAllChunks();
|
|
@@ -415784,7 +416222,7 @@ function initTaskOutput(taskId) {
|
|
|
415784
416222
|
return track((async () => {
|
|
415785
416223
|
await ensureOutputDir();
|
|
415786
416224
|
const outputPath = getTaskOutputPath(taskId);
|
|
415787
|
-
const fh = await
|
|
416225
|
+
const fh = await open21(outputPath, process.platform === "win32" ? "wx" : fsConstants6.O_WRONLY | fsConstants6.O_CREAT | fsConstants6.O_EXCL | O_NOFOLLOW2);
|
|
415788
416226
|
await fh.close();
|
|
415789
416227
|
return outputPath;
|
|
415790
416228
|
})());
|
|
@@ -415866,7 +416304,7 @@ var init_Task = __esm(() => {
|
|
|
415866
416304
|
});
|
|
415867
416305
|
|
|
415868
416306
|
// utils/ShellCommand.ts
|
|
415869
|
-
import { stat as
|
|
416307
|
+
import { stat as stat49 } from "fs/promises";
|
|
415870
416308
|
function prependStderr(prefix, stderr) {
|
|
415871
416309
|
return stderr ? `${prefix} ${stderr}` : prefix;
|
|
415872
416310
|
}
|
|
@@ -415990,7 +416428,7 @@ class ShellCommandImpl {
|
|
|
415990
416428
|
}
|
|
415991
416429
|
#startSizeWatchdog() {
|
|
415992
416430
|
this.#sizeWatchdog = setInterval(() => {
|
|
415993
|
-
|
|
416431
|
+
stat49(this.taskOutput.path).then((s) => {
|
|
415994
416432
|
if (s.size > this.#maxOutputBytes && this.#status === "backgrounded" && this.#sizeWatchdog !== null) {
|
|
415995
416433
|
this.#killedForSize = true;
|
|
415996
416434
|
this.#clearSizeWatchdog();
|
|
@@ -419853,7 +420291,7 @@ var init_hooks5 = __esm(() => {
|
|
|
419853
420291
|
});
|
|
419854
420292
|
|
|
419855
420293
|
// utils/settings/changeDetector.ts
|
|
419856
|
-
import { stat as
|
|
420294
|
+
import { stat as stat50 } from "fs/promises";
|
|
419857
420295
|
import * as platformPath from "path";
|
|
419858
420296
|
async function initialize() {
|
|
419859
420297
|
if (getIsRemoteMode())
|
|
@@ -419933,7 +420371,7 @@ async function getWatchTargets() {
|
|
|
419933
420371
|
}
|
|
419934
420372
|
dirToSettingsFiles.get(dir).add(path17);
|
|
419935
420373
|
try {
|
|
419936
|
-
const stats2 = await
|
|
420374
|
+
const stats2 = await stat50(path17);
|
|
419937
420375
|
if (stats2.isFile()) {
|
|
419938
420376
|
dirsWithExistingFiles.add(dir);
|
|
419939
420377
|
}
|
|
@@ -419951,7 +420389,7 @@ async function getWatchTargets() {
|
|
|
419951
420389
|
let dropInDir = null;
|
|
419952
420390
|
const managedDropIn = getManagedSettingsDropInDir();
|
|
419953
420391
|
try {
|
|
419954
|
-
const stats2 = await
|
|
420392
|
+
const stats2 = await stat50(managedDropIn);
|
|
419955
420393
|
if (stats2.isDirectory()) {
|
|
419956
420394
|
dirsWithExistingFiles.add(managedDropIn);
|
|
419957
420395
|
dropInDir = managedDropIn;
|
|
@@ -420131,8 +420569,8 @@ __export(exports_sandbox_adapter, {
|
|
|
420131
420569
|
SandboxManager: () => SandboxManager2
|
|
420132
420570
|
});
|
|
420133
420571
|
import { rmSync as rmSync5, statSync as statSync13 } from "fs";
|
|
420134
|
-
import { readFile as
|
|
420135
|
-
import { join as
|
|
420572
|
+
import { readFile as readFile56 } from "fs/promises";
|
|
420573
|
+
import { join as join153, resolve as resolve46, sep as sep33 } from "path";
|
|
420136
420574
|
function permissionRuleValueFromString2(ruleString) {
|
|
420137
420575
|
const matches = ruleString.match(/^([^(]+)\(([^)]+)\)$/);
|
|
420138
420576
|
if (!matches) {
|
|
@@ -420314,9 +420752,9 @@ function scrubBareGitRepoFiles() {
|
|
|
420314
420752
|
}
|
|
420315
420753
|
}
|
|
420316
420754
|
async function detectWorktreeMainRepoPath(cwd2) {
|
|
420317
|
-
const gitPath =
|
|
420755
|
+
const gitPath = join153(cwd2, ".git");
|
|
420318
420756
|
try {
|
|
420319
|
-
const gitContent = await
|
|
420757
|
+
const gitContent = await readFile56(gitPath, { encoding: "utf8" });
|
|
420320
420758
|
const gitdirMatch = gitContent.match(/^gitdir:\s*(.+)$/m);
|
|
420321
420759
|
if (!gitdirMatch?.[1]) {
|
|
420322
420760
|
return null;
|
|
@@ -420618,7 +421056,7 @@ var init_sandbox_adapter = __esm(() => {
|
|
|
420618
421056
|
|
|
420619
421057
|
// utils/permissions/pathValidation.ts
|
|
420620
421058
|
import { homedir as homedir40 } from "os";
|
|
420621
|
-
import { dirname as
|
|
421059
|
+
import { dirname as dirname64, isAbsolute as isAbsolute29, resolve as resolve47 } from "path";
|
|
420622
421060
|
function formatDirectoryList2(directories) {
|
|
420623
421061
|
const dirCount = directories.length;
|
|
420624
421062
|
if (dirCount <= MAX_DIRS_TO_LIST2) {
|
|
@@ -420761,7 +421199,7 @@ function isDangerousRemovalPath(resolvedPath) {
|
|
|
420761
421199
|
if (normalizedPath === normalizedHome) {
|
|
420762
421200
|
return true;
|
|
420763
421201
|
}
|
|
420764
|
-
const parentDir =
|
|
421202
|
+
const parentDir = dirname64(normalizedPath);
|
|
420765
421203
|
if (parentDir === "/") {
|
|
420766
421204
|
return true;
|
|
420767
421205
|
}
|
|
@@ -420841,8 +421279,8 @@ var init_pathValidation3 = __esm(() => {
|
|
|
420841
421279
|
|
|
420842
421280
|
// utils/plugins/pluginDirectories.ts
|
|
420843
421281
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
420844
|
-
import { readdir as
|
|
420845
|
-
import { delimiter as delimiter3, join as
|
|
421282
|
+
import { readdir as readdir34, rm as rm10, stat as stat51 } from "fs/promises";
|
|
421283
|
+
import { delimiter as delimiter3, join as join154 } from "path";
|
|
420846
421284
|
function getPluginsDirectoryName() {
|
|
420847
421285
|
if (getUseCoworkPlugins()) {
|
|
420848
421286
|
return COWORK_PLUGINS_DIR;
|
|
@@ -420857,7 +421295,7 @@ function getPluginsDirectory() {
|
|
|
420857
421295
|
if (envOverride) {
|
|
420858
421296
|
return expandTilde2(envOverride);
|
|
420859
421297
|
}
|
|
420860
|
-
return
|
|
421298
|
+
return join154(getTheusConfigHomeDir(), getPluginsDirectoryName());
|
|
420861
421299
|
}
|
|
420862
421300
|
function getPluginSeedDirs() {
|
|
420863
421301
|
const raw = process.env.THEUS_CODE_PLUGIN_SEED_DIR;
|
|
@@ -420869,7 +421307,7 @@ function sanitizePluginId(pluginId) {
|
|
|
420869
421307
|
return pluginId.replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
420870
421308
|
}
|
|
420871
421309
|
function pluginDataDirPath(pluginId) {
|
|
420872
|
-
return
|
|
421310
|
+
return join154(getPluginsDirectory(), "data", sanitizePluginId(pluginId));
|
|
420873
421311
|
}
|
|
420874
421312
|
function getPluginDataDir(pluginId) {
|
|
420875
421313
|
const dir = pluginDataDirPath(pluginId);
|
|
@@ -420880,13 +421318,13 @@ async function getPluginDataDirSize(pluginId) {
|
|
|
420880
421318
|
const dir = pluginDataDirPath(pluginId);
|
|
420881
421319
|
let bytes = 0;
|
|
420882
421320
|
const walk = async (p) => {
|
|
420883
|
-
for (const entry of await
|
|
420884
|
-
const full =
|
|
421321
|
+
for (const entry of await readdir34(p, { withFileTypes: true })) {
|
|
421322
|
+
const full = join154(p, entry.name);
|
|
420885
421323
|
if (entry.isDirectory()) {
|
|
420886
421324
|
await walk(full);
|
|
420887
421325
|
} else {
|
|
420888
421326
|
try {
|
|
420889
|
-
bytes += (await
|
|
421327
|
+
bytes += (await stat51(full)).size;
|
|
420890
421328
|
} catch {}
|
|
420891
421329
|
}
|
|
420892
421330
|
}
|
|
@@ -420921,8 +421359,8 @@ var init_pluginDirectories = __esm(() => {
|
|
|
420921
421359
|
});
|
|
420922
421360
|
|
|
420923
421361
|
// utils/plugins/lspPluginIntegration.ts
|
|
420924
|
-
import { readFile as
|
|
420925
|
-
import { join as
|
|
421362
|
+
import { readFile as readFile57 } from "fs/promises";
|
|
421363
|
+
import { join as join155, relative as relative31, resolve as resolve48 } from "path";
|
|
420926
421364
|
function validatePathWithinPlugin(pluginPath, relativePath2) {
|
|
420927
421365
|
const resolvedPluginPath = resolve48(pluginPath);
|
|
420928
421366
|
const resolvedFilePath = resolve48(pluginPath, relativePath2);
|
|
@@ -420934,9 +421372,9 @@ function validatePathWithinPlugin(pluginPath, relativePath2) {
|
|
|
420934
421372
|
}
|
|
420935
421373
|
async function loadPluginLspServers(plugin2, errors4 = []) {
|
|
420936
421374
|
const servers = {};
|
|
420937
|
-
const lspJsonPath =
|
|
421375
|
+
const lspJsonPath = join155(plugin2.path, ".lsp.json");
|
|
420938
421376
|
try {
|
|
420939
|
-
const content = await
|
|
421377
|
+
const content = await readFile57(lspJsonPath, "utf-8");
|
|
420940
421378
|
const parsed = jsonParse(content);
|
|
420941
421379
|
const result = exports_external.record(exports_external.string(), LspServerConfigSchema()).safeParse(parsed);
|
|
420942
421380
|
if (result.success) {
|
|
@@ -420993,7 +421431,7 @@ async function loadLspServersFromManifest(declaration, pluginPath, pluginName, e
|
|
|
420993
421431
|
continue;
|
|
420994
421432
|
}
|
|
420995
421433
|
try {
|
|
420996
|
-
const content = await
|
|
421434
|
+
const content = await readFile57(validatedPath, "utf-8");
|
|
420997
421435
|
const parsed = jsonParse(content);
|
|
420998
421436
|
const result = exports_external.record(exports_external.string(), LspServerConfigSchema()).safeParse(parsed);
|
|
420999
421437
|
if (result.success) {
|
|
@@ -426193,9 +426631,9 @@ __export(exports_upstreamproxy, {
|
|
|
426193
426631
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
426194
426632
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
426195
426633
|
});
|
|
426196
|
-
import { mkdir as mkdir48, readFile as
|
|
426634
|
+
import { mkdir as mkdir48, readFile as readFile58, unlink as unlink24, writeFile as writeFile50 } from "fs/promises";
|
|
426197
426635
|
import { homedir as homedir41 } from "os";
|
|
426198
|
-
import { join as
|
|
426636
|
+
import { join as join156 } from "path";
|
|
426199
426637
|
async function initUpstreamProxy(opts) {
|
|
426200
426638
|
if (!isEnvTruthy(process.env.THEUS_CODE_REMOTE)) {
|
|
426201
426639
|
return state;
|
|
@@ -426216,7 +426654,7 @@ async function initUpstreamProxy(opts) {
|
|
|
426216
426654
|
}
|
|
426217
426655
|
setNonDumpable();
|
|
426218
426656
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.THEUS_BASE_URL ?? "https://api.theus.pe";
|
|
426219
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
426657
|
+
const caBundlePath = opts?.caBundlePath ?? join156(homedir41(), ".ccr", "ca-bundle.crt");
|
|
426220
426658
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
426221
426659
|
if (!caOk)
|
|
426222
426660
|
return state;
|
|
@@ -426274,7 +426712,7 @@ function resetUpstreamProxyForTests() {
|
|
|
426274
426712
|
}
|
|
426275
426713
|
async function readToken(path19) {
|
|
426276
426714
|
try {
|
|
426277
|
-
const raw = await
|
|
426715
|
+
const raw = await readFile58(path19, "utf8");
|
|
426278
426716
|
return raw.trim() || null;
|
|
426279
426717
|
} catch (err2) {
|
|
426280
426718
|
if (isENOENT(err2))
|
|
@@ -426316,8 +426754,8 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
426316
426754
|
return false;
|
|
426317
426755
|
}
|
|
426318
426756
|
const ccrCa = await resp.text();
|
|
426319
|
-
const systemCa = await
|
|
426320
|
-
await mkdir48(
|
|
426757
|
+
const systemCa = await readFile58(systemCaPath, "utf8").catch(() => "");
|
|
426758
|
+
await mkdir48(join156(outPath, ".."), { recursive: true });
|
|
426321
426759
|
await writeFile50(outPath, systemCa + `
|
|
426322
426760
|
` + ccrCa, "utf8");
|
|
426323
426761
|
return true;
|
|
@@ -426746,14 +427184,14 @@ import {
|
|
|
426746
427184
|
appendFile as appendFile7,
|
|
426747
427185
|
chmod as chmod12,
|
|
426748
427186
|
mkdir as mkdir49,
|
|
426749
|
-
readdir as
|
|
427187
|
+
readdir as readdir35,
|
|
426750
427188
|
rmdir as rmdir3,
|
|
426751
|
-
stat as
|
|
427189
|
+
stat as stat52,
|
|
426752
427190
|
unlink as unlink25
|
|
426753
427191
|
} from "fs/promises";
|
|
426754
427192
|
import { createServer as createServer9 } from "net";
|
|
426755
427193
|
import { platform as platform6 } from "os";
|
|
426756
|
-
import { join as
|
|
427194
|
+
import { join as join157 } from "path";
|
|
426757
427195
|
function log(message, ...args) {
|
|
426758
427196
|
if (LOG_FILE) {
|
|
426759
427197
|
const timestamp2 = new Date().toISOString();
|
|
@@ -426800,7 +427238,7 @@ class ChromeNativeHost {
|
|
|
426800
427238
|
if (platform6() !== "win32") {
|
|
426801
427239
|
const socketDir = getSocketDir();
|
|
426802
427240
|
try {
|
|
426803
|
-
const dirStats = await
|
|
427241
|
+
const dirStats = await stat52(socketDir);
|
|
426804
427242
|
if (!dirStats.isDirectory()) {
|
|
426805
427243
|
await unlink25(socketDir);
|
|
426806
427244
|
}
|
|
@@ -426808,7 +427246,7 @@ class ChromeNativeHost {
|
|
|
426808
427246
|
await mkdir49(socketDir, { recursive: true, mode: 448 });
|
|
426809
427247
|
await chmod12(socketDir, 448).catch(() => {});
|
|
426810
427248
|
try {
|
|
426811
|
-
const files2 = await
|
|
427249
|
+
const files2 = await readdir35(socketDir);
|
|
426812
427250
|
for (const file2 of files2) {
|
|
426813
427251
|
if (!file2.endsWith(".sock")) {
|
|
426814
427252
|
continue;
|
|
@@ -426820,7 +427258,7 @@ class ChromeNativeHost {
|
|
|
426820
427258
|
try {
|
|
426821
427259
|
process.kill(pid, 0);
|
|
426822
427260
|
} catch {
|
|
426823
|
-
await unlink25(
|
|
427261
|
+
await unlink25(join157(socketDir, file2)).catch(() => {});
|
|
426824
427262
|
log(`Removed stale socket for PID ${pid}`);
|
|
426825
427263
|
}
|
|
426826
427264
|
}
|
|
@@ -426869,7 +427307,7 @@ class ChromeNativeHost {
|
|
|
426869
427307
|
} catch {}
|
|
426870
427308
|
try {
|
|
426871
427309
|
const socketDir = getSocketDir();
|
|
426872
|
-
const remaining = await
|
|
427310
|
+
const remaining = await readdir35(socketDir);
|
|
426873
427311
|
if (remaining.length === 0) {
|
|
426874
427312
|
await rmdir3(socketDir);
|
|
426875
427313
|
log("Removed empty socket directory");
|
|
@@ -427769,7 +428207,7 @@ async function handleMemories(state2) {
|
|
|
427769
428207
|
async function runProjectContextMcpServer() {
|
|
427770
428208
|
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
427771
428209
|
const state2 = new ProjectContextState(projectRoot);
|
|
427772
|
-
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.
|
|
428210
|
+
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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: {} } });
|
|
427773
428211
|
server2.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
427774
428212
|
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
427775
428213
|
name: t.name,
|
|
@@ -427895,13 +428333,13 @@ var init_server3 = __esm(() => {
|
|
|
427895
428333
|
|
|
427896
428334
|
// services/mcpComputerUse/macos.ts
|
|
427897
428335
|
import { execFile as execFile8 } from "child_process";
|
|
427898
|
-
import { existsSync as
|
|
428336
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync12, readFileSync as readFileSync30, statSync as statSync14, unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "fs";
|
|
427899
428337
|
import { homedir as homedir43, tmpdir as tmpdir13 } from "os";
|
|
427900
|
-
import { join as
|
|
428338
|
+
import { join as join158 } from "path";
|
|
427901
428339
|
import { promisify as promisify6 } from "util";
|
|
427902
428340
|
function cuDir() {
|
|
427903
|
-
const dir =
|
|
427904
|
-
if (!
|
|
428341
|
+
const dir = join158(homedir43(), ".theus", "cu");
|
|
428342
|
+
if (!existsSync26(dir))
|
|
427905
428343
|
mkdirSync12(dir, { recursive: true });
|
|
427906
428344
|
return dir;
|
|
427907
428345
|
}
|
|
@@ -427914,7 +428352,7 @@ function resolveBin(name, extra = []) {
|
|
|
427914
428352
|
`/usr/sbin/${name}`
|
|
427915
428353
|
];
|
|
427916
428354
|
for (const candidate of candidates) {
|
|
427917
|
-
if (
|
|
428355
|
+
if (existsSync26(candidate))
|
|
427918
428356
|
return candidate;
|
|
427919
428357
|
}
|
|
427920
428358
|
return name;
|
|
@@ -427948,9 +428386,9 @@ async function getScreenGeometry(force = false) {
|
|
|
427948
428386
|
return cachedGeometry;
|
|
427949
428387
|
}
|
|
427950
428388
|
async function checkPermissions() {
|
|
427951
|
-
const probe =
|
|
428389
|
+
const probe = join158(tmpdir13(), `theus-cu-probe-${process.pid}.jpg`);
|
|
427952
428390
|
const cap = await run6(SCREENCAPTURE, ["-x", "-t", "jpg", probe], { timeoutMs: 8000 });
|
|
427953
|
-
const screenRecording =
|
|
428391
|
+
const screenRecording = existsSync26(probe) && (() => {
|
|
427954
428392
|
try {
|
|
427955
428393
|
return statSync14(probe).size > 0;
|
|
427956
428394
|
} catch {
|
|
@@ -427958,7 +428396,7 @@ async function checkPermissions() {
|
|
|
427958
428396
|
}
|
|
427959
428397
|
})();
|
|
427960
428398
|
try {
|
|
427961
|
-
if (
|
|
428399
|
+
if (existsSync26(probe))
|
|
427962
428400
|
unlinkSync3(probe);
|
|
427963
428401
|
} catch {}
|
|
427964
428402
|
const cc = await run6(CLICLICK, ["p"], { timeoutMs: 5000 });
|
|
@@ -427977,14 +428415,14 @@ async function checkPermissions() {
|
|
|
427977
428415
|
async function captureScreenshot(opts = {}) {
|
|
427978
428416
|
const maxSide = opts.maxSide ?? 1400;
|
|
427979
428417
|
const quality = Math.min(Math.max(opts.quality ?? 72, 1), 100);
|
|
427980
|
-
const raw =
|
|
427981
|
-
const out =
|
|
428418
|
+
const raw = join158(cuDir(), `shot-${process.pid}.png`);
|
|
428419
|
+
const out = join158(cuDir(), `shot-${process.pid}.jpg`);
|
|
427982
428420
|
const capArgs = ["-x", "-t", "png", "-o"];
|
|
427983
428421
|
if (opts.displayIndex && opts.displayIndex > 0)
|
|
427984
428422
|
capArgs.push("-D", String(opts.displayIndex));
|
|
427985
428423
|
capArgs.push(raw);
|
|
427986
428424
|
const cap = await run6(SCREENCAPTURE, capArgs, { timeoutMs: 12000 });
|
|
427987
|
-
if (!
|
|
428425
|
+
if (!existsSync26(raw) || statSync14(raw).size === 0) {
|
|
427988
428426
|
throw new ComputerUseError("No se pudo capturar la pantalla (" + (cap.stderr.trim() || "screencapture no produjo imagen") + "). Falta el permiso de Grabaci\xF3n de pantalla para el app que corre Theus.");
|
|
427989
428427
|
}
|
|
427990
428428
|
await run6(SIPS, [
|
|
@@ -428000,7 +428438,7 @@ async function captureScreenshot(opts = {}) {
|
|
|
428000
428438
|
"--out",
|
|
428001
428439
|
out
|
|
428002
428440
|
], { timeoutMs: 12000 });
|
|
428003
|
-
if (!
|
|
428441
|
+
if (!existsSync26(out) || statSync14(out).size === 0) {
|
|
428004
428442
|
throw new ComputerUseError("sips no pudo reescalar la captura a JPEG.");
|
|
428005
428443
|
}
|
|
428006
428444
|
const dims = await run6(SIPS, ["-g", "pixelWidth", "-g", "pixelHeight", out]);
|
|
@@ -428141,15 +428579,15 @@ async function ensureScrollHelper() {
|
|
|
428141
428579
|
if (scrollBinPromise)
|
|
428142
428580
|
return scrollBinPromise;
|
|
428143
428581
|
scrollBinPromise = (async () => {
|
|
428144
|
-
if (!
|
|
428145
|
-
const src =
|
|
428146
|
-
const bin =
|
|
428147
|
-
if (
|
|
428582
|
+
if (!existsSync26(SWIFTC) && SWIFTC === "swiftc") {}
|
|
428583
|
+
const src = join158(cuDir(), "scroll.swift");
|
|
428584
|
+
const bin = join158(cuDir(), "theus-cu-scroll");
|
|
428585
|
+
if (existsSync26(bin))
|
|
428148
428586
|
return bin;
|
|
428149
428587
|
try {
|
|
428150
428588
|
writeFileSync10(src, SCROLL_SWIFT, "utf8");
|
|
428151
428589
|
const res = await run6(SWIFTC, ["-O", "-o", bin, src], { timeoutMs: 60000 });
|
|
428152
|
-
if (
|
|
428590
|
+
if (existsSync26(bin))
|
|
428153
428591
|
return bin;
|
|
428154
428592
|
process.stderr.write(`[computer-use] no se pudo compilar el helper de scroll: ${res.stderr}
|
|
428155
428593
|
`);
|
|
@@ -428473,8 +428911,8 @@ var exports_selftest = {};
|
|
|
428473
428911
|
__export(exports_selftest, {
|
|
428474
428912
|
runComputerUseSelfTest: () => runComputerUseSelfTest
|
|
428475
428913
|
});
|
|
428476
|
-
import { existsSync as
|
|
428477
|
-
import { join as
|
|
428914
|
+
import { existsSync as existsSync27, writeFileSync as writeFileSync11 } from "fs";
|
|
428915
|
+
import { join as join159 } from "path";
|
|
428478
428916
|
import { homedir as homedir44 } from "os";
|
|
428479
428917
|
async function runComputerUseSelfTest() {
|
|
428480
428918
|
let pass = 0;
|
|
@@ -428497,7 +428935,7 @@ Theus computer-use \u2014 self-test (macOS)
|
|
|
428497
428935
|
`);
|
|
428498
428936
|
const tools = toolingReport();
|
|
428499
428937
|
for (const [name, path19] of Object.entries(tools)) {
|
|
428500
|
-
if (
|
|
428938
|
+
if (existsSync27(path19))
|
|
428501
428939
|
ok2(`${name}: ${path19}`);
|
|
428502
428940
|
else if (name === "swiftc")
|
|
428503
428941
|
warn(`${name}: no encontrado (scroll quedar\xE1 deshabilitado; el resto funciona)`);
|
|
@@ -428526,7 +428964,7 @@ Geometr\xEDa y captura:`);
|
|
|
428526
428964
|
let captureOk = false;
|
|
428527
428965
|
try {
|
|
428528
428966
|
const shot = await captureScreenshot();
|
|
428529
|
-
const outPath =
|
|
428967
|
+
const outPath = join159(homedir44(), ".theus", "cu", "selftest-shot.jpg");
|
|
428530
428968
|
writeFileSync11(outPath, Buffer.from(shot.base64, "base64"));
|
|
428531
428969
|
ok2(`Captura ${shot.width}\xD7${shot.height} px, ${Math.round(shot.base64.length * 0.75 / 1024)} KB \u2192 ${outPath}`);
|
|
428532
428970
|
captureOk = true;
|
|
@@ -428999,7 +429437,7 @@ var init_client6 = __esm(() => {
|
|
|
428999
429437
|
// services/titanFleet/executor.ts
|
|
429000
429438
|
import { createHash as createHash32 } from "crypto";
|
|
429001
429439
|
import { spawn as spawn11 } from "child_process";
|
|
429002
|
-
import { existsSync as
|
|
429440
|
+
import { existsSync as existsSync28 } from "fs";
|
|
429003
429441
|
import { resolve as resolve51 } from "path";
|
|
429004
429442
|
async function ensureFleetDurableEffect(effect, signal) {
|
|
429005
429443
|
if (effect.hasChanges) {
|
|
@@ -429007,10 +429445,10 @@ async function ensureFleetDurableEffect(effect, signal) {
|
|
|
429007
429445
|
}
|
|
429008
429446
|
}
|
|
429009
429447
|
async function cleanupFleetDurableEffect(effect) {
|
|
429010
|
-
if (!
|
|
429448
|
+
if (!existsSync28(effect.worktreePath))
|
|
429011
429449
|
return;
|
|
429012
429450
|
const removed = await removeAgentWorktree(effect.worktreePath, effect.worktreeBranch, effect.gitRoot, effect.hookBased);
|
|
429013
|
-
if (!removed &&
|
|
429451
|
+
if (!removed && existsSync28(effect.worktreePath)) {
|
|
429014
429452
|
throw new Error("Fleet no pudo limpiar el worktree durable; el outbox se conserva");
|
|
429015
429453
|
}
|
|
429016
429454
|
}
|
|
@@ -429173,7 +429611,7 @@ function installedCliPath() {
|
|
|
429173
429611
|
resolve51(import.meta.dir, "..", "..", "bin", "theus"),
|
|
429174
429612
|
resolve51(import.meta.dir, "bin", "theus")
|
|
429175
429613
|
];
|
|
429176
|
-
const found = candidates.find((candidate) =>
|
|
429614
|
+
const found = candidates.find((candidate) => existsSync28(candidate));
|
|
429177
429615
|
if (!found) {
|
|
429178
429616
|
throw new Error("No se encontr\xF3 el launcher bin/theus para el worker Fleet");
|
|
429179
429617
|
}
|
|
@@ -429378,32 +429816,32 @@ import {
|
|
|
429378
429816
|
chmod as chmod13,
|
|
429379
429817
|
lstat as lstat7,
|
|
429380
429818
|
mkdir as mkdir50,
|
|
429381
|
-
open as
|
|
429382
|
-
readFile as
|
|
429819
|
+
open as open22,
|
|
429820
|
+
readFile as readFile59,
|
|
429383
429821
|
rename as rename10,
|
|
429384
429822
|
unlink as unlink26
|
|
429385
429823
|
} from "fs/promises";
|
|
429386
429824
|
import { homedir as homedir45 } from "os";
|
|
429387
|
-
import { dirname as
|
|
429825
|
+
import { dirname as dirname65, resolve as resolve52 } from "path";
|
|
429388
429826
|
function defaultFleetCredentialsPath() {
|
|
429389
429827
|
return resolve52(homedir45(), ".theus", "titan", "fleet-worker.json");
|
|
429390
429828
|
}
|
|
429391
429829
|
async function rejectSymlink(path19) {
|
|
429392
|
-
const
|
|
429830
|
+
const stat53 = await lstat7(path19).catch((error40) => {
|
|
429393
429831
|
if (error40.code === "ENOENT")
|
|
429394
429832
|
return;
|
|
429395
429833
|
throw error40;
|
|
429396
429834
|
});
|
|
429397
|
-
if (
|
|
429835
|
+
if (stat53?.isSymbolicLink()) {
|
|
429398
429836
|
throw new Error("Se rechaz\xF3 un symlink como almac\xE9n de credenciales Fleet");
|
|
429399
429837
|
}
|
|
429400
|
-
if (
|
|
429838
|
+
if (stat53 && !stat53.isFile()) {
|
|
429401
429839
|
throw new Error("El almac\xE9n de credenciales Fleet no es un archivo regular");
|
|
429402
429840
|
}
|
|
429403
429841
|
}
|
|
429404
429842
|
async function loadFleetCredentials(path19 = defaultFleetCredentialsPath()) {
|
|
429405
429843
|
await rejectSymlink(path19);
|
|
429406
|
-
const raw = await
|
|
429844
|
+
const raw = await readFile59(path19, "utf8").catch((error40) => {
|
|
429407
429845
|
if (error40.code === "ENOENT")
|
|
429408
429846
|
return;
|
|
429409
429847
|
throw error40;
|
|
@@ -429414,7 +429852,7 @@ async function loadFleetCredentials(path19 = defaultFleetCredentialsPath()) {
|
|
|
429414
429852
|
}
|
|
429415
429853
|
async function saveFleetCredentials(value, path19 = defaultFleetCredentialsPath()) {
|
|
429416
429854
|
const parsed = storedCredentialsSchema.parse(value);
|
|
429417
|
-
const directory =
|
|
429855
|
+
const directory = dirname65(path19);
|
|
429418
429856
|
const existingDirectory = await lstat7(directory).catch((error40) => {
|
|
429419
429857
|
if (error40.code === "ENOENT")
|
|
429420
429858
|
return;
|
|
@@ -429429,7 +429867,7 @@ async function saveFleetCredentials(value, path19 = defaultFleetCredentialsPath(
|
|
|
429429
429867
|
await rejectSymlink(path19);
|
|
429430
429868
|
const temp = `${path19}.tmp-${process.pid}-${randomUUID38()}`;
|
|
429431
429869
|
const flags = constants5.O_WRONLY | constants5.O_CREAT | constants5.O_EXCL | (constants5.O_NOFOLLOW ?? 0);
|
|
429432
|
-
const handle2 = await
|
|
429870
|
+
const handle2 = await open22(temp, flags, 384);
|
|
429433
429871
|
try {
|
|
429434
429872
|
await handle2.writeFile(`${JSON.stringify(parsed, null, 2)}
|
|
429435
429873
|
`, "utf8");
|
|
@@ -429466,14 +429904,14 @@ import {
|
|
|
429466
429904
|
chmod as chmod14,
|
|
429467
429905
|
lstat as lstat8,
|
|
429468
429906
|
mkdir as mkdir51,
|
|
429469
|
-
open as
|
|
429470
|
-
readFile as
|
|
429907
|
+
open as open23,
|
|
429908
|
+
readFile as readFile60,
|
|
429471
429909
|
rename as rename11,
|
|
429472
|
-
stat as
|
|
429910
|
+
stat as stat53,
|
|
429473
429911
|
unlink as unlink27
|
|
429474
429912
|
} from "fs/promises";
|
|
429475
429913
|
import { homedir as homedir46 } from "os";
|
|
429476
|
-
import { dirname as
|
|
429914
|
+
import { dirname as dirname66, resolve as resolve53 } from "path";
|
|
429477
429915
|
function defaultFleetOutboxPath() {
|
|
429478
429916
|
return resolve53(homedir46(), ".theus", "titan", "fleet-terminal-outbox.json");
|
|
429479
429917
|
}
|
|
@@ -429539,7 +429977,7 @@ async function rejectSymlink2(path19) {
|
|
|
429539
429977
|
}
|
|
429540
429978
|
async function readRecords(path19) {
|
|
429541
429979
|
await rejectSymlink2(path19);
|
|
429542
|
-
const info = await
|
|
429980
|
+
const info = await stat53(path19).catch((error40) => {
|
|
429543
429981
|
if (error40.code === "ENOENT")
|
|
429544
429982
|
return;
|
|
429545
429983
|
throw error40;
|
|
@@ -429556,7 +429994,7 @@ async function readRecords(path19) {
|
|
|
429556
429994
|
throw new FleetOutboxCorruptError("El outbox Fleet excede el l\xEDmite de bytes");
|
|
429557
429995
|
}
|
|
429558
429996
|
try {
|
|
429559
|
-
const parsed = outboxFileSchema.parse(JSON.parse(await
|
|
429997
|
+
const parsed = outboxFileSchema.parse(JSON.parse(await readFile60(path19, "utf8")));
|
|
429560
429998
|
const ids = new Set;
|
|
429561
429999
|
return parsed.records.map((record3) => {
|
|
429562
430000
|
const checked = validateRecord(record3);
|
|
@@ -429582,7 +430020,7 @@ async function writeRecords(path19, records) {
|
|
|
429582
430020
|
if (Buffer.byteLength(serialized) > MAX_FILE_BYTES) {
|
|
429583
430021
|
throw new FleetOutboxCorruptError("El outbox Fleet alcanz\xF3 su l\xEDmite de bytes");
|
|
429584
430022
|
}
|
|
429585
|
-
const directory =
|
|
430023
|
+
const directory = dirname66(path19);
|
|
429586
430024
|
const directoryEntry = await lstat8(directory).catch((error40) => {
|
|
429587
430025
|
if (error40.code === "ENOENT")
|
|
429588
430026
|
return;
|
|
@@ -429596,7 +430034,7 @@ async function writeRecords(path19, records) {
|
|
|
429596
430034
|
await chmod14(directory, 448);
|
|
429597
430035
|
await rejectSymlink2(path19);
|
|
429598
430036
|
const temp = `${path19}.tmp-${process.pid}-${randomUUID39()}`;
|
|
429599
|
-
const handle2 = await
|
|
430037
|
+
const handle2 = await open23(temp, constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | (constants6.O_NOFOLLOW ?? 0), 384);
|
|
429600
430038
|
try {
|
|
429601
430039
|
await handle2.writeFile(serialized, "utf8");
|
|
429602
430040
|
await handle2.sync();
|
|
@@ -429607,7 +430045,7 @@ async function writeRecords(path19, records) {
|
|
|
429607
430045
|
await chmod14(temp, 384);
|
|
429608
430046
|
await rename11(temp, path19);
|
|
429609
430047
|
await chmod14(path19, 384);
|
|
429610
|
-
const directoryHandle = await
|
|
430048
|
+
const directoryHandle = await open23(directory, constants6.O_RDONLY);
|
|
429611
430049
|
try {
|
|
429612
430050
|
await directoryHandle.sync();
|
|
429613
430051
|
} finally {
|
|
@@ -430446,7 +430884,7 @@ async function runTitanFleetWorker(args) {
|
|
|
430446
430884
|
max_concurrency: maxConcurrency,
|
|
430447
430885
|
runtime: {
|
|
430448
430886
|
name: "theus-cli",
|
|
430449
|
-
version: { VERSION: "0.2.
|
|
430887
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
430450
430888
|
}
|
|
430451
430889
|
});
|
|
430452
430890
|
const client2 = new TitanFleetClient({
|
|
@@ -430974,7 +431412,7 @@ __export(exports_titan_fleet_run, {
|
|
|
430974
431412
|
parseFleetPlanFile: () => parseFleetPlanFile,
|
|
430975
431413
|
describeFleetRunError: () => describeFleetRunError
|
|
430976
431414
|
});
|
|
430977
|
-
import { readFile as
|
|
431415
|
+
import { readFile as readFile61 } from "fs/promises";
|
|
430978
431416
|
import { resolve as resolve55 } from "path";
|
|
430979
431417
|
function valuesAfter(args, name) {
|
|
430980
431418
|
const found = [];
|
|
@@ -431085,7 +431523,7 @@ async function runTitanFleetRun(args) {
|
|
|
431085
431523
|
process.stdout.write(HELP3);
|
|
431086
431524
|
return;
|
|
431087
431525
|
}
|
|
431088
|
-
const build = options2.planPath ? parseFleetPlanFile(await
|
|
431526
|
+
const build = options2.planPath ? parseFleetPlanFile(await readFile61(resolve55(options2.planPath), "utf8")) : options2.build;
|
|
431089
431527
|
if (!build) {
|
|
431090
431528
|
throw new FleetProducerError("No hay nada que encolar");
|
|
431091
431529
|
}
|
|
@@ -431167,15 +431605,15 @@ var init_titan_fleet_run = __esm(() => {
|
|
|
431167
431605
|
});
|
|
431168
431606
|
|
|
431169
431607
|
// utils/cronTasksLock.ts
|
|
431170
|
-
import { mkdir as mkdir52, readFile as
|
|
431171
|
-
import { dirname as
|
|
431608
|
+
import { mkdir as mkdir52, readFile as readFile62, unlink as unlink28, writeFile as writeFile51 } from "fs/promises";
|
|
431609
|
+
import { dirname as dirname67, join as join160 } from "path";
|
|
431172
431610
|
function getLockPath(dir) {
|
|
431173
|
-
return
|
|
431611
|
+
return join160(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
431174
431612
|
}
|
|
431175
431613
|
async function readLock(dir) {
|
|
431176
431614
|
let raw;
|
|
431177
431615
|
try {
|
|
431178
|
-
raw = await
|
|
431616
|
+
raw = await readFile62(getLockPath(dir), "utf8");
|
|
431179
431617
|
} catch {
|
|
431180
431618
|
return;
|
|
431181
431619
|
}
|
|
@@ -431193,7 +431631,7 @@ async function tryCreateExclusive(lock2, dir) {
|
|
|
431193
431631
|
if (code === "EEXIST")
|
|
431194
431632
|
return false;
|
|
431195
431633
|
if (code === "ENOENT") {
|
|
431196
|
-
await mkdir52(
|
|
431634
|
+
await mkdir52(dirname67(path19), { recursive: true });
|
|
431197
431635
|
try {
|
|
431198
431636
|
await writeFile51(path19, body, { flag: "wx" });
|
|
431199
431637
|
return true;
|
|
@@ -431276,7 +431714,7 @@ var init_cronTasksLock = __esm(() => {
|
|
|
431276
431714
|
init_genericProcessUtils();
|
|
431277
431715
|
init_json();
|
|
431278
431716
|
init_slowOperations();
|
|
431279
|
-
LOCK_FILE_REL =
|
|
431717
|
+
LOCK_FILE_REL = join160(".theus", "scheduled_tasks.lock");
|
|
431280
431718
|
schedulerLockSchema = lazySchema(() => exports_external.object({
|
|
431281
431719
|
sessionId: exports_external.string(),
|
|
431282
431720
|
pid: exports_external.number(),
|
|
@@ -431584,10 +432022,10 @@ import {
|
|
|
431584
432022
|
writeFileSync as writeFileSync12
|
|
431585
432023
|
} from "fs";
|
|
431586
432024
|
import { homedir as homedir47 } from "os";
|
|
431587
|
-
import { dirname as
|
|
432025
|
+
import { dirname as dirname68, join as join161 } from "path";
|
|
431588
432026
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
431589
432027
|
function projectsConfigPath() {
|
|
431590
|
-
return
|
|
432028
|
+
return join161(homedir47(), ".theus", "daemon", "projects.json");
|
|
431591
432029
|
}
|
|
431592
432030
|
function readEnabledProjects() {
|
|
431593
432031
|
let raw;
|
|
@@ -431606,17 +432044,17 @@ function readEnabledProjects() {
|
|
|
431606
432044
|
return list3.filter((p) => p && typeof p.dir === "string" && p.enabled !== false);
|
|
431607
432045
|
}
|
|
431608
432046
|
function daemonDir2() {
|
|
431609
|
-
return
|
|
432047
|
+
return join161(homedir47(), ".theus", "daemon");
|
|
431610
432048
|
}
|
|
431611
432049
|
function daemonLogPath() {
|
|
431612
|
-
return
|
|
432050
|
+
return join161(daemonDir2(), "daemon.log");
|
|
431613
432051
|
}
|
|
431614
432052
|
function resolveWorkerBin() {
|
|
431615
432053
|
const override = process.env.THEUS_DAEMON_WORKER_BIN;
|
|
431616
432054
|
if (typeof override === "string" && override.length > 0)
|
|
431617
432055
|
return override;
|
|
431618
|
-
const here =
|
|
431619
|
-
return
|
|
432056
|
+
const here = dirname68(fileURLToPath7(import.meta.url));
|
|
432057
|
+
return join161(here, "..", "bin", "theus");
|
|
431620
432058
|
}
|
|
431621
432059
|
function turnTimeoutMs() {
|
|
431622
432060
|
const raw = process.env.THEUS_DAEMON_TURN_TIMEOUT_MS;
|
|
@@ -431649,10 +432087,10 @@ function logDaemonLine(line) {
|
|
|
431649
432087
|
}
|
|
431650
432088
|
function writeRunHistory(record3) {
|
|
431651
432089
|
try {
|
|
431652
|
-
const dir =
|
|
432090
|
+
const dir = join161(daemonDir2(), "runs", record3.taskId);
|
|
431653
432091
|
mkdirSync13(dir, { recursive: true });
|
|
431654
432092
|
const stamp2 = record3.startedAt.replace(/:/g, "-");
|
|
431655
|
-
writeFileSync12(
|
|
432093
|
+
writeFileSync12(join161(dir, `${stamp2}.json`), JSON.stringify(record3, null, 2), "utf8");
|
|
431656
432094
|
pruneRunHistory(record3.taskId);
|
|
431657
432095
|
} catch (e) {
|
|
431658
432096
|
logDaemonLine(`[daemon:cron] ERROR guardando historial task=${record3.taskId}: ${e?.message}`);
|
|
@@ -431663,13 +432101,13 @@ function pruneRunHistory(taskId) {
|
|
|
431663
432101
|
const raw = process.env.THEUS_DAEMON_RUNS_KEEP;
|
|
431664
432102
|
const parsed = raw ? Number.parseInt(raw, 10) : NaN;
|
|
431665
432103
|
const keep = Number.isInteger(parsed) && parsed > 0 ? parsed : 50;
|
|
431666
|
-
const dir =
|
|
432104
|
+
const dir = join161(daemonDir2(), "runs", taskId);
|
|
431667
432105
|
const files2 = readdirSync5(dir).filter((f) => f.endsWith(".json")).sort();
|
|
431668
432106
|
if (files2.length <= keep)
|
|
431669
432107
|
return;
|
|
431670
432108
|
for (const f of files2.slice(0, files2.length - keep)) {
|
|
431671
432109
|
try {
|
|
431672
|
-
unlinkSync4(
|
|
432110
|
+
unlinkSync4(join161(dir, f));
|
|
431673
432111
|
} catch {}
|
|
431674
432112
|
}
|
|
431675
432113
|
} catch {}
|
|
@@ -431852,22 +432290,22 @@ __export(exports_main, {
|
|
|
431852
432290
|
daemonMain: () => daemonMain
|
|
431853
432291
|
});
|
|
431854
432292
|
import {
|
|
431855
|
-
existsSync as
|
|
432293
|
+
existsSync as existsSync29,
|
|
431856
432294
|
mkdirSync as mkdirSync14,
|
|
431857
432295
|
readFileSync as readFileSync32,
|
|
431858
432296
|
rmSync as rmSync6,
|
|
431859
432297
|
writeFileSync as writeFileSync13
|
|
431860
432298
|
} from "fs";
|
|
431861
432299
|
import { homedir as homedir48 } from "os";
|
|
431862
|
-
import { dirname as
|
|
432300
|
+
import { dirname as dirname69, join as join162 } from "path";
|
|
431863
432301
|
function daemonDir3() {
|
|
431864
|
-
return
|
|
432302
|
+
return join162(homedir48(), ".theus", "daemon");
|
|
431865
432303
|
}
|
|
431866
432304
|
function pidFilePath() {
|
|
431867
|
-
return
|
|
432305
|
+
return join162(daemonDir3(), "theus-daemon.pid");
|
|
431868
432306
|
}
|
|
431869
432307
|
function logFilePath() {
|
|
431870
|
-
return
|
|
432308
|
+
return join162(daemonDir3(), "daemon.log");
|
|
431871
432309
|
}
|
|
431872
432310
|
function ensureDaemonDir() {
|
|
431873
432311
|
mkdirSync14(daemonDir3(), { recursive: true });
|
|
@@ -431941,7 +432379,7 @@ function doStatus() {
|
|
|
431941
432379
|
}
|
|
431942
432380
|
function doLogs() {
|
|
431943
432381
|
const path19 = logFilePath();
|
|
431944
|
-
if (!
|
|
432382
|
+
if (!existsSync29(path19)) {
|
|
431945
432383
|
console.log(`Sin registro de daemon todav\xEDa (${path19}).`);
|
|
431946
432384
|
return;
|
|
431947
432385
|
}
|
|
@@ -431965,7 +432403,7 @@ function resolveTheusBin() {
|
|
|
431965
432403
|
return "theus";
|
|
431966
432404
|
}
|
|
431967
432405
|
function macosServiceSpec() {
|
|
431968
|
-
const path19 =
|
|
432406
|
+
const path19 = join162(homedir48(), "Library", "LaunchAgents", "pe.theus.daemon.plist");
|
|
431969
432407
|
const bin = resolveTheusBin();
|
|
431970
432408
|
const logDir = daemonDir3();
|
|
431971
432409
|
const content = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -431992,9 +432430,9 @@ function macosServiceSpec() {
|
|
|
431992
432430
|
<key>KeepAlive</key>
|
|
431993
432431
|
<true/>
|
|
431994
432432
|
<key>StandardOutPath</key>
|
|
431995
|
-
<string>${
|
|
432433
|
+
<string>${join162(logDir, "launchd.out.log")}</string>
|
|
431996
432434
|
<key>StandardErrorPath</key>
|
|
431997
|
-
<string>${
|
|
432435
|
+
<string>${join162(logDir, "launchd.err.log")}</string>
|
|
431998
432436
|
</dict>
|
|
431999
432437
|
</plist>
|
|
432000
432438
|
`;
|
|
@@ -432009,7 +432447,7 @@ function macosServiceSpec() {
|
|
|
432009
432447
|
};
|
|
432010
432448
|
}
|
|
432011
432449
|
function linuxServiceSpec() {
|
|
432012
|
-
const path19 =
|
|
432450
|
+
const path19 = join162(homedir48(), ".config", "systemd", "user", "theus-daemon.service");
|
|
432013
432451
|
const bin = resolveTheusBin();
|
|
432014
432452
|
const content = `[Unit]
|
|
432015
432453
|
Description=Theus daemon (cron/agent supervisor)
|
|
@@ -432071,7 +432509,7 @@ Pasos posteriores:
|
|
|
432071
432509
|
return;
|
|
432072
432510
|
}
|
|
432073
432511
|
try {
|
|
432074
|
-
mkdirSync14(
|
|
432512
|
+
mkdirSync14(dirname69(spec.path), { recursive: true });
|
|
432075
432513
|
writeFileSync13(spec.path, spec.content, "utf8");
|
|
432076
432514
|
console.log(`Archivo de servicio escrito en: ${spec.path}`);
|
|
432077
432515
|
if (spec.notes.length > 0) {
|
|
@@ -432093,11 +432531,11 @@ function doUninstall(args) {
|
|
|
432093
432531
|
if (!hasConfirm(args)) {
|
|
432094
432532
|
console.log(`[dry-run] Desinstalaci\xF3n del daemon de Theus (${spec.platform}).
|
|
432095
432533
|
` + `Se eliminar\xEDa: ${spec.path}
|
|
432096
|
-
` + (
|
|
432534
|
+
` + (existsSync29(spec.path) ? "El archivo existe y ser\xEDa borrado." : "El archivo no existe actualmente (nada que borrar).") + `
|
|
432097
432535
|
Vuelve a ejecutar con --confirm para eliminarlo.`);
|
|
432098
432536
|
return;
|
|
432099
432537
|
}
|
|
432100
|
-
if (!
|
|
432538
|
+
if (!existsSync29(spec.path)) {
|
|
432101
432539
|
console.log(`No hay archivo de servicio que eliminar en: ${spec.path}`);
|
|
432102
432540
|
return;
|
|
432103
432541
|
}
|
|
@@ -432337,7 +432775,7 @@ function createBridgeLogger(options2) {
|
|
|
432337
432775
|
connectUrl = buildBridgeConnectUrl(environmentId, cachedIngressUrl);
|
|
432338
432776
|
regenerateQr(connectUrl);
|
|
432339
432777
|
if (verbose) {
|
|
432340
|
-
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.
|
|
432778
|
+
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
432341
432779
|
`);
|
|
432342
432780
|
}
|
|
432343
432781
|
if (verbose) {
|
|
@@ -432745,7 +433183,7 @@ var init_pollConfig = __esm(() => {
|
|
|
432745
433183
|
import { spawn as spawn13 } from "child_process";
|
|
432746
433184
|
import { createWriteStream as createWriteStream4 } from "fs";
|
|
432747
433185
|
import { tmpdir as tmpdir14 } from "os";
|
|
432748
|
-
import { dirname as
|
|
433186
|
+
import { dirname as dirname70, join as join163 } from "path";
|
|
432749
433187
|
import { createInterface } from "readline";
|
|
432750
433188
|
function safeFilenameId(id2) {
|
|
432751
433189
|
return id2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -432878,12 +433316,12 @@ function createSessionSpawner(deps) {
|
|
|
432878
433316
|
debugFile = `${deps.debugFile}-${safeId}`;
|
|
432879
433317
|
}
|
|
432880
433318
|
} else if (deps.verbose || false) {
|
|
432881
|
-
debugFile =
|
|
433319
|
+
debugFile = join163(tmpdir14(), "theus", `bridge-session-${safeId}.log`);
|
|
432882
433320
|
}
|
|
432883
433321
|
let transcriptStream = null;
|
|
432884
433322
|
let transcriptPath;
|
|
432885
433323
|
if (deps.debugFile) {
|
|
432886
|
-
transcriptPath =
|
|
433324
|
+
transcriptPath = join163(dirname70(deps.debugFile), `bridge-transcript-${safeId}.jsonl`);
|
|
432887
433325
|
transcriptStream = createWriteStream4(transcriptPath, { flags: "a" });
|
|
432888
433326
|
transcriptStream.on("error", (err2) => {
|
|
432889
433327
|
deps.onDebug(`[bridge:session] Transcript write error: ${err2.message}`);
|
|
@@ -433156,15 +433594,15 @@ __export(exports_bridgePointer, {
|
|
|
433156
433594
|
clearBridgePointer: () => clearBridgePointer,
|
|
433157
433595
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
433158
433596
|
});
|
|
433159
|
-
import { mkdir as mkdir53, readFile as
|
|
433160
|
-
import { dirname as
|
|
433597
|
+
import { mkdir as mkdir53, readFile as readFile63, stat as stat54, unlink as unlink29, writeFile as writeFile52 } from "fs/promises";
|
|
433598
|
+
import { dirname as dirname71, join as join164 } from "path";
|
|
433161
433599
|
function getBridgePointerPath(dir) {
|
|
433162
|
-
return
|
|
433600
|
+
return join164(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
433163
433601
|
}
|
|
433164
433602
|
async function writeBridgePointer(dir, pointer) {
|
|
433165
433603
|
const path19 = getBridgePointerPath(dir);
|
|
433166
433604
|
try {
|
|
433167
|
-
await mkdir53(
|
|
433605
|
+
await mkdir53(dirname71(path19), { recursive: true });
|
|
433168
433606
|
await writeFile52(path19, jsonStringify(pointer), "utf8");
|
|
433169
433607
|
logForDebugging(`[bridge:pointer] wrote ${path19}`);
|
|
433170
433608
|
} catch (err2) {
|
|
@@ -433176,8 +433614,8 @@ async function readBridgePointer(dir) {
|
|
|
433176
433614
|
let raw;
|
|
433177
433615
|
let mtimeMs;
|
|
433178
433616
|
try {
|
|
433179
|
-
mtimeMs = (await
|
|
433180
|
-
raw = await
|
|
433617
|
+
mtimeMs = (await stat54(path19)).mtimeMs;
|
|
433618
|
+
raw = await readFile63(path19, "utf8");
|
|
433181
433619
|
} catch {
|
|
433182
433620
|
return null;
|
|
433183
433621
|
}
|
|
@@ -433261,12 +433699,12 @@ var init_bridgePointer = __esm(() => {
|
|
|
433261
433699
|
});
|
|
433262
433700
|
|
|
433263
433701
|
// utils/errorLogSink.ts
|
|
433264
|
-
import { dirname as
|
|
433702
|
+
import { dirname as dirname72, join as join165 } from "path";
|
|
433265
433703
|
function getErrorsPath() {
|
|
433266
|
-
return
|
|
433704
|
+
return join165(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
433267
433705
|
}
|
|
433268
433706
|
function getMCPLogsPath(serverName) {
|
|
433269
|
-
return
|
|
433707
|
+
return join165(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
433270
433708
|
}
|
|
433271
433709
|
function createJsonlWriter(options2) {
|
|
433272
433710
|
const writer = createBufferedWriter(options2);
|
|
@@ -433282,7 +433720,7 @@ function createJsonlWriter(options2) {
|
|
|
433282
433720
|
function getLogWriter(path19) {
|
|
433283
433721
|
let writer = logWriters.get(path19);
|
|
433284
433722
|
if (!writer) {
|
|
433285
|
-
const dir =
|
|
433723
|
+
const dir = dirname72(path19);
|
|
433286
433724
|
writer = createJsonlWriter({
|
|
433287
433725
|
writeFn: (content) => {
|
|
433288
433726
|
try {
|
|
@@ -433310,7 +433748,7 @@ function appendToLog(path19, message) {
|
|
|
433310
433748
|
cwd: getFsImplementation().cwd(),
|
|
433311
433749
|
userType: "external",
|
|
433312
433750
|
sessionId: getSessionId(),
|
|
433313
|
-
version: { VERSION: "0.2.
|
|
433751
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
433314
433752
|
};
|
|
433315
433753
|
getLogWriter(path19).write(messageWithTimestamp);
|
|
433316
433754
|
}
|
|
@@ -433422,7 +433860,7 @@ __export(exports_bridgeMain, {
|
|
|
433422
433860
|
});
|
|
433423
433861
|
import { randomUUID as randomUUID42 } from "crypto";
|
|
433424
433862
|
import { hostname as hostname4, tmpdir as tmpdir15 } from "os";
|
|
433425
|
-
import { basename as basename51, join as
|
|
433863
|
+
import { basename as basename51, join as join166, resolve as resolve56 } from "path";
|
|
433426
433864
|
async function isMultiSessionSpawnEnabled() {
|
|
433427
433865
|
return checkGate_CACHED_OR_BLOCKING("theus_ccr_bridge_multi_session");
|
|
433428
433866
|
}
|
|
@@ -433935,7 +434373,7 @@ async function runBridgeLoop(config3, environmentId, environmentSecret, api2, sp
|
|
|
433935
434373
|
sessionDebugFile = `${config3.debugFile}-${safeId}`;
|
|
433936
434374
|
}
|
|
433937
434375
|
} else if (config3.verbose || false) {
|
|
433938
|
-
sessionDebugFile =
|
|
434376
|
+
sessionDebugFile = join166(tmpdir15(), "theus", `bridge-session-${safeId}.log`);
|
|
433939
434377
|
}
|
|
433940
434378
|
if (sessionDebugFile) {
|
|
433941
434379
|
logger.logVerbose(`Debug log: ${sessionDebugFile}`);
|
|
@@ -434571,7 +435009,7 @@ Spawn mode for this project:
|
|
|
434571
435009
|
const api2 = createBridgeApiClient({
|
|
434572
435010
|
baseUrl,
|
|
434573
435011
|
getAccessToken: getBridgeAccessToken2,
|
|
434574
|
-
runnerVersion: { VERSION: "0.2.
|
|
435012
|
+
runnerVersion: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
434575
435013
|
onDebug: logForDebugging,
|
|
434576
435014
|
onAuth401: handleOAuth401Error2,
|
|
434577
435015
|
getTrustedDeviceToken
|
|
@@ -434809,7 +435247,7 @@ async function runBridgeHeadless(opts, signal) {
|
|
|
434809
435247
|
const api2 = createBridgeApiClient({
|
|
434810
435248
|
baseUrl,
|
|
434811
435249
|
getAccessToken: opts.getAccessToken,
|
|
434812
|
-
runnerVersion: { VERSION: "0.2.
|
|
435250
|
+
runnerVersion: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
434813
435251
|
onDebug: log2,
|
|
434814
435252
|
onAuth401: opts.onAuth401,
|
|
434815
435253
|
getTrustedDeviceToken
|
|
@@ -437906,7 +438344,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
437906
438344
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
437907
438345
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
437908
438346
|
betas: getSdkBetas(),
|
|
437909
|
-
theus_code_version: { VERSION: "0.2.
|
|
438347
|
+
theus_code_version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
437910
438348
|
output_style: outputStyle2,
|
|
437911
438349
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
437912
438350
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -437946,8 +438384,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
437946
438384
|
}
|
|
437947
438385
|
async function checkEnvLessBridgeMinVersion() {
|
|
437948
438386
|
const cfg = await getEnvLessBridgeConfig();
|
|
437949
|
-
if (cfg.min_version && lt({ VERSION: "0.2.
|
|
437950
|
-
return `Your version of Theus (${{ VERSION: "0.2.
|
|
438387
|
+
if (cfg.min_version && lt({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
438388
|
+
return `Your version of Theus (${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
437951
438389
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
437952
438390
|
}
|
|
437953
438391
|
return null;
|
|
@@ -440271,7 +440709,7 @@ async function initBridgeCore(params) {
|
|
|
440271
440709
|
const rawApi = createBridgeApiClient({
|
|
440272
440710
|
baseUrl,
|
|
440273
440711
|
getAccessToken,
|
|
440274
|
-
runnerVersion: { VERSION: "0.2.
|
|
440712
|
+
runnerVersion: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
440275
440713
|
onDebug: logForDebugging,
|
|
440276
440714
|
onAuth401,
|
|
440277
440715
|
getTrustedDeviceToken
|
|
@@ -442105,7 +442543,7 @@ __export(exports_inboundAttachments, {
|
|
|
442105
442543
|
});
|
|
442106
442544
|
import { randomUUID as randomUUID47 } from "crypto";
|
|
442107
442545
|
import { mkdir as mkdir54, writeFile as writeFile53 } from "fs/promises";
|
|
442108
|
-
import { basename as basename52, join as
|
|
442546
|
+
import { basename as basename52, join as join167 } from "path";
|
|
442109
442547
|
function debug2(msg) {
|
|
442110
442548
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
442111
442549
|
}
|
|
@@ -442121,7 +442559,7 @@ function sanitizeFileName(name) {
|
|
|
442121
442559
|
return base2 || "attachment";
|
|
442122
442560
|
}
|
|
442123
442561
|
function uploadsDir() {
|
|
442124
|
-
return
|
|
442562
|
+
return join167(getTheusConfigHomeDir(), "uploads", getSessionId());
|
|
442125
442563
|
}
|
|
442126
442564
|
async function resolveOne(att) {
|
|
442127
442565
|
const token = getBridgeAccessToken();
|
|
@@ -442150,7 +442588,7 @@ async function resolveOne(att) {
|
|
|
442150
442588
|
const safeName = sanitizeFileName(att.file_name);
|
|
442151
442589
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID47().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
442152
442590
|
const dir = uploadsDir();
|
|
442153
|
-
const outPath =
|
|
442591
|
+
const outPath = join167(dir, `${prefix}-${safeName}`);
|
|
442154
442592
|
try {
|
|
442155
442593
|
await mkdir54(dir, { recursive: true });
|
|
442156
442594
|
await writeFile53(outPath, data);
|
|
@@ -449010,7 +449448,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
449010
449448
|
|
|
449011
449449
|
// components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
449012
449450
|
import { homedir as homedir49 } from "os";
|
|
449013
|
-
import { basename as basename56, join as
|
|
449451
|
+
import { basename as basename56, join as join168, sep as sep34 } from "path";
|
|
449014
449452
|
function isInTheusFolder(filePath) {
|
|
449015
449453
|
const absolutePath = expandPath(filePath);
|
|
449016
449454
|
const theusFolderPath = expandPath(`${getOriginalCwd()}/.theus`);
|
|
@@ -449020,7 +449458,7 @@ function isInTheusFolder(filePath) {
|
|
|
449020
449458
|
}
|
|
449021
449459
|
function isInGlobalTheusFolder(filePath) {
|
|
449022
449460
|
const absolutePath = expandPath(filePath);
|
|
449023
|
-
const globalTheusFolderPath =
|
|
449461
|
+
const globalTheusFolderPath = join168(homedir49(), ".theus");
|
|
449024
449462
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
449025
449463
|
const normalizedGlobalTheusFolderPath = normalizeCaseForComparison(globalTheusFolderPath);
|
|
449026
449464
|
return normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + sep34.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + "/");
|
|
@@ -456912,7 +457350,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
456912
457350
|
function getSemverPart(version3) {
|
|
456913
457351
|
return `${import_semver11.major(version3, { loose: true })}.${import_semver11.minor(version3, { loose: true })}.${import_semver11.patch(version3, { loose: true })}`;
|
|
456914
457352
|
}
|
|
456915
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.
|
|
457353
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
456916
457354
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react235.useState(() => getSemverPart(initialVersion));
|
|
456917
457355
|
if (!updatedVersion) {
|
|
456918
457356
|
return null;
|
|
@@ -456952,7 +457390,7 @@ function AutoUpdater({
|
|
|
456952
457390
|
return;
|
|
456953
457391
|
}
|
|
456954
457392
|
if (false) {}
|
|
456955
|
-
const currentVersion = { VERSION: "0.2.
|
|
457393
|
+
const currentVersion = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
456956
457394
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
456957
457395
|
let latestVersion = await getLatestVersion(channel2);
|
|
456958
457396
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -457087,7 +457525,7 @@ function AutoUpdater({
|
|
|
457087
457525
|
" ",
|
|
457088
457526
|
/* @__PURE__ */ jsx_runtime414.jsx(ThemedText, {
|
|
457089
457527
|
bold: true,
|
|
457090
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
457528
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.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.72", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
457091
457529
|
})
|
|
457092
457530
|
]
|
|
457093
457531
|
})
|
|
@@ -457164,12 +457602,12 @@ function NativeAutoUpdater({
|
|
|
457164
457602
|
logEvent("theus_native_auto_updater_start", {});
|
|
457165
457603
|
try {
|
|
457166
457604
|
const maxVersion = await getMaxVersion();
|
|
457167
|
-
if (maxVersion && gt({ VERSION: "0.2.
|
|
457605
|
+
if (maxVersion && gt({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
457168
457606
|
const msg = await getMaxVersionMessage();
|
|
457169
457607
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
457170
457608
|
}
|
|
457171
457609
|
const result = await installLatest(channel2);
|
|
457172
|
-
const currentVersion = { VERSION: "0.2.
|
|
457610
|
+
const currentVersion = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
457173
457611
|
const latencyMs = Date.now() - startTime2;
|
|
457174
457612
|
if (result.lockFailed) {
|
|
457175
457613
|
logEvent("theus_native_auto_updater_lock_contention", {
|
|
@@ -457306,17 +457744,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
457306
457744
|
const maxVersion = await getMaxVersion();
|
|
457307
457745
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
457308
457746
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
457309
|
-
if (gte({ VERSION: "0.2.
|
|
457310
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.
|
|
457747
|
+
if (gte({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
457748
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
457311
457749
|
setUpdateAvailable(false);
|
|
457312
457750
|
return;
|
|
457313
457751
|
}
|
|
457314
457752
|
latest = maxVersion;
|
|
457315
457753
|
}
|
|
457316
|
-
const hasUpdate = latest && !gte({ VERSION: "0.2.
|
|
457754
|
+
const hasUpdate = latest && !gte({ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
457317
457755
|
setUpdateAvailable(!!hasUpdate);
|
|
457318
457756
|
if (hasUpdate) {
|
|
457319
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.
|
|
457757
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`);
|
|
457320
457758
|
}
|
|
457321
457759
|
};
|
|
457322
457760
|
$2[0] = t1;
|
|
@@ -457350,7 +457788,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
457350
457788
|
wrap: "truncate",
|
|
457351
457789
|
children: [
|
|
457352
457790
|
"versi\xF3n actual: ",
|
|
457353
|
-
{ VERSION: "0.2.
|
|
457791
|
+
{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457792
|
]
|
|
457355
457793
|
});
|
|
457356
457794
|
$2[3] = verbose;
|
|
@@ -463988,8 +464426,8 @@ function findTextObject(text2, offset, objectType2, isInner) {
|
|
|
463988
464426
|
return findWordObject(text2, offset, isInner, (ch2) => !isVimWhitespace(ch2));
|
|
463989
464427
|
const pair = PAIRS[objectType2];
|
|
463990
464428
|
if (pair) {
|
|
463991
|
-
const [
|
|
463992
|
-
return
|
|
464429
|
+
const [open24, close] = pair;
|
|
464430
|
+
return open24 === close ? findQuoteObject(text2, offset, open24, isInner) : findBracketObject(text2, offset, open24, close, isInner);
|
|
463993
464431
|
}
|
|
463994
464432
|
return null;
|
|
463995
464433
|
}
|
|
@@ -464064,13 +464502,13 @@ function findQuoteObject(text2, offset, quote2, isInner) {
|
|
|
464064
464502
|
}
|
|
464065
464503
|
return null;
|
|
464066
464504
|
}
|
|
464067
|
-
function findBracketObject(text2, offset,
|
|
464505
|
+
function findBracketObject(text2, offset, open24, close, isInner) {
|
|
464068
464506
|
let depth = 0;
|
|
464069
464507
|
let start = -1;
|
|
464070
464508
|
for (let i3 = offset;i3 >= 0; i3--) {
|
|
464071
464509
|
if (text2[i3] === close && i3 !== offset)
|
|
464072
464510
|
depth++;
|
|
464073
|
-
else if (text2[i3] ===
|
|
464511
|
+
else if (text2[i3] === open24) {
|
|
464074
464512
|
if (depth === 0) {
|
|
464075
464513
|
start = i3;
|
|
464076
464514
|
break;
|
|
@@ -464083,7 +464521,7 @@ function findBracketObject(text2, offset, open22, close, isInner) {
|
|
|
464083
464521
|
depth = 0;
|
|
464084
464522
|
let end = -1;
|
|
464085
464523
|
for (let i3 = start + 1;i3 < text2.length; i3++) {
|
|
464086
|
-
if (text2[i3] ===
|
|
464524
|
+
if (text2[i3] === open24)
|
|
464087
464525
|
depth++;
|
|
464088
464526
|
else if (text2[i3] === close) {
|
|
464089
464527
|
if (depth === 0) {
|
|
@@ -465213,7 +465651,7 @@ function buildStatusLineCommandInput(permissionMode2, exceeds200kTokens, setting
|
|
|
465213
465651
|
project_dir: getOriginalCwd(),
|
|
465214
465652
|
added_dirs: addedDirs
|
|
465215
465653
|
},
|
|
465216
|
-
version: { VERSION: "0.2.
|
|
465654
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
465217
465655
|
output_style: {
|
|
465218
465656
|
name: outputStyleName
|
|
465219
465657
|
},
|
|
@@ -471201,9 +471639,9 @@ function initSkillImprovement() {
|
|
|
471201
471639
|
async function applySkillImprovement(skillName, updates) {
|
|
471202
471640
|
if (!skillName)
|
|
471203
471641
|
return;
|
|
471204
|
-
const { join:
|
|
471642
|
+
const { join: join169 } = await import("path");
|
|
471205
471643
|
const fs5 = await import("fs/promises");
|
|
471206
|
-
const filePath =
|
|
471644
|
+
const filePath = join169(getCwd(), ".theus", "skills", skillName, "SKILL.md");
|
|
471207
471645
|
let currentContent;
|
|
471208
471646
|
try {
|
|
471209
471647
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -471355,7 +471793,7 @@ function useMoreRight(_args) {
|
|
|
471355
471793
|
}
|
|
471356
471794
|
|
|
471357
471795
|
// utils/cleanup.ts
|
|
471358
|
-
import { join as
|
|
471796
|
+
import { join as join169 } from "path";
|
|
471359
471797
|
function getCutoffDate() {
|
|
471360
471798
|
const settings = getSettings_DEPRECATED() || {};
|
|
471361
471799
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -471380,7 +471818,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
471380
471818
|
try {
|
|
471381
471819
|
const timestamp2 = convertFileNameToDate(file2.name);
|
|
471382
471820
|
if (timestamp2 < cutoffDate) {
|
|
471383
|
-
await getFsImplementation().unlink(
|
|
471821
|
+
await getFsImplementation().unlink(join169(dirPath, file2.name));
|
|
471384
471822
|
if (isMessagePath) {
|
|
471385
471823
|
result.messages++;
|
|
471386
471824
|
} else {
|
|
@@ -471411,7 +471849,7 @@ async function cleanupOldMessageFiles() {
|
|
|
471411
471849
|
} catch {
|
|
471412
471850
|
return result;
|
|
471413
471851
|
}
|
|
471414
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
471852
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join169(baseCachePath, dirent.name));
|
|
471415
471853
|
for (const mcpLogDir of mcpLogDirs) {
|
|
471416
471854
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
471417
471855
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -471450,7 +471888,7 @@ async function cleanupOldSessionFiles() {
|
|
|
471450
471888
|
for (const projectDirent of projectDirents) {
|
|
471451
471889
|
if (!projectDirent.isDirectory())
|
|
471452
471890
|
continue;
|
|
471453
|
-
const projectDir =
|
|
471891
|
+
const projectDir = join169(projectsDir, projectDirent.name);
|
|
471454
471892
|
let entries;
|
|
471455
471893
|
try {
|
|
471456
471894
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -471464,15 +471902,15 @@ async function cleanupOldSessionFiles() {
|
|
|
471464
471902
|
continue;
|
|
471465
471903
|
}
|
|
471466
471904
|
try {
|
|
471467
|
-
if (await unlinkIfOld(
|
|
471905
|
+
if (await unlinkIfOld(join169(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
471468
471906
|
result.messages++;
|
|
471469
471907
|
}
|
|
471470
471908
|
} catch {
|
|
471471
471909
|
result.errors++;
|
|
471472
471910
|
}
|
|
471473
471911
|
} else if (entry.isDirectory()) {
|
|
471474
|
-
const sessionDir =
|
|
471475
|
-
const toolResultsDir =
|
|
471912
|
+
const sessionDir = join169(projectDir, entry.name);
|
|
471913
|
+
const toolResultsDir = join169(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
471476
471914
|
let toolDirs;
|
|
471477
471915
|
try {
|
|
471478
471916
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -471483,14 +471921,14 @@ async function cleanupOldSessionFiles() {
|
|
|
471483
471921
|
for (const toolEntry of toolDirs) {
|
|
471484
471922
|
if (toolEntry.isFile()) {
|
|
471485
471923
|
try {
|
|
471486
|
-
if (await unlinkIfOld(
|
|
471924
|
+
if (await unlinkIfOld(join169(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
471487
471925
|
result.messages++;
|
|
471488
471926
|
}
|
|
471489
471927
|
} catch {
|
|
471490
471928
|
result.errors++;
|
|
471491
471929
|
}
|
|
471492
471930
|
} else if (toolEntry.isDirectory()) {
|
|
471493
|
-
const toolDirPath =
|
|
471931
|
+
const toolDirPath = join169(toolResultsDir, toolEntry.name);
|
|
471494
471932
|
let toolFiles;
|
|
471495
471933
|
try {
|
|
471496
471934
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -471501,7 +471939,7 @@ async function cleanupOldSessionFiles() {
|
|
|
471501
471939
|
if (!tf.isFile())
|
|
471502
471940
|
continue;
|
|
471503
471941
|
try {
|
|
471504
|
-
if (await unlinkIfOld(
|
|
471942
|
+
if (await unlinkIfOld(join169(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
471505
471943
|
result.messages++;
|
|
471506
471944
|
}
|
|
471507
471945
|
} catch {
|
|
@@ -471533,7 +471971,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
471533
471971
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
471534
471972
|
continue;
|
|
471535
471973
|
try {
|
|
471536
|
-
if (await unlinkIfOld(
|
|
471974
|
+
if (await unlinkIfOld(join169(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
471537
471975
|
result.messages++;
|
|
471538
471976
|
}
|
|
471539
471977
|
} catch {
|
|
@@ -471546,7 +471984,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
471546
471984
|
return result;
|
|
471547
471985
|
}
|
|
471548
471986
|
function cleanupOldPlanFiles() {
|
|
471549
|
-
const plansDir =
|
|
471987
|
+
const plansDir = join169(getTheusConfigHomeDir(), "plans");
|
|
471550
471988
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
471551
471989
|
}
|
|
471552
471990
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -471555,14 +471993,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
471555
471993
|
const fsImpl = getFsImplementation();
|
|
471556
471994
|
try {
|
|
471557
471995
|
const configDir = getTheusConfigHomeDir();
|
|
471558
|
-
const fileHistoryStorageDir =
|
|
471996
|
+
const fileHistoryStorageDir = join169(configDir, "file-history");
|
|
471559
471997
|
let dirents;
|
|
471560
471998
|
try {
|
|
471561
471999
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
471562
472000
|
} catch {
|
|
471563
472001
|
return result;
|
|
471564
472002
|
}
|
|
471565
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
472003
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join169(fileHistoryStorageDir, dirent.name));
|
|
471566
472004
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
471567
472005
|
try {
|
|
471568
472006
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -471589,14 +472027,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
471589
472027
|
const fsImpl = getFsImplementation();
|
|
471590
472028
|
try {
|
|
471591
472029
|
const configDir = getTheusConfigHomeDir();
|
|
471592
|
-
const sessionEnvBaseDir =
|
|
472030
|
+
const sessionEnvBaseDir = join169(configDir, "session-env");
|
|
471593
472031
|
let dirents;
|
|
471594
472032
|
try {
|
|
471595
472033
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
471596
472034
|
} catch {
|
|
471597
472035
|
return result;
|
|
471598
472036
|
}
|
|
471599
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
472037
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join169(sessionEnvBaseDir, dirent.name));
|
|
471600
472038
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
471601
472039
|
try {
|
|
471602
472040
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -471618,7 +472056,7 @@ async function cleanupOldDebugLogs() {
|
|
|
471618
472056
|
const cutoffDate = getCutoffDate();
|
|
471619
472057
|
const result = { messages: 0, errors: 0 };
|
|
471620
472058
|
const fsImpl = getFsImplementation();
|
|
471621
|
-
const debugDir =
|
|
472059
|
+
const debugDir = join169(getTheusConfigHomeDir(), "debug");
|
|
471622
472060
|
let dirents;
|
|
471623
472061
|
try {
|
|
471624
472062
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -471630,7 +472068,7 @@ async function cleanupOldDebugLogs() {
|
|
|
471630
472068
|
continue;
|
|
471631
472069
|
}
|
|
471632
472070
|
try {
|
|
471633
|
-
if (await unlinkIfOld(
|
|
472071
|
+
if (await unlinkIfOld(join169(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
471634
472072
|
result.messages++;
|
|
471635
472073
|
}
|
|
471636
472074
|
} catch {
|
|
@@ -474842,7 +475280,7 @@ __export(exports_asciicast, {
|
|
|
474842
475280
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
474843
475281
|
});
|
|
474844
475282
|
import { appendFile as appendFile8, rename as rename12 } from "fs/promises";
|
|
474845
|
-
import { basename as basename65, dirname as
|
|
475283
|
+
import { basename as basename65, dirname as dirname73, join as join171 } from "path";
|
|
474846
475284
|
function getRecordFilePath() {
|
|
474847
475285
|
if (recordingState.filePath !== null) {
|
|
474848
475286
|
return recordingState.filePath;
|
|
@@ -474853,10 +475291,10 @@ function getRecordFilePath() {
|
|
|
474853
475291
|
if (!isEnvTruthy(process.env.THEUS_CODE_TERMINAL_RECORDING)) {
|
|
474854
475292
|
return null;
|
|
474855
475293
|
}
|
|
474856
|
-
const projectsDir =
|
|
474857
|
-
const projectDir =
|
|
475294
|
+
const projectsDir = join171(getTheusConfigHomeDir(), "projects");
|
|
475295
|
+
const projectDir = join171(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
474858
475296
|
recordingState.timestamp = Date.now();
|
|
474859
|
-
recordingState.filePath =
|
|
475297
|
+
recordingState.filePath = join171(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
474860
475298
|
return recordingState.filePath;
|
|
474861
475299
|
}
|
|
474862
475300
|
function _resetRecordingStateForTesting() {
|
|
@@ -474865,13 +475303,13 @@ function _resetRecordingStateForTesting() {
|
|
|
474865
475303
|
}
|
|
474866
475304
|
function getSessionRecordingPaths() {
|
|
474867
475305
|
const sessionId = getSessionId();
|
|
474868
|
-
const projectsDir =
|
|
474869
|
-
const projectDir =
|
|
475306
|
+
const projectsDir = join171(getTheusConfigHomeDir(), "projects");
|
|
475307
|
+
const projectDir = join171(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
474870
475308
|
try {
|
|
474871
475309
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
474872
475310
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
474873
475311
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
474874
|
-
return files2.map((f) =>
|
|
475312
|
+
return files2.map((f) => join171(projectDir, f));
|
|
474875
475313
|
} catch {
|
|
474876
475314
|
return [];
|
|
474877
475315
|
}
|
|
@@ -474881,9 +475319,9 @@ async function renameRecordingForSession() {
|
|
|
474881
475319
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
474882
475320
|
return;
|
|
474883
475321
|
}
|
|
474884
|
-
const projectsDir =
|
|
474885
|
-
const projectDir =
|
|
474886
|
-
const newPath =
|
|
475322
|
+
const projectsDir = join171(getTheusConfigHomeDir(), "projects");
|
|
475323
|
+
const projectDir = join171(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
475324
|
+
const newPath = join171(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
474887
475325
|
if (oldPath === newPath) {
|
|
474888
475326
|
return;
|
|
474889
475327
|
}
|
|
@@ -474924,7 +475362,7 @@ function installAsciicastRecorder() {
|
|
|
474924
475362
|
}
|
|
474925
475363
|
});
|
|
474926
475364
|
try {
|
|
474927
|
-
getFsImplementation().mkdirSync(
|
|
475365
|
+
getFsImplementation().mkdirSync(dirname73(filePath));
|
|
474928
475366
|
} catch {}
|
|
474929
475367
|
getFsImplementation().appendFileSync(filePath, header + `
|
|
474930
475368
|
`, { mode: 384 });
|
|
@@ -474993,7 +475431,7 @@ var init_asciicast = __esm(() => {
|
|
|
474993
475431
|
});
|
|
474994
475432
|
|
|
474995
475433
|
// utils/sessionRestore.ts
|
|
474996
|
-
import { dirname as
|
|
475434
|
+
import { dirname as dirname74 } from "path";
|
|
474997
475435
|
function extractTodosFromTranscript(messages) {
|
|
474998
475436
|
for (let i3 = messages.length - 1;i3 >= 0; i3--) {
|
|
474999
475437
|
const msg = messages[i3];
|
|
@@ -475118,7 +475556,7 @@ async function processResumedConversation(result, opts, context3) {
|
|
|
475118
475556
|
if (!opts.forkSession) {
|
|
475119
475557
|
const sid = opts.sessionIdOverride ?? result.sessionId;
|
|
475120
475558
|
if (sid) {
|
|
475121
|
-
switchSession(asSessionId(sid), opts.transcriptPath ?
|
|
475559
|
+
switchSession(asSessionId(sid), opts.transcriptPath ? dirname74(opts.transcriptPath) : null);
|
|
475122
475560
|
await renameRecordingForSession();
|
|
475123
475561
|
await resetSessionFilePointer();
|
|
475124
475562
|
restoreCostStateForSession(sid);
|
|
@@ -476493,7 +476931,7 @@ function useSurveyState({
|
|
|
476493
476931
|
setState("submitted");
|
|
476494
476932
|
setTimeout(setState, hideThanksAfterMs, "closed");
|
|
476495
476933
|
}, [hideThanksAfterMs]);
|
|
476496
|
-
const
|
|
476934
|
+
const open24 = import_react301.useCallback(() => {
|
|
476497
476935
|
if (state2 !== "closed") {
|
|
476498
476936
|
return;
|
|
476499
476937
|
}
|
|
@@ -476544,7 +476982,7 @@ function useSurveyState({
|
|
|
476544
476982
|
return {
|
|
476545
476983
|
state: state2,
|
|
476546
476984
|
lastResponse,
|
|
476547
|
-
open:
|
|
476985
|
+
open: open24,
|
|
476548
476986
|
handleSelect,
|
|
476549
476987
|
handleTranscriptSelect
|
|
476550
476988
|
};
|
|
@@ -476680,7 +477118,7 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
476680
477118
|
const {
|
|
476681
477119
|
state: state2,
|
|
476682
477120
|
lastResponse,
|
|
476683
|
-
open:
|
|
477121
|
+
open: open24,
|
|
476684
477122
|
handleSelect,
|
|
476685
477123
|
handleTranscriptSelect
|
|
476686
477124
|
} = useSurveyState({
|
|
@@ -476761,9 +477199,9 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
476761
477199
|
}, [state2, isLoading, hasActivePrompt, isModelAllowed2, feedbackSurvey.timeLastShown, feedbackSurvey.submitCountAtLastAppearance, submitCount, config3.minTimeBetweenFeedbackMs, config3.minTimeBetweenGlobalFeedbackMs, config3.minUserTurnsBetweenFeedback, config3.minTimeBeforeFeedbackMs, config3.minUserTurnsBeforeFeedback, config3.probability, settingsRate]);
|
|
476762
477200
|
import_react302.useEffect(() => {
|
|
476763
477201
|
if (shouldOpen) {
|
|
476764
|
-
|
|
477202
|
+
open24();
|
|
476765
477203
|
}
|
|
476766
|
-
}, [shouldOpen,
|
|
477204
|
+
}, [shouldOpen, open24]);
|
|
476767
477205
|
return {
|
|
476768
477206
|
state: state2,
|
|
476769
477207
|
lastResponse,
|
|
@@ -476907,7 +477345,7 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
476907
477345
|
const {
|
|
476908
477346
|
state: state2,
|
|
476909
477347
|
lastResponse,
|
|
476910
|
-
open:
|
|
477348
|
+
open: open24,
|
|
476911
477349
|
handleSelect,
|
|
476912
477350
|
handleTranscriptSelect
|
|
476913
477351
|
} = useSurveyState({
|
|
@@ -476960,9 +477398,9 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
476960
477398
|
return;
|
|
476961
477399
|
}
|
|
476962
477400
|
if (Math.random() < SURVEY_PROBABILITY) {
|
|
476963
|
-
|
|
477401
|
+
open24();
|
|
476964
477402
|
}
|
|
476965
|
-
}, [enabled, state2, isLoading, hasActivePrompt, lastAssistant, messages,
|
|
477403
|
+
}, [enabled, state2, isLoading, hasActivePrompt, lastAssistant, messages, open24]);
|
|
476966
477404
|
return {
|
|
476967
477405
|
state: state2,
|
|
476968
477406
|
lastResponse,
|
|
@@ -477044,7 +477482,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477044
477482
|
const {
|
|
477045
477483
|
state: state2,
|
|
477046
477484
|
lastResponse,
|
|
477047
|
-
open:
|
|
477485
|
+
open: open24,
|
|
477048
477486
|
handleSelect
|
|
477049
477487
|
} = useSurveyState(t5);
|
|
477050
477488
|
let t6;
|
|
@@ -477076,7 +477514,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477076
477514
|
const currentCompactBoundaries = t8;
|
|
477077
477515
|
let t10;
|
|
477078
477516
|
let t9;
|
|
477079
|
-
if ($2[9] !== currentCompactBoundaries || $2[10] !== enabled || $2[11] !== gateEnabled || $2[12] !== hasActivePrompt || $2[13] !== isLoading || $2[14] !== messages || $2[15] !==
|
|
477517
|
+
if ($2[9] !== currentCompactBoundaries || $2[10] !== enabled || $2[11] !== gateEnabled || $2[12] !== hasActivePrompt || $2[13] !== isLoading || $2[14] !== messages || $2[15] !== open24 || $2[16] !== state2) {
|
|
477080
477518
|
t9 = () => {
|
|
477081
477519
|
if (!enabled) {
|
|
477082
477520
|
return;
|
|
@@ -477100,7 +477538,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477100
477538
|
if (hasMessageAfterBoundary(messages, pendingCompactBoundaryUuid.current)) {
|
|
477101
477539
|
pendingCompactBoundaryUuid.current = null;
|
|
477102
477540
|
if (Math.random() < SURVEY_PROBABILITY2) {
|
|
477103
|
-
|
|
477541
|
+
open24();
|
|
477104
477542
|
}
|
|
477105
477543
|
return;
|
|
477106
477544
|
}
|
|
@@ -477111,14 +477549,14 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477111
477549
|
pendingCompactBoundaryUuid.current = newBoundaries[newBoundaries.length - 1];
|
|
477112
477550
|
}
|
|
477113
477551
|
};
|
|
477114
|
-
t10 = [enabled, currentCompactBoundaries, state2, isLoading, hasActivePrompt, gateEnabled, messages,
|
|
477552
|
+
t10 = [enabled, currentCompactBoundaries, state2, isLoading, hasActivePrompt, gateEnabled, messages, open24];
|
|
477115
477553
|
$2[9] = currentCompactBoundaries;
|
|
477116
477554
|
$2[10] = enabled;
|
|
477117
477555
|
$2[11] = gateEnabled;
|
|
477118
477556
|
$2[12] = hasActivePrompt;
|
|
477119
477557
|
$2[13] = isLoading;
|
|
477120
477558
|
$2[14] = messages;
|
|
477121
|
-
$2[15] =
|
|
477559
|
+
$2[15] = open24;
|
|
477122
477560
|
$2[16] = state2;
|
|
477123
477561
|
$2[17] = t10;
|
|
477124
477562
|
$2[18] = t9;
|
|
@@ -477645,8 +478083,8 @@ var init_useAwaySummary = __esm(() => {
|
|
|
477645
478083
|
});
|
|
477646
478084
|
|
|
477647
478085
|
// utils/theusInChrome/setupPortable.ts
|
|
477648
|
-
import { readdir as
|
|
477649
|
-
import { join as
|
|
478086
|
+
import { readdir as readdir36 } from "fs/promises";
|
|
478087
|
+
import { join as join172 } from "path";
|
|
477650
478088
|
function getExtensionIds() {
|
|
477651
478089
|
return [THEUS_BROWSER_EXTENSION_ID];
|
|
477652
478090
|
}
|
|
@@ -477659,7 +478097,7 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
477659
478097
|
for (const { browser, path: browserBasePath } of browserPaths) {
|
|
477660
478098
|
let browserProfileEntries = [];
|
|
477661
478099
|
try {
|
|
477662
|
-
browserProfileEntries = await
|
|
478100
|
+
browserProfileEntries = await readdir36(browserBasePath, {
|
|
477663
478101
|
withFileTypes: true
|
|
477664
478102
|
});
|
|
477665
478103
|
} catch (e) {
|
|
@@ -477673,9 +478111,9 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
477673
478111
|
}
|
|
477674
478112
|
for (const profile of profileDirs) {
|
|
477675
478113
|
for (const extensionId of extensionIds) {
|
|
477676
|
-
const extensionPath =
|
|
478114
|
+
const extensionPath = join172(browserBasePath, profile, "Extensions", extensionId);
|
|
477677
478115
|
try {
|
|
477678
|
-
await
|
|
478116
|
+
await readdir36(extensionPath);
|
|
477679
478117
|
log2?.(`[Theus in Chrome] Extension ${extensionId} found in ${browser} ${profile}`);
|
|
477680
478118
|
return { isInstalled: true, browser };
|
|
477681
478119
|
} catch {}
|
|
@@ -477695,9 +478133,9 @@ var init_setupPortable = __esm(() => {
|
|
|
477695
478133
|
});
|
|
477696
478134
|
|
|
477697
478135
|
// utils/theusInChrome/setup.ts
|
|
477698
|
-
import { chmod as chmod15, mkdir as mkdir55, readFile as
|
|
478136
|
+
import { chmod as chmod15, mkdir as mkdir55, readFile as readFile64, writeFile as writeFile54 } from "fs/promises";
|
|
477699
478137
|
import { homedir as homedir50 } from "os";
|
|
477700
|
-
import { join as
|
|
478138
|
+
import { join as join173 } from "path";
|
|
477701
478139
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
477702
478140
|
function isTheusInChromeEngineAvailable() {
|
|
477703
478141
|
return Array.isArray(BROWSER_TOOLS);
|
|
@@ -477761,8 +478199,8 @@ function setupTheusInChrome() {
|
|
|
477761
478199
|
};
|
|
477762
478200
|
} else {
|
|
477763
478201
|
const __filename3 = fileURLToPath8(import.meta.url);
|
|
477764
|
-
const __dirname3 =
|
|
477765
|
-
const cliPath =
|
|
478202
|
+
const __dirname3 = join173(__filename3, "..");
|
|
478203
|
+
const cliPath = join173(__dirname3, "cli.js");
|
|
477766
478204
|
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" }));
|
|
477767
478205
|
const mcpConfig = {
|
|
477768
478206
|
[THEUS_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -477784,8 +478222,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
477784
478222
|
const platform7 = getPlatform();
|
|
477785
478223
|
if (platform7 === "windows") {
|
|
477786
478224
|
const home = homedir50();
|
|
477787
|
-
const appData = process.env.APPDATA ||
|
|
477788
|
-
return [
|
|
478225
|
+
const appData = process.env.APPDATA || join173(home, "AppData", "Local");
|
|
478226
|
+
return [join173(appData, "Theus", "ChromeNativeHost")];
|
|
477789
478227
|
}
|
|
477790
478228
|
return getAllNativeMessagingHostsDirs().map(({ path: path21 }) => path21);
|
|
477791
478229
|
}
|
|
@@ -477804,8 +478242,8 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
477804
478242
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
477805
478243
|
let anyManifestUpdated = false;
|
|
477806
478244
|
for (const manifestDir of manifestDirs) {
|
|
477807
|
-
const manifestPath =
|
|
477808
|
-
const existingContent = await
|
|
478245
|
+
const manifestPath = join173(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
478246
|
+
const existingContent = await readFile64(manifestPath, "utf-8").catch(() => null);
|
|
477809
478247
|
if (existingContent === manifestContent) {
|
|
477810
478248
|
continue;
|
|
477811
478249
|
}
|
|
@@ -477819,7 +478257,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
477819
478257
|
}
|
|
477820
478258
|
}
|
|
477821
478259
|
if (getPlatform() === "windows") {
|
|
477822
|
-
const manifestPath =
|
|
478260
|
+
const manifestPath = join173(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
477823
478261
|
registerWindowsNativeHosts(manifestPath);
|
|
477824
478262
|
}
|
|
477825
478263
|
if (anyManifestUpdated) {
|
|
@@ -477857,8 +478295,8 @@ function registerWindowsNativeHosts(manifestPath) {
|
|
|
477857
478295
|
}
|
|
477858
478296
|
async function createWrapperScript(command9) {
|
|
477859
478297
|
const platform7 = getPlatform();
|
|
477860
|
-
const chromeDir =
|
|
477861
|
-
const wrapperPath = platform7 === "windows" ?
|
|
478298
|
+
const chromeDir = join173(getTheusConfigHomeDir(), "chrome");
|
|
478299
|
+
const wrapperPath = platform7 === "windows" ? join173(chromeDir, "chrome-native-host.bat") : join173(chromeDir, "chrome-native-host");
|
|
477862
478300
|
const scriptContent = platform7 === "windows" ? `@echo off
|
|
477863
478301
|
REM Chrome native host wrapper script
|
|
477864
478302
|
REM Generated by Theus - do not edit manually
|
|
@@ -477868,7 +478306,7 @@ ${command9}
|
|
|
477868
478306
|
# Generated by Theus - do not edit manually
|
|
477869
478307
|
exec ${command9}
|
|
477870
478308
|
`;
|
|
477871
|
-
const existingContent = await
|
|
478309
|
+
const existingContent = await readFile64(wrapperPath, "utf-8").catch(() => null);
|
|
477872
478310
|
if (existingContent === scriptContent) {
|
|
477873
478311
|
return wrapperPath;
|
|
477874
478312
|
}
|
|
@@ -477987,7 +478425,7 @@ var init_useChromeExtensionNotification = __esm(() => {
|
|
|
477987
478425
|
});
|
|
477988
478426
|
|
|
477989
478427
|
// utils/plugins/officialMarketplaceStartupCheck.ts
|
|
477990
|
-
import { join as
|
|
478428
|
+
import { join as join174 } from "path";
|
|
477991
478429
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
477992
478430
|
if (isEnvTruthy(process.env.THEUS_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)) {
|
|
477993
478431
|
return true;
|
|
@@ -478065,7 +478503,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
478065
478503
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
478066
478504
|
}
|
|
478067
478505
|
const cacheDir = getMarketplacesCacheDir();
|
|
478068
|
-
const installLocation =
|
|
478506
|
+
const installLocation = join174(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
478069
478507
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
478070
478508
|
if (gcsSha !== null) {
|
|
478071
478509
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -480849,7 +481287,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
480849
481287
|
});
|
|
480850
481288
|
|
|
480851
481289
|
// hooks/useLspPluginRecommendation.tsx
|
|
480852
|
-
import { extname as extname20, join as
|
|
481290
|
+
import { extname as extname20, join as join175 } from "path";
|
|
480853
481291
|
function useLspPluginRecommendation() {
|
|
480854
481292
|
const $2 = c3(12);
|
|
480855
481293
|
const trackedFiles = useAppState(_temp202);
|
|
@@ -480934,7 +481372,7 @@ function useLspPluginRecommendation() {
|
|
|
480934
481372
|
case "yes": {
|
|
480935
481373
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
480936
481374
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
480937
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
481375
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join175(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
480938
481376
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
480939
481377
|
const settings = getSettingsForSource("userSettings");
|
|
480940
481378
|
updateSettingsForSource("userSettings", {
|
|
@@ -484138,7 +484576,7 @@ var exports_REPL = {};
|
|
|
484138
484576
|
__export(exports_REPL, {
|
|
484139
484577
|
REPL: () => REPL
|
|
484140
484578
|
});
|
|
484141
|
-
import { dirname as
|
|
484579
|
+
import { dirname as dirname75, join as join176 } from "path";
|
|
484142
484580
|
import { tmpdir as tmpdir16 } from "os";
|
|
484143
484581
|
import { writeFile as writeFile55 } from "fs/promises";
|
|
484144
484582
|
import { randomUUID as randomUUID61 } from "crypto";
|
|
@@ -485084,7 +485522,7 @@ function REPL({
|
|
|
485084
485522
|
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
485085
485523
|
saveCurrentSessionCosts();
|
|
485086
485524
|
resetCostState();
|
|
485087
|
-
switchSession(asSessionId(sessionId), log2.fullPath ?
|
|
485525
|
+
switchSession(asSessionId(sessionId), log2.fullPath ? dirname75(log2.fullPath) : null);
|
|
485088
485526
|
const {
|
|
485089
485527
|
renameRecordingForSession: renameRecordingForSession2
|
|
485090
485528
|
} = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
|
|
@@ -486772,7 +487210,7 @@ Note: ctrl + z now suspends Theus, ctrl + _ undoes input.
|
|
|
486772
487210
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
486773
487211
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
486774
487212
|
const text2 = raw.replace(/[ \t]+$/gm, "");
|
|
486775
|
-
const path21 =
|
|
487213
|
+
const path21 = join176(tmpdir16(), `cc-transcript-${Date.now()}.txt`);
|
|
486776
487214
|
await writeFile55(path21, text2);
|
|
486777
487215
|
const opened = openFileInExternalEditor(path21);
|
|
486778
487216
|
setStatus(opened ? `opening ${path21}` : `wrote ${path21} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -489536,7 +489974,7 @@ function completeOnboarding() {
|
|
|
489536
489974
|
saveGlobalConfig((current) => ({
|
|
489537
489975
|
...current,
|
|
489538
489976
|
hasCompletedOnboarding: true,
|
|
489539
|
-
lastOnboardingVersion: { VERSION: "0.2.
|
|
489977
|
+
lastOnboardingVersion: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
489540
489978
|
}));
|
|
489541
489979
|
}
|
|
489542
489980
|
function showDialog(root2, renderer) {
|
|
@@ -489766,18 +490204,18 @@ var init_interactiveHelpers = __esm(() => {
|
|
|
489766
490204
|
});
|
|
489767
490205
|
|
|
489768
490206
|
// components/Theus/arsenalStats.ts
|
|
489769
|
-
import { existsSync as
|
|
489770
|
-
import { dirname as
|
|
490207
|
+
import { existsSync as existsSync30, readdirSync as readdirSync6 } from "fs";
|
|
490208
|
+
import { dirname as dirname76, join as join177 } from "path";
|
|
489771
490209
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
489772
490210
|
function countBundledArsenalSkills() {
|
|
489773
490211
|
try {
|
|
489774
|
-
const here =
|
|
490212
|
+
const here = dirname76(fileURLToPath9(import.meta.url));
|
|
489775
490213
|
for (const dir of [
|
|
489776
|
-
|
|
489777
|
-
|
|
489778
|
-
|
|
490214
|
+
join177(here, "..", "..", "vendor", "theus-arsenal", "skills"),
|
|
490215
|
+
join177(here, "vendor", "theus-arsenal", "skills"),
|
|
490216
|
+
join177(here, "..", "vendor", "theus-arsenal", "skills")
|
|
489779
490217
|
]) {
|
|
489780
|
-
if (!
|
|
490218
|
+
if (!existsSync30(dir))
|
|
489781
490219
|
continue;
|
|
489782
490220
|
let count4 = 0;
|
|
489783
490221
|
for (const entry of readdirSync6(dir, { withFileTypes: true })) {
|
|
@@ -489857,13 +490295,13 @@ var init_arsenalStats = __esm(() => {
|
|
|
489857
490295
|
});
|
|
489858
490296
|
|
|
489859
490297
|
// services/import/detect/global.ts
|
|
489860
|
-
import { existsSync as
|
|
489861
|
-
import { open as
|
|
489862
|
-
import { join as
|
|
490298
|
+
import { existsSync as existsSync31 } from "fs";
|
|
490299
|
+
import { open as open24, readdir as readdir37, stat as stat55 } from "fs/promises";
|
|
490300
|
+
import { join as join178 } from "path";
|
|
489863
490301
|
async function rutaDelTranscript(fichero) {
|
|
489864
490302
|
let crudo;
|
|
489865
490303
|
try {
|
|
489866
|
-
const fh = await
|
|
490304
|
+
const fh = await open24(fichero, "r");
|
|
489867
490305
|
try {
|
|
489868
490306
|
const buf = Buffer.alloc(65536);
|
|
489869
490307
|
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
@@ -489890,19 +490328,19 @@ async function rutaDelTranscript(fichero) {
|
|
|
489890
490328
|
return null;
|
|
489891
490329
|
}
|
|
489892
490330
|
async function explorarTodoElTrabajo(entorno) {
|
|
489893
|
-
const raiz =
|
|
490331
|
+
const raiz = join178(directorioConfig(entorno), "projects");
|
|
489894
490332
|
let directorios;
|
|
489895
490333
|
try {
|
|
489896
|
-
directorios = await
|
|
490334
|
+
directorios = await readdir37(raiz);
|
|
489897
490335
|
} catch {
|
|
489898
490336
|
return [];
|
|
489899
490337
|
}
|
|
489900
490338
|
const salida = [];
|
|
489901
490339
|
for (const dir of directorios) {
|
|
489902
|
-
const ruta =
|
|
490340
|
+
const ruta = join178(raiz, dir);
|
|
489903
490341
|
let sesiones;
|
|
489904
490342
|
try {
|
|
489905
|
-
sesiones = (await
|
|
490343
|
+
sesiones = (await readdir37(ruta)).filter((n3) => n3.endsWith(".jsonl"));
|
|
489906
490344
|
} catch {
|
|
489907
490345
|
continue;
|
|
489908
490346
|
}
|
|
@@ -489913,7 +490351,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
489913
490351
|
let ficheroMasReciente = sesiones[0];
|
|
489914
490352
|
for (const nombre of sesiones) {
|
|
489915
490353
|
try {
|
|
489916
|
-
const info = await
|
|
490354
|
+
const info = await stat55(join178(ruta, nombre));
|
|
489917
490355
|
bytes += info.size;
|
|
489918
490356
|
if (info.mtimeMs > masReciente) {
|
|
489919
490357
|
masReciente = info.mtimeMs;
|
|
@@ -489921,7 +490359,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
489921
490359
|
}
|
|
489922
490360
|
} catch {}
|
|
489923
490361
|
}
|
|
489924
|
-
const proyecto = await rutaDelTranscript(
|
|
490362
|
+
const proyecto = await rutaDelTranscript(join178(ruta, ficheroMasReciente));
|
|
489925
490363
|
if (!proyecto)
|
|
489926
490364
|
continue;
|
|
489927
490365
|
salida.push({
|
|
@@ -489932,7 +490370,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
489932
490370
|
masReciente,
|
|
489933
490371
|
bytes,
|
|
489934
490372
|
proyecto,
|
|
489935
|
-
existe:
|
|
490373
|
+
existe: existsSync31(proyecto)
|
|
489936
490374
|
});
|
|
489937
490375
|
}
|
|
489938
490376
|
return salida.sort((a2, b) => {
|
|
@@ -490024,8 +490462,8 @@ __export(exports_OnboardingWizard, {
|
|
|
490024
490462
|
default: () => OnboardingWizard_default,
|
|
490025
490463
|
OnboardingWizard: () => OnboardingWizard
|
|
490026
490464
|
});
|
|
490027
|
-
import { existsSync as
|
|
490028
|
-
import { join as
|
|
490465
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync15, writeFileSync as writeFileSync14 } from "fs";
|
|
490466
|
+
import { join as join179 } from "path";
|
|
490029
490467
|
function hasSeenOnboardingWizard() {
|
|
490030
490468
|
if (isEnvTruthy(process.env.THEUS_FORCE_ONBOARDING_WIZARD))
|
|
490031
490469
|
return false;
|
|
@@ -490033,7 +490471,7 @@ function hasSeenOnboardingWizard() {
|
|
|
490033
490471
|
return true;
|
|
490034
490472
|
}
|
|
490035
490473
|
try {
|
|
490036
|
-
return
|
|
490474
|
+
return existsSync32(join179(getTheusConfigHome(), WIZARD_MARKER));
|
|
490037
490475
|
} catch {
|
|
490038
490476
|
return true;
|
|
490039
490477
|
}
|
|
@@ -490042,7 +490480,7 @@ function markOnboardingWizardSeen() {
|
|
|
490042
490480
|
try {
|
|
490043
490481
|
const home = getTheusConfigHome();
|
|
490044
490482
|
mkdirSync15(home, { recursive: true });
|
|
490045
|
-
writeFileSync14(
|
|
490483
|
+
writeFileSync14(join179(home, WIZARD_MARKER), `${JSON.stringify({
|
|
490046
490484
|
seenAt: new Date().toISOString(),
|
|
490047
490485
|
version: globalThis.MACRO?.VERSION ?? null
|
|
490048
490486
|
})}
|
|
@@ -491408,7 +491846,7 @@ var init_TheusMissionLaunch = __esm(() => {
|
|
|
491408
491846
|
});
|
|
491409
491847
|
|
|
491410
491848
|
// replLauncher.tsx
|
|
491411
|
-
import { readFile as
|
|
491849
|
+
import { readFile as readFile65 } from "fs/promises";
|
|
491412
491850
|
function shouldShowStartMenu(replProps) {
|
|
491413
491851
|
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;
|
|
491414
491852
|
}
|
|
@@ -491440,7 +491878,7 @@ function withTimeout2(promise3, ms, fallback) {
|
|
|
491440
491878
|
async function readMemoryFacts() {
|
|
491441
491879
|
try {
|
|
491442
491880
|
const { getGraphPath: getGraphPath2 } = await Promise.resolve().then(() => (init_paths2(), exports_paths));
|
|
491443
|
-
const raw = await
|
|
491881
|
+
const raw = await readFile65(getGraphPath2(getCwd()), "utf8");
|
|
491444
491882
|
const data = JSON.parse(raw);
|
|
491445
491883
|
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
491446
491884
|
let facts = 0;
|
|
@@ -492726,7 +493164,7 @@ var exports_ResumeConversation = {};
|
|
|
492726
493164
|
__export(exports_ResumeConversation, {
|
|
492727
493165
|
ResumeConversation: () => ResumeConversation
|
|
492728
493166
|
});
|
|
492729
|
-
import { dirname as
|
|
493167
|
+
import { dirname as dirname77 } from "path";
|
|
492730
493168
|
function parsePrIdentifier(value) {
|
|
492731
493169
|
const directNumber = parseInt(value, 10);
|
|
492732
493170
|
if (!isNaN(directNumber) && directNumber > 0) {
|
|
@@ -492858,7 +493296,7 @@ function ResumeConversation({
|
|
|
492858
493296
|
}
|
|
492859
493297
|
if (false) {}
|
|
492860
493298
|
if (result_3.sessionId && !forkSession) {
|
|
492861
|
-
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ?
|
|
493299
|
+
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname77(log_0.fullPath) : null);
|
|
492862
493300
|
await renameRecordingForSession();
|
|
492863
493301
|
await resetSessionFilePointer();
|
|
492864
493302
|
restoreCostStateForSession(result_3.sessionId);
|
|
@@ -493522,7 +493960,7 @@ var init_theusInChrome = __esm(() => {
|
|
|
493522
493960
|
});
|
|
493523
493961
|
|
|
493524
493962
|
// skills/bundled/debug.ts
|
|
493525
|
-
import { open as
|
|
493963
|
+
import { open as open25, stat as stat56 } from "fs/promises";
|
|
493526
493964
|
function registerDebugSkill() {
|
|
493527
493965
|
registerBundledSkill({
|
|
493528
493966
|
name: "debug",
|
|
@@ -493536,10 +493974,10 @@ function registerDebugSkill() {
|
|
|
493536
493974
|
const debugLogPath = getDebugLogPath();
|
|
493537
493975
|
let logInfo;
|
|
493538
493976
|
try {
|
|
493539
|
-
const stats2 = await
|
|
493977
|
+
const stats2 = await stat56(debugLogPath);
|
|
493540
493978
|
const readSize = Math.min(stats2.size, TAIL_READ_BYTES);
|
|
493541
493979
|
const startOffset = stats2.size - readSize;
|
|
493542
|
-
const fd2 = await
|
|
493980
|
+
const fd2 = await open25(debugLogPath, "r");
|
|
493543
493981
|
try {
|
|
493544
493982
|
const { buffer, bytesRead } = await fd2.read({
|
|
493545
493983
|
buffer: Buffer.alloc(readSize),
|
|
@@ -496122,10 +496560,10 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
496122
496560
|
});
|
|
496123
496561
|
|
|
496124
496562
|
// utils/releaseNotes.ts
|
|
496125
|
-
import { mkdir as mkdir56, readFile as
|
|
496126
|
-
import { dirname as
|
|
496563
|
+
import { mkdir as mkdir56, readFile as readFile66, writeFile as writeFile56 } from "fs/promises";
|
|
496564
|
+
import { dirname as dirname78, join as join180 } from "path";
|
|
496127
496565
|
function getChangelogCachePath() {
|
|
496128
|
-
return
|
|
496566
|
+
return join180(getTheusConfigHomeDir(), "cache", "changelog.md");
|
|
496129
496567
|
}
|
|
496130
496568
|
async function migrateChangelogFromConfig() {
|
|
496131
496569
|
const config3 = getGlobalConfig();
|
|
@@ -496134,7 +496572,7 @@ async function migrateChangelogFromConfig() {
|
|
|
496134
496572
|
}
|
|
496135
496573
|
const cachePath2 = getChangelogCachePath();
|
|
496136
496574
|
try {
|
|
496137
|
-
await mkdir56(
|
|
496575
|
+
await mkdir56(dirname78(cachePath2), { recursive: true });
|
|
496138
496576
|
await writeFile56(cachePath2, config3.cachedChangelog, {
|
|
496139
496577
|
encoding: "utf-8",
|
|
496140
496578
|
flag: "wx"
|
|
@@ -496156,7 +496594,7 @@ async function fetchAndStoreChangelog() {
|
|
|
496156
496594
|
return;
|
|
496157
496595
|
}
|
|
496158
496596
|
const cachePath2 = getChangelogCachePath();
|
|
496159
|
-
await mkdir56(
|
|
496597
|
+
await mkdir56(dirname78(cachePath2), { recursive: true });
|
|
496160
496598
|
await writeFile56(cachePath2, changelogContent, { encoding: "utf-8" });
|
|
496161
496599
|
changelogMemoryCache = changelogContent;
|
|
496162
496600
|
const changelogLastFetched = Date.now();
|
|
@@ -496172,7 +496610,7 @@ async function getStoredChangelog() {
|
|
|
496172
496610
|
}
|
|
496173
496611
|
const cachePath2 = getChangelogCachePath();
|
|
496174
496612
|
try {
|
|
496175
|
-
const content = await
|
|
496613
|
+
const content = await readFile66(cachePath2, "utf-8");
|
|
496176
496614
|
changelogMemoryCache = content;
|
|
496177
496615
|
return content;
|
|
496178
496616
|
} catch {
|
|
@@ -496225,7 +496663,7 @@ function getRecentReleaseNotes(currentVersion, previousVersion, changelogContent
|
|
|
496225
496663
|
}
|
|
496226
496664
|
return [];
|
|
496227
496665
|
}
|
|
496228
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.
|
|
496666
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
496229
496667
|
if (false) {}
|
|
496230
496668
|
const cachedChangelog = await getStoredChangelog();
|
|
496231
496669
|
if (lastSeenVersion !== currentVersion || !cachedChangelog) {
|
|
@@ -496323,7 +496761,7 @@ __export(exports_setup2, {
|
|
|
496323
496761
|
setupComputerUse: () => setupComputerUse,
|
|
496324
496762
|
COMPUTER_USE_SYSTEM_HINT: () => COMPUTER_USE_SYSTEM_HINT
|
|
496325
496763
|
});
|
|
496326
|
-
import { dirname as
|
|
496764
|
+
import { dirname as dirname79, join as join181 } from "path";
|
|
496327
496765
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
496328
496766
|
function setupComputerUse() {
|
|
496329
496767
|
const allowedTools = COMPUTER_USE_TOOL_NAMES.map((name) => buildMcpToolName(COMPUTER_USE_SERVER_NAME, name));
|
|
@@ -496350,11 +496788,11 @@ function resolveComputerUseLauncher() {
|
|
|
496350
496788
|
return { command: process.execPath, args: [entry, COMPUTER_USE_FLAG] };
|
|
496351
496789
|
}
|
|
496352
496790
|
if (entry) {
|
|
496353
|
-
const launcher =
|
|
496791
|
+
const launcher = join181(dirname79(entry), "..", "bin", "theus");
|
|
496354
496792
|
return { command: launcher, args: [COMPUTER_USE_FLAG] };
|
|
496355
496793
|
}
|
|
496356
496794
|
return {
|
|
496357
|
-
command:
|
|
496795
|
+
command: join181(fileURLToPath10(import.meta.url), "..", "..", "..", "bin", "theus"),
|
|
496358
496796
|
args: [COMPUTER_USE_FLAG]
|
|
496359
496797
|
};
|
|
496360
496798
|
}
|
|
@@ -496371,19 +496809,19 @@ __export(exports_arsenalBundled, {
|
|
|
496371
496809
|
isArsenalAutoInstallEnabled: () => isArsenalAutoInstallEnabled,
|
|
496372
496810
|
ensureBundledArsenalInstalled: () => ensureBundledArsenalInstalled
|
|
496373
496811
|
});
|
|
496374
|
-
import { existsSync as
|
|
496375
|
-
import { dirname as
|
|
496812
|
+
import { existsSync as existsSync33, readFileSync as readFileSync33 } from "fs";
|
|
496813
|
+
import { dirname as dirname80, join as join182 } from "path";
|
|
496376
496814
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
496377
496815
|
function isArsenalAutoInstallEnabled() {
|
|
496378
496816
|
return process.env.THEUS_NO_ARSENAL !== "1";
|
|
496379
496817
|
}
|
|
496380
496818
|
function findBundledArsenalDir() {
|
|
496381
|
-
const here =
|
|
496819
|
+
const here = dirname80(fileURLToPath11(import.meta.url));
|
|
496382
496820
|
for (const candidate of [
|
|
496383
|
-
|
|
496384
|
-
|
|
496821
|
+
join182(here, "vendor", "theus-arsenal"),
|
|
496822
|
+
join182(here, "..", "vendor", "theus-arsenal")
|
|
496385
496823
|
]) {
|
|
496386
|
-
if (
|
|
496824
|
+
if (existsSync33(join182(candidate, ".theus-plugin", "plugin.json"))) {
|
|
496387
496825
|
return candidate;
|
|
496388
496826
|
}
|
|
496389
496827
|
}
|
|
@@ -496391,7 +496829,7 @@ function findBundledArsenalDir() {
|
|
|
496391
496829
|
}
|
|
496392
496830
|
function readBundledVersion(bundledDir) {
|
|
496393
496831
|
try {
|
|
496394
|
-
const manifest = JSON.parse(readFileSync33(
|
|
496832
|
+
const manifest = JSON.parse(readFileSync33(join182(bundledDir, ".theus-plugin", "plugin.json"), "utf8"));
|
|
496395
496833
|
return typeof manifest.version === "string" ? manifest.version : null;
|
|
496396
496834
|
} catch {
|
|
496397
496835
|
return null;
|
|
@@ -496629,9 +497067,9 @@ var init_sessionMemory = __esm(() => {
|
|
|
496629
497067
|
});
|
|
496630
497068
|
|
|
496631
497069
|
// utils/iTermBackup.ts
|
|
496632
|
-
import { copyFile as copyFile10, stat as
|
|
497070
|
+
import { copyFile as copyFile10, stat as stat57 } from "fs/promises";
|
|
496633
497071
|
import { homedir as homedir52 } from "os";
|
|
496634
|
-
import { join as
|
|
497072
|
+
import { join as join183 } from "path";
|
|
496635
497073
|
function markITerm2SetupComplete() {
|
|
496636
497074
|
saveGlobalConfig((current) => ({
|
|
496637
497075
|
...current,
|
|
@@ -496646,7 +497084,7 @@ function getIterm2RecoveryInfo() {
|
|
|
496646
497084
|
};
|
|
496647
497085
|
}
|
|
496648
497086
|
function getITerm2PlistPath() {
|
|
496649
|
-
return
|
|
497087
|
+
return join183(homedir52(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
496650
497088
|
}
|
|
496651
497089
|
async function checkAndRestoreITerm2Backup() {
|
|
496652
497090
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -496658,7 +497096,7 @@ async function checkAndRestoreITerm2Backup() {
|
|
|
496658
497096
|
return { status: "no_backup" };
|
|
496659
497097
|
}
|
|
496660
497098
|
try {
|
|
496661
|
-
await
|
|
497099
|
+
await stat57(backupPath);
|
|
496662
497100
|
} catch {
|
|
496663
497101
|
markITerm2SetupComplete();
|
|
496664
497102
|
return { status: "no_backup" };
|
|
@@ -498153,11 +498591,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
498153
498591
|
});
|
|
498154
498592
|
|
|
498155
498593
|
// utils/plugins/zipCacheAdapters.ts
|
|
498156
|
-
import { readFile as
|
|
498157
|
-
import { join as
|
|
498594
|
+
import { readFile as readFile67 } from "fs/promises";
|
|
498595
|
+
import { join as join184 } from "path";
|
|
498158
498596
|
async function readZipCacheKnownMarketplaces() {
|
|
498159
498597
|
try {
|
|
498160
|
-
const content = await
|
|
498598
|
+
const content = await readFile67(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
498161
498599
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
498162
498600
|
if (!parsed.success) {
|
|
498163
498601
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -498179,18 +498617,18 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
498179
498617
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
498180
498618
|
if (content !== null) {
|
|
498181
498619
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
498182
|
-
await atomicWriteToZipCache(
|
|
498620
|
+
await atomicWriteToZipCache(join184(zipCachePath, relPath), content);
|
|
498183
498621
|
}
|
|
498184
498622
|
}
|
|
498185
498623
|
async function readMarketplaceJsonContent(dir) {
|
|
498186
498624
|
const candidates = [
|
|
498187
|
-
|
|
498188
|
-
|
|
498625
|
+
join184(dir, ".theus-plugin", "marketplace.json"),
|
|
498626
|
+
join184(dir, "marketplace.json"),
|
|
498189
498627
|
dir
|
|
498190
498628
|
];
|
|
498191
498629
|
for (const candidate of candidates) {
|
|
498192
498630
|
try {
|
|
498193
|
-
return await
|
|
498631
|
+
return await readFile67(candidate, "utf-8");
|
|
498194
498632
|
} catch {}
|
|
498195
498633
|
}
|
|
498196
498634
|
return null;
|
|
@@ -498320,8 +498758,8 @@ __export(exports_print, {
|
|
|
498320
498758
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
498321
498759
|
canBatchWith: () => canBatchWith
|
|
498322
498760
|
});
|
|
498323
|
-
import { readFile as
|
|
498324
|
-
import { dirname as
|
|
498761
|
+
import { readFile as readFile68, stat as stat58 } from "fs/promises";
|
|
498762
|
+
import { dirname as dirname81 } from "path";
|
|
498325
498763
|
import { cwd as cwd2 } from "process";
|
|
498326
498764
|
import { randomUUID as randomUUID64 } from "crypto";
|
|
498327
498765
|
function trackReceivedMessageUuid(uuid3) {
|
|
@@ -499709,9 +500147,9 @@ ${m.text}
|
|
|
499709
500147
|
} else if (request.subtype === "seed_read_state") {
|
|
499710
500148
|
try {
|
|
499711
500149
|
const normalizedPath = expandPath(request.path);
|
|
499712
|
-
const diskMtime = Math.floor((await
|
|
500150
|
+
const diskMtime = Math.floor((await stat58(normalizedPath)).mtimeMs);
|
|
499713
500151
|
if (diskMtime <= request.mtime) {
|
|
499714
|
-
const raw = await
|
|
500152
|
+
const raw = await readFile68(normalizedPath, "utf-8");
|
|
499715
500153
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
499716
500154
|
`, `
|
|
499717
500155
|
`);
|
|
@@ -500809,7 +501247,7 @@ async function loadInitialMessages(setAppState, options2) {
|
|
|
500809
501247
|
if (false) {}
|
|
500810
501248
|
if (!options2.forkSession) {
|
|
500811
501249
|
if (result.sessionId) {
|
|
500812
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
501250
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname81(result.fullPath) : null);
|
|
500813
501251
|
if (persistSession) {
|
|
500814
501252
|
await resetSessionFilePointer();
|
|
500815
501253
|
}
|
|
@@ -500907,7 +501345,7 @@ async function loadInitialMessages(setAppState, options2) {
|
|
|
500907
501345
|
}
|
|
500908
501346
|
if (false) {}
|
|
500909
501347
|
if (!options2.forkSession && result.sessionId) {
|
|
500910
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
501348
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname81(result.fullPath) : null);
|
|
500911
501349
|
if (persistSession) {
|
|
500912
501350
|
await resetSessionFilePointer();
|
|
500913
501351
|
}
|
|
@@ -501758,7 +502196,7 @@ async function startMCPServer(cwd3, debug3, verbose) {
|
|
|
501758
502196
|
setCwd(cwd3);
|
|
501759
502197
|
const server2 = new Server({
|
|
501760
502198
|
name: "theus/tengu",
|
|
501761
|
-
version: { VERSION: "0.2.
|
|
502199
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
501762
502200
|
}, {
|
|
501763
502201
|
capabilities: {
|
|
501764
502202
|
tools: {}
|
|
@@ -501888,37 +502326,37 @@ __export(exports_theusDesktop, {
|
|
|
501888
502326
|
readTheusDesktopMcpServers: () => readTheusDesktopMcpServers,
|
|
501889
502327
|
getTheusDesktopConfigPath: () => getTheusDesktopConfigPath
|
|
501890
502328
|
});
|
|
501891
|
-
import { readdir as
|
|
502329
|
+
import { readdir as readdir38, readFile as readFile69, stat as stat59 } from "fs/promises";
|
|
501892
502330
|
import { homedir as homedir53 } from "os";
|
|
501893
|
-
import { join as
|
|
502331
|
+
import { join as join185 } from "path";
|
|
501894
502332
|
async function getTheusDesktopConfigPath() {
|
|
501895
502333
|
const platform7 = getPlatform();
|
|
501896
502334
|
if (!SUPPORTED_PLATFORMS.includes(platform7)) {
|
|
501897
502335
|
throw new Error(`Unsupported platform: ${platform7} - Theus Desktop integration only works on macOS and WSL.`);
|
|
501898
502336
|
}
|
|
501899
502337
|
if (platform7 === "macos") {
|
|
501900
|
-
return
|
|
502338
|
+
return join185(homedir53(), "Library", "Application Support", "Theus", "theus_desktop_config.json");
|
|
501901
502339
|
}
|
|
501902
502340
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
501903
502341
|
if (windowsHome) {
|
|
501904
502342
|
const wslPath = windowsHome.replace(/^[A-Z]:/, "");
|
|
501905
502343
|
const configPath2 = `/mnt/c${wslPath}/AppData/Roaming/Theus/theus_desktop_config.json`;
|
|
501906
502344
|
try {
|
|
501907
|
-
await
|
|
502345
|
+
await stat59(configPath2);
|
|
501908
502346
|
return configPath2;
|
|
501909
502347
|
} catch {}
|
|
501910
502348
|
}
|
|
501911
502349
|
try {
|
|
501912
502350
|
const usersDir = "/mnt/c/Users";
|
|
501913
502351
|
try {
|
|
501914
|
-
const userDirs = await
|
|
502352
|
+
const userDirs = await readdir38(usersDir, { withFileTypes: true });
|
|
501915
502353
|
for (const user of userDirs) {
|
|
501916
502354
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
501917
502355
|
continue;
|
|
501918
502356
|
}
|
|
501919
|
-
const potentialConfigPath =
|
|
502357
|
+
const potentialConfigPath = join185(usersDir, user.name, "AppData", "Roaming", "Theus", "theus_desktop_config.json");
|
|
501920
502358
|
try {
|
|
501921
|
-
await
|
|
502359
|
+
await stat59(potentialConfigPath);
|
|
501922
502360
|
return potentialConfigPath;
|
|
501923
502361
|
} catch {}
|
|
501924
502362
|
}
|
|
@@ -501936,7 +502374,7 @@ async function readTheusDesktopMcpServers() {
|
|
|
501936
502374
|
const configPath2 = await getTheusDesktopConfigPath();
|
|
501937
502375
|
let configContent;
|
|
501938
502376
|
try {
|
|
501939
|
-
configContent = await
|
|
502377
|
+
configContent = await readFile69(configPath2, { encoding: "utf8" });
|
|
501940
502378
|
} catch (e) {
|
|
501941
502379
|
const code = getErrnoCode(e);
|
|
501942
502380
|
if (code === "ENOENT") {
|
|
@@ -501987,7 +502425,7 @@ __export(exports_mcp3, {
|
|
|
501987
502425
|
mcpAddJsonHandler: () => mcpAddJsonHandler,
|
|
501988
502426
|
mcpAddFromDesktopHandler: () => mcpAddFromDesktopHandler
|
|
501989
502427
|
});
|
|
501990
|
-
import { stat as
|
|
502428
|
+
import { stat as stat60 } from "fs/promises";
|
|
501991
502429
|
import { cwd as cwd3 } from "process";
|
|
501992
502430
|
async function checkMcpServerHealth(name, server2) {
|
|
501993
502431
|
try {
|
|
@@ -502010,7 +502448,7 @@ async function mcpServeHandler({
|
|
|
502010
502448
|
const providedCwd = cwd3();
|
|
502011
502449
|
logEvent("theus_mcp_start", {});
|
|
502012
502450
|
try {
|
|
502013
|
-
await
|
|
502451
|
+
await stat60(providedCwd);
|
|
502014
502452
|
} catch (error40) {
|
|
502015
502453
|
if (isFsInaccessible(error40)) {
|
|
502016
502454
|
cliError(`Error: Directory ${providedCwd} does not exist`);
|
|
@@ -502312,7 +502750,7 @@ __export(exports_plugins, {
|
|
|
502312
502750
|
VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
|
|
502313
502751
|
VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
|
|
502314
502752
|
});
|
|
502315
|
-
import { basename as basename68, dirname as
|
|
502753
|
+
import { basename as basename68, dirname as dirname82 } from "path";
|
|
502316
502754
|
function handleMarketplaceError(error40, action2) {
|
|
502317
502755
|
logError2(error40);
|
|
502318
502756
|
cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error40)}`);
|
|
@@ -502345,9 +502783,9 @@ async function pluginValidateHandler(manifestPath, options2) {
|
|
|
502345
502783
|
printValidationResult(result);
|
|
502346
502784
|
let contentResults = [];
|
|
502347
502785
|
if (result.fileType === "plugin") {
|
|
502348
|
-
const manifestDir =
|
|
502786
|
+
const manifestDir = dirname82(result.filePath);
|
|
502349
502787
|
if (basename68(manifestDir) === ".theus-plugin") {
|
|
502350
|
-
contentResults = await validatePluginContents(
|
|
502788
|
+
contentResults = await validatePluginContents(dirname82(manifestDir));
|
|
502351
502789
|
for (const r of contentResults) {
|
|
502352
502790
|
console.log(`Validating ${r.fileType}: ${r.filePath}
|
|
502353
502791
|
`);
|
|
@@ -502825,12 +503263,12 @@ __export(exports_install, {
|
|
|
502825
503263
|
install: () => install
|
|
502826
503264
|
});
|
|
502827
503265
|
import { homedir as homedir54 } from "os";
|
|
502828
|
-
import { join as
|
|
503266
|
+
import { join as join186 } from "path";
|
|
502829
503267
|
function getInstallationPath2() {
|
|
502830
503268
|
const isWindows2 = env3.platform === "win32";
|
|
502831
503269
|
const homeDir = homedir54();
|
|
502832
503270
|
if (isWindows2) {
|
|
502833
|
-
const windowsPath =
|
|
503271
|
+
const windowsPath = join186(homeDir, ".local", "bin", "theus.exe");
|
|
502834
503272
|
return windowsPath.replace(/\//g, "\\");
|
|
502835
503273
|
}
|
|
502836
503274
|
return "~/.local/bin/theus";
|
|
@@ -503200,7 +503638,7 @@ async function setupTokenHandler(root2) {
|
|
|
503200
503638
|
gap: 1,
|
|
503201
503639
|
children: [
|
|
503202
503640
|
/* @__PURE__ */ jsx_runtime502.jsx(TheusBanner, {
|
|
503203
|
-
version: { VERSION: "0.2.
|
|
503641
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
503204
503642
|
}),
|
|
503205
503643
|
showAuthWarning && /* @__PURE__ */ jsx_runtime502.jsxs(ThemedBox_default, {
|
|
503206
503644
|
flexDirection: "column",
|
|
@@ -503369,7 +503807,7 @@ var exports_import2 = {};
|
|
|
503369
503807
|
__export(exports_import2, {
|
|
503370
503808
|
importHandler: () => importHandler
|
|
503371
503809
|
});
|
|
503372
|
-
import { readFile as
|
|
503810
|
+
import { readFile as readFile70 } from "fs/promises";
|
|
503373
503811
|
import { homedir as homedir55 } from "os";
|
|
503374
503812
|
import { resolve as resolve59 } from "path";
|
|
503375
503813
|
function resolvePath4(raw) {
|
|
@@ -503391,7 +503829,7 @@ async function importHandler(file2, options2 = {}) {
|
|
|
503391
503829
|
const abs = resolvePath4(file2);
|
|
503392
503830
|
let bytes;
|
|
503393
503831
|
try {
|
|
503394
|
-
bytes = await
|
|
503832
|
+
bytes = await readFile70(abs);
|
|
503395
503833
|
} catch {
|
|
503396
503834
|
process.stderr.write(`\u2717 No pude leer el archivo: ${abs}
|
|
503397
503835
|
`);
|
|
@@ -504785,7 +505223,7 @@ ${assistantAddendum}` : assistantAddendum;
|
|
|
504785
505223
|
}
|
|
504786
505224
|
}
|
|
504787
505225
|
logForDiagnosticsNoPII("info", "started", {
|
|
504788
|
-
version: { VERSION: "0.2.
|
|
505226
|
+
version: { VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
504789
505227
|
is_native_binary: isInBundledMode()
|
|
504790
505228
|
});
|
|
504791
505229
|
registerCleanup(async () => {
|
|
@@ -505653,7 +506091,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
505653
506091
|
pendingHookMessages
|
|
505654
506092
|
}, renderAndRun);
|
|
505655
506093
|
}
|
|
505656
|
-
}).version(`${{ VERSION: "0.2.
|
|
506094
|
+
}).version(`${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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");
|
|
505657
506095
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
505658
506096
|
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.");
|
|
505659
506097
|
if (canUserConfigureAdvisor()) {
|
|
@@ -506254,7 +506692,7 @@ if (false) {}
|
|
|
506254
506692
|
async function main2() {
|
|
506255
506693
|
const args = process.argv.slice(2);
|
|
506256
506694
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
506257
|
-
console.log(`${{ VERSION: "0.2.
|
|
506695
|
+
console.log(`${{ VERSION: "0.2.72", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)`);
|
|
506258
506696
|
return;
|
|
506259
506697
|
}
|
|
506260
506698
|
if (args[0] === "login" || args[0] === "signin" || args[0] === "entrar" || args[0] === "iniciar-sesion") {
|