theus-cli 0.2.71 → 0.2.73
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 +1199 -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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
|
|
245846
245846
|
if (macroPackageResult.success) {
|
|
245847
245847
|
removed++;
|
|
245848
245848
|
if (macroPackageResult.warning) {
|
|
@@ -256259,6 +256259,25 @@ var init_ConsoleOAuthFlow = __esm(() => {
|
|
|
256259
256259
|
var NOVEDADES;
|
|
256260
256260
|
var init_data = __esm(() => {
|
|
256261
256261
|
NOVEDADES = [
|
|
256262
|
+
{
|
|
256263
|
+
version: "v0.2.73",
|
|
256264
|
+
fecha: "2026-08-13",
|
|
256265
|
+
titulo: "Theus reconoce el trabajo de cuatro agentes de c\xF3digo distintos",
|
|
256266
|
+
puntos: [
|
|
256267
|
+
"Se suma la detecci\xF3n del historial de un cuarto asistente. Su documentaci\xF3n p\xFAblica dice que las carpetas se nombran con un c\xF3digo derivado de la ruta del proyecto, pero eso cambi\xF3 a principios de a\xF1o: ahora Theus consulta el \xEDndice de la propia herramienta, que guarda las rutas en claro, y va directo a lo tuyo sin enumerar tus dem\xE1s proyectos.",
|
|
256268
|
+
"Corregido un fallo en la lectura del historial que algunos asistentes dejan dentro del repositorio: los mensajes del sistema (\xABarchivo modificado\xBB, \xABcommit creado\xBB) se estaban leyendo como si los hubiera dicho el asistente."
|
|
256269
|
+
]
|
|
256270
|
+
},
|
|
256271
|
+
{
|
|
256272
|
+
version: "v0.2.72",
|
|
256273
|
+
fecha: "2026-08-13",
|
|
256274
|
+
titulo: "Theus reconoce m\xE1s agentes de c\xF3digo, y por fin puedes ver lo que recuerda",
|
|
256275
|
+
puntos: [
|
|
256276
|
+
"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.",
|
|
256277
|
+
"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.",
|
|
256278
|
+
"/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."
|
|
256279
|
+
]
|
|
256280
|
+
},
|
|
256262
256281
|
{
|
|
256263
256282
|
version: "v0.2.71",
|
|
256264
256283
|
fecha: "2026-08-13",
|
|
@@ -300111,9 +300130,9 @@ function getTheusEnvMetadata() {
|
|
|
300111
300130
|
};
|
|
300112
300131
|
}
|
|
300113
300132
|
function getBuildAgeMinutes() {
|
|
300114
|
-
if (!{ VERSION: "0.2.
|
|
300133
|
+
if (!{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
300134
|
return;
|
|
300116
|
-
const buildTime = new Date({ VERSION: "0.2.
|
|
300135
|
+
const buildTime = new Date({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
300136
|
if (isNaN(buildTime))
|
|
300118
300137
|
return;
|
|
300119
300138
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -318418,7 +318437,7 @@ function getSimpleDoingTasksSection() {
|
|
|
318418
318437
|
];
|
|
318419
318438
|
const userHelpSubitems = [
|
|
318420
318439
|
`/help: Get help with using Theus`,
|
|
318421
|
-
`To give feedback, users should ${{ VERSION: "0.2.
|
|
318440
|
+
`To give feedback, users should ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
318441
|
];
|
|
318423
318442
|
const items = [
|
|
318424
318443
|
`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 +329573,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
329554
329573
|
} catch {}
|
|
329555
329574
|
const data = {
|
|
329556
329575
|
trigger,
|
|
329557
|
-
version: { VERSION: "0.2.
|
|
329576
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
329577
|
platform: process.platform,
|
|
329559
329578
|
transcript,
|
|
329560
329579
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -329759,10 +329778,10 @@ Si el usuario indic\xF3 una duraci\xF3n, p\xE1sala en el par\xE1metro \`duration
|
|
|
329759
329778
|
|
|
329760
329779
|
// commands/issue/index.ts
|
|
329761
329780
|
function getCliVersion() {
|
|
329762
|
-
return { VERSION: "0.2.
|
|
329781
|
+
return { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
329782
|
}
|
|
329764
329783
|
function getIssuesExplainer() {
|
|
329765
|
-
return { VERSION: "0.2.
|
|
329784
|
+
return { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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
329785
|
}
|
|
329767
329786
|
function getActiveModelLabel() {
|
|
329768
329787
|
try {
|
|
@@ -332548,7 +332567,7 @@ function buildPrimarySection() {
|
|
|
332548
332567
|
});
|
|
332549
332568
|
return [{
|
|
332550
332569
|
label: "Version",
|
|
332551
|
-
value: { VERSION: "0.2.
|
|
332570
|
+
value: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
332571
|
}, {
|
|
332553
332572
|
label: "Session name",
|
|
332554
332573
|
value: nameValue
|
|
@@ -336364,7 +336383,7 @@ function Config({
|
|
|
336364
336383
|
}
|
|
336365
336384
|
})
|
|
336366
336385
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime189.jsx(ChannelDowngradeDialog, {
|
|
336367
|
-
currentVersion: { VERSION: "0.2.
|
|
336386
|
+
currentVersion: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
336387
|
onChoice: (choice) => {
|
|
336369
336388
|
setShowSubmenu(null);
|
|
336370
336389
|
setTabsHidden(false);
|
|
@@ -336376,7 +336395,7 @@ function Config({
|
|
|
336376
336395
|
autoUpdatesChannel: "stable"
|
|
336377
336396
|
};
|
|
336378
336397
|
if (choice === "stay") {
|
|
336379
|
-
newSettings.minimumVersion = { VERSION: "0.2.
|
|
336398
|
+
newSettings.minimumVersion = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
336399
|
}
|
|
336381
336400
|
updateSettingsForSource("userSettings", newSettings);
|
|
336382
336401
|
setSettingsData((prev_27) => ({
|
|
@@ -342753,6 +342772,79 @@ var init_MemoryUpdateNotification = __esm(() => {
|
|
|
342753
342772
|
jsx_runtime210 = __toESM(require_jsx_runtime(), 1);
|
|
342754
342773
|
});
|
|
342755
342774
|
|
|
342775
|
+
// services/knowledge/leerMemorias.ts
|
|
342776
|
+
var exports_leerMemorias = {};
|
|
342777
|
+
__export(exports_leerMemorias, {
|
|
342778
|
+
resumirRecuerdos: () => resumirRecuerdos,
|
|
342779
|
+
leerRecuerdos: () => leerRecuerdos
|
|
342780
|
+
});
|
|
342781
|
+
import { readFile as readFile44 } from "fs/promises";
|
|
342782
|
+
function comoLista(valor) {
|
|
342783
|
+
return Array.isArray(valor) ? valor.filter((x2) => typeof x2 === "string") : [];
|
|
342784
|
+
}
|
|
342785
|
+
function comoFecha(valor) {
|
|
342786
|
+
if (typeof valor === "number" && Number.isFinite(valor))
|
|
342787
|
+
return valor;
|
|
342788
|
+
if (typeof valor === "string") {
|
|
342789
|
+
const t = Date.parse(valor);
|
|
342790
|
+
if (!Number.isNaN(t))
|
|
342791
|
+
return t;
|
|
342792
|
+
}
|
|
342793
|
+
return;
|
|
342794
|
+
}
|
|
342795
|
+
async function leerRecuerdos(projectRoot) {
|
|
342796
|
+
let crudo;
|
|
342797
|
+
try {
|
|
342798
|
+
crudo = await readFile44(getGraphPath(projectRoot), "utf8");
|
|
342799
|
+
} catch {
|
|
342800
|
+
return [];
|
|
342801
|
+
}
|
|
342802
|
+
let nodos;
|
|
342803
|
+
try {
|
|
342804
|
+
const data = JSON.parse(crudo);
|
|
342805
|
+
nodos = Array.isArray(data.nodes) ? data.nodes : [];
|
|
342806
|
+
} catch {
|
|
342807
|
+
return [];
|
|
342808
|
+
}
|
|
342809
|
+
const salida = [];
|
|
342810
|
+
for (const nodo of nodos) {
|
|
342811
|
+
if (nodo?.type !== "memory")
|
|
342812
|
+
continue;
|
|
342813
|
+
const texto = typeof nodo.text === "string" ? nodo.text : "";
|
|
342814
|
+
const titulo = typeof nodo.label === "string" && nodo.label.trim() ? nodo.label : texto.slice(0, 80);
|
|
342815
|
+
if (!texto.trim() && !titulo.trim())
|
|
342816
|
+
continue;
|
|
342817
|
+
const etiquetas = comoLista(nodo.meta?.tags);
|
|
342818
|
+
const cuando = comoFecha(nodo.meta?.importedAt) ?? comoFecha(nodo.meta?.createdAt);
|
|
342819
|
+
salida.push({
|
|
342820
|
+
titulo,
|
|
342821
|
+
texto,
|
|
342822
|
+
etiquetas,
|
|
342823
|
+
importado: etiquetas.includes("imported"),
|
|
342824
|
+
...cuando !== undefined ? { cuando } : {}
|
|
342825
|
+
});
|
|
342826
|
+
}
|
|
342827
|
+
return salida.sort((a2, b) => {
|
|
342828
|
+
if (a2.importado !== b.importado)
|
|
342829
|
+
return a2.importado ? -1 : 1;
|
|
342830
|
+
return (b.cuando ?? 0) - (a2.cuando ?? 0);
|
|
342831
|
+
});
|
|
342832
|
+
}
|
|
342833
|
+
function resumirRecuerdos(recuerdos) {
|
|
342834
|
+
if (recuerdos.length === 0)
|
|
342835
|
+
return "Todav\xEDa no hay nada guardado de este proyecto.";
|
|
342836
|
+
const importados = recuerdos.filter((r) => r.importado).length;
|
|
342837
|
+
const total = recuerdos.length === 1 ? "1 recuerdo" : `${recuerdos.length} recuerdos`;
|
|
342838
|
+
if (importados === 0)
|
|
342839
|
+
return `${total} de este proyecto.`;
|
|
342840
|
+
if (importados === recuerdos.length)
|
|
342841
|
+
return `${total}, tra\xEDdos de otra IA.`;
|
|
342842
|
+
return `${total} \xB7 ${importados} tra\xEDdos de otra IA.`;
|
|
342843
|
+
}
|
|
342844
|
+
var init_leerMemorias = __esm(() => {
|
|
342845
|
+
init_paths2();
|
|
342846
|
+
});
|
|
342847
|
+
|
|
342756
342848
|
// utils/editor.ts
|
|
342757
342849
|
import {
|
|
342758
342850
|
spawn as spawn7,
|
|
@@ -343027,11 +343119,69 @@ ${editorHint}`, {
|
|
|
343027
343119
|
onDone(`Error al abrir el archivo de memoria: ${error40}`);
|
|
343028
343120
|
}
|
|
343029
343121
|
};
|
|
343122
|
+
const [vista, setVista] = React60.useState("menu");
|
|
343123
|
+
const [recuerdos, setRecuerdos] = React60.useState([]);
|
|
343124
|
+
React60.useEffect(() => {
|
|
343125
|
+
let vivo = true;
|
|
343126
|
+
Promise.resolve().then(() => (init_leerMemorias(), exports_leerMemorias)).then(async (m) => {
|
|
343127
|
+
const { getCwd: getCwd3 } = await Promise.resolve().then(() => (init_cwd2(), exports_cwd));
|
|
343128
|
+
const lista = await m.leerRecuerdos(getCwd3());
|
|
343129
|
+
if (vivo)
|
|
343130
|
+
setRecuerdos(lista);
|
|
343131
|
+
}).catch(() => {});
|
|
343132
|
+
return () => {
|
|
343133
|
+
vivo = false;
|
|
343134
|
+
};
|
|
343135
|
+
}, []);
|
|
343030
343136
|
const handleCancel = () => {
|
|
343031
343137
|
onDone("Edici\xF3n de memoria cancelada", {
|
|
343032
343138
|
display: "system"
|
|
343033
343139
|
});
|
|
343034
343140
|
};
|
|
343141
|
+
if (vista === "recuerdos") {
|
|
343142
|
+
return /* @__PURE__ */ jsx_runtime211.jsx(Dialog, {
|
|
343143
|
+
title: "Lo que Theus recuerda",
|
|
343144
|
+
onCancel: handleCancel,
|
|
343145
|
+
color: "remember",
|
|
343146
|
+
children: /* @__PURE__ */ jsx_runtime211.jsxs(ThemedBox_default, {
|
|
343147
|
+
flexDirection: "column",
|
|
343148
|
+
children: [
|
|
343149
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedText, {
|
|
343150
|
+
dimColor: true,
|
|
343151
|
+
children: resumirRecuerdos(recuerdos)
|
|
343152
|
+
}),
|
|
343153
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343154
|
+
flexDirection: "column",
|
|
343155
|
+
marginTop: 1,
|
|
343156
|
+
children: recuerdos.slice(0, 15).map((r, i3) => /* @__PURE__ */ jsx_runtime211.jsxs(ThemedText, {
|
|
343157
|
+
children: [
|
|
343158
|
+
r.importado ? "\u2193 " : "\xB7 ",
|
|
343159
|
+
r.titulo.slice(0, 90)
|
|
343160
|
+
]
|
|
343161
|
+
}, i3))
|
|
343162
|
+
}),
|
|
343163
|
+
recuerdos.length > 15 && /* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343164
|
+
marginTop: 1,
|
|
343165
|
+
children: /* @__PURE__ */ jsx_runtime211.jsxs(ThemedText, {
|
|
343166
|
+
dimColor: true,
|
|
343167
|
+
children: [
|
|
343168
|
+
"\u2026y ",
|
|
343169
|
+
recuerdos.length - 15,
|
|
343170
|
+
" m\xE1s."
|
|
343171
|
+
]
|
|
343172
|
+
})
|
|
343173
|
+
}),
|
|
343174
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343175
|
+
marginTop: 1,
|
|
343176
|
+
children: /* @__PURE__ */ jsx_runtime211.jsx(ThemedText, {
|
|
343177
|
+
dimColor: true,
|
|
343178
|
+
children: "Los marcados con \u2193 vinieron de otra IA. Theus los usa al responder sobre este proyecto."
|
|
343179
|
+
})
|
|
343180
|
+
})
|
|
343181
|
+
]
|
|
343182
|
+
})
|
|
343183
|
+
});
|
|
343184
|
+
}
|
|
343035
343185
|
return /* @__PURE__ */ jsx_runtime211.jsx(Dialog, {
|
|
343036
343186
|
title: "Memoria",
|
|
343037
343187
|
onCancel: handleCancel,
|
|
@@ -343039,7 +343189,29 @@ ${editorHint}`, {
|
|
|
343039
343189
|
children: /* @__PURE__ */ jsx_runtime211.jsxs(ThemedBox_default, {
|
|
343040
343190
|
flexDirection: "column",
|
|
343041
343191
|
children: [
|
|
343042
|
-
/* @__PURE__ */ jsx_runtime211.jsx(
|
|
343192
|
+
/* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343193
|
+
flexDirection: "column",
|
|
343194
|
+
marginBottom: 1,
|
|
343195
|
+
children: /* @__PURE__ */ jsx_runtime211.jsx(ThemedText, {
|
|
343196
|
+
dimColor: true,
|
|
343197
|
+
children: resumirRecuerdos(recuerdos)
|
|
343198
|
+
})
|
|
343199
|
+
}),
|
|
343200
|
+
recuerdos.length > 0 && /* @__PURE__ */ jsx_runtime211.jsx(ThemedBox_default, {
|
|
343201
|
+
marginBottom: 1,
|
|
343202
|
+
children: /* @__PURE__ */ jsx_runtime211.jsx(Select, {
|
|
343203
|
+
options: [{
|
|
343204
|
+
label: `Ver lo que Theus recuerda (${recuerdos.length})`,
|
|
343205
|
+
value: "recuerdos"
|
|
343206
|
+
}, {
|
|
343207
|
+
label: "Editar los archivos de memoria",
|
|
343208
|
+
value: "archivos"
|
|
343209
|
+
}],
|
|
343210
|
+
onChange: (v) => v === "recuerdos" ? setVista("recuerdos") : setVista("archivos"),
|
|
343211
|
+
onCancel: handleCancel
|
|
343212
|
+
})
|
|
343213
|
+
}),
|
|
343214
|
+
(vista === "archivos" || recuerdos.length === 0) && /* @__PURE__ */ jsx_runtime211.jsx(React60.Suspense, {
|
|
343043
343215
|
fallback: null,
|
|
343044
343216
|
children: /* @__PURE__ */ jsx_runtime211.jsx(MemoryFileSelector, {
|
|
343045
343217
|
onSelect: handleSelectMemoryFile,
|
|
@@ -343053,7 +343225,7 @@ ${editorHint}`, {
|
|
|
343053
343225
|
children: [
|
|
343054
343226
|
"M\xE1s informaci\xF3n: ",
|
|
343055
343227
|
/* @__PURE__ */ jsx_runtime211.jsx(Link, {
|
|
343056
|
-
url: "https://docs.theus.pe/docs/
|
|
343228
|
+
url: "https://docs.theus.pe/docs/memoria"
|
|
343057
343229
|
})
|
|
343058
343230
|
]
|
|
343059
343231
|
})
|
|
@@ -343074,6 +343246,8 @@ var init_memory2 = __esm(() => {
|
|
|
343074
343246
|
init_MemoryFileSelector();
|
|
343075
343247
|
init_MemoryUpdateNotification();
|
|
343076
343248
|
init_ink2();
|
|
343249
|
+
init_select();
|
|
343250
|
+
init_leerMemorias();
|
|
343077
343251
|
init_theusmd();
|
|
343078
343252
|
init_envUtils();
|
|
343079
343253
|
init_errors();
|
|
@@ -343580,7 +343754,7 @@ function HelpV2(t0) {
|
|
|
343580
343754
|
let t6;
|
|
343581
343755
|
if ($2[31] !== tabs) {
|
|
343582
343756
|
t6 = /* @__PURE__ */ jsx_runtime215.jsx(Tabs, {
|
|
343583
|
-
title: `Theus v${{ VERSION: "0.2.
|
|
343757
|
+
title: `Theus v${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
343758
|
color: "professionalBlue",
|
|
343585
343759
|
defaultTab: "general",
|
|
343586
343760
|
children: tabs
|
|
@@ -350583,7 +350757,7 @@ var init_AddMarketplace = __esm(() => {
|
|
|
350583
350757
|
|
|
350584
350758
|
// utils/plugins/installCounts.ts
|
|
350585
350759
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
350586
|
-
import { readFile as
|
|
350760
|
+
import { readFile as readFile45, rename as rename7, unlink as unlink18, writeFile as writeFile44 } from "fs/promises";
|
|
350587
350761
|
import { join as join128 } from "path";
|
|
350588
350762
|
function getInstallCountsCachePath() {
|
|
350589
350763
|
return join128(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
@@ -350591,7 +350765,7 @@ function getInstallCountsCachePath() {
|
|
|
350591
350765
|
async function loadInstallCountsCache() {
|
|
350592
350766
|
const cachePath2 = getInstallCountsCachePath();
|
|
350593
350767
|
try {
|
|
350594
|
-
const content = await
|
|
350768
|
+
const content = await readFile45(cachePath2, { encoding: "utf-8" });
|
|
350595
350769
|
const parsed = jsonParse(content);
|
|
350596
350770
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("fetchedAt" in parsed) || !("counts" in parsed)) {
|
|
350597
350771
|
logForDebugging("Install counts cache has invalid structure");
|
|
@@ -355058,7 +355232,7 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
355058
355232
|
|
|
355059
355233
|
// utils/plugins/pluginFlagging.ts
|
|
355060
355234
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
355061
|
-
import { readFile as
|
|
355235
|
+
import { readFile as readFile46, rename as rename8, unlink as unlink19, writeFile as writeFile45 } from "fs/promises";
|
|
355062
355236
|
import { join as join130 } from "path";
|
|
355063
355237
|
function getFlaggedPluginsPath() {
|
|
355064
355238
|
return join130(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
@@ -355085,7 +355259,7 @@ function parsePluginsData(content) {
|
|
|
355085
355259
|
}
|
|
355086
355260
|
async function readFromDisk() {
|
|
355087
355261
|
try {
|
|
355088
|
-
const content = await
|
|
355262
|
+
const content = await readFile46(getFlaggedPluginsPath(), {
|
|
355089
355263
|
encoding: "utf-8"
|
|
355090
355264
|
});
|
|
355091
355265
|
return parsePluginsData(content);
|
|
@@ -358354,7 +358528,7 @@ function parsePluginArgs(args) {
|
|
|
358354
358528
|
}
|
|
358355
358529
|
|
|
358356
358530
|
// utils/plugins/validatePlugin.ts
|
|
358357
|
-
import { readdir as readdir28, readFile as
|
|
358531
|
+
import { readdir as readdir28, readFile as readFile48, stat as stat42 } from "fs/promises";
|
|
358358
358532
|
import * as path16 from "path";
|
|
358359
358533
|
function detectManifestType(filePath) {
|
|
358360
358534
|
const fileName = path16.basename(filePath);
|
|
@@ -358394,7 +358568,7 @@ async function validatePluginManifest(filePath) {
|
|
|
358394
358568
|
const absolutePath = path16.resolve(filePath);
|
|
358395
358569
|
let content;
|
|
358396
358570
|
try {
|
|
358397
|
-
content = await
|
|
358571
|
+
content = await readFile48(absolutePath, { encoding: "utf-8" });
|
|
358398
358572
|
} catch (error40) {
|
|
358399
358573
|
const code = getErrnoCode(error40);
|
|
358400
358574
|
let message;
|
|
@@ -358518,7 +358692,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
358518
358692
|
const absolutePath = path16.resolve(filePath);
|
|
358519
358693
|
let content;
|
|
358520
358694
|
try {
|
|
358521
|
-
content = await
|
|
358695
|
+
content = await readFile48(absolutePath, { encoding: "utf-8" });
|
|
358522
358696
|
} catch (error40) {
|
|
358523
358697
|
const code = getErrnoCode(error40);
|
|
358524
358698
|
let message;
|
|
@@ -358604,7 +358778,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
358604
358778
|
const pluginJsonPath = path16.join(marketplaceRoot, entry.source, ".theus-plugin", "plugin.json");
|
|
358605
358779
|
let manifestVersion;
|
|
358606
358780
|
try {
|
|
358607
|
-
const raw = await
|
|
358781
|
+
const raw = await readFile48(pluginJsonPath, { encoding: "utf-8" });
|
|
358608
358782
|
const parsed2 = jsonParse(raw);
|
|
358609
358783
|
if (typeof parsed2.version === "string") {
|
|
358610
358784
|
manifestVersion = parsed2.version;
|
|
@@ -358721,7 +358895,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
358721
358895
|
async function validateHooksJson(filePath) {
|
|
358722
358896
|
let content;
|
|
358723
358897
|
try {
|
|
358724
|
-
content = await
|
|
358898
|
+
content = await readFile48(filePath, { encoding: "utf-8" });
|
|
358725
358899
|
} catch (e) {
|
|
358726
358900
|
const code = getErrnoCode(e);
|
|
358727
358901
|
if (code === "ENOENT") {
|
|
@@ -358814,7 +358988,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
358814
358988
|
for (const filePath of files) {
|
|
358815
358989
|
let content;
|
|
358816
358990
|
try {
|
|
358817
|
-
content = await
|
|
358991
|
+
content = await readFile48(filePath, { encoding: "utf-8" });
|
|
358818
358992
|
} catch (e) {
|
|
358819
358993
|
if (isENOENT(e))
|
|
358820
358994
|
continue;
|
|
@@ -358883,7 +359057,7 @@ async function validateManifest2(filePath) {
|
|
|
358883
359057
|
return validateMarketplaceManifest(filePath);
|
|
358884
359058
|
case "unknown": {
|
|
358885
359059
|
try {
|
|
358886
|
-
const content = await
|
|
359060
|
+
const content = await readFile48(absolutePath, { encoding: "utf-8" });
|
|
358887
359061
|
const parsed = jsonParse(content);
|
|
358888
359062
|
if (Array.isArray(parsed.plugins)) {
|
|
358889
359063
|
return validateMarketplaceManifest(filePath);
|
|
@@ -362184,7 +362358,7 @@ function Onboarding({
|
|
|
362184
362358
|
flexDirection: "column",
|
|
362185
362359
|
children: [
|
|
362186
362360
|
/* @__PURE__ */ jsx_runtime250.jsx(TheusBanner, {
|
|
362187
|
-
version: { VERSION: "0.2.
|
|
362361
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
362362
|
}),
|
|
362189
362363
|
/* @__PURE__ */ jsx_runtime250.jsxs(ThemedBox_default, {
|
|
362190
362364
|
flexDirection: "column",
|
|
@@ -367571,7 +367745,7 @@ var init_Messages = __esm(() => {
|
|
|
367571
367745
|
let t1;
|
|
367572
367746
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
367573
367747
|
t1 = /* @__PURE__ */ jsx_runtime263.jsx(TheusSessionHeader, {
|
|
367574
|
-
version: { VERSION: "0.2.
|
|
367748
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
367749
|
});
|
|
367576
367750
|
$2[0] = t1;
|
|
367577
367751
|
} else {
|
|
@@ -377281,9 +377455,444 @@ var init_claudeCode = __esm(() => {
|
|
|
377281
377455
|
};
|
|
377282
377456
|
});
|
|
377283
377457
|
|
|
377284
|
-
// services/import/detect/sources/
|
|
377285
|
-
import {
|
|
377458
|
+
// services/import/detect/sources/codex.ts
|
|
377459
|
+
import { open as open15, readdir as readdir30, stat as stat44 } from "fs/promises";
|
|
377286
377460
|
import { join as join134 } from "path";
|
|
377461
|
+
function directorioCodex(entorno) {
|
|
377462
|
+
const override = entorno.env.CODEX_HOME?.trim();
|
|
377463
|
+
return override && override.length > 0 ? override : join134(entorno.home, ".codex");
|
|
377464
|
+
}
|
|
377465
|
+
async function indiceMasReciente(dirCodex) {
|
|
377466
|
+
let entradas;
|
|
377467
|
+
try {
|
|
377468
|
+
entradas = await readdir30(dirCodex);
|
|
377469
|
+
} catch {
|
|
377470
|
+
return null;
|
|
377471
|
+
}
|
|
377472
|
+
let mejor = null;
|
|
377473
|
+
for (const nombre of entradas) {
|
|
377474
|
+
const m = /^state_(\d+)\.sqlite$/.exec(nombre);
|
|
377475
|
+
if (!m?.[1])
|
|
377476
|
+
continue;
|
|
377477
|
+
const n2 = Number(m[1]);
|
|
377478
|
+
if (!mejor || n2 > mejor.n)
|
|
377479
|
+
mejor = { nombre, n: n2 };
|
|
377480
|
+
}
|
|
377481
|
+
return mejor ? join134(dirCodex, mejor.nombre) : null;
|
|
377482
|
+
}
|
|
377483
|
+
async function hilosDelProyecto(indice, proyecto) {
|
|
377484
|
+
try {
|
|
377485
|
+
const { Database } = await import("bun:sqlite");
|
|
377486
|
+
const db = new Database(indice, { readonly: true });
|
|
377487
|
+
try {
|
|
377488
|
+
const filas = db.query(`SELECT rollout_path, updated_at FROM ${TABLA}
|
|
377489
|
+
WHERE cwd = ? AND (archived IS NULL OR archived = 0)
|
|
377490
|
+
ORDER BY updated_at DESC`).all(proyecto);
|
|
377491
|
+
return filas.map((f) => typeof f.rollout_path === "string" ? f.rollout_path : "").filter(Boolean);
|
|
377492
|
+
} finally {
|
|
377493
|
+
db.close();
|
|
377494
|
+
}
|
|
377495
|
+
} catch {
|
|
377496
|
+
return [];
|
|
377497
|
+
}
|
|
377498
|
+
}
|
|
377499
|
+
function textoDePayload(payload, maxChars) {
|
|
377500
|
+
if (!payload || typeof payload !== "object")
|
|
377501
|
+
return "";
|
|
377502
|
+
const p = payload;
|
|
377503
|
+
const contenido = p.content ?? p.message;
|
|
377504
|
+
if (typeof contenido === "string")
|
|
377505
|
+
return contenido.slice(0, maxChars);
|
|
377506
|
+
if (!Array.isArray(contenido))
|
|
377507
|
+
return "";
|
|
377508
|
+
const partes = [];
|
|
377509
|
+
for (const bloque of contenido) {
|
|
377510
|
+
if (!bloque || typeof bloque !== "object")
|
|
377511
|
+
continue;
|
|
377512
|
+
const b = bloque;
|
|
377513
|
+
if (typeof b.text === "string" && b.text.trim())
|
|
377514
|
+
partes.push(b.text);
|
|
377515
|
+
}
|
|
377516
|
+
return partes.join(`
|
|
377517
|
+
`).slice(0, maxChars);
|
|
377518
|
+
}
|
|
377519
|
+
var TABLA = "threads", detectorCodex;
|
|
377520
|
+
var init_codex = __esm(() => {
|
|
377521
|
+
detectorCodex = {
|
|
377522
|
+
herramienta: "codex",
|
|
377523
|
+
async explorar(entorno) {
|
|
377524
|
+
const dir = directorioCodex(entorno);
|
|
377525
|
+
const indice = await indiceMasReciente(dir);
|
|
377526
|
+
if (!indice)
|
|
377527
|
+
return null;
|
|
377528
|
+
const rutas = await hilosDelProyecto(indice, entorno.proyecto);
|
|
377529
|
+
if (rutas.length === 0)
|
|
377530
|
+
return null;
|
|
377531
|
+
let bytes = 0;
|
|
377532
|
+
let masReciente = 0;
|
|
377533
|
+
for (const ruta of rutas) {
|
|
377534
|
+
try {
|
|
377535
|
+
const info = await stat44(ruta);
|
|
377536
|
+
bytes += info.size;
|
|
377537
|
+
if (info.mtimeMs > masReciente)
|
|
377538
|
+
masReciente = info.mtimeMs;
|
|
377539
|
+
} catch {}
|
|
377540
|
+
}
|
|
377541
|
+
if (masReciente === 0)
|
|
377542
|
+
return null;
|
|
377543
|
+
return {
|
|
377544
|
+
herramienta: "codex",
|
|
377545
|
+
etiqueta: "Otro agente de c\xF3digo que usaste aqu\xED",
|
|
377546
|
+
ruta: indice,
|
|
377547
|
+
sesiones: rutas.length,
|
|
377548
|
+
masReciente,
|
|
377549
|
+
bytes,
|
|
377550
|
+
proyectoConsultado: entorno.proyecto
|
|
377551
|
+
};
|
|
377552
|
+
},
|
|
377553
|
+
async leer(fuente, limites) {
|
|
377554
|
+
const proyecto = fuente.proyectoConsultado;
|
|
377555
|
+
if (!proyecto)
|
|
377556
|
+
return [];
|
|
377557
|
+
const rutas = await hilosDelProyecto(fuente.ruta, proyecto);
|
|
377558
|
+
const conFecha = [];
|
|
377559
|
+
for (const ruta of rutas) {
|
|
377560
|
+
try {
|
|
377561
|
+
const info = await stat44(ruta);
|
|
377562
|
+
conFecha.push({ ruta, mtime: info.mtimeMs });
|
|
377563
|
+
} catch {}
|
|
377564
|
+
}
|
|
377565
|
+
conFecha.sort((a2, b) => b.mtime - a2.mtime);
|
|
377566
|
+
const salida = [];
|
|
377567
|
+
for (const { ruta, mtime } of conFecha.slice(0, limites.maxSesiones)) {
|
|
377568
|
+
let crudo;
|
|
377569
|
+
try {
|
|
377570
|
+
const fh = await open15(ruta, "r");
|
|
377571
|
+
try {
|
|
377572
|
+
const buf = Buffer.alloc(limites.maxBytesPorSesion);
|
|
377573
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
377574
|
+
crudo = buf.subarray(0, bytesRead).toString("utf8");
|
|
377575
|
+
} finally {
|
|
377576
|
+
await fh.close();
|
|
377577
|
+
}
|
|
377578
|
+
} catch {
|
|
377579
|
+
continue;
|
|
377580
|
+
}
|
|
377581
|
+
const mensajes = [];
|
|
377582
|
+
for (const linea of crudo.split(`
|
|
377583
|
+
`)) {
|
|
377584
|
+
if (!linea.trim())
|
|
377585
|
+
continue;
|
|
377586
|
+
let obj;
|
|
377587
|
+
try {
|
|
377588
|
+
obj = JSON.parse(linea);
|
|
377589
|
+
} catch {
|
|
377590
|
+
continue;
|
|
377591
|
+
}
|
|
377592
|
+
if (obj.type !== "response_item")
|
|
377593
|
+
continue;
|
|
377594
|
+
const rol = obj.payload?.role;
|
|
377595
|
+
if (rol !== "user" && rol !== "assistant")
|
|
377596
|
+
continue;
|
|
377597
|
+
const text = textoDePayload(obj.payload, limites.maxCharsPorMensaje);
|
|
377598
|
+
if (!text.trim())
|
|
377599
|
+
continue;
|
|
377600
|
+
mensajes.push({ role: rol, text });
|
|
377601
|
+
if (mensajes.length >= limites.maxMensajes)
|
|
377602
|
+
break;
|
|
377603
|
+
}
|
|
377604
|
+
if (mensajes.length > 0) {
|
|
377605
|
+
salida.push({
|
|
377606
|
+
titulo: `Sesi\xF3n del ${new Date(mtime).toISOString().slice(0, 10)}`,
|
|
377607
|
+
creadaEn: mtime,
|
|
377608
|
+
mensajes
|
|
377609
|
+
});
|
|
377610
|
+
}
|
|
377611
|
+
}
|
|
377612
|
+
return salida;
|
|
377613
|
+
}
|
|
377614
|
+
};
|
|
377615
|
+
});
|
|
377616
|
+
|
|
377617
|
+
// services/import/detect/sources/aider.ts
|
|
377618
|
+
import { open as open16, stat as stat45 } from "fs/promises";
|
|
377619
|
+
import { dirname as dirname57, join as join135 } from "path";
|
|
377620
|
+
import { existsSync as existsSync20 } from "fs";
|
|
377621
|
+
function raizDelRepo(desde) {
|
|
377622
|
+
let actual = desde;
|
|
377623
|
+
for (let i3 = 0;i3 < 40; i3++) {
|
|
377624
|
+
if (existsSync20(join135(actual, ".git")))
|
|
377625
|
+
return actual;
|
|
377626
|
+
const padre = dirname57(actual);
|
|
377627
|
+
if (padre === actual)
|
|
377628
|
+
break;
|
|
377629
|
+
actual = padre;
|
|
377630
|
+
}
|
|
377631
|
+
return desde;
|
|
377632
|
+
}
|
|
377633
|
+
function parsearHistorialAider(crudo, maxCharsPorMensaje) {
|
|
377634
|
+
const mensajes = [];
|
|
377635
|
+
let rolActual = null;
|
|
377636
|
+
let buffer = [];
|
|
377637
|
+
const volcar = () => {
|
|
377638
|
+
if (!rolActual) {
|
|
377639
|
+
buffer = [];
|
|
377640
|
+
return;
|
|
377641
|
+
}
|
|
377642
|
+
const texto = buffer.join(`
|
|
377643
|
+
`).trim();
|
|
377644
|
+
const soloComando = rolActual === "user" && texto.startsWith("/") && !texto.includes(`
|
|
377645
|
+
`);
|
|
377646
|
+
if (texto && !soloComando) {
|
|
377647
|
+
mensajes.push({ role: rolActual, text: texto.slice(0, maxCharsPorMensaje) });
|
|
377648
|
+
}
|
|
377649
|
+
buffer = [];
|
|
377650
|
+
};
|
|
377651
|
+
for (const linea of crudo.split(`
|
|
377652
|
+
`)) {
|
|
377653
|
+
if (linea.startsWith("# ")) {
|
|
377654
|
+
volcar();
|
|
377655
|
+
rolActual = null;
|
|
377656
|
+
continue;
|
|
377657
|
+
}
|
|
377658
|
+
if (linea.startsWith("> ")) {
|
|
377659
|
+
volcar();
|
|
377660
|
+
rolActual = null;
|
|
377661
|
+
continue;
|
|
377662
|
+
}
|
|
377663
|
+
if (linea.startsWith("#### ")) {
|
|
377664
|
+
if (rolActual !== "user")
|
|
377665
|
+
volcar();
|
|
377666
|
+
rolActual = "user";
|
|
377667
|
+
buffer.push(linea.slice(5));
|
|
377668
|
+
continue;
|
|
377669
|
+
}
|
|
377670
|
+
if (linea.trim() === "" && buffer.length === 0)
|
|
377671
|
+
continue;
|
|
377672
|
+
if (rolActual === "user") {
|
|
377673
|
+
volcar();
|
|
377674
|
+
rolActual = "assistant";
|
|
377675
|
+
} else if (rolActual === null) {
|
|
377676
|
+
if (linea.trim() === "")
|
|
377677
|
+
continue;
|
|
377678
|
+
rolActual = "assistant";
|
|
377679
|
+
}
|
|
377680
|
+
buffer.push(linea);
|
|
377681
|
+
}
|
|
377682
|
+
volcar();
|
|
377683
|
+
return mensajes;
|
|
377684
|
+
}
|
|
377685
|
+
var FICHERO = ".aider.chat.history.md", detectorAider;
|
|
377686
|
+
var init_aider = __esm(() => {
|
|
377687
|
+
detectorAider = {
|
|
377688
|
+
herramienta: "aider",
|
|
377689
|
+
async explorar(entorno) {
|
|
377690
|
+
const ruta = join135(raizDelRepo(entorno.proyecto), FICHERO);
|
|
377691
|
+
let info;
|
|
377692
|
+
try {
|
|
377693
|
+
info = await stat45(ruta);
|
|
377694
|
+
} catch {
|
|
377695
|
+
return null;
|
|
377696
|
+
}
|
|
377697
|
+
if (!info.isFile() || info.size === 0)
|
|
377698
|
+
return null;
|
|
377699
|
+
return {
|
|
377700
|
+
herramienta: "aider",
|
|
377701
|
+
etiqueta: "Historial de otro asistente en este repo",
|
|
377702
|
+
ruta,
|
|
377703
|
+
sesiones: 1,
|
|
377704
|
+
masReciente: info.mtimeMs,
|
|
377705
|
+
bytes: info.size,
|
|
377706
|
+
proyectoConsultado: entorno.proyecto
|
|
377707
|
+
};
|
|
377708
|
+
},
|
|
377709
|
+
async leer(fuente, limites) {
|
|
377710
|
+
let crudo;
|
|
377711
|
+
try {
|
|
377712
|
+
const fh = await open16(fuente.ruta, "r");
|
|
377713
|
+
try {
|
|
377714
|
+
const buf = Buffer.alloc(limites.maxBytesPorSesion);
|
|
377715
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
377716
|
+
crudo = buf.subarray(0, bytesRead).toString("utf8");
|
|
377717
|
+
} finally {
|
|
377718
|
+
await fh.close();
|
|
377719
|
+
}
|
|
377720
|
+
} catch {
|
|
377721
|
+
return [];
|
|
377722
|
+
}
|
|
377723
|
+
const mensajes = parsearHistorialAider(crudo, limites.maxCharsPorMensaje).slice(0, limites.maxMensajes);
|
|
377724
|
+
if (mensajes.length === 0)
|
|
377725
|
+
return [];
|
|
377726
|
+
return [
|
|
377727
|
+
{
|
|
377728
|
+
titulo: "Historial en este repositorio",
|
|
377729
|
+
creadaEn: fuente.masReciente,
|
|
377730
|
+
mensajes
|
|
377731
|
+
}
|
|
377732
|
+
];
|
|
377733
|
+
}
|
|
377734
|
+
};
|
|
377735
|
+
});
|
|
377736
|
+
|
|
377737
|
+
// services/import/detect/sources/geminiCli.ts
|
|
377738
|
+
import { open as open17, readdir as readdir31, readFile as readFile49, stat as stat46 } from "fs/promises";
|
|
377739
|
+
import { join as join136 } from "path";
|
|
377740
|
+
function directorioGemini(entorno) {
|
|
377741
|
+
const override = entorno.env.GEMINI_CLI_HOME?.trim();
|
|
377742
|
+
const home = override && override.length > 0 ? override : entorno.home;
|
|
377743
|
+
return join136(home, CARPETA);
|
|
377744
|
+
}
|
|
377745
|
+
async function slugDelIndice(dirGemini, proyecto) {
|
|
377746
|
+
let crudo;
|
|
377747
|
+
try {
|
|
377748
|
+
crudo = await readFile49(join136(dirGemini, "projects.json"), "utf8");
|
|
377749
|
+
} catch {
|
|
377750
|
+
return null;
|
|
377751
|
+
}
|
|
377752
|
+
try {
|
|
377753
|
+
const data = JSON.parse(crudo);
|
|
377754
|
+
const mapa = data.projects;
|
|
377755
|
+
if (!mapa || typeof mapa !== "object")
|
|
377756
|
+
return null;
|
|
377757
|
+
const slug = mapa[proyecto];
|
|
377758
|
+
return typeof slug === "string" && slug ? slug : null;
|
|
377759
|
+
} catch {
|
|
377760
|
+
return null;
|
|
377761
|
+
}
|
|
377762
|
+
}
|
|
377763
|
+
function textoDeContenido2(contenido, maxChars) {
|
|
377764
|
+
if (typeof contenido === "string")
|
|
377765
|
+
return contenido.slice(0, maxChars);
|
|
377766
|
+
if (!Array.isArray(contenido))
|
|
377767
|
+
return "";
|
|
377768
|
+
const partes = [];
|
|
377769
|
+
for (const parte of contenido) {
|
|
377770
|
+
if (typeof parte === "string") {
|
|
377771
|
+
partes.push(parte);
|
|
377772
|
+
continue;
|
|
377773
|
+
}
|
|
377774
|
+
if (!parte || typeof parte !== "object")
|
|
377775
|
+
continue;
|
|
377776
|
+
const p = parte;
|
|
377777
|
+
if (typeof p.text === "string" && p.text.trim())
|
|
377778
|
+
partes.push(p.text);
|
|
377779
|
+
}
|
|
377780
|
+
return partes.join(`
|
|
377781
|
+
`).slice(0, maxChars);
|
|
377782
|
+
}
|
|
377783
|
+
async function carpetaDeChats(entorno) {
|
|
377784
|
+
const dir = directorioGemini(entorno);
|
|
377785
|
+
const slug = await slugDelIndice(dir, entorno.proyecto);
|
|
377786
|
+
if (!slug)
|
|
377787
|
+
return null;
|
|
377788
|
+
return join136(dir, "tmp", slug, "chats");
|
|
377789
|
+
}
|
|
377790
|
+
var CARPETA = ".gemini", detectorGeminiCli;
|
|
377791
|
+
var init_geminiCli = __esm(() => {
|
|
377792
|
+
detectorGeminiCli = {
|
|
377793
|
+
herramienta: "gemini-cli",
|
|
377794
|
+
async explorar(entorno) {
|
|
377795
|
+
const ruta = await carpetaDeChats(entorno);
|
|
377796
|
+
if (!ruta)
|
|
377797
|
+
return null;
|
|
377798
|
+
let entradas;
|
|
377799
|
+
try {
|
|
377800
|
+
entradas = await readdir31(ruta);
|
|
377801
|
+
} catch {
|
|
377802
|
+
return null;
|
|
377803
|
+
}
|
|
377804
|
+
const sesiones = entradas.filter((n2) => n2.endsWith(".jsonl") || n2.endsWith(".json"));
|
|
377805
|
+
if (sesiones.length === 0)
|
|
377806
|
+
return null;
|
|
377807
|
+
let bytes = 0;
|
|
377808
|
+
let masReciente = 0;
|
|
377809
|
+
for (const nombre of sesiones) {
|
|
377810
|
+
try {
|
|
377811
|
+
const info = await stat46(join136(ruta, nombre));
|
|
377812
|
+
bytes += info.size;
|
|
377813
|
+
if (info.mtimeMs > masReciente)
|
|
377814
|
+
masReciente = info.mtimeMs;
|
|
377815
|
+
} catch {}
|
|
377816
|
+
}
|
|
377817
|
+
return {
|
|
377818
|
+
herramienta: "gemini-cli",
|
|
377819
|
+
etiqueta: "Otro asistente que usaste en esta carpeta",
|
|
377820
|
+
ruta,
|
|
377821
|
+
sesiones: sesiones.length,
|
|
377822
|
+
masReciente,
|
|
377823
|
+
bytes,
|
|
377824
|
+
proyectoConsultado: entorno.proyecto
|
|
377825
|
+
};
|
|
377826
|
+
},
|
|
377827
|
+
async leer(fuente, limites) {
|
|
377828
|
+
let entradas;
|
|
377829
|
+
try {
|
|
377830
|
+
entradas = await readdir31(fuente.ruta);
|
|
377831
|
+
} catch {
|
|
377832
|
+
return [];
|
|
377833
|
+
}
|
|
377834
|
+
const ficheros = [];
|
|
377835
|
+
for (const nombre of entradas) {
|
|
377836
|
+
if (!nombre.endsWith(".jsonl"))
|
|
377837
|
+
continue;
|
|
377838
|
+
try {
|
|
377839
|
+
const info = await stat46(join136(fuente.ruta, nombre));
|
|
377840
|
+
ficheros.push({ nombre, mtime: info.mtimeMs });
|
|
377841
|
+
} catch {}
|
|
377842
|
+
}
|
|
377843
|
+
ficheros.sort((a2, b) => b.mtime - a2.mtime);
|
|
377844
|
+
const salida = [];
|
|
377845
|
+
for (const { nombre, mtime } of ficheros.slice(0, limites.maxSesiones)) {
|
|
377846
|
+
let crudo;
|
|
377847
|
+
try {
|
|
377848
|
+
const fh = await open17(join136(fuente.ruta, nombre), "r");
|
|
377849
|
+
try {
|
|
377850
|
+
const buf = Buffer.alloc(limites.maxBytesPorSesion);
|
|
377851
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
377852
|
+
crudo = buf.subarray(0, bytesRead).toString("utf8");
|
|
377853
|
+
} finally {
|
|
377854
|
+
await fh.close();
|
|
377855
|
+
}
|
|
377856
|
+
} catch {
|
|
377857
|
+
continue;
|
|
377858
|
+
}
|
|
377859
|
+
const mensajes = [];
|
|
377860
|
+
for (const linea of crudo.split(`
|
|
377861
|
+
`)) {
|
|
377862
|
+
if (!linea.trim())
|
|
377863
|
+
continue;
|
|
377864
|
+
let obj;
|
|
377865
|
+
try {
|
|
377866
|
+
obj = JSON.parse(linea);
|
|
377867
|
+
} catch {
|
|
377868
|
+
continue;
|
|
377869
|
+
}
|
|
377870
|
+
const rol = obj.type === "user" ? "user" : obj.type === "gemini" ? "assistant" : null;
|
|
377871
|
+
if (!rol)
|
|
377872
|
+
continue;
|
|
377873
|
+
const text = textoDeContenido2(obj.content, limites.maxCharsPorMensaje);
|
|
377874
|
+
if (!text.trim())
|
|
377875
|
+
continue;
|
|
377876
|
+
mensajes.push({ role: rol, text });
|
|
377877
|
+
if (mensajes.length >= limites.maxMensajes)
|
|
377878
|
+
break;
|
|
377879
|
+
}
|
|
377880
|
+
if (mensajes.length > 0) {
|
|
377881
|
+
salida.push({
|
|
377882
|
+
titulo: `Sesi\xF3n del ${new Date(mtime).toISOString().slice(0, 10)}`,
|
|
377883
|
+
creadaEn: mtime,
|
|
377884
|
+
mensajes
|
|
377885
|
+
});
|
|
377886
|
+
}
|
|
377887
|
+
}
|
|
377888
|
+
return salida;
|
|
377889
|
+
}
|
|
377890
|
+
};
|
|
377891
|
+
});
|
|
377892
|
+
|
|
377893
|
+
// services/import/detect/sources/memoriaAgente.ts
|
|
377894
|
+
import { readdir as readdir32, readFile as readFile50, stat as stat47 } from "fs/promises";
|
|
377895
|
+
import { join as join137 } from "path";
|
|
377287
377896
|
function parsearFicheroMemoria(crudo, nombreFichero) {
|
|
377288
377897
|
const texto = crudo.trim();
|
|
377289
377898
|
if (!texto)
|
|
@@ -377311,10 +377920,10 @@ function parsearFicheroMemoria(crudo, nombreFichero) {
|
|
|
377311
377920
|
return { titulo, texto: cuerpo, ...categoria ? { categoria } : {} };
|
|
377312
377921
|
}
|
|
377313
377922
|
async function explorarMemoria(entorno) {
|
|
377314
|
-
const ruta =
|
|
377923
|
+
const ruta = join137(directorioConfig(entorno), "projects", slugDeProyecto(entorno.proyecto), "memory");
|
|
377315
377924
|
let ficheros;
|
|
377316
377925
|
try {
|
|
377317
|
-
ficheros = (await
|
|
377926
|
+
ficheros = (await readdir32(ruta)).filter((n2) => n2.toLowerCase().endsWith(".md"));
|
|
377318
377927
|
} catch {
|
|
377319
377928
|
return null;
|
|
377320
377929
|
}
|
|
@@ -377324,7 +377933,7 @@ async function explorarMemoria(entorno) {
|
|
|
377324
377933
|
let masReciente = 0;
|
|
377325
377934
|
for (const nombre of ficheros) {
|
|
377326
377935
|
try {
|
|
377327
|
-
const info = await
|
|
377936
|
+
const info = await stat47(join137(ruta, nombre));
|
|
377328
377937
|
bytes += info.size;
|
|
377329
377938
|
if (info.mtimeMs > masReciente)
|
|
377330
377939
|
masReciente = info.mtimeMs;
|
|
@@ -377343,7 +377952,7 @@ async function explorarMemoria(entorno) {
|
|
|
377343
377952
|
async function leerMemoria(fuente, maxHechos = 60) {
|
|
377344
377953
|
let ficheros;
|
|
377345
377954
|
try {
|
|
377346
|
-
ficheros = (await
|
|
377955
|
+
ficheros = (await readdir32(fuente.ruta)).filter((n2) => n2.toLowerCase().endsWith(".md"));
|
|
377347
377956
|
} catch {
|
|
377348
377957
|
return [];
|
|
377349
377958
|
}
|
|
@@ -377355,7 +377964,7 @@ async function leerMemoria(fuente, maxHechos = 60) {
|
|
|
377355
377964
|
break;
|
|
377356
377965
|
let crudo;
|
|
377357
377966
|
try {
|
|
377358
|
-
crudo = await
|
|
377967
|
+
crudo = await readFile50(join137(fuente.ruta, nombre), "utf8");
|
|
377359
377968
|
} catch {
|
|
377360
377969
|
continue;
|
|
377361
377970
|
}
|
|
@@ -377470,8 +378079,16 @@ var DETECTORES;
|
|
|
377470
378079
|
var init_registry4 = __esm(() => {
|
|
377471
378080
|
init_types12();
|
|
377472
378081
|
init_claudeCode();
|
|
378082
|
+
init_codex();
|
|
378083
|
+
init_aider();
|
|
378084
|
+
init_geminiCli();
|
|
377473
378085
|
init_memoriaAgente();
|
|
377474
|
-
DETECTORES = [
|
|
378086
|
+
DETECTORES = [
|
|
378087
|
+
detectorClaudeCode,
|
|
378088
|
+
detectorCodex,
|
|
378089
|
+
detectorGeminiCli,
|
|
378090
|
+
detectorAider
|
|
378091
|
+
];
|
|
377475
378092
|
});
|
|
377476
378093
|
|
|
377477
378094
|
// commands/import/import.tsx
|
|
@@ -377480,7 +378097,7 @@ __export(exports_import, {
|
|
|
377480
378097
|
call: () => call42,
|
|
377481
378098
|
ImportContext: () => ImportContext
|
|
377482
378099
|
});
|
|
377483
|
-
import { readFile as
|
|
378100
|
+
import { readFile as readFile51 } from "fs/promises";
|
|
377484
378101
|
import { homedir as homedir36 } from "os";
|
|
377485
378102
|
import { resolve as resolve42 } from "path";
|
|
377486
378103
|
function resolvePath3(raw) {
|
|
@@ -377591,7 +378208,7 @@ function ImportContext({
|
|
|
377591
378208
|
const abs = resolvePath3(filePath);
|
|
377592
378209
|
let bytes;
|
|
377593
378210
|
try {
|
|
377594
|
-
bytes = await
|
|
378211
|
+
bytes = await readFile51(abs);
|
|
377595
378212
|
} catch {
|
|
377596
378213
|
setError(`No pude leer el archivo: ${abs}`);
|
|
377597
378214
|
setStep("error");
|
|
@@ -384573,7 +385190,7 @@ __export(exports_TheusHome, {
|
|
|
384573
385190
|
default: () => TheusHome_default,
|
|
384574
385191
|
TheusHome: () => TheusHome
|
|
384575
385192
|
});
|
|
384576
|
-
import { readFile as
|
|
385193
|
+
import { readFile as readFile52 } from "fs/promises";
|
|
384577
385194
|
function firstName() {
|
|
384578
385195
|
const info = getOauthAccountInfo();
|
|
384579
385196
|
if (info?.displayName)
|
|
@@ -384616,7 +385233,7 @@ function relativeWhen(iso) {
|
|
|
384616
385233
|
}
|
|
384617
385234
|
async function readMemory() {
|
|
384618
385235
|
try {
|
|
384619
|
-
const raw = await
|
|
385236
|
+
const raw = await readFile52(getGraphPath(getCwd()), "utf8");
|
|
384620
385237
|
const data = JSON.parse(raw);
|
|
384621
385238
|
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
384622
385239
|
let facts = 0;
|
|
@@ -385398,8 +386015,8 @@ __export(exports_thinkback, {
|
|
|
385398
386015
|
playAnimation: () => playAnimation,
|
|
385399
386016
|
call: () => call51
|
|
385400
386017
|
});
|
|
385401
|
-
import { readFile as
|
|
385402
|
-
import { join as
|
|
386018
|
+
import { readFile as readFile53 } from "fs/promises";
|
|
386019
|
+
import { join as join138 } from "path";
|
|
385403
386020
|
function getMarketplaceName() {
|
|
385404
386021
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
385405
386022
|
}
|
|
@@ -385417,17 +386034,17 @@ async function getThinkbackSkillDir() {
|
|
|
385417
386034
|
if (!thinkbackPlugin) {
|
|
385418
386035
|
return null;
|
|
385419
386036
|
}
|
|
385420
|
-
const skillDir =
|
|
386037
|
+
const skillDir = join138(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
385421
386038
|
if (await pathExists(skillDir)) {
|
|
385422
386039
|
return skillDir;
|
|
385423
386040
|
}
|
|
385424
386041
|
return null;
|
|
385425
386042
|
}
|
|
385426
386043
|
async function playAnimation(skillDir) {
|
|
385427
|
-
const dataPath =
|
|
385428
|
-
const playerPath =
|
|
386044
|
+
const dataPath = join138(skillDir, "year_in_review.js");
|
|
386045
|
+
const playerPath = join138(skillDir, "player.js");
|
|
385429
386046
|
try {
|
|
385430
|
-
await
|
|
386047
|
+
await readFile53(dataPath);
|
|
385431
386048
|
} catch (e) {
|
|
385432
386049
|
if (isENOENT(e)) {
|
|
385433
386050
|
return {
|
|
@@ -385442,7 +386059,7 @@ async function playAnimation(skillDir) {
|
|
|
385442
386059
|
};
|
|
385443
386060
|
}
|
|
385444
386061
|
try {
|
|
385445
|
-
await
|
|
386062
|
+
await readFile53(playerPath);
|
|
385446
386063
|
} catch (e) {
|
|
385447
386064
|
if (isENOENT(e)) {
|
|
385448
386065
|
return {
|
|
@@ -385473,7 +386090,7 @@ async function playAnimation(skillDir) {
|
|
|
385473
386090
|
} catch {} finally {
|
|
385474
386091
|
inkInstance.exitAlternateScreen();
|
|
385475
386092
|
}
|
|
385476
|
-
const htmlPath =
|
|
386093
|
+
const htmlPath = join138(skillDir, "year_in_review.html");
|
|
385477
386094
|
if (await pathExists(htmlPath)) {
|
|
385478
386095
|
const platform6 = getPlatform();
|
|
385479
386096
|
const openCmd = platform6 === "macos" ? "open" : platform6 === "windows" ? "start" : "xdg-open";
|
|
@@ -385809,7 +386426,7 @@ function ThinkbackFlow(t0) {
|
|
|
385809
386426
|
if (!skillDir) {
|
|
385810
386427
|
return;
|
|
385811
386428
|
}
|
|
385812
|
-
const dataPath =
|
|
386429
|
+
const dataPath = join138(skillDir, "year_in_review.js");
|
|
385813
386430
|
pathExists(dataPath).then((exists) => {
|
|
385814
386431
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
385815
386432
|
setHasGenerated(exists);
|
|
@@ -385983,7 +386600,7 @@ var exports_thinkback_play = {};
|
|
|
385983
386600
|
__export(exports_thinkback_play, {
|
|
385984
386601
|
call: () => call52
|
|
385985
386602
|
});
|
|
385986
|
-
import { join as
|
|
386603
|
+
import { join as join139 } from "path";
|
|
385987
386604
|
function getPluginId2() {
|
|
385988
386605
|
const marketplaceName = OFFICIAL_MARKETPLACE_NAME;
|
|
385989
386606
|
return `thinkback@${marketplaceName}`;
|
|
@@ -386005,7 +386622,7 @@ async function call52() {
|
|
|
386005
386622
|
value: "Thinkback plugin installation path not found."
|
|
386006
386623
|
};
|
|
386007
386624
|
}
|
|
386008
|
-
const skillDir =
|
|
386625
|
+
const skillDir = join139(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
386009
386626
|
const result = await playAnimation(skillDir);
|
|
386010
386627
|
return { type: "text", value: result.message };
|
|
386011
386628
|
}
|
|
@@ -392235,7 +392852,7 @@ __export(exports_branch, {
|
|
|
392235
392852
|
call: () => call60
|
|
392236
392853
|
});
|
|
392237
392854
|
import { randomUUID as randomUUID33 } from "crypto";
|
|
392238
|
-
import { mkdir as mkdir42, readFile as
|
|
392855
|
+
import { mkdir as mkdir42, readFile as readFile54, writeFile as writeFile46 } from "fs/promises";
|
|
392239
392856
|
function deriveFirstPrompt(firstUserMessage) {
|
|
392240
392857
|
const content = firstUserMessage?.message?.content;
|
|
392241
392858
|
if (!content)
|
|
@@ -392254,7 +392871,7 @@ async function createFork(customTitle) {
|
|
|
392254
392871
|
await mkdir42(projectDir, { recursive: true, mode: 448 });
|
|
392255
392872
|
let transcriptContent;
|
|
392256
392873
|
try {
|
|
392257
|
-
transcriptContent = await
|
|
392874
|
+
transcriptContent = await readFile54(currentTranscriptPath);
|
|
392258
392875
|
} catch {
|
|
392259
392876
|
throw new Error("No hay conversaci\xF3n que ramificar");
|
|
392260
392877
|
}
|
|
@@ -392507,8 +393124,8 @@ var init_types14 = __esm(() => {
|
|
|
392507
393124
|
});
|
|
392508
393125
|
|
|
392509
393126
|
// components/agents/agentFileUtils.ts
|
|
392510
|
-
import { mkdir as mkdir43, open as
|
|
392511
|
-
import { join as
|
|
393127
|
+
import { mkdir as mkdir43, open as open18, unlink as unlink20 } from "fs/promises";
|
|
393128
|
+
import { join as join140 } from "path";
|
|
392512
393129
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
392513
393130
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
392514
393131
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -392535,26 +393152,26 @@ function getAgentDirectoryPath(location) {
|
|
|
392535
393152
|
case "flagSettings":
|
|
392536
393153
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
392537
393154
|
case "userSettings":
|
|
392538
|
-
return
|
|
393155
|
+
return join140(getTheusConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
392539
393156
|
case "projectSettings":
|
|
392540
|
-
return
|
|
393157
|
+
return join140(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392541
393158
|
case "policySettings":
|
|
392542
|
-
return
|
|
393159
|
+
return join140(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392543
393160
|
case "localSettings":
|
|
392544
|
-
return
|
|
393161
|
+
return join140(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392545
393162
|
}
|
|
392546
393163
|
}
|
|
392547
393164
|
function getRelativeAgentDirectoryPath(location) {
|
|
392548
393165
|
switch (location) {
|
|
392549
393166
|
case "projectSettings":
|
|
392550
|
-
return
|
|
393167
|
+
return join140(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
392551
393168
|
default:
|
|
392552
393169
|
return getAgentDirectoryPath(location);
|
|
392553
393170
|
}
|
|
392554
393171
|
}
|
|
392555
393172
|
function getNewAgentFilePath(agent) {
|
|
392556
393173
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
392557
|
-
return
|
|
393174
|
+
return join140(dirPath, `${agent.agentType}.md`);
|
|
392558
393175
|
}
|
|
392559
393176
|
function getActualAgentFilePath(agent) {
|
|
392560
393177
|
if (agent.source === "built-in") {
|
|
@@ -392565,14 +393182,14 @@ function getActualAgentFilePath(agent) {
|
|
|
392565
393182
|
}
|
|
392566
393183
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
392567
393184
|
const filename = agent.filename || agent.agentType;
|
|
392568
|
-
return
|
|
393185
|
+
return join140(dirPath, `${filename}.md`);
|
|
392569
393186
|
}
|
|
392570
393187
|
function getNewRelativeAgentFilePath(agent) {
|
|
392571
393188
|
if (agent.source === "built-in") {
|
|
392572
393189
|
return "Built-in";
|
|
392573
393190
|
}
|
|
392574
393191
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
392575
|
-
return
|
|
393192
|
+
return join140(dirPath, `${agent.agentType}.md`);
|
|
392576
393193
|
}
|
|
392577
393194
|
function getActualRelativeAgentFilePath(agent) {
|
|
392578
393195
|
if (isBuiltInAgent(agent)) {
|
|
@@ -392586,7 +393203,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
392586
393203
|
}
|
|
392587
393204
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
392588
393205
|
const filename = agent.filename || agent.agentType;
|
|
392589
|
-
return
|
|
393206
|
+
return join140(dirPath, `${filename}.md`);
|
|
392590
393207
|
}
|
|
392591
393208
|
async function ensureAgentDirectoryExists(source) {
|
|
392592
393209
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -392632,7 +393249,7 @@ async function deleteAgentFromFile(agent) {
|
|
|
392632
393249
|
}
|
|
392633
393250
|
}
|
|
392634
393251
|
async function writeFileAndFlush(filePath, content, flag = "w") {
|
|
392635
|
-
const handle2 = await
|
|
393252
|
+
const handle2 = await open18(filePath, flag);
|
|
392636
393253
|
try {
|
|
392637
393254
|
await handle2.writeFile(content, { encoding: "utf-8" });
|
|
392638
393255
|
await handle2.datasync();
|
|
@@ -398598,8 +399215,8 @@ var init_rewind = __esm(() => {
|
|
|
398598
399215
|
|
|
398599
399216
|
// utils/heapDumpService.ts
|
|
398600
399217
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync7 } from "fs";
|
|
398601
|
-
import { readdir as
|
|
398602
|
-
import { join as
|
|
399218
|
+
import { readdir as readdir33, readFile as readFile55, writeFile as writeFile47 } from "fs/promises";
|
|
399219
|
+
import { join as join141 } from "path";
|
|
398603
399220
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
398604
399221
|
import {
|
|
398605
399222
|
getHeapSnapshot,
|
|
@@ -398619,11 +399236,11 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
398619
399236
|
const activeRequests = process._getActiveRequests().length;
|
|
398620
399237
|
let openFileDescriptors;
|
|
398621
399238
|
try {
|
|
398622
|
-
openFileDescriptors = (await
|
|
399239
|
+
openFileDescriptors = (await readdir33("/proc/self/fd")).length;
|
|
398623
399240
|
} catch {}
|
|
398624
399241
|
let smapsRollup;
|
|
398625
399242
|
try {
|
|
398626
|
-
smapsRollup = await
|
|
399243
|
+
smapsRollup = await readFile55("/proc/self/smaps_rollup", "utf8");
|
|
398627
399244
|
} catch {}
|
|
398628
399245
|
const nativeMemory = usage2.rss - usage2.heapUsed;
|
|
398629
399246
|
const bytesPerSecond = uptimeSeconds > 0 ? usage2.rss / uptimeSeconds : 0;
|
|
@@ -398689,7 +399306,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
398689
399306
|
smapsRollup,
|
|
398690
399307
|
platform: process.platform,
|
|
398691
399308
|
nodeVersion: process.version,
|
|
398692
|
-
ccVersion: { VERSION: "0.2.
|
|
399309
|
+
ccVersion: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
399310
|
};
|
|
398694
399311
|
}
|
|
398695
399312
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -398707,8 +399324,8 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
398707
399324
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
398708
399325
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
398709
399326
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
398710
|
-
const heapPath =
|
|
398711
|
-
const diagPath =
|
|
399327
|
+
const heapPath = join141(dumpDir, heapFilename);
|
|
399328
|
+
const diagPath = join141(dumpDir, diagFilename);
|
|
398712
399329
|
await writeFile47(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
398713
399330
|
mode: 384
|
|
398714
399331
|
});
|
|
@@ -399450,7 +400067,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
399450
400067
|
var call68 = async () => {
|
|
399451
400068
|
return {
|
|
399452
400069
|
type: "text",
|
|
399453
|
-
value: { VERSION: "0.2.
|
|
400070
|
+
value: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
400071
|
};
|
|
399455
400072
|
}, version2, version_default;
|
|
399456
400073
|
var init_version = __esm(() => {
|
|
@@ -401890,8 +402507,8 @@ var init_advisor2 = __esm(() => {
|
|
|
401890
402507
|
|
|
401891
402508
|
// skills/bundledSkills.ts
|
|
401892
402509
|
import { constants as fsConstants5 } from "fs";
|
|
401893
|
-
import { mkdir as mkdir44, open as
|
|
401894
|
-
import { dirname as
|
|
402510
|
+
import { mkdir as mkdir44, open as open19 } from "fs/promises";
|
|
402511
|
+
import { dirname as dirname58, isAbsolute as isAbsolute28, join as join142, normalize as normalize13, sep as pathSep2 } from "path";
|
|
401895
402512
|
function registerBundledSkill(definition) {
|
|
401896
402513
|
const { files: files2 } = definition;
|
|
401897
402514
|
let skillRoot;
|
|
@@ -401939,7 +402556,7 @@ function getBundledSkills() {
|
|
|
401939
402556
|
return [...bundledSkills];
|
|
401940
402557
|
}
|
|
401941
402558
|
function getBundledSkillExtractDir(skillName) {
|
|
401942
|
-
return
|
|
402559
|
+
return join142(getBundledSkillsRoot(), skillName);
|
|
401943
402560
|
}
|
|
401944
402561
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
401945
402562
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -401955,7 +402572,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
401955
402572
|
const byParent = new Map;
|
|
401956
402573
|
for (const [relPath, content] of Object.entries(files2)) {
|
|
401957
402574
|
const target = resolveSkillFilePath(dir, relPath);
|
|
401958
|
-
const parent2 =
|
|
402575
|
+
const parent2 = dirname58(target);
|
|
401959
402576
|
const entry = [target, content];
|
|
401960
402577
|
const group = byParent.get(parent2);
|
|
401961
402578
|
if (group)
|
|
@@ -401969,7 +402586,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
401969
402586
|
}));
|
|
401970
402587
|
}
|
|
401971
402588
|
async function safeWriteFile(p, content) {
|
|
401972
|
-
const fh = await
|
|
402589
|
+
const fh = await open19(p, SAFE_WRITE_FLAGS, 384);
|
|
401973
402590
|
try {
|
|
401974
402591
|
await fh.writeFile(content, "utf8");
|
|
401975
402592
|
} finally {
|
|
@@ -401981,7 +402598,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
401981
402598
|
if (isAbsolute28(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
401982
402599
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
401983
402600
|
}
|
|
401984
|
-
return
|
|
402601
|
+
return join142(baseDir, normalized);
|
|
401985
402602
|
}
|
|
401986
402603
|
function prependBaseDir(blocks, baseDir) {
|
|
401987
402604
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -402051,7 +402668,7 @@ var SECRET_NAME_PATTERN, EXTRA_ENV_ALLOWLIST, REDACTED2 = "\u2039oculto\u203A",
|
|
|
402051
402668
|
const lines = [];
|
|
402052
402669
|
lines.push("## Entorno de ejecuci\xF3n");
|
|
402053
402670
|
lines.push("");
|
|
402054
|
-
const version3 = { VERSION: "0.2.
|
|
402671
|
+
const version3 = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
402672
|
lines.push(`- Versi\xF3n de Theus: ${version3}`);
|
|
402056
402673
|
lines.push(`- Directorio de trabajo: ${getCwd()}`);
|
|
402057
402674
|
lines.push(`- \xBFRepositorio git?: ${isGit ? "s\xED" : "no"}`);
|
|
@@ -402492,7 +403109,7 @@ var init_exit2 = __esm(() => {
|
|
|
402492
403109
|
});
|
|
402493
403110
|
|
|
402494
403111
|
// components/ExportDialog.tsx
|
|
402495
|
-
import { join as
|
|
403112
|
+
import { join as join143 } from "path";
|
|
402496
403113
|
function ExportDialog({
|
|
402497
403114
|
content,
|
|
402498
403115
|
defaultFilename,
|
|
@@ -402525,7 +403142,7 @@ function ExportDialog({
|
|
|
402525
403142
|
};
|
|
402526
403143
|
const handleFilenameSubmit = () => {
|
|
402527
403144
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
402528
|
-
const filepath =
|
|
403145
|
+
const filepath = join143(getCwd(), finalFilename);
|
|
402529
403146
|
try {
|
|
402530
403147
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
402531
403148
|
encoding: "utf-8",
|
|
@@ -402748,7 +403365,7 @@ __export(exports_export, {
|
|
|
402748
403365
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
402749
403366
|
call: () => call80
|
|
402750
403367
|
});
|
|
402751
|
-
import { join as
|
|
403368
|
+
import { join as join144 } from "path";
|
|
402752
403369
|
function formatTimestamp(date6) {
|
|
402753
403370
|
const year = date6.getFullYear();
|
|
402754
403371
|
const month = String(date6.getMonth() + 1).padStart(2, "0");
|
|
@@ -402792,7 +403409,7 @@ async function call80(onDone, context3, args) {
|
|
|
402792
403409
|
const filename = args.trim();
|
|
402793
403410
|
if (filename) {
|
|
402794
403411
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
402795
|
-
const filepath =
|
|
403412
|
+
const filepath = join144(getCwd(), finalFilename);
|
|
402796
403413
|
try {
|
|
402797
403414
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
402798
403415
|
encoding: "utf-8",
|
|
@@ -402845,10 +403462,10 @@ var init_export2 = __esm(() => {
|
|
|
402845
403462
|
});
|
|
402846
403463
|
|
|
402847
403464
|
// services/providers/sessionCatalog.ts
|
|
402848
|
-
import { existsSync as
|
|
403465
|
+
import { existsSync as existsSync21, readFileSync as readFileSync27 } from "fs";
|
|
402849
403466
|
function loadConfig2() {
|
|
402850
403467
|
const path17 = defaultProvidersConfigPath();
|
|
402851
|
-
if (!
|
|
403468
|
+
if (!existsSync21(path17))
|
|
402852
403469
|
return null;
|
|
402853
403470
|
try {
|
|
402854
403471
|
const parsed = JSON.parse(readFileSync27(path17, "utf8"));
|
|
@@ -404414,7 +405031,7 @@ import { spawn as spawn8, spawnSync as spawnSync9 } from "child_process";
|
|
|
404414
405031
|
import { createHash as createHash31 } from "crypto";
|
|
404415
405032
|
import {
|
|
404416
405033
|
cpSync,
|
|
404417
|
-
existsSync as
|
|
405034
|
+
existsSync as existsSync22,
|
|
404418
405035
|
mkdtempSync,
|
|
404419
405036
|
readFileSync as readFileSync28,
|
|
404420
405037
|
realpathSync as realpathSync5,
|
|
@@ -404422,7 +405039,7 @@ import {
|
|
|
404422
405039
|
writeFileSync as writeFileSync8
|
|
404423
405040
|
} from "fs";
|
|
404424
405041
|
import { tmpdir as tmpdir10 } from "os";
|
|
404425
|
-
import { dirname as
|
|
405042
|
+
import { dirname as dirname59, join as join145 } from "path";
|
|
404426
405043
|
function naupaVersionOf(bin) {
|
|
404427
405044
|
try {
|
|
404428
405045
|
const out = spawnSync9(bin, ["--version"], {
|
|
@@ -404437,13 +405054,13 @@ function naupaVersionOf(bin) {
|
|
|
404437
405054
|
}
|
|
404438
405055
|
function rescatarNaupaBorrado(binEnUso) {
|
|
404439
405056
|
try {
|
|
404440
|
-
if (
|
|
405057
|
+
if (existsSync22(binEnUso))
|
|
404441
405058
|
return;
|
|
404442
405059
|
const apartado = `${binEnUso}.old`;
|
|
404443
|
-
if (!
|
|
405060
|
+
if (!existsSync22(apartado))
|
|
404444
405061
|
return;
|
|
404445
405062
|
cpSync(apartado, binEnUso, { force: true });
|
|
404446
|
-
if (!
|
|
405063
|
+
if (!existsSync22(binEnUso))
|
|
404447
405064
|
return;
|
|
404448
405065
|
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
405066
|
`);
|
|
@@ -404458,8 +405075,8 @@ function rescatarNaupaMalUbicado(binEnUso, options2 = {}) {
|
|
|
404458
405075
|
const platform6 = options2.platform ?? process.platform;
|
|
404459
405076
|
const versionOf = options2.versionOf ?? naupaVersionOf;
|
|
404460
405077
|
const nombre = platform6 === "win32" ? "naupa.exe" : "naupa";
|
|
404461
|
-
const rutaFija =
|
|
404462
|
-
if (!
|
|
405078
|
+
const rutaFija = join145(home, ".local", "bin", nombre);
|
|
405079
|
+
if (!existsSync22(rutaFija))
|
|
404463
405080
|
return;
|
|
404464
405081
|
try {
|
|
404465
405082
|
if (realpathSync5(rutaFija) === realpathSync5(binEnUso))
|
|
@@ -404548,7 +405165,7 @@ function isReleaseBundleInstall() {
|
|
|
404548
405165
|
return false;
|
|
404549
405166
|
if (real.includes("node_modules"))
|
|
404550
405167
|
return false;
|
|
404551
|
-
return
|
|
405168
|
+
return existsSync22(join145(dirname59(real), "bin", "theus"));
|
|
404552
405169
|
} catch {
|
|
404553
405170
|
return false;
|
|
404554
405171
|
}
|
|
@@ -404582,7 +405199,7 @@ async function downloadToFile(url3, dest) {
|
|
|
404582
405199
|
}
|
|
404583
405200
|
}
|
|
404584
405201
|
async function updateReleaseBundle() {
|
|
404585
|
-
const bundleDir =
|
|
405202
|
+
const bundleDir = dirname59(realpathSync5(process.argv[1]));
|
|
404586
405203
|
const latest = await fetchReleaseChannelVersion();
|
|
404587
405204
|
if (!latest) {
|
|
404588
405205
|
process.stderr.write(source_default.red(`No pude comprobar la \xFAltima versi\xF3n en theus.pe/dl.
|
|
@@ -404592,20 +405209,20 @@ async function updateReleaseBundle() {
|
|
|
404592
405209
|
await gracefulShutdown(1);
|
|
404593
405210
|
return;
|
|
404594
405211
|
}
|
|
404595
|
-
if (gte({ VERSION: "0.2.
|
|
404596
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405212
|
+
if (gte({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405213
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405214
|
`);
|
|
404598
405215
|
await gracefulShutdown(0);
|
|
404599
405216
|
return;
|
|
404600
405217
|
}
|
|
404601
|
-
writeToStdout(`Nueva versi\xF3n disponible: ${latest} (actual: ${{ VERSION: "0.2.
|
|
405218
|
+
writeToStdout(`Nueva versi\xF3n disponible: ${latest} (actual: ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405219
|
`);
|
|
404603
405220
|
writeToStdout(`Instalando la actualizaci\xF3n desde theus.pe/dl...
|
|
404604
405221
|
`);
|
|
404605
|
-
const tmp = mkdtempSync(
|
|
405222
|
+
const tmp = mkdtempSync(join145(tmpdir10(), "theus-update-"));
|
|
404606
405223
|
try {
|
|
404607
|
-
const tarPath =
|
|
404608
|
-
const sumsPath =
|
|
405224
|
+
const tarPath = join145(tmp, "theus-cli.tar.gz");
|
|
405225
|
+
const sumsPath = join145(tmp, "SHA256SUMS");
|
|
404609
405226
|
if (!await downloadToFile(`${DL_BASE}/theus-cli.tar.gz`, tarPath) || !await downloadToFile(`${DL_BASE}/SHA256SUMS`, sumsPath)) {
|
|
404610
405227
|
process.stderr.write(source_default.red(`Fall\xF3 la descarga del release desde theus.pe/dl.
|
|
404611
405228
|
`));
|
|
@@ -404624,15 +405241,15 @@ async function updateReleaseBundle() {
|
|
|
404624
405241
|
const ex = spawnSync9("tar", ["-xzf", tarPath, "-C", tmp], {
|
|
404625
405242
|
stdio: "ignore"
|
|
404626
405243
|
});
|
|
404627
|
-
const staged =
|
|
404628
|
-
if (ex.status !== 0 || !
|
|
405244
|
+
const staged = join145(tmp, "theus-cli");
|
|
405245
|
+
if (ex.status !== 0 || !existsSync22(join145(staged, "cli.js"))) {
|
|
404629
405246
|
process.stderr.write(source_default.red(`No pude extraer el release descargado (o vino incompleto).
|
|
404630
405247
|
`));
|
|
404631
405248
|
await gracefulShutdown(1);
|
|
404632
405249
|
return;
|
|
404633
405250
|
}
|
|
404634
405251
|
cpSync(staged, bundleDir, { recursive: true, force: true });
|
|
404635
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405252
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405253
|
`);
|
|
404637
405254
|
await regenerateCompletionCache();
|
|
404638
405255
|
} finally {
|
|
@@ -404645,7 +405262,7 @@ async function updateReleaseBundle() {
|
|
|
404645
405262
|
async function update() {
|
|
404646
405263
|
logEvent("theus_update_check", {});
|
|
404647
405264
|
await updateNaupa();
|
|
404648
|
-
writeToStdout(`Versi\xF3n actual: ${{ VERSION: "0.2.
|
|
405265
|
+
writeToStdout(`Versi\xF3n actual: ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405266
|
`);
|
|
404650
405267
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
404651
405268
|
writeToStdout(`Buscando actualizaciones en el canal ${channel2}...
|
|
@@ -404724,8 +405341,8 @@ async function update() {
|
|
|
404724
405341
|
writeToStdout(`Theus est\xE1 gestionado por Homebrew.
|
|
404725
405342
|
`);
|
|
404726
405343
|
const latest = await getLatestVersion(channel2);
|
|
404727
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
404728
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405344
|
+
if (latest && !gte({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405345
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405346
|
`);
|
|
404730
405347
|
writeToStdout(`
|
|
404731
405348
|
`);
|
|
@@ -404741,8 +405358,8 @@ async function update() {
|
|
|
404741
405358
|
writeToStdout(`Theus est\xE1 gestionado por winget.
|
|
404742
405359
|
`);
|
|
404743
405360
|
const latest = await getLatestVersion(channel2);
|
|
404744
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
404745
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405361
|
+
if (latest && !gte({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405362
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405363
|
`);
|
|
404747
405364
|
writeToStdout(`
|
|
404748
405365
|
`);
|
|
@@ -404758,8 +405375,8 @@ async function update() {
|
|
|
404758
405375
|
writeToStdout(`Theus est\xE1 gestionado por apk.
|
|
404759
405376
|
`);
|
|
404760
405377
|
const latest = await getLatestVersion(channel2);
|
|
404761
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
404762
|
-
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.
|
|
405378
|
+
if (latest && !gte({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405379
|
+
writeToStdout(`Actualizaci\xF3n disponible: ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405380
|
`);
|
|
404764
405381
|
writeToStdout(`
|
|
404765
405382
|
`);
|
|
@@ -404824,11 +405441,11 @@ async function update() {
|
|
|
404824
405441
|
`);
|
|
404825
405442
|
await gracefulShutdown(1);
|
|
404826
405443
|
}
|
|
404827
|
-
if (result.latestVersion === { VERSION: "0.2.
|
|
404828
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405444
|
+
if (result.latestVersion === { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
405445
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405446
|
`);
|
|
404830
405447
|
} else {
|
|
404831
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405448
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405449
|
`);
|
|
404833
405450
|
await regenerateCompletionCache();
|
|
404834
405451
|
}
|
|
@@ -404847,9 +405464,9 @@ async function update() {
|
|
|
404847
405464
|
await removeInstalledSymlink();
|
|
404848
405465
|
}
|
|
404849
405466
|
logForDebugging("update: Checking npm registry for latest version");
|
|
404850
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.
|
|
405467
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
405468
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
404852
|
-
const npmCommand = `npm view ${{ VERSION: "0.2.
|
|
405469
|
+
const npmCommand = `npm view ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
405470
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
404854
405471
|
const latestVersion = await getLatestVersion(channel2);
|
|
404855
405472
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -404869,7 +405486,7 @@ async function update() {
|
|
|
404869
405486
|
`);
|
|
404870
405487
|
process.stderr.write(` \u2022 Un proxy o firewall corporativo bloquea npm
|
|
404871
405488
|
`);
|
|
404872
|
-
if ({ VERSION: "0.2.
|
|
405489
|
+
if ({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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
405490
|
process.stderr.write(` \u2022 Compilaci\xF3n interna/de desarrollo no publicada en npm
|
|
404874
405491
|
`);
|
|
404875
405492
|
}
|
|
@@ -404881,19 +405498,19 @@ async function update() {
|
|
|
404881
405498
|
`);
|
|
404882
405499
|
process.stderr.write(` \u2022 Ejecuta con el flag --debug para m\xE1s detalle
|
|
404883
405500
|
`);
|
|
404884
|
-
const packageName = { VERSION: "0.2.
|
|
405501
|
+
const packageName = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
405502
|
process.stderr.write(` \u2022 Comprueba a mano: npm view ${packageName} version
|
|
404886
405503
|
`);
|
|
404887
405504
|
process.stderr.write(` \u2022 Comprueba si te falta iniciar sesi\xF3n: npm whoami
|
|
404888
405505
|
`);
|
|
404889
405506
|
await gracefulShutdown(1);
|
|
404890
405507
|
}
|
|
404891
|
-
if (gte({ VERSION: "0.2.
|
|
404892
|
-
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.
|
|
405508
|
+
if (gte({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
405509
|
+
writeToStdout(source_default.green(`Theus ya est\xE1 al d\xEDa (${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405510
|
`);
|
|
404894
405511
|
await gracefulShutdown(0);
|
|
404895
405512
|
}
|
|
404896
|
-
writeToStdout(`Nueva versi\xF3n disponible: ${latestVersion} (actual: ${{ VERSION: "0.2.
|
|
405513
|
+
writeToStdout(`Nueva versi\xF3n disponible: ${latestVersion} (actual: ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405514
|
`);
|
|
404898
405515
|
writeToStdout(`Instalando la actualizaci\xF3n...
|
|
404899
405516
|
`);
|
|
@@ -404938,7 +405555,7 @@ async function update() {
|
|
|
404938
405555
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
404939
405556
|
switch (status2) {
|
|
404940
405557
|
case "success":
|
|
404941
|
-
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.
|
|
405558
|
+
writeToStdout(source_default.green(`Actualizado correctamente de ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
405559
|
`);
|
|
404943
405560
|
await regenerateCompletionCache();
|
|
404944
405561
|
break;
|
|
@@ -404948,7 +405565,7 @@ async function update() {
|
|
|
404948
405565
|
if (useLocalUpdate) {
|
|
404949
405566
|
process.stderr.write(`Prueba a actualizar a mano con:
|
|
404950
405567
|
`);
|
|
404951
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
405568
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
405569
|
`);
|
|
404953
405570
|
} else {
|
|
404954
405571
|
process.stderr.write(`Prueba con sudo o corrige los permisos de npm
|
|
@@ -404964,7 +405581,7 @@ async function update() {
|
|
|
404964
405581
|
if (useLocalUpdate) {
|
|
404965
405582
|
process.stderr.write(`Prueba a actualizar a mano con:
|
|
404966
405583
|
`);
|
|
404967
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
405584
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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
405585
|
`);
|
|
404969
405586
|
} else {
|
|
404970
405587
|
process.stderr.write(`O p\xE1sate a la instalaci\xF3n nativa con: theus install
|
|
@@ -405432,8 +406049,8 @@ var init_effort3 = __esm(() => {
|
|
|
405432
406049
|
|
|
405433
406050
|
// utils/statsCache.ts
|
|
405434
406051
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
405435
|
-
import { open as
|
|
405436
|
-
import { join as
|
|
406052
|
+
import { open as open20 } from "fs/promises";
|
|
406053
|
+
import { join as join146 } from "path";
|
|
405437
406054
|
async function withStatsCacheLock(fn) {
|
|
405438
406055
|
while (statsCacheLockPromise) {
|
|
405439
406056
|
await statsCacheLockPromise;
|
|
@@ -405450,7 +406067,7 @@ async function withStatsCacheLock(fn) {
|
|
|
405450
406067
|
}
|
|
405451
406068
|
}
|
|
405452
406069
|
function getStatsCachePath() {
|
|
405453
|
-
return
|
|
406070
|
+
return join146(getTheusConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
405454
406071
|
}
|
|
405455
406072
|
function getEmptyCache() {
|
|
405456
406073
|
return {
|
|
@@ -405528,7 +406145,7 @@ async function saveStatsCache(cache4) {
|
|
|
405528
406145
|
await fs5.mkdir(configDir);
|
|
405529
406146
|
} catch {}
|
|
405530
406147
|
const content = jsonStringify(cache4, null, 2);
|
|
405531
|
-
const handle2 = await
|
|
406148
|
+
const handle2 = await open20(tempPath, "w", 384);
|
|
405532
406149
|
try {
|
|
405533
406150
|
await handle2.writeFile(content, { encoding: "utf-8" });
|
|
405534
406151
|
await handle2.sync();
|
|
@@ -406120,12 +406737,12 @@ var init_ansiToPng = __esm(() => {
|
|
|
406120
406737
|
// utils/screenshotClipboard.ts
|
|
406121
406738
|
import { mkdir as mkdir45, unlink as unlink21, writeFile as writeFile48 } from "fs/promises";
|
|
406122
406739
|
import { tmpdir as tmpdir11 } from "os";
|
|
406123
|
-
import { join as
|
|
406740
|
+
import { join as join147 } from "path";
|
|
406124
406741
|
async function copyAnsiToClipboard(ansiText, options2) {
|
|
406125
406742
|
try {
|
|
406126
|
-
const tempDir =
|
|
406743
|
+
const tempDir = join147(tmpdir11(), "theus-code-screenshots");
|
|
406127
406744
|
await mkdir45(tempDir, { recursive: true });
|
|
406128
|
-
const pngPath =
|
|
406745
|
+
const pngPath = join147(tempDir, `screenshot-${Date.now()}.png`);
|
|
406129
406746
|
const pngBuffer = ansiToPng(ansiText, options2);
|
|
406130
406747
|
await writeFile48(pngPath, pngBuffer);
|
|
406131
406748
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -406195,8 +406812,8 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
406195
406812
|
});
|
|
406196
406813
|
|
|
406197
406814
|
// utils/stats.ts
|
|
406198
|
-
import { open as
|
|
406199
|
-
import { basename as basename45, join as
|
|
406815
|
+
import { open as open21 } from "fs/promises";
|
|
406816
|
+
import { basename as basename45, join as join148, sep as sep29 } from "path";
|
|
406200
406817
|
async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
406201
406818
|
const { fromDate, toDate } = options2;
|
|
406202
406819
|
const fs5 = getFsImplementation();
|
|
@@ -406374,17 +406991,17 @@ async function getAllSessionFiles() {
|
|
|
406374
406991
|
return [];
|
|
406375
406992
|
throw e;
|
|
406376
406993
|
}
|
|
406377
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
406994
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join148(projectsDir, dirent.name));
|
|
406378
406995
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
406379
406996
|
try {
|
|
406380
406997
|
const entries = await fs5.readdir(projectDir);
|
|
406381
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
406998
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join148(projectDir, dirent.name));
|
|
406382
406999
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
406383
407000
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
406384
|
-
const subagentsDir =
|
|
407001
|
+
const subagentsDir = join148(projectDir, sessionDir.name, "subagents");
|
|
406385
407002
|
try {
|
|
406386
407003
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
406387
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
407004
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join148(subagentsDir, dirent.name));
|
|
406388
407005
|
} catch {
|
|
406389
407006
|
return [];
|
|
406390
407007
|
}
|
|
@@ -406684,7 +407301,7 @@ function calculateStreaks(dailyActivity) {
|
|
|
406684
407301
|
}
|
|
406685
407302
|
async function readSessionStartDate(filePath) {
|
|
406686
407303
|
try {
|
|
406687
|
-
const fd2 = await
|
|
407304
|
+
const fd2 = await open21(filePath, "r");
|
|
406688
407305
|
try {
|
|
406689
407306
|
const buf = Buffer.allocUnsafe(4096);
|
|
406690
407307
|
const { bytesRead } = await fd2.read(buf, 0, buf.length, 0);
|
|
@@ -409138,8 +409755,8 @@ __export(exports_assistant, {
|
|
|
409138
409755
|
call: () => call93,
|
|
409139
409756
|
NewInstallWizard: () => NewInstallWizard
|
|
409140
409757
|
});
|
|
409141
|
-
import { existsSync as
|
|
409142
|
-
import { dirname as
|
|
409758
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync10, readFileSync as readFileSync29, writeFileSync as writeFileSync9 } from "fs";
|
|
409759
|
+
import { dirname as dirname61, join as join149, resolve as resolve43 } from "path";
|
|
409143
409760
|
async function computeDefaultInstallDir() {
|
|
409144
409761
|
try {
|
|
409145
409762
|
return getOriginalCwd();
|
|
@@ -409149,7 +409766,7 @@ async function computeDefaultInstallDir() {
|
|
|
409149
409766
|
}
|
|
409150
409767
|
function readJsonSafe(path17) {
|
|
409151
409768
|
try {
|
|
409152
|
-
if (!
|
|
409769
|
+
if (!existsSync23(path17))
|
|
409153
409770
|
return {};
|
|
409154
409771
|
const parsed = JSON.parse(readFileSync29(path17, "utf8"));
|
|
409155
409772
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
@@ -409158,23 +409775,23 @@ function readJsonSafe(path17) {
|
|
|
409158
409775
|
}
|
|
409159
409776
|
}
|
|
409160
409777
|
function writeJson(path17, value) {
|
|
409161
|
-
mkdirSync10(
|
|
409778
|
+
mkdirSync10(dirname61(path17), { recursive: true });
|
|
409162
409779
|
writeFileSync9(path17, `${JSON.stringify(value, null, 2)}
|
|
409163
409780
|
`, "utf8");
|
|
409164
409781
|
}
|
|
409165
409782
|
function installAssistant(dir) {
|
|
409166
409783
|
const root2 = resolve43(dir);
|
|
409167
|
-
const theusDir =
|
|
409168
|
-
const settingsPath =
|
|
409784
|
+
const theusDir = join149(root2, ".theus");
|
|
409785
|
+
const settingsPath = join149(theusDir, "settings.json");
|
|
409169
409786
|
const settings = readJsonSafe(settingsPath);
|
|
409170
409787
|
settings.assistant = true;
|
|
409171
409788
|
writeJson(settingsPath, settings);
|
|
409172
|
-
const localPath =
|
|
409789
|
+
const localPath = join149(theusDir, "settings.local.json");
|
|
409173
409790
|
const local = readJsonSafe(localPath);
|
|
409174
409791
|
local.defaultView = "chat";
|
|
409175
409792
|
writeJson(localPath, local);
|
|
409176
|
-
const agentPath =
|
|
409177
|
-
mkdirSync10(
|
|
409793
|
+
const agentPath = join149(theusDir, "agents", "assistant.md");
|
|
409794
|
+
mkdirSync10(dirname61(agentPath), { recursive: true });
|
|
409178
409795
|
writeFileSync9(agentPath, ASSISTANT_AGENT_MD, "utf8");
|
|
409179
409796
|
return root2;
|
|
409180
409797
|
}
|
|
@@ -409347,7 +409964,7 @@ var exports_workflows = {};
|
|
|
409347
409964
|
__export(exports_workflows, {
|
|
409348
409965
|
default: () => workflows_default
|
|
409349
409966
|
});
|
|
409350
|
-
import { existsSync as
|
|
409967
|
+
import { existsSync as existsSync24, readdirSync as readdirSync3, statSync as statSync11 } from "fs";
|
|
409351
409968
|
import { homedir as homedir37 } from "os";
|
|
409352
409969
|
import { basename as basename46, extname as extname16, resolve as resolve44 } from "path";
|
|
409353
409970
|
function safeCwd2() {
|
|
@@ -409366,7 +409983,7 @@ function workflowDirs(cwd2) {
|
|
|
409366
409983
|
function scanDir(dir) {
|
|
409367
409984
|
const out = [];
|
|
409368
409985
|
try {
|
|
409369
|
-
if (!
|
|
409986
|
+
if (!existsSync24(dir))
|
|
409370
409987
|
return out;
|
|
409371
409988
|
for (const entry of readdirSync3(dir)) {
|
|
409372
409989
|
const ext = extname16(entry);
|
|
@@ -410836,11 +411453,11 @@ function BuddyPanel({
|
|
|
410836
411453
|
/* @__PURE__ */ jsx_runtime369.jsx(ThemedBox_default, {
|
|
410837
411454
|
flexDirection: "column",
|
|
410838
411455
|
marginTop: 1,
|
|
410839
|
-
children: STAT_NAMES.map((
|
|
410840
|
-
label: STAT_ES[
|
|
410841
|
-
value: companion.stats[
|
|
411456
|
+
children: STAT_NAMES.map((stat48) => /* @__PURE__ */ jsx_runtime369.jsx(StatRow, {
|
|
411457
|
+
label: STAT_ES[stat48],
|
|
411458
|
+
value: companion.stats[stat48],
|
|
410842
411459
|
color: color3
|
|
410843
|
-
},
|
|
411460
|
+
}, stat48))
|
|
410844
411461
|
}),
|
|
410845
411462
|
muted && /* @__PURE__ */ jsx_runtime369.jsx(ThemedBox_default, {
|
|
410846
411463
|
marginTop: 1,
|
|
@@ -410921,12 +411538,12 @@ __export(exports_createWorkflowCommand, {
|
|
|
410921
411538
|
getWorkflowCommands: () => getWorkflowCommands,
|
|
410922
411539
|
default: () => createWorkflowCommand_default
|
|
410923
411540
|
});
|
|
410924
|
-
import { existsSync as
|
|
411541
|
+
import { existsSync as existsSync25, readdirSync as readdirSync4, statSync as statSync12 } from "fs";
|
|
410925
411542
|
import { homedir as homedir38 } from "os";
|
|
410926
411543
|
import { basename as basename47, extname as extname17, resolve as resolve45 } from "path";
|
|
410927
411544
|
function listWorkflowFiles(dir) {
|
|
410928
411545
|
try {
|
|
410929
|
-
if (!
|
|
411546
|
+
if (!existsSync25(dir))
|
|
410930
411547
|
return [];
|
|
410931
411548
|
const out = [];
|
|
410932
411549
|
for (const entry of readdirSync4(dir)) {
|
|
@@ -411557,13 +412174,13 @@ import {
|
|
|
411557
412174
|
appendFile as fsAppendFile,
|
|
411558
412175
|
open as fsOpen2,
|
|
411559
412176
|
mkdir as mkdir46,
|
|
411560
|
-
readdir as
|
|
411561
|
-
readFile as
|
|
411562
|
-
stat as
|
|
412177
|
+
readdir as readdir34,
|
|
412178
|
+
readFile as readFile56,
|
|
412179
|
+
stat as stat48,
|
|
411563
412180
|
unlink as unlink22,
|
|
411564
412181
|
writeFile as writeFile49
|
|
411565
412182
|
} from "fs/promises";
|
|
411566
|
-
import { basename as basename48, dirname as
|
|
412183
|
+
import { basename as basename48, dirname as dirname62, join as join150 } from "path";
|
|
411567
412184
|
function isTranscriptMessage(entry) {
|
|
411568
412185
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
411569
412186
|
}
|
|
@@ -411577,18 +412194,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
411577
412194
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
411578
412195
|
}
|
|
411579
412196
|
function getProjectsDir2() {
|
|
411580
|
-
return
|
|
412197
|
+
return join150(getTheusConfigHomeDir(), "projects");
|
|
411581
412198
|
}
|
|
411582
412199
|
function getTranscriptPath() {
|
|
411583
412200
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
411584
|
-
return
|
|
412201
|
+
return join150(projectDir, `${getSessionId()}.jsonl`);
|
|
411585
412202
|
}
|
|
411586
412203
|
function getTranscriptPathForSession(sessionId) {
|
|
411587
412204
|
if (sessionId === getSessionId()) {
|
|
411588
412205
|
return getTranscriptPath();
|
|
411589
412206
|
}
|
|
411590
412207
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
411591
|
-
return
|
|
412208
|
+
return join150(projectDir, `${sessionId}.jsonl`);
|
|
411592
412209
|
}
|
|
411593
412210
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
411594
412211
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -411600,21 +412217,21 @@ function getAgentTranscriptPath(agentId) {
|
|
|
411600
412217
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
411601
412218
|
const sessionId = getSessionId();
|
|
411602
412219
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
411603
|
-
const base2 = subdir ?
|
|
411604
|
-
return
|
|
412220
|
+
const base2 = subdir ? join150(projectDir, sessionId, "subagents", subdir) : join150(projectDir, sessionId, "subagents");
|
|
412221
|
+
return join150(base2, `agent-${agentId}.jsonl`);
|
|
411605
412222
|
}
|
|
411606
412223
|
function getAgentMetadataPath(agentId) {
|
|
411607
412224
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
411608
412225
|
}
|
|
411609
412226
|
async function writeAgentMetadata(agentId, metadata) {
|
|
411610
412227
|
const path17 = getAgentMetadataPath(agentId);
|
|
411611
|
-
await mkdir46(
|
|
412228
|
+
await mkdir46(dirname62(path17), { recursive: true });
|
|
411612
412229
|
await writeFile49(path17, JSON.stringify(metadata));
|
|
411613
412230
|
}
|
|
411614
412231
|
async function readAgentMetadata(agentId) {
|
|
411615
412232
|
const path17 = getAgentMetadataPath(agentId);
|
|
411616
412233
|
try {
|
|
411617
|
-
const raw = await
|
|
412234
|
+
const raw = await readFile56(path17, "utf-8");
|
|
411618
412235
|
return JSON.parse(raw);
|
|
411619
412236
|
} catch (e) {
|
|
411620
412237
|
if (isFsInaccessible(e))
|
|
@@ -411624,20 +412241,20 @@ async function readAgentMetadata(agentId) {
|
|
|
411624
412241
|
}
|
|
411625
412242
|
function getRemoteAgentsDir() {
|
|
411626
412243
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
411627
|
-
return
|
|
412244
|
+
return join150(projectDir, getSessionId(), "remote-agents");
|
|
411628
412245
|
}
|
|
411629
412246
|
function getRemoteAgentMetadataPath(taskId) {
|
|
411630
|
-
return
|
|
412247
|
+
return join150(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
411631
412248
|
}
|
|
411632
412249
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
411633
412250
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
411634
|
-
await mkdir46(
|
|
412251
|
+
await mkdir46(dirname62(path17), { recursive: true });
|
|
411635
412252
|
await writeFile49(path17, JSON.stringify(metadata));
|
|
411636
412253
|
}
|
|
411637
412254
|
async function readRemoteAgentMetadata(taskId) {
|
|
411638
412255
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
411639
412256
|
try {
|
|
411640
|
-
const raw = await
|
|
412257
|
+
const raw = await readFile56(path17, "utf-8");
|
|
411641
412258
|
return JSON.parse(raw);
|
|
411642
412259
|
} catch (e) {
|
|
411643
412260
|
if (isFsInaccessible(e))
|
|
@@ -411659,7 +412276,7 @@ async function listRemoteAgentMetadata() {
|
|
|
411659
412276
|
const dir = getRemoteAgentsDir();
|
|
411660
412277
|
let entries;
|
|
411661
412278
|
try {
|
|
411662
|
-
entries = await
|
|
412279
|
+
entries = await readdir34(dir, { withFileTypes: true });
|
|
411663
412280
|
} catch (e) {
|
|
411664
412281
|
if (isFsInaccessible(e))
|
|
411665
412282
|
return [];
|
|
@@ -411670,7 +412287,7 @@ async function listRemoteAgentMetadata() {
|
|
|
411670
412287
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
411671
412288
|
continue;
|
|
411672
412289
|
try {
|
|
411673
|
-
const raw = await
|
|
412290
|
+
const raw = await readFile56(join150(dir, entry.name), "utf-8");
|
|
411674
412291
|
results.push(JSON.parse(raw));
|
|
411675
412292
|
} catch (e) {
|
|
411676
412293
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -411680,7 +412297,7 @@ async function listRemoteAgentMetadata() {
|
|
|
411680
412297
|
}
|
|
411681
412298
|
function sessionIdExists(sessionId) {
|
|
411682
412299
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
411683
|
-
const sessionFile =
|
|
412300
|
+
const sessionFile = join150(projectDir, `${sessionId}.jsonl`);
|
|
411684
412301
|
const fs5 = getFsImplementation();
|
|
411685
412302
|
try {
|
|
411686
412303
|
fs5.statSync(sessionFile);
|
|
@@ -411820,7 +412437,7 @@ class Project {
|
|
|
411820
412437
|
try {
|
|
411821
412438
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
411822
412439
|
} catch {
|
|
411823
|
-
await mkdir46(
|
|
412440
|
+
await mkdir46(dirname62(filePath), { recursive: true, mode: 448 });
|
|
411824
412441
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
411825
412442
|
}
|
|
411826
412443
|
}
|
|
@@ -412012,7 +412629,7 @@ class Project {
|
|
|
412012
412629
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
412013
412630
|
return;
|
|
412014
412631
|
}
|
|
412015
|
-
const content = await
|
|
412632
|
+
const content = await readFile56(this.sessionFile, { encoding: "utf-8" });
|
|
412016
412633
|
const lines = content.split(`
|
|
412017
412634
|
`).filter((line) => {
|
|
412018
412635
|
if (!line.trim())
|
|
@@ -412222,7 +412839,7 @@ class Project {
|
|
|
412222
412839
|
return cached3;
|
|
412223
412840
|
const targetFile = getTranscriptPathForSession(sessionId);
|
|
412224
412841
|
try {
|
|
412225
|
-
await
|
|
412842
|
+
await stat48(targetFile);
|
|
412226
412843
|
this.existingSessionFiles.set(sessionId, targetFile);
|
|
412227
412844
|
return targetFile;
|
|
412228
412845
|
} catch (e) {
|
|
@@ -412419,7 +413036,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
412419
413036
|
}
|
|
412420
413037
|
for (const [agentId, entries] of byAgent) {
|
|
412421
413038
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
412422
|
-
await mkdir46(
|
|
413039
|
+
await mkdir46(dirname62(agentFile), { recursive: true, mode: 448 });
|
|
412423
413040
|
const agentContent = entries.map((p) => jsonStringify(p) + `
|
|
412424
413041
|
`).join("");
|
|
412425
413042
|
await writeFile49(agentFile, agentContent, {
|
|
@@ -412822,7 +413439,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
412822
413439
|
worktreeSession: worktreeStates.has(sessionId) ? worktreeStates.get(sessionId) : undefined
|
|
412823
413440
|
};
|
|
412824
413441
|
}
|
|
412825
|
-
const content = await
|
|
413442
|
+
const content = await readFile56(filePath, { encoding: "utf-8" });
|
|
412826
413443
|
let parsed;
|
|
412827
413444
|
try {
|
|
412828
413445
|
parsed = jsonParse(content);
|
|
@@ -412956,7 +413573,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
412956
413573
|
try {
|
|
412957
413574
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
412958
413575
|
} catch {
|
|
412959
|
-
fs5.mkdirSync(
|
|
413576
|
+
fs5.mkdirSync(dirname62(fullPath), { mode: 448 });
|
|
412960
413577
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
412961
413578
|
}
|
|
412962
413579
|
}
|
|
@@ -413474,7 +414091,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413474
414091
|
let metadataLines = null;
|
|
413475
414092
|
let hasPreservedSegment = false;
|
|
413476
414093
|
if (!isEnvTruthy(process.env.THEUS_CODE_DISABLE_PRECOMPACT_SKIP)) {
|
|
413477
|
-
const { size } = await
|
|
414094
|
+
const { size } = await stat48(filePath);
|
|
413478
414095
|
if (size > SKIP_PRECOMPACT_THRESHOLD) {
|
|
413479
414096
|
const scan = await readTranscriptForLoad(filePath, size);
|
|
413480
414097
|
buf = scan.postBoundaryBuf;
|
|
@@ -413484,7 +414101,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413484
414101
|
}
|
|
413485
414102
|
}
|
|
413486
414103
|
}
|
|
413487
|
-
buf ??= await
|
|
414104
|
+
buf ??= await readFile56(filePath);
|
|
413488
414105
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.THEUS_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
413489
414106
|
buf = walkChainBeforeParse(buf);
|
|
413490
414107
|
}
|
|
@@ -413649,7 +414266,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
413649
414266
|
};
|
|
413650
414267
|
}
|
|
413651
414268
|
async function loadSessionFile(sessionId) {
|
|
413652
|
-
const sessionFile =
|
|
414269
|
+
const sessionFile = join150(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
413653
414270
|
return loadTranscriptFile(sessionFile);
|
|
413654
414271
|
}
|
|
413655
414272
|
function clearSessionMessagesCache() {
|
|
@@ -413713,11 +414330,11 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
413713
414330
|
const projectsDir = getProjectsDir2();
|
|
413714
414331
|
let dirents;
|
|
413715
414332
|
try {
|
|
413716
|
-
dirents = await
|
|
414333
|
+
dirents = await readdir34(projectsDir, { withFileTypes: true });
|
|
413717
414334
|
} catch {
|
|
413718
414335
|
return [];
|
|
413719
414336
|
}
|
|
413720
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
414337
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join150(projectsDir, dirent.name));
|
|
413721
414338
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
413722
414339
|
const allLogs = logsPerProject.flat();
|
|
413723
414340
|
const deduped = new Map;
|
|
@@ -413738,11 +414355,11 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
413738
414355
|
const projectsDir = getProjectsDir2();
|
|
413739
414356
|
let dirents;
|
|
413740
414357
|
try {
|
|
413741
|
-
dirents = await
|
|
414358
|
+
dirents = await readdir34(projectsDir, { withFileTypes: true });
|
|
413742
414359
|
} catch {
|
|
413743
414360
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
413744
414361
|
}
|
|
413745
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
414362
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join150(projectsDir, dirent.name));
|
|
413746
414363
|
const rawLogs = [];
|
|
413747
414364
|
for (const projectDir of projectDirs) {
|
|
413748
414365
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -413788,7 +414405,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
413788
414405
|
const seenDirs = new Set;
|
|
413789
414406
|
let allDirents;
|
|
413790
414407
|
try {
|
|
413791
|
-
allDirents = await
|
|
414408
|
+
allDirents = await readdir34(projectsDir, { withFileTypes: true });
|
|
413792
414409
|
} catch (e) {
|
|
413793
414410
|
logForDebugging(`Failed to read projects dir ${projectsDir}, falling back to current project: ${e}`);
|
|
413794
414411
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
@@ -413803,7 +414420,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
413803
414420
|
for (const { path: wtPath, prefix } of indexed) {
|
|
413804
414421
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
413805
414422
|
seenDirs.add(dirName);
|
|
413806
|
-
allLogs.push(...await getSessionFilesLite(
|
|
414423
|
+
allLogs.push(...await getSessionFilesLite(join150(projectsDir, dirent.name), undefined, wtPath));
|
|
413807
414424
|
break;
|
|
413808
414425
|
}
|
|
413809
414426
|
}
|
|
@@ -413872,10 +414489,10 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
413872
414489
|
return transcripts;
|
|
413873
414490
|
}
|
|
413874
414491
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
413875
|
-
const subagentsDir =
|
|
414492
|
+
const subagentsDir = join150(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), getSessionId(), "subagents");
|
|
413876
414493
|
let entries;
|
|
413877
414494
|
try {
|
|
413878
|
-
entries = await
|
|
414495
|
+
entries = await readdir34(subagentsDir, { withFileTypes: true });
|
|
413879
414496
|
} catch {
|
|
413880
414497
|
return {};
|
|
413881
414498
|
}
|
|
@@ -413989,7 +414606,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
413989
414606
|
const sessionFilesMap = new Map;
|
|
413990
414607
|
let dirents;
|
|
413991
414608
|
try {
|
|
413992
|
-
dirents = await
|
|
414609
|
+
dirents = await readdir34(projectDir, { withFileTypes: true });
|
|
413993
414610
|
} catch {
|
|
413994
414611
|
return sessionFilesMap;
|
|
413995
414612
|
}
|
|
@@ -414000,11 +414617,11 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
414000
414617
|
const sessionId = validateUuid2(basename48(dirent.name, ".jsonl"));
|
|
414001
414618
|
if (!sessionId)
|
|
414002
414619
|
continue;
|
|
414003
|
-
candidates.push({ sessionId, filePath:
|
|
414620
|
+
candidates.push({ sessionId, filePath: join150(projectDir, dirent.name) });
|
|
414004
414621
|
}
|
|
414005
414622
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
414006
414623
|
try {
|
|
414007
|
-
const st = await
|
|
414624
|
+
const st = await stat48(filePath);
|
|
414008
414625
|
sessionFilesMap.set(sessionId, {
|
|
414009
414626
|
path: filePath,
|
|
414010
414627
|
mtime: st.mtime.getTime(),
|
|
@@ -414387,7 +415004,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
414387
415004
|
init_settings2();
|
|
414388
415005
|
init_slowOperations();
|
|
414389
415006
|
init_uuid();
|
|
414390
|
-
VERSION4 = { VERSION: "0.2.
|
|
415007
|
+
VERSION4 = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
415008
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
414392
415009
|
SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
414393
415010
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -414399,7 +415016,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
414399
415016
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
414400
415017
|
agentTranscriptSubdirs = new Map;
|
|
414401
415018
|
getProjectDir3 = memoize_default((projectDir) => {
|
|
414402
|
-
return
|
|
415019
|
+
return join150(getProjectsDir2(), sanitizePath2(projectDir));
|
|
414403
415020
|
});
|
|
414404
415021
|
METADATA_TYPE_MARKERS = [
|
|
414405
415022
|
'"type":"summary"',
|
|
@@ -414637,41 +415254,41 @@ var init_memdir = __esm(() => {
|
|
|
414637
415254
|
});
|
|
414638
415255
|
|
|
414639
415256
|
// tools/AgentTool/agentMemory.ts
|
|
414640
|
-
import { join as
|
|
415257
|
+
import { join as join151, normalize as normalize14, sep as sep30 } from "path";
|
|
414641
415258
|
function sanitizeAgentTypeForPath(agentType) {
|
|
414642
415259
|
return agentType.replace(/:/g, "-");
|
|
414643
415260
|
}
|
|
414644
415261
|
function getLocalAgentMemoryDir(dirName) {
|
|
414645
415262
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
414646
|
-
return
|
|
415263
|
+
return join151(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep30;
|
|
414647
415264
|
}
|
|
414648
|
-
return
|
|
415265
|
+
return join151(getCwd(), ".theus", "agent-memory-local", dirName) + sep30;
|
|
414649
415266
|
}
|
|
414650
415267
|
function getAgentMemoryDir(agentType, scope) {
|
|
414651
415268
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
414652
415269
|
switch (scope) {
|
|
414653
415270
|
case "project":
|
|
414654
|
-
return
|
|
415271
|
+
return join151(getCwd(), ".theus", "agent-memory", dirName) + sep30;
|
|
414655
415272
|
case "local":
|
|
414656
415273
|
return getLocalAgentMemoryDir(dirName);
|
|
414657
415274
|
case "user":
|
|
414658
|
-
return
|
|
415275
|
+
return join151(getMemoryBaseDir(), "agent-memory", dirName) + sep30;
|
|
414659
415276
|
}
|
|
414660
415277
|
}
|
|
414661
415278
|
function isAgentMemoryPath(absolutePath) {
|
|
414662
415279
|
const normalizedPath = normalize14(absolutePath);
|
|
414663
415280
|
const memoryBase = getMemoryBaseDir();
|
|
414664
|
-
if (normalizedPath.startsWith(
|
|
415281
|
+
if (normalizedPath.startsWith(join151(memoryBase, "agent-memory") + sep30)) {
|
|
414665
415282
|
return true;
|
|
414666
415283
|
}
|
|
414667
|
-
if (normalizedPath.startsWith(
|
|
415284
|
+
if (normalizedPath.startsWith(join151(getCwd(), ".theus", "agent-memory") + sep30)) {
|
|
414668
415285
|
return true;
|
|
414669
415286
|
}
|
|
414670
415287
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
414671
|
-
if (normalizedPath.includes(sep30 + "agent-memory-local" + sep30) && normalizedPath.startsWith(
|
|
415288
|
+
if (normalizedPath.includes(sep30 + "agent-memory-local" + sep30) && normalizedPath.startsWith(join151(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects") + sep30)) {
|
|
414672
415289
|
return true;
|
|
414673
415290
|
}
|
|
414674
|
-
} else if (normalizedPath.startsWith(
|
|
415291
|
+
} else if (normalizedPath.startsWith(join151(getCwd(), ".theus", "agent-memory-local") + sep30)) {
|
|
414675
415292
|
return true;
|
|
414676
415293
|
}
|
|
414677
415294
|
return false;
|
|
@@ -414679,7 +415296,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
414679
415296
|
function getMemoryScopeDisplay(memory2) {
|
|
414680
415297
|
switch (memory2) {
|
|
414681
415298
|
case "user":
|
|
414682
|
-
return `User (${
|
|
415299
|
+
return `User (${join151(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
414683
415300
|
case "project":
|
|
414684
415301
|
return "Project (.theus/agent-memory/)";
|
|
414685
415302
|
case "local":
|
|
@@ -414722,7 +415339,7 @@ var init_agentMemory = __esm(() => {
|
|
|
414722
415339
|
// utils/permissions/filesystem.ts
|
|
414723
415340
|
import { randomBytes as randomBytes21 } from "crypto";
|
|
414724
415341
|
import { homedir as homedir39, tmpdir as tmpdir12 } from "os";
|
|
414725
|
-
import { join as
|
|
415342
|
+
import { join as join152, normalize as normalize15, posix as posix7, sep as sep31 } from "path";
|
|
414726
415343
|
function normalizeCaseForComparison(path17) {
|
|
414727
415344
|
return path17.toLowerCase();
|
|
414728
415345
|
}
|
|
@@ -414731,11 +415348,11 @@ function getTheusSkillScope(filePath) {
|
|
|
414731
415348
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
414732
415349
|
const bases = [
|
|
414733
415350
|
{
|
|
414734
|
-
dir: expandPath(
|
|
415351
|
+
dir: expandPath(join152(getOriginalCwd(), ".theus", "skills")),
|
|
414735
415352
|
prefix: "/.theus/skills/"
|
|
414736
415353
|
},
|
|
414737
415354
|
{
|
|
414738
|
-
dir: expandPath(
|
|
415355
|
+
dir: expandPath(join152(homedir39(), ".theus", "skills")),
|
|
414739
415356
|
prefix: "~/.theus/skills/"
|
|
414740
415357
|
}
|
|
414741
415358
|
];
|
|
@@ -414790,21 +415407,21 @@ function isTheusConfigFilePath(filePath) {
|
|
|
414790
415407
|
if (isTheusSettingsPath(filePath)) {
|
|
414791
415408
|
return true;
|
|
414792
415409
|
}
|
|
414793
|
-
const commandsDir =
|
|
414794
|
-
const agentsDir =
|
|
414795
|
-
const skillsDir =
|
|
415410
|
+
const commandsDir = join152(getOriginalCwd(), ".theus", "commands");
|
|
415411
|
+
const agentsDir = join152(getOriginalCwd(), ".theus", "agents");
|
|
415412
|
+
const skillsDir = join152(getOriginalCwd(), ".theus", "skills");
|
|
414796
415413
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
414797
415414
|
}
|
|
414798
415415
|
function isSessionPlanFile(absolutePath) {
|
|
414799
|
-
const expectedPrefix =
|
|
415416
|
+
const expectedPrefix = join152(getPlansDirectory(), getPlanSlug());
|
|
414800
415417
|
const normalizedPath = normalize15(absolutePath);
|
|
414801
415418
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
414802
415419
|
}
|
|
414803
415420
|
function getSessionMemoryDir() {
|
|
414804
|
-
return
|
|
415421
|
+
return join152(getProjectDir3(getCwd()), getSessionId(), "session-memory") + sep31;
|
|
414805
415422
|
}
|
|
414806
415423
|
function getSessionMemoryPath() {
|
|
414807
|
-
return
|
|
415424
|
+
return join152(getSessionMemoryDir(), "summary.md");
|
|
414808
415425
|
}
|
|
414809
415426
|
function isSessionMemoryPath(absolutePath) {
|
|
414810
415427
|
const normalizedPath = normalize15(absolutePath);
|
|
@@ -414826,10 +415443,10 @@ function getTheusTempDirName() {
|
|
|
414826
415443
|
return `theus-${uid}`;
|
|
414827
415444
|
}
|
|
414828
415445
|
function getProjectTempDir() {
|
|
414829
|
-
return
|
|
415446
|
+
return join152(getTheusTempDir(), sanitizePath2(getOriginalCwd())) + sep31;
|
|
414830
415447
|
}
|
|
414831
415448
|
function getScratchpadDir() {
|
|
414832
|
-
return
|
|
415449
|
+
return join152(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
414833
415450
|
}
|
|
414834
415451
|
async function ensureScratchpadDir() {
|
|
414835
415452
|
if (!isScratchpadEnabled()) {
|
|
@@ -415407,7 +416024,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
415407
416024
|
}
|
|
415408
416025
|
};
|
|
415409
416026
|
}
|
|
415410
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
416027
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join152(getOriginalCwd(), ".theus", "launch.json"))) {
|
|
415411
416028
|
return {
|
|
415412
416029
|
behavior: "allow",
|
|
415413
416030
|
updatedInput: input,
|
|
@@ -415504,7 +416121,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
415504
416121
|
}
|
|
415505
416122
|
};
|
|
415506
416123
|
}
|
|
415507
|
-
const tasksDir =
|
|
416124
|
+
const tasksDir = join152(getTheusConfigHomeDir(), "tasks") + sep31;
|
|
415508
416125
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
415509
416126
|
return {
|
|
415510
416127
|
behavior: "allow",
|
|
@@ -415515,7 +416132,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
415515
416132
|
}
|
|
415516
416133
|
};
|
|
415517
416134
|
}
|
|
415518
|
-
const teamsReadDir =
|
|
416135
|
+
const teamsReadDir = join152(getTheusConfigHomeDir(), "teams") + sep31;
|
|
415519
416136
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
415520
416137
|
return {
|
|
415521
416138
|
behavior: "allow",
|
|
@@ -415588,11 +416205,11 @@ var init_filesystem = __esm(() => {
|
|
|
415588
416205
|
try {
|
|
415589
416206
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
415590
416207
|
} catch {}
|
|
415591
|
-
return
|
|
416208
|
+
return join152(resolvedBaseTmpDir, getTheusTempDirName()) + sep31;
|
|
415592
416209
|
});
|
|
415593
416210
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
415594
416211
|
const nonce = randomBytes21(16).toString("hex");
|
|
415595
|
-
return
|
|
416212
|
+
return join152(getTheusTempDir(), "bundled-skills", { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
416213
|
});
|
|
415597
416214
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
415598
416215
|
});
|
|
@@ -415601,15 +416218,15 @@ var init_filesystem = __esm(() => {
|
|
|
415601
416218
|
import { constants as fsConstants6 } from "fs";
|
|
415602
416219
|
import {
|
|
415603
416220
|
mkdir as mkdir47,
|
|
415604
|
-
open as
|
|
415605
|
-
stat as
|
|
416221
|
+
open as open22,
|
|
416222
|
+
stat as stat49,
|
|
415606
416223
|
symlink as symlink6,
|
|
415607
416224
|
unlink as unlink23
|
|
415608
416225
|
} from "fs/promises";
|
|
415609
|
-
import { join as
|
|
416226
|
+
import { join as join153 } from "path";
|
|
415610
416227
|
function getTaskOutputDir() {
|
|
415611
416228
|
if (_taskOutputDir === undefined) {
|
|
415612
|
-
_taskOutputDir =
|
|
416229
|
+
_taskOutputDir = join153(getProjectTempDir(), getSessionId(), "tasks");
|
|
415613
416230
|
}
|
|
415614
416231
|
return _taskOutputDir;
|
|
415615
416232
|
}
|
|
@@ -415617,7 +416234,7 @@ async function ensureOutputDir() {
|
|
|
415617
416234
|
await mkdir47(getTaskOutputDir(), { recursive: true });
|
|
415618
416235
|
}
|
|
415619
416236
|
function getTaskOutputPath(taskId) {
|
|
415620
|
-
return
|
|
416237
|
+
return join153(getTaskOutputDir(), `${taskId}.output`);
|
|
415621
416238
|
}
|
|
415622
416239
|
function track(p) {
|
|
415623
416240
|
_pendingOps.add(p);
|
|
@@ -415667,7 +416284,7 @@ class DiskTaskOutput {
|
|
|
415667
416284
|
try {
|
|
415668
416285
|
if (!this.#fileHandle) {
|
|
415669
416286
|
await ensureOutputDir();
|
|
415670
|
-
this.#fileHandle = await
|
|
416287
|
+
this.#fileHandle = await open22(this.#path, process.platform === "win32" ? "a" : fsConstants6.O_WRONLY | fsConstants6.O_APPEND | fsConstants6.O_CREAT | O_NOFOLLOW2);
|
|
415671
416288
|
}
|
|
415672
416289
|
while (true) {
|
|
415673
416290
|
await this.#writeAllChunks();
|
|
@@ -415784,7 +416401,7 @@ function initTaskOutput(taskId) {
|
|
|
415784
416401
|
return track((async () => {
|
|
415785
416402
|
await ensureOutputDir();
|
|
415786
416403
|
const outputPath = getTaskOutputPath(taskId);
|
|
415787
|
-
const fh = await
|
|
416404
|
+
const fh = await open22(outputPath, process.platform === "win32" ? "wx" : fsConstants6.O_WRONLY | fsConstants6.O_CREAT | fsConstants6.O_EXCL | O_NOFOLLOW2);
|
|
415788
416405
|
await fh.close();
|
|
415789
416406
|
return outputPath;
|
|
415790
416407
|
})());
|
|
@@ -415866,7 +416483,7 @@ var init_Task = __esm(() => {
|
|
|
415866
416483
|
});
|
|
415867
416484
|
|
|
415868
416485
|
// utils/ShellCommand.ts
|
|
415869
|
-
import { stat as
|
|
416486
|
+
import { stat as stat50 } from "fs/promises";
|
|
415870
416487
|
function prependStderr(prefix, stderr) {
|
|
415871
416488
|
return stderr ? `${prefix} ${stderr}` : prefix;
|
|
415872
416489
|
}
|
|
@@ -415990,7 +416607,7 @@ class ShellCommandImpl {
|
|
|
415990
416607
|
}
|
|
415991
416608
|
#startSizeWatchdog() {
|
|
415992
416609
|
this.#sizeWatchdog = setInterval(() => {
|
|
415993
|
-
|
|
416610
|
+
stat50(this.taskOutput.path).then((s) => {
|
|
415994
416611
|
if (s.size > this.#maxOutputBytes && this.#status === "backgrounded" && this.#sizeWatchdog !== null) {
|
|
415995
416612
|
this.#killedForSize = true;
|
|
415996
416613
|
this.#clearSizeWatchdog();
|
|
@@ -419853,7 +420470,7 @@ var init_hooks5 = __esm(() => {
|
|
|
419853
420470
|
});
|
|
419854
420471
|
|
|
419855
420472
|
// utils/settings/changeDetector.ts
|
|
419856
|
-
import { stat as
|
|
420473
|
+
import { stat as stat51 } from "fs/promises";
|
|
419857
420474
|
import * as platformPath from "path";
|
|
419858
420475
|
async function initialize() {
|
|
419859
420476
|
if (getIsRemoteMode())
|
|
@@ -419933,7 +420550,7 @@ async function getWatchTargets() {
|
|
|
419933
420550
|
}
|
|
419934
420551
|
dirToSettingsFiles.get(dir).add(path17);
|
|
419935
420552
|
try {
|
|
419936
|
-
const stats2 = await
|
|
420553
|
+
const stats2 = await stat51(path17);
|
|
419937
420554
|
if (stats2.isFile()) {
|
|
419938
420555
|
dirsWithExistingFiles.add(dir);
|
|
419939
420556
|
}
|
|
@@ -419951,7 +420568,7 @@ async function getWatchTargets() {
|
|
|
419951
420568
|
let dropInDir = null;
|
|
419952
420569
|
const managedDropIn = getManagedSettingsDropInDir();
|
|
419953
420570
|
try {
|
|
419954
|
-
const stats2 = await
|
|
420571
|
+
const stats2 = await stat51(managedDropIn);
|
|
419955
420572
|
if (stats2.isDirectory()) {
|
|
419956
420573
|
dirsWithExistingFiles.add(managedDropIn);
|
|
419957
420574
|
dropInDir = managedDropIn;
|
|
@@ -420131,8 +420748,8 @@ __export(exports_sandbox_adapter, {
|
|
|
420131
420748
|
SandboxManager: () => SandboxManager2
|
|
420132
420749
|
});
|
|
420133
420750
|
import { rmSync as rmSync5, statSync as statSync13 } from "fs";
|
|
420134
|
-
import { readFile as
|
|
420135
|
-
import { join as
|
|
420751
|
+
import { readFile as readFile57 } from "fs/promises";
|
|
420752
|
+
import { join as join154, resolve as resolve46, sep as sep33 } from "path";
|
|
420136
420753
|
function permissionRuleValueFromString2(ruleString) {
|
|
420137
420754
|
const matches = ruleString.match(/^([^(]+)\(([^)]+)\)$/);
|
|
420138
420755
|
if (!matches) {
|
|
@@ -420314,9 +420931,9 @@ function scrubBareGitRepoFiles() {
|
|
|
420314
420931
|
}
|
|
420315
420932
|
}
|
|
420316
420933
|
async function detectWorktreeMainRepoPath(cwd2) {
|
|
420317
|
-
const gitPath =
|
|
420934
|
+
const gitPath = join154(cwd2, ".git");
|
|
420318
420935
|
try {
|
|
420319
|
-
const gitContent = await
|
|
420936
|
+
const gitContent = await readFile57(gitPath, { encoding: "utf8" });
|
|
420320
420937
|
const gitdirMatch = gitContent.match(/^gitdir:\s*(.+)$/m);
|
|
420321
420938
|
if (!gitdirMatch?.[1]) {
|
|
420322
420939
|
return null;
|
|
@@ -420618,7 +421235,7 @@ var init_sandbox_adapter = __esm(() => {
|
|
|
420618
421235
|
|
|
420619
421236
|
// utils/permissions/pathValidation.ts
|
|
420620
421237
|
import { homedir as homedir40 } from "os";
|
|
420621
|
-
import { dirname as
|
|
421238
|
+
import { dirname as dirname64, isAbsolute as isAbsolute29, resolve as resolve47 } from "path";
|
|
420622
421239
|
function formatDirectoryList2(directories) {
|
|
420623
421240
|
const dirCount = directories.length;
|
|
420624
421241
|
if (dirCount <= MAX_DIRS_TO_LIST2) {
|
|
@@ -420761,7 +421378,7 @@ function isDangerousRemovalPath(resolvedPath) {
|
|
|
420761
421378
|
if (normalizedPath === normalizedHome) {
|
|
420762
421379
|
return true;
|
|
420763
421380
|
}
|
|
420764
|
-
const parentDir =
|
|
421381
|
+
const parentDir = dirname64(normalizedPath);
|
|
420765
421382
|
if (parentDir === "/") {
|
|
420766
421383
|
return true;
|
|
420767
421384
|
}
|
|
@@ -420841,8 +421458,8 @@ var init_pathValidation3 = __esm(() => {
|
|
|
420841
421458
|
|
|
420842
421459
|
// utils/plugins/pluginDirectories.ts
|
|
420843
421460
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
420844
|
-
import { readdir as
|
|
420845
|
-
import { delimiter as delimiter3, join as
|
|
421461
|
+
import { readdir as readdir35, rm as rm10, stat as stat52 } from "fs/promises";
|
|
421462
|
+
import { delimiter as delimiter3, join as join155 } from "path";
|
|
420846
421463
|
function getPluginsDirectoryName() {
|
|
420847
421464
|
if (getUseCoworkPlugins()) {
|
|
420848
421465
|
return COWORK_PLUGINS_DIR;
|
|
@@ -420857,7 +421474,7 @@ function getPluginsDirectory() {
|
|
|
420857
421474
|
if (envOverride) {
|
|
420858
421475
|
return expandTilde2(envOverride);
|
|
420859
421476
|
}
|
|
420860
|
-
return
|
|
421477
|
+
return join155(getTheusConfigHomeDir(), getPluginsDirectoryName());
|
|
420861
421478
|
}
|
|
420862
421479
|
function getPluginSeedDirs() {
|
|
420863
421480
|
const raw = process.env.THEUS_CODE_PLUGIN_SEED_DIR;
|
|
@@ -420869,7 +421486,7 @@ function sanitizePluginId(pluginId) {
|
|
|
420869
421486
|
return pluginId.replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
420870
421487
|
}
|
|
420871
421488
|
function pluginDataDirPath(pluginId) {
|
|
420872
|
-
return
|
|
421489
|
+
return join155(getPluginsDirectory(), "data", sanitizePluginId(pluginId));
|
|
420873
421490
|
}
|
|
420874
421491
|
function getPluginDataDir(pluginId) {
|
|
420875
421492
|
const dir = pluginDataDirPath(pluginId);
|
|
@@ -420880,13 +421497,13 @@ async function getPluginDataDirSize(pluginId) {
|
|
|
420880
421497
|
const dir = pluginDataDirPath(pluginId);
|
|
420881
421498
|
let bytes = 0;
|
|
420882
421499
|
const walk = async (p) => {
|
|
420883
|
-
for (const entry of await
|
|
420884
|
-
const full =
|
|
421500
|
+
for (const entry of await readdir35(p, { withFileTypes: true })) {
|
|
421501
|
+
const full = join155(p, entry.name);
|
|
420885
421502
|
if (entry.isDirectory()) {
|
|
420886
421503
|
await walk(full);
|
|
420887
421504
|
} else {
|
|
420888
421505
|
try {
|
|
420889
|
-
bytes += (await
|
|
421506
|
+
bytes += (await stat52(full)).size;
|
|
420890
421507
|
} catch {}
|
|
420891
421508
|
}
|
|
420892
421509
|
}
|
|
@@ -420921,8 +421538,8 @@ var init_pluginDirectories = __esm(() => {
|
|
|
420921
421538
|
});
|
|
420922
421539
|
|
|
420923
421540
|
// utils/plugins/lspPluginIntegration.ts
|
|
420924
|
-
import { readFile as
|
|
420925
|
-
import { join as
|
|
421541
|
+
import { readFile as readFile58 } from "fs/promises";
|
|
421542
|
+
import { join as join156, relative as relative31, resolve as resolve48 } from "path";
|
|
420926
421543
|
function validatePathWithinPlugin(pluginPath, relativePath2) {
|
|
420927
421544
|
const resolvedPluginPath = resolve48(pluginPath);
|
|
420928
421545
|
const resolvedFilePath = resolve48(pluginPath, relativePath2);
|
|
@@ -420934,9 +421551,9 @@ function validatePathWithinPlugin(pluginPath, relativePath2) {
|
|
|
420934
421551
|
}
|
|
420935
421552
|
async function loadPluginLspServers(plugin2, errors4 = []) {
|
|
420936
421553
|
const servers = {};
|
|
420937
|
-
const lspJsonPath =
|
|
421554
|
+
const lspJsonPath = join156(plugin2.path, ".lsp.json");
|
|
420938
421555
|
try {
|
|
420939
|
-
const content = await
|
|
421556
|
+
const content = await readFile58(lspJsonPath, "utf-8");
|
|
420940
421557
|
const parsed = jsonParse(content);
|
|
420941
421558
|
const result = exports_external.record(exports_external.string(), LspServerConfigSchema()).safeParse(parsed);
|
|
420942
421559
|
if (result.success) {
|
|
@@ -420993,7 +421610,7 @@ async function loadLspServersFromManifest(declaration, pluginPath, pluginName, e
|
|
|
420993
421610
|
continue;
|
|
420994
421611
|
}
|
|
420995
421612
|
try {
|
|
420996
|
-
const content = await
|
|
421613
|
+
const content = await readFile58(validatedPath, "utf-8");
|
|
420997
421614
|
const parsed = jsonParse(content);
|
|
420998
421615
|
const result = exports_external.record(exports_external.string(), LspServerConfigSchema()).safeParse(parsed);
|
|
420999
421616
|
if (result.success) {
|
|
@@ -426193,9 +426810,9 @@ __export(exports_upstreamproxy, {
|
|
|
426193
426810
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
426194
426811
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
426195
426812
|
});
|
|
426196
|
-
import { mkdir as mkdir48, readFile as
|
|
426813
|
+
import { mkdir as mkdir48, readFile as readFile59, unlink as unlink24, writeFile as writeFile50 } from "fs/promises";
|
|
426197
426814
|
import { homedir as homedir41 } from "os";
|
|
426198
|
-
import { join as
|
|
426815
|
+
import { join as join157 } from "path";
|
|
426199
426816
|
async function initUpstreamProxy(opts) {
|
|
426200
426817
|
if (!isEnvTruthy(process.env.THEUS_CODE_REMOTE)) {
|
|
426201
426818
|
return state;
|
|
@@ -426216,7 +426833,7 @@ async function initUpstreamProxy(opts) {
|
|
|
426216
426833
|
}
|
|
426217
426834
|
setNonDumpable();
|
|
426218
426835
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.THEUS_BASE_URL ?? "https://api.theus.pe";
|
|
426219
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
426836
|
+
const caBundlePath = opts?.caBundlePath ?? join157(homedir41(), ".ccr", "ca-bundle.crt");
|
|
426220
426837
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
426221
426838
|
if (!caOk)
|
|
426222
426839
|
return state;
|
|
@@ -426274,7 +426891,7 @@ function resetUpstreamProxyForTests() {
|
|
|
426274
426891
|
}
|
|
426275
426892
|
async function readToken(path19) {
|
|
426276
426893
|
try {
|
|
426277
|
-
const raw = await
|
|
426894
|
+
const raw = await readFile59(path19, "utf8");
|
|
426278
426895
|
return raw.trim() || null;
|
|
426279
426896
|
} catch (err2) {
|
|
426280
426897
|
if (isENOENT(err2))
|
|
@@ -426316,8 +426933,8 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
426316
426933
|
return false;
|
|
426317
426934
|
}
|
|
426318
426935
|
const ccrCa = await resp.text();
|
|
426319
|
-
const systemCa = await
|
|
426320
|
-
await mkdir48(
|
|
426936
|
+
const systemCa = await readFile59(systemCaPath, "utf8").catch(() => "");
|
|
426937
|
+
await mkdir48(join157(outPath, ".."), { recursive: true });
|
|
426321
426938
|
await writeFile50(outPath, systemCa + `
|
|
426322
426939
|
` + ccrCa, "utf8");
|
|
426323
426940
|
return true;
|
|
@@ -426746,14 +427363,14 @@ import {
|
|
|
426746
427363
|
appendFile as appendFile7,
|
|
426747
427364
|
chmod as chmod12,
|
|
426748
427365
|
mkdir as mkdir49,
|
|
426749
|
-
readdir as
|
|
427366
|
+
readdir as readdir36,
|
|
426750
427367
|
rmdir as rmdir3,
|
|
426751
|
-
stat as
|
|
427368
|
+
stat as stat53,
|
|
426752
427369
|
unlink as unlink25
|
|
426753
427370
|
} from "fs/promises";
|
|
426754
427371
|
import { createServer as createServer9 } from "net";
|
|
426755
427372
|
import { platform as platform6 } from "os";
|
|
426756
|
-
import { join as
|
|
427373
|
+
import { join as join158 } from "path";
|
|
426757
427374
|
function log(message, ...args) {
|
|
426758
427375
|
if (LOG_FILE) {
|
|
426759
427376
|
const timestamp2 = new Date().toISOString();
|
|
@@ -426800,7 +427417,7 @@ class ChromeNativeHost {
|
|
|
426800
427417
|
if (platform6() !== "win32") {
|
|
426801
427418
|
const socketDir = getSocketDir();
|
|
426802
427419
|
try {
|
|
426803
|
-
const dirStats = await
|
|
427420
|
+
const dirStats = await stat53(socketDir);
|
|
426804
427421
|
if (!dirStats.isDirectory()) {
|
|
426805
427422
|
await unlink25(socketDir);
|
|
426806
427423
|
}
|
|
@@ -426808,7 +427425,7 @@ class ChromeNativeHost {
|
|
|
426808
427425
|
await mkdir49(socketDir, { recursive: true, mode: 448 });
|
|
426809
427426
|
await chmod12(socketDir, 448).catch(() => {});
|
|
426810
427427
|
try {
|
|
426811
|
-
const files2 = await
|
|
427428
|
+
const files2 = await readdir36(socketDir);
|
|
426812
427429
|
for (const file2 of files2) {
|
|
426813
427430
|
if (!file2.endsWith(".sock")) {
|
|
426814
427431
|
continue;
|
|
@@ -426820,7 +427437,7 @@ class ChromeNativeHost {
|
|
|
426820
427437
|
try {
|
|
426821
427438
|
process.kill(pid, 0);
|
|
426822
427439
|
} catch {
|
|
426823
|
-
await unlink25(
|
|
427440
|
+
await unlink25(join158(socketDir, file2)).catch(() => {});
|
|
426824
427441
|
log(`Removed stale socket for PID ${pid}`);
|
|
426825
427442
|
}
|
|
426826
427443
|
}
|
|
@@ -426869,7 +427486,7 @@ class ChromeNativeHost {
|
|
|
426869
427486
|
} catch {}
|
|
426870
427487
|
try {
|
|
426871
427488
|
const socketDir = getSocketDir();
|
|
426872
|
-
const remaining = await
|
|
427489
|
+
const remaining = await readdir36(socketDir);
|
|
426873
427490
|
if (remaining.length === 0) {
|
|
426874
427491
|
await rmdir3(socketDir);
|
|
426875
427492
|
log("Removed empty socket directory");
|
|
@@ -427769,7 +428386,7 @@ async function handleMemories(state2) {
|
|
|
427769
428386
|
async function runProjectContextMcpServer() {
|
|
427770
428387
|
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
427771
428388
|
const state2 = new ProjectContextState(projectRoot);
|
|
427772
|
-
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.
|
|
428389
|
+
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
428390
|
server2.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
427774
428391
|
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
427775
428392
|
name: t.name,
|
|
@@ -427895,13 +428512,13 @@ var init_server3 = __esm(() => {
|
|
|
427895
428512
|
|
|
427896
428513
|
// services/mcpComputerUse/macos.ts
|
|
427897
428514
|
import { execFile as execFile8 } from "child_process";
|
|
427898
|
-
import { existsSync as
|
|
428515
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync12, readFileSync as readFileSync30, statSync as statSync14, unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "fs";
|
|
427899
428516
|
import { homedir as homedir43, tmpdir as tmpdir13 } from "os";
|
|
427900
|
-
import { join as
|
|
428517
|
+
import { join as join159 } from "path";
|
|
427901
428518
|
import { promisify as promisify6 } from "util";
|
|
427902
428519
|
function cuDir() {
|
|
427903
|
-
const dir =
|
|
427904
|
-
if (!
|
|
428520
|
+
const dir = join159(homedir43(), ".theus", "cu");
|
|
428521
|
+
if (!existsSync26(dir))
|
|
427905
428522
|
mkdirSync12(dir, { recursive: true });
|
|
427906
428523
|
return dir;
|
|
427907
428524
|
}
|
|
@@ -427914,7 +428531,7 @@ function resolveBin(name, extra = []) {
|
|
|
427914
428531
|
`/usr/sbin/${name}`
|
|
427915
428532
|
];
|
|
427916
428533
|
for (const candidate of candidates) {
|
|
427917
|
-
if (
|
|
428534
|
+
if (existsSync26(candidate))
|
|
427918
428535
|
return candidate;
|
|
427919
428536
|
}
|
|
427920
428537
|
return name;
|
|
@@ -427948,9 +428565,9 @@ async function getScreenGeometry(force = false) {
|
|
|
427948
428565
|
return cachedGeometry;
|
|
427949
428566
|
}
|
|
427950
428567
|
async function checkPermissions() {
|
|
427951
|
-
const probe =
|
|
428568
|
+
const probe = join159(tmpdir13(), `theus-cu-probe-${process.pid}.jpg`);
|
|
427952
428569
|
const cap = await run6(SCREENCAPTURE, ["-x", "-t", "jpg", probe], { timeoutMs: 8000 });
|
|
427953
|
-
const screenRecording =
|
|
428570
|
+
const screenRecording = existsSync26(probe) && (() => {
|
|
427954
428571
|
try {
|
|
427955
428572
|
return statSync14(probe).size > 0;
|
|
427956
428573
|
} catch {
|
|
@@ -427958,7 +428575,7 @@ async function checkPermissions() {
|
|
|
427958
428575
|
}
|
|
427959
428576
|
})();
|
|
427960
428577
|
try {
|
|
427961
|
-
if (
|
|
428578
|
+
if (existsSync26(probe))
|
|
427962
428579
|
unlinkSync3(probe);
|
|
427963
428580
|
} catch {}
|
|
427964
428581
|
const cc = await run6(CLICLICK, ["p"], { timeoutMs: 5000 });
|
|
@@ -427977,14 +428594,14 @@ async function checkPermissions() {
|
|
|
427977
428594
|
async function captureScreenshot(opts = {}) {
|
|
427978
428595
|
const maxSide = opts.maxSide ?? 1400;
|
|
427979
428596
|
const quality = Math.min(Math.max(opts.quality ?? 72, 1), 100);
|
|
427980
|
-
const raw =
|
|
427981
|
-
const out =
|
|
428597
|
+
const raw = join159(cuDir(), `shot-${process.pid}.png`);
|
|
428598
|
+
const out = join159(cuDir(), `shot-${process.pid}.jpg`);
|
|
427982
428599
|
const capArgs = ["-x", "-t", "png", "-o"];
|
|
427983
428600
|
if (opts.displayIndex && opts.displayIndex > 0)
|
|
427984
428601
|
capArgs.push("-D", String(opts.displayIndex));
|
|
427985
428602
|
capArgs.push(raw);
|
|
427986
428603
|
const cap = await run6(SCREENCAPTURE, capArgs, { timeoutMs: 12000 });
|
|
427987
|
-
if (!
|
|
428604
|
+
if (!existsSync26(raw) || statSync14(raw).size === 0) {
|
|
427988
428605
|
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
428606
|
}
|
|
427990
428607
|
await run6(SIPS, [
|
|
@@ -428000,7 +428617,7 @@ async function captureScreenshot(opts = {}) {
|
|
|
428000
428617
|
"--out",
|
|
428001
428618
|
out
|
|
428002
428619
|
], { timeoutMs: 12000 });
|
|
428003
|
-
if (!
|
|
428620
|
+
if (!existsSync26(out) || statSync14(out).size === 0) {
|
|
428004
428621
|
throw new ComputerUseError("sips no pudo reescalar la captura a JPEG.");
|
|
428005
428622
|
}
|
|
428006
428623
|
const dims = await run6(SIPS, ["-g", "pixelWidth", "-g", "pixelHeight", out]);
|
|
@@ -428141,15 +428758,15 @@ async function ensureScrollHelper() {
|
|
|
428141
428758
|
if (scrollBinPromise)
|
|
428142
428759
|
return scrollBinPromise;
|
|
428143
428760
|
scrollBinPromise = (async () => {
|
|
428144
|
-
if (!
|
|
428145
|
-
const src =
|
|
428146
|
-
const bin =
|
|
428147
|
-
if (
|
|
428761
|
+
if (!existsSync26(SWIFTC) && SWIFTC === "swiftc") {}
|
|
428762
|
+
const src = join159(cuDir(), "scroll.swift");
|
|
428763
|
+
const bin = join159(cuDir(), "theus-cu-scroll");
|
|
428764
|
+
if (existsSync26(bin))
|
|
428148
428765
|
return bin;
|
|
428149
428766
|
try {
|
|
428150
428767
|
writeFileSync10(src, SCROLL_SWIFT, "utf8");
|
|
428151
428768
|
const res = await run6(SWIFTC, ["-O", "-o", bin, src], { timeoutMs: 60000 });
|
|
428152
|
-
if (
|
|
428769
|
+
if (existsSync26(bin))
|
|
428153
428770
|
return bin;
|
|
428154
428771
|
process.stderr.write(`[computer-use] no se pudo compilar el helper de scroll: ${res.stderr}
|
|
428155
428772
|
`);
|
|
@@ -428473,8 +429090,8 @@ var exports_selftest = {};
|
|
|
428473
429090
|
__export(exports_selftest, {
|
|
428474
429091
|
runComputerUseSelfTest: () => runComputerUseSelfTest
|
|
428475
429092
|
});
|
|
428476
|
-
import { existsSync as
|
|
428477
|
-
import { join as
|
|
429093
|
+
import { existsSync as existsSync27, writeFileSync as writeFileSync11 } from "fs";
|
|
429094
|
+
import { join as join160 } from "path";
|
|
428478
429095
|
import { homedir as homedir44 } from "os";
|
|
428479
429096
|
async function runComputerUseSelfTest() {
|
|
428480
429097
|
let pass = 0;
|
|
@@ -428497,7 +429114,7 @@ Theus computer-use \u2014 self-test (macOS)
|
|
|
428497
429114
|
`);
|
|
428498
429115
|
const tools = toolingReport();
|
|
428499
429116
|
for (const [name, path19] of Object.entries(tools)) {
|
|
428500
|
-
if (
|
|
429117
|
+
if (existsSync27(path19))
|
|
428501
429118
|
ok2(`${name}: ${path19}`);
|
|
428502
429119
|
else if (name === "swiftc")
|
|
428503
429120
|
warn(`${name}: no encontrado (scroll quedar\xE1 deshabilitado; el resto funciona)`);
|
|
@@ -428526,7 +429143,7 @@ Geometr\xEDa y captura:`);
|
|
|
428526
429143
|
let captureOk = false;
|
|
428527
429144
|
try {
|
|
428528
429145
|
const shot = await captureScreenshot();
|
|
428529
|
-
const outPath =
|
|
429146
|
+
const outPath = join160(homedir44(), ".theus", "cu", "selftest-shot.jpg");
|
|
428530
429147
|
writeFileSync11(outPath, Buffer.from(shot.base64, "base64"));
|
|
428531
429148
|
ok2(`Captura ${shot.width}\xD7${shot.height} px, ${Math.round(shot.base64.length * 0.75 / 1024)} KB \u2192 ${outPath}`);
|
|
428532
429149
|
captureOk = true;
|
|
@@ -428999,7 +429616,7 @@ var init_client6 = __esm(() => {
|
|
|
428999
429616
|
// services/titanFleet/executor.ts
|
|
429000
429617
|
import { createHash as createHash32 } from "crypto";
|
|
429001
429618
|
import { spawn as spawn11 } from "child_process";
|
|
429002
|
-
import { existsSync as
|
|
429619
|
+
import { existsSync as existsSync28 } from "fs";
|
|
429003
429620
|
import { resolve as resolve51 } from "path";
|
|
429004
429621
|
async function ensureFleetDurableEffect(effect, signal) {
|
|
429005
429622
|
if (effect.hasChanges) {
|
|
@@ -429007,10 +429624,10 @@ async function ensureFleetDurableEffect(effect, signal) {
|
|
|
429007
429624
|
}
|
|
429008
429625
|
}
|
|
429009
429626
|
async function cleanupFleetDurableEffect(effect) {
|
|
429010
|
-
if (!
|
|
429627
|
+
if (!existsSync28(effect.worktreePath))
|
|
429011
429628
|
return;
|
|
429012
429629
|
const removed = await removeAgentWorktree(effect.worktreePath, effect.worktreeBranch, effect.gitRoot, effect.hookBased);
|
|
429013
|
-
if (!removed &&
|
|
429630
|
+
if (!removed && existsSync28(effect.worktreePath)) {
|
|
429014
429631
|
throw new Error("Fleet no pudo limpiar el worktree durable; el outbox se conserva");
|
|
429015
429632
|
}
|
|
429016
429633
|
}
|
|
@@ -429173,7 +429790,7 @@ function installedCliPath() {
|
|
|
429173
429790
|
resolve51(import.meta.dir, "..", "..", "bin", "theus"),
|
|
429174
429791
|
resolve51(import.meta.dir, "bin", "theus")
|
|
429175
429792
|
];
|
|
429176
|
-
const found = candidates.find((candidate) =>
|
|
429793
|
+
const found = candidates.find((candidate) => existsSync28(candidate));
|
|
429177
429794
|
if (!found) {
|
|
429178
429795
|
throw new Error("No se encontr\xF3 el launcher bin/theus para el worker Fleet");
|
|
429179
429796
|
}
|
|
@@ -429378,32 +429995,32 @@ import {
|
|
|
429378
429995
|
chmod as chmod13,
|
|
429379
429996
|
lstat as lstat7,
|
|
429380
429997
|
mkdir as mkdir50,
|
|
429381
|
-
open as
|
|
429382
|
-
readFile as
|
|
429998
|
+
open as open23,
|
|
429999
|
+
readFile as readFile60,
|
|
429383
430000
|
rename as rename10,
|
|
429384
430001
|
unlink as unlink26
|
|
429385
430002
|
} from "fs/promises";
|
|
429386
430003
|
import { homedir as homedir45 } from "os";
|
|
429387
|
-
import { dirname as
|
|
430004
|
+
import { dirname as dirname65, resolve as resolve52 } from "path";
|
|
429388
430005
|
function defaultFleetCredentialsPath() {
|
|
429389
430006
|
return resolve52(homedir45(), ".theus", "titan", "fleet-worker.json");
|
|
429390
430007
|
}
|
|
429391
430008
|
async function rejectSymlink(path19) {
|
|
429392
|
-
const
|
|
430009
|
+
const stat54 = await lstat7(path19).catch((error40) => {
|
|
429393
430010
|
if (error40.code === "ENOENT")
|
|
429394
430011
|
return;
|
|
429395
430012
|
throw error40;
|
|
429396
430013
|
});
|
|
429397
|
-
if (
|
|
430014
|
+
if (stat54?.isSymbolicLink()) {
|
|
429398
430015
|
throw new Error("Se rechaz\xF3 un symlink como almac\xE9n de credenciales Fleet");
|
|
429399
430016
|
}
|
|
429400
|
-
if (
|
|
430017
|
+
if (stat54 && !stat54.isFile()) {
|
|
429401
430018
|
throw new Error("El almac\xE9n de credenciales Fleet no es un archivo regular");
|
|
429402
430019
|
}
|
|
429403
430020
|
}
|
|
429404
430021
|
async function loadFleetCredentials(path19 = defaultFleetCredentialsPath()) {
|
|
429405
430022
|
await rejectSymlink(path19);
|
|
429406
|
-
const raw = await
|
|
430023
|
+
const raw = await readFile60(path19, "utf8").catch((error40) => {
|
|
429407
430024
|
if (error40.code === "ENOENT")
|
|
429408
430025
|
return;
|
|
429409
430026
|
throw error40;
|
|
@@ -429414,7 +430031,7 @@ async function loadFleetCredentials(path19 = defaultFleetCredentialsPath()) {
|
|
|
429414
430031
|
}
|
|
429415
430032
|
async function saveFleetCredentials(value, path19 = defaultFleetCredentialsPath()) {
|
|
429416
430033
|
const parsed = storedCredentialsSchema.parse(value);
|
|
429417
|
-
const directory =
|
|
430034
|
+
const directory = dirname65(path19);
|
|
429418
430035
|
const existingDirectory = await lstat7(directory).catch((error40) => {
|
|
429419
430036
|
if (error40.code === "ENOENT")
|
|
429420
430037
|
return;
|
|
@@ -429429,7 +430046,7 @@ async function saveFleetCredentials(value, path19 = defaultFleetCredentialsPath(
|
|
|
429429
430046
|
await rejectSymlink(path19);
|
|
429430
430047
|
const temp = `${path19}.tmp-${process.pid}-${randomUUID38()}`;
|
|
429431
430048
|
const flags = constants5.O_WRONLY | constants5.O_CREAT | constants5.O_EXCL | (constants5.O_NOFOLLOW ?? 0);
|
|
429432
|
-
const handle2 = await
|
|
430049
|
+
const handle2 = await open23(temp, flags, 384);
|
|
429433
430050
|
try {
|
|
429434
430051
|
await handle2.writeFile(`${JSON.stringify(parsed, null, 2)}
|
|
429435
430052
|
`, "utf8");
|
|
@@ -429466,14 +430083,14 @@ import {
|
|
|
429466
430083
|
chmod as chmod14,
|
|
429467
430084
|
lstat as lstat8,
|
|
429468
430085
|
mkdir as mkdir51,
|
|
429469
|
-
open as
|
|
429470
|
-
readFile as
|
|
430086
|
+
open as open24,
|
|
430087
|
+
readFile as readFile61,
|
|
429471
430088
|
rename as rename11,
|
|
429472
|
-
stat as
|
|
430089
|
+
stat as stat54,
|
|
429473
430090
|
unlink as unlink27
|
|
429474
430091
|
} from "fs/promises";
|
|
429475
430092
|
import { homedir as homedir46 } from "os";
|
|
429476
|
-
import { dirname as
|
|
430093
|
+
import { dirname as dirname66, resolve as resolve53 } from "path";
|
|
429477
430094
|
function defaultFleetOutboxPath() {
|
|
429478
430095
|
return resolve53(homedir46(), ".theus", "titan", "fleet-terminal-outbox.json");
|
|
429479
430096
|
}
|
|
@@ -429539,7 +430156,7 @@ async function rejectSymlink2(path19) {
|
|
|
429539
430156
|
}
|
|
429540
430157
|
async function readRecords(path19) {
|
|
429541
430158
|
await rejectSymlink2(path19);
|
|
429542
|
-
const info = await
|
|
430159
|
+
const info = await stat54(path19).catch((error40) => {
|
|
429543
430160
|
if (error40.code === "ENOENT")
|
|
429544
430161
|
return;
|
|
429545
430162
|
throw error40;
|
|
@@ -429556,7 +430173,7 @@ async function readRecords(path19) {
|
|
|
429556
430173
|
throw new FleetOutboxCorruptError("El outbox Fleet excede el l\xEDmite de bytes");
|
|
429557
430174
|
}
|
|
429558
430175
|
try {
|
|
429559
|
-
const parsed = outboxFileSchema.parse(JSON.parse(await
|
|
430176
|
+
const parsed = outboxFileSchema.parse(JSON.parse(await readFile61(path19, "utf8")));
|
|
429560
430177
|
const ids = new Set;
|
|
429561
430178
|
return parsed.records.map((record3) => {
|
|
429562
430179
|
const checked = validateRecord(record3);
|
|
@@ -429582,7 +430199,7 @@ async function writeRecords(path19, records) {
|
|
|
429582
430199
|
if (Buffer.byteLength(serialized) > MAX_FILE_BYTES) {
|
|
429583
430200
|
throw new FleetOutboxCorruptError("El outbox Fleet alcanz\xF3 su l\xEDmite de bytes");
|
|
429584
430201
|
}
|
|
429585
|
-
const directory =
|
|
430202
|
+
const directory = dirname66(path19);
|
|
429586
430203
|
const directoryEntry = await lstat8(directory).catch((error40) => {
|
|
429587
430204
|
if (error40.code === "ENOENT")
|
|
429588
430205
|
return;
|
|
@@ -429596,7 +430213,7 @@ async function writeRecords(path19, records) {
|
|
|
429596
430213
|
await chmod14(directory, 448);
|
|
429597
430214
|
await rejectSymlink2(path19);
|
|
429598
430215
|
const temp = `${path19}.tmp-${process.pid}-${randomUUID39()}`;
|
|
429599
|
-
const handle2 = await
|
|
430216
|
+
const handle2 = await open24(temp, constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | (constants6.O_NOFOLLOW ?? 0), 384);
|
|
429600
430217
|
try {
|
|
429601
430218
|
await handle2.writeFile(serialized, "utf8");
|
|
429602
430219
|
await handle2.sync();
|
|
@@ -429607,7 +430224,7 @@ async function writeRecords(path19, records) {
|
|
|
429607
430224
|
await chmod14(temp, 384);
|
|
429608
430225
|
await rename11(temp, path19);
|
|
429609
430226
|
await chmod14(path19, 384);
|
|
429610
|
-
const directoryHandle = await
|
|
430227
|
+
const directoryHandle = await open24(directory, constants6.O_RDONLY);
|
|
429611
430228
|
try {
|
|
429612
430229
|
await directoryHandle.sync();
|
|
429613
430230
|
} finally {
|
|
@@ -430446,7 +431063,7 @@ async function runTitanFleetWorker(args) {
|
|
|
430446
431063
|
max_concurrency: maxConcurrency,
|
|
430447
431064
|
runtime: {
|
|
430448
431065
|
name: "theus-cli",
|
|
430449
|
-
version: { VERSION: "0.2.
|
|
431066
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
431067
|
}
|
|
430451
431068
|
});
|
|
430452
431069
|
const client2 = new TitanFleetClient({
|
|
@@ -430974,7 +431591,7 @@ __export(exports_titan_fleet_run, {
|
|
|
430974
431591
|
parseFleetPlanFile: () => parseFleetPlanFile,
|
|
430975
431592
|
describeFleetRunError: () => describeFleetRunError
|
|
430976
431593
|
});
|
|
430977
|
-
import { readFile as
|
|
431594
|
+
import { readFile as readFile62 } from "fs/promises";
|
|
430978
431595
|
import { resolve as resolve55 } from "path";
|
|
430979
431596
|
function valuesAfter(args, name) {
|
|
430980
431597
|
const found = [];
|
|
@@ -431085,7 +431702,7 @@ async function runTitanFleetRun(args) {
|
|
|
431085
431702
|
process.stdout.write(HELP3);
|
|
431086
431703
|
return;
|
|
431087
431704
|
}
|
|
431088
|
-
const build = options2.planPath ? parseFleetPlanFile(await
|
|
431705
|
+
const build = options2.planPath ? parseFleetPlanFile(await readFile62(resolve55(options2.planPath), "utf8")) : options2.build;
|
|
431089
431706
|
if (!build) {
|
|
431090
431707
|
throw new FleetProducerError("No hay nada que encolar");
|
|
431091
431708
|
}
|
|
@@ -431167,15 +431784,15 @@ var init_titan_fleet_run = __esm(() => {
|
|
|
431167
431784
|
});
|
|
431168
431785
|
|
|
431169
431786
|
// utils/cronTasksLock.ts
|
|
431170
|
-
import { mkdir as mkdir52, readFile as
|
|
431171
|
-
import { dirname as
|
|
431787
|
+
import { mkdir as mkdir52, readFile as readFile63, unlink as unlink28, writeFile as writeFile51 } from "fs/promises";
|
|
431788
|
+
import { dirname as dirname67, join as join161 } from "path";
|
|
431172
431789
|
function getLockPath(dir) {
|
|
431173
|
-
return
|
|
431790
|
+
return join161(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
431174
431791
|
}
|
|
431175
431792
|
async function readLock(dir) {
|
|
431176
431793
|
let raw;
|
|
431177
431794
|
try {
|
|
431178
|
-
raw = await
|
|
431795
|
+
raw = await readFile63(getLockPath(dir), "utf8");
|
|
431179
431796
|
} catch {
|
|
431180
431797
|
return;
|
|
431181
431798
|
}
|
|
@@ -431193,7 +431810,7 @@ async function tryCreateExclusive(lock2, dir) {
|
|
|
431193
431810
|
if (code === "EEXIST")
|
|
431194
431811
|
return false;
|
|
431195
431812
|
if (code === "ENOENT") {
|
|
431196
|
-
await mkdir52(
|
|
431813
|
+
await mkdir52(dirname67(path19), { recursive: true });
|
|
431197
431814
|
try {
|
|
431198
431815
|
await writeFile51(path19, body, { flag: "wx" });
|
|
431199
431816
|
return true;
|
|
@@ -431276,7 +431893,7 @@ var init_cronTasksLock = __esm(() => {
|
|
|
431276
431893
|
init_genericProcessUtils();
|
|
431277
431894
|
init_json();
|
|
431278
431895
|
init_slowOperations();
|
|
431279
|
-
LOCK_FILE_REL =
|
|
431896
|
+
LOCK_FILE_REL = join161(".theus", "scheduled_tasks.lock");
|
|
431280
431897
|
schedulerLockSchema = lazySchema(() => exports_external.object({
|
|
431281
431898
|
sessionId: exports_external.string(),
|
|
431282
431899
|
pid: exports_external.number(),
|
|
@@ -431584,10 +432201,10 @@ import {
|
|
|
431584
432201
|
writeFileSync as writeFileSync12
|
|
431585
432202
|
} from "fs";
|
|
431586
432203
|
import { homedir as homedir47 } from "os";
|
|
431587
|
-
import { dirname as
|
|
432204
|
+
import { dirname as dirname68, join as join162 } from "path";
|
|
431588
432205
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
431589
432206
|
function projectsConfigPath() {
|
|
431590
|
-
return
|
|
432207
|
+
return join162(homedir47(), ".theus", "daemon", "projects.json");
|
|
431591
432208
|
}
|
|
431592
432209
|
function readEnabledProjects() {
|
|
431593
432210
|
let raw;
|
|
@@ -431606,17 +432223,17 @@ function readEnabledProjects() {
|
|
|
431606
432223
|
return list3.filter((p) => p && typeof p.dir === "string" && p.enabled !== false);
|
|
431607
432224
|
}
|
|
431608
432225
|
function daemonDir2() {
|
|
431609
|
-
return
|
|
432226
|
+
return join162(homedir47(), ".theus", "daemon");
|
|
431610
432227
|
}
|
|
431611
432228
|
function daemonLogPath() {
|
|
431612
|
-
return
|
|
432229
|
+
return join162(daemonDir2(), "daemon.log");
|
|
431613
432230
|
}
|
|
431614
432231
|
function resolveWorkerBin() {
|
|
431615
432232
|
const override = process.env.THEUS_DAEMON_WORKER_BIN;
|
|
431616
432233
|
if (typeof override === "string" && override.length > 0)
|
|
431617
432234
|
return override;
|
|
431618
|
-
const here =
|
|
431619
|
-
return
|
|
432235
|
+
const here = dirname68(fileURLToPath7(import.meta.url));
|
|
432236
|
+
return join162(here, "..", "bin", "theus");
|
|
431620
432237
|
}
|
|
431621
432238
|
function turnTimeoutMs() {
|
|
431622
432239
|
const raw = process.env.THEUS_DAEMON_TURN_TIMEOUT_MS;
|
|
@@ -431649,10 +432266,10 @@ function logDaemonLine(line) {
|
|
|
431649
432266
|
}
|
|
431650
432267
|
function writeRunHistory(record3) {
|
|
431651
432268
|
try {
|
|
431652
|
-
const dir =
|
|
432269
|
+
const dir = join162(daemonDir2(), "runs", record3.taskId);
|
|
431653
432270
|
mkdirSync13(dir, { recursive: true });
|
|
431654
432271
|
const stamp2 = record3.startedAt.replace(/:/g, "-");
|
|
431655
|
-
writeFileSync12(
|
|
432272
|
+
writeFileSync12(join162(dir, `${stamp2}.json`), JSON.stringify(record3, null, 2), "utf8");
|
|
431656
432273
|
pruneRunHistory(record3.taskId);
|
|
431657
432274
|
} catch (e) {
|
|
431658
432275
|
logDaemonLine(`[daemon:cron] ERROR guardando historial task=${record3.taskId}: ${e?.message}`);
|
|
@@ -431663,13 +432280,13 @@ function pruneRunHistory(taskId) {
|
|
|
431663
432280
|
const raw = process.env.THEUS_DAEMON_RUNS_KEEP;
|
|
431664
432281
|
const parsed = raw ? Number.parseInt(raw, 10) : NaN;
|
|
431665
432282
|
const keep = Number.isInteger(parsed) && parsed > 0 ? parsed : 50;
|
|
431666
|
-
const dir =
|
|
432283
|
+
const dir = join162(daemonDir2(), "runs", taskId);
|
|
431667
432284
|
const files2 = readdirSync5(dir).filter((f) => f.endsWith(".json")).sort();
|
|
431668
432285
|
if (files2.length <= keep)
|
|
431669
432286
|
return;
|
|
431670
432287
|
for (const f of files2.slice(0, files2.length - keep)) {
|
|
431671
432288
|
try {
|
|
431672
|
-
unlinkSync4(
|
|
432289
|
+
unlinkSync4(join162(dir, f));
|
|
431673
432290
|
} catch {}
|
|
431674
432291
|
}
|
|
431675
432292
|
} catch {}
|
|
@@ -431852,22 +432469,22 @@ __export(exports_main, {
|
|
|
431852
432469
|
daemonMain: () => daemonMain
|
|
431853
432470
|
});
|
|
431854
432471
|
import {
|
|
431855
|
-
existsSync as
|
|
432472
|
+
existsSync as existsSync29,
|
|
431856
432473
|
mkdirSync as mkdirSync14,
|
|
431857
432474
|
readFileSync as readFileSync32,
|
|
431858
432475
|
rmSync as rmSync6,
|
|
431859
432476
|
writeFileSync as writeFileSync13
|
|
431860
432477
|
} from "fs";
|
|
431861
432478
|
import { homedir as homedir48 } from "os";
|
|
431862
|
-
import { dirname as
|
|
432479
|
+
import { dirname as dirname69, join as join163 } from "path";
|
|
431863
432480
|
function daemonDir3() {
|
|
431864
|
-
return
|
|
432481
|
+
return join163(homedir48(), ".theus", "daemon");
|
|
431865
432482
|
}
|
|
431866
432483
|
function pidFilePath() {
|
|
431867
|
-
return
|
|
432484
|
+
return join163(daemonDir3(), "theus-daemon.pid");
|
|
431868
432485
|
}
|
|
431869
432486
|
function logFilePath() {
|
|
431870
|
-
return
|
|
432487
|
+
return join163(daemonDir3(), "daemon.log");
|
|
431871
432488
|
}
|
|
431872
432489
|
function ensureDaemonDir() {
|
|
431873
432490
|
mkdirSync14(daemonDir3(), { recursive: true });
|
|
@@ -431941,7 +432558,7 @@ function doStatus() {
|
|
|
431941
432558
|
}
|
|
431942
432559
|
function doLogs() {
|
|
431943
432560
|
const path19 = logFilePath();
|
|
431944
|
-
if (!
|
|
432561
|
+
if (!existsSync29(path19)) {
|
|
431945
432562
|
console.log(`Sin registro de daemon todav\xEDa (${path19}).`);
|
|
431946
432563
|
return;
|
|
431947
432564
|
}
|
|
@@ -431965,7 +432582,7 @@ function resolveTheusBin() {
|
|
|
431965
432582
|
return "theus";
|
|
431966
432583
|
}
|
|
431967
432584
|
function macosServiceSpec() {
|
|
431968
|
-
const path19 =
|
|
432585
|
+
const path19 = join163(homedir48(), "Library", "LaunchAgents", "pe.theus.daemon.plist");
|
|
431969
432586
|
const bin = resolveTheusBin();
|
|
431970
432587
|
const logDir = daemonDir3();
|
|
431971
432588
|
const content = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -431992,9 +432609,9 @@ function macosServiceSpec() {
|
|
|
431992
432609
|
<key>KeepAlive</key>
|
|
431993
432610
|
<true/>
|
|
431994
432611
|
<key>StandardOutPath</key>
|
|
431995
|
-
<string>${
|
|
432612
|
+
<string>${join163(logDir, "launchd.out.log")}</string>
|
|
431996
432613
|
<key>StandardErrorPath</key>
|
|
431997
|
-
<string>${
|
|
432614
|
+
<string>${join163(logDir, "launchd.err.log")}</string>
|
|
431998
432615
|
</dict>
|
|
431999
432616
|
</plist>
|
|
432000
432617
|
`;
|
|
@@ -432009,7 +432626,7 @@ function macosServiceSpec() {
|
|
|
432009
432626
|
};
|
|
432010
432627
|
}
|
|
432011
432628
|
function linuxServiceSpec() {
|
|
432012
|
-
const path19 =
|
|
432629
|
+
const path19 = join163(homedir48(), ".config", "systemd", "user", "theus-daemon.service");
|
|
432013
432630
|
const bin = resolveTheusBin();
|
|
432014
432631
|
const content = `[Unit]
|
|
432015
432632
|
Description=Theus daemon (cron/agent supervisor)
|
|
@@ -432071,7 +432688,7 @@ Pasos posteriores:
|
|
|
432071
432688
|
return;
|
|
432072
432689
|
}
|
|
432073
432690
|
try {
|
|
432074
|
-
mkdirSync14(
|
|
432691
|
+
mkdirSync14(dirname69(spec.path), { recursive: true });
|
|
432075
432692
|
writeFileSync13(spec.path, spec.content, "utf8");
|
|
432076
432693
|
console.log(`Archivo de servicio escrito en: ${spec.path}`);
|
|
432077
432694
|
if (spec.notes.length > 0) {
|
|
@@ -432093,11 +432710,11 @@ function doUninstall(args) {
|
|
|
432093
432710
|
if (!hasConfirm(args)) {
|
|
432094
432711
|
console.log(`[dry-run] Desinstalaci\xF3n del daemon de Theus (${spec.platform}).
|
|
432095
432712
|
` + `Se eliminar\xEDa: ${spec.path}
|
|
432096
|
-
` + (
|
|
432713
|
+
` + (existsSync29(spec.path) ? "El archivo existe y ser\xEDa borrado." : "El archivo no existe actualmente (nada que borrar).") + `
|
|
432097
432714
|
Vuelve a ejecutar con --confirm para eliminarlo.`);
|
|
432098
432715
|
return;
|
|
432099
432716
|
}
|
|
432100
|
-
if (!
|
|
432717
|
+
if (!existsSync29(spec.path)) {
|
|
432101
432718
|
console.log(`No hay archivo de servicio que eliminar en: ${spec.path}`);
|
|
432102
432719
|
return;
|
|
432103
432720
|
}
|
|
@@ -432337,7 +432954,7 @@ function createBridgeLogger(options2) {
|
|
|
432337
432954
|
connectUrl = buildBridgeConnectUrl(environmentId, cachedIngressUrl);
|
|
432338
432955
|
regenerateQr(connectUrl);
|
|
432339
432956
|
if (verbose) {
|
|
432340
|
-
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.
|
|
432957
|
+
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
432958
|
`);
|
|
432342
432959
|
}
|
|
432343
432960
|
if (verbose) {
|
|
@@ -432745,7 +433362,7 @@ var init_pollConfig = __esm(() => {
|
|
|
432745
433362
|
import { spawn as spawn13 } from "child_process";
|
|
432746
433363
|
import { createWriteStream as createWriteStream4 } from "fs";
|
|
432747
433364
|
import { tmpdir as tmpdir14 } from "os";
|
|
432748
|
-
import { dirname as
|
|
433365
|
+
import { dirname as dirname70, join as join164 } from "path";
|
|
432749
433366
|
import { createInterface } from "readline";
|
|
432750
433367
|
function safeFilenameId(id2) {
|
|
432751
433368
|
return id2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -432878,12 +433495,12 @@ function createSessionSpawner(deps) {
|
|
|
432878
433495
|
debugFile = `${deps.debugFile}-${safeId}`;
|
|
432879
433496
|
}
|
|
432880
433497
|
} else if (deps.verbose || false) {
|
|
432881
|
-
debugFile =
|
|
433498
|
+
debugFile = join164(tmpdir14(), "theus", `bridge-session-${safeId}.log`);
|
|
432882
433499
|
}
|
|
432883
433500
|
let transcriptStream = null;
|
|
432884
433501
|
let transcriptPath;
|
|
432885
433502
|
if (deps.debugFile) {
|
|
432886
|
-
transcriptPath =
|
|
433503
|
+
transcriptPath = join164(dirname70(deps.debugFile), `bridge-transcript-${safeId}.jsonl`);
|
|
432887
433504
|
transcriptStream = createWriteStream4(transcriptPath, { flags: "a" });
|
|
432888
433505
|
transcriptStream.on("error", (err2) => {
|
|
432889
433506
|
deps.onDebug(`[bridge:session] Transcript write error: ${err2.message}`);
|
|
@@ -433156,15 +433773,15 @@ __export(exports_bridgePointer, {
|
|
|
433156
433773
|
clearBridgePointer: () => clearBridgePointer,
|
|
433157
433774
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
433158
433775
|
});
|
|
433159
|
-
import { mkdir as mkdir53, readFile as
|
|
433160
|
-
import { dirname as
|
|
433776
|
+
import { mkdir as mkdir53, readFile as readFile64, stat as stat55, unlink as unlink29, writeFile as writeFile52 } from "fs/promises";
|
|
433777
|
+
import { dirname as dirname71, join as join165 } from "path";
|
|
433161
433778
|
function getBridgePointerPath(dir) {
|
|
433162
|
-
return
|
|
433779
|
+
return join165(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
433163
433780
|
}
|
|
433164
433781
|
async function writeBridgePointer(dir, pointer) {
|
|
433165
433782
|
const path19 = getBridgePointerPath(dir);
|
|
433166
433783
|
try {
|
|
433167
|
-
await mkdir53(
|
|
433784
|
+
await mkdir53(dirname71(path19), { recursive: true });
|
|
433168
433785
|
await writeFile52(path19, jsonStringify(pointer), "utf8");
|
|
433169
433786
|
logForDebugging(`[bridge:pointer] wrote ${path19}`);
|
|
433170
433787
|
} catch (err2) {
|
|
@@ -433176,8 +433793,8 @@ async function readBridgePointer(dir) {
|
|
|
433176
433793
|
let raw;
|
|
433177
433794
|
let mtimeMs;
|
|
433178
433795
|
try {
|
|
433179
|
-
mtimeMs = (await
|
|
433180
|
-
raw = await
|
|
433796
|
+
mtimeMs = (await stat55(path19)).mtimeMs;
|
|
433797
|
+
raw = await readFile64(path19, "utf8");
|
|
433181
433798
|
} catch {
|
|
433182
433799
|
return null;
|
|
433183
433800
|
}
|
|
@@ -433261,12 +433878,12 @@ var init_bridgePointer = __esm(() => {
|
|
|
433261
433878
|
});
|
|
433262
433879
|
|
|
433263
433880
|
// utils/errorLogSink.ts
|
|
433264
|
-
import { dirname as
|
|
433881
|
+
import { dirname as dirname72, join as join166 } from "path";
|
|
433265
433882
|
function getErrorsPath() {
|
|
433266
|
-
return
|
|
433883
|
+
return join166(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
433267
433884
|
}
|
|
433268
433885
|
function getMCPLogsPath(serverName) {
|
|
433269
|
-
return
|
|
433886
|
+
return join166(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
433270
433887
|
}
|
|
433271
433888
|
function createJsonlWriter(options2) {
|
|
433272
433889
|
const writer = createBufferedWriter(options2);
|
|
@@ -433282,7 +433899,7 @@ function createJsonlWriter(options2) {
|
|
|
433282
433899
|
function getLogWriter(path19) {
|
|
433283
433900
|
let writer = logWriters.get(path19);
|
|
433284
433901
|
if (!writer) {
|
|
433285
|
-
const dir =
|
|
433902
|
+
const dir = dirname72(path19);
|
|
433286
433903
|
writer = createJsonlWriter({
|
|
433287
433904
|
writeFn: (content) => {
|
|
433288
433905
|
try {
|
|
@@ -433310,7 +433927,7 @@ function appendToLog(path19, message) {
|
|
|
433310
433927
|
cwd: getFsImplementation().cwd(),
|
|
433311
433928
|
userType: "external",
|
|
433312
433929
|
sessionId: getSessionId(),
|
|
433313
|
-
version: { VERSION: "0.2.
|
|
433930
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
433931
|
};
|
|
433315
433932
|
getLogWriter(path19).write(messageWithTimestamp);
|
|
433316
433933
|
}
|
|
@@ -433422,7 +434039,7 @@ __export(exports_bridgeMain, {
|
|
|
433422
434039
|
});
|
|
433423
434040
|
import { randomUUID as randomUUID42 } from "crypto";
|
|
433424
434041
|
import { hostname as hostname4, tmpdir as tmpdir15 } from "os";
|
|
433425
|
-
import { basename as basename51, join as
|
|
434042
|
+
import { basename as basename51, join as join167, resolve as resolve56 } from "path";
|
|
433426
434043
|
async function isMultiSessionSpawnEnabled() {
|
|
433427
434044
|
return checkGate_CACHED_OR_BLOCKING("theus_ccr_bridge_multi_session");
|
|
433428
434045
|
}
|
|
@@ -433935,7 +434552,7 @@ async function runBridgeLoop(config3, environmentId, environmentSecret, api2, sp
|
|
|
433935
434552
|
sessionDebugFile = `${config3.debugFile}-${safeId}`;
|
|
433936
434553
|
}
|
|
433937
434554
|
} else if (config3.verbose || false) {
|
|
433938
|
-
sessionDebugFile =
|
|
434555
|
+
sessionDebugFile = join167(tmpdir15(), "theus", `bridge-session-${safeId}.log`);
|
|
433939
434556
|
}
|
|
433940
434557
|
if (sessionDebugFile) {
|
|
433941
434558
|
logger.logVerbose(`Debug log: ${sessionDebugFile}`);
|
|
@@ -434571,7 +435188,7 @@ Spawn mode for this project:
|
|
|
434571
435188
|
const api2 = createBridgeApiClient({
|
|
434572
435189
|
baseUrl,
|
|
434573
435190
|
getAccessToken: getBridgeAccessToken2,
|
|
434574
|
-
runnerVersion: { VERSION: "0.2.
|
|
435191
|
+
runnerVersion: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
435192
|
onDebug: logForDebugging,
|
|
434576
435193
|
onAuth401: handleOAuth401Error2,
|
|
434577
435194
|
getTrustedDeviceToken
|
|
@@ -434809,7 +435426,7 @@ async function runBridgeHeadless(opts, signal) {
|
|
|
434809
435426
|
const api2 = createBridgeApiClient({
|
|
434810
435427
|
baseUrl,
|
|
434811
435428
|
getAccessToken: opts.getAccessToken,
|
|
434812
|
-
runnerVersion: { VERSION: "0.2.
|
|
435429
|
+
runnerVersion: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
435430
|
onDebug: log2,
|
|
434814
435431
|
onAuth401: opts.onAuth401,
|
|
434815
435432
|
getTrustedDeviceToken
|
|
@@ -437906,7 +438523,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
437906
438523
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
437907
438524
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
437908
438525
|
betas: getSdkBetas(),
|
|
437909
|
-
theus_code_version: { VERSION: "0.2.
|
|
438526
|
+
theus_code_version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
438527
|
output_style: outputStyle2,
|
|
437911
438528
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
437912
438529
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -437946,8 +438563,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
437946
438563
|
}
|
|
437947
438564
|
async function checkEnvLessBridgeMinVersion() {
|
|
437948
438565
|
const cfg = await getEnvLessBridgeConfig();
|
|
437949
|
-
if (cfg.min_version && lt({ VERSION: "0.2.
|
|
437950
|
-
return `Your version of Theus (${{ VERSION: "0.2.
|
|
438566
|
+
if (cfg.min_version && lt({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
438567
|
+
return `Your version of Theus (${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
438568
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
437952
438569
|
}
|
|
437953
438570
|
return null;
|
|
@@ -440271,7 +440888,7 @@ async function initBridgeCore(params) {
|
|
|
440271
440888
|
const rawApi = createBridgeApiClient({
|
|
440272
440889
|
baseUrl,
|
|
440273
440890
|
getAccessToken,
|
|
440274
|
-
runnerVersion: { VERSION: "0.2.
|
|
440891
|
+
runnerVersion: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
440892
|
onDebug: logForDebugging,
|
|
440276
440893
|
onAuth401,
|
|
440277
440894
|
getTrustedDeviceToken
|
|
@@ -442105,7 +442722,7 @@ __export(exports_inboundAttachments, {
|
|
|
442105
442722
|
});
|
|
442106
442723
|
import { randomUUID as randomUUID47 } from "crypto";
|
|
442107
442724
|
import { mkdir as mkdir54, writeFile as writeFile53 } from "fs/promises";
|
|
442108
|
-
import { basename as basename52, join as
|
|
442725
|
+
import { basename as basename52, join as join168 } from "path";
|
|
442109
442726
|
function debug2(msg) {
|
|
442110
442727
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
442111
442728
|
}
|
|
@@ -442121,7 +442738,7 @@ function sanitizeFileName(name) {
|
|
|
442121
442738
|
return base2 || "attachment";
|
|
442122
442739
|
}
|
|
442123
442740
|
function uploadsDir() {
|
|
442124
|
-
return
|
|
442741
|
+
return join168(getTheusConfigHomeDir(), "uploads", getSessionId());
|
|
442125
442742
|
}
|
|
442126
442743
|
async function resolveOne(att) {
|
|
442127
442744
|
const token = getBridgeAccessToken();
|
|
@@ -442150,7 +442767,7 @@ async function resolveOne(att) {
|
|
|
442150
442767
|
const safeName = sanitizeFileName(att.file_name);
|
|
442151
442768
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID47().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
442152
442769
|
const dir = uploadsDir();
|
|
442153
|
-
const outPath =
|
|
442770
|
+
const outPath = join168(dir, `${prefix}-${safeName}`);
|
|
442154
442771
|
try {
|
|
442155
442772
|
await mkdir54(dir, { recursive: true });
|
|
442156
442773
|
await writeFile53(outPath, data);
|
|
@@ -449010,7 +449627,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
449010
449627
|
|
|
449011
449628
|
// components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
449012
449629
|
import { homedir as homedir49 } from "os";
|
|
449013
|
-
import { basename as basename56, join as
|
|
449630
|
+
import { basename as basename56, join as join169, sep as sep34 } from "path";
|
|
449014
449631
|
function isInTheusFolder(filePath) {
|
|
449015
449632
|
const absolutePath = expandPath(filePath);
|
|
449016
449633
|
const theusFolderPath = expandPath(`${getOriginalCwd()}/.theus`);
|
|
@@ -449020,7 +449637,7 @@ function isInTheusFolder(filePath) {
|
|
|
449020
449637
|
}
|
|
449021
449638
|
function isInGlobalTheusFolder(filePath) {
|
|
449022
449639
|
const absolutePath = expandPath(filePath);
|
|
449023
|
-
const globalTheusFolderPath =
|
|
449640
|
+
const globalTheusFolderPath = join169(homedir49(), ".theus");
|
|
449024
449641
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
449025
449642
|
const normalizedGlobalTheusFolderPath = normalizeCaseForComparison(globalTheusFolderPath);
|
|
449026
449643
|
return normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + sep34.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + "/");
|
|
@@ -456912,7 +457529,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
456912
457529
|
function getSemverPart(version3) {
|
|
456913
457530
|
return `${import_semver11.major(version3, { loose: true })}.${import_semver11.minor(version3, { loose: true })}.${import_semver11.patch(version3, { loose: true })}`;
|
|
456914
457531
|
}
|
|
456915
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.
|
|
457532
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457533
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react235.useState(() => getSemverPart(initialVersion));
|
|
456917
457534
|
if (!updatedVersion) {
|
|
456918
457535
|
return null;
|
|
@@ -456952,7 +457569,7 @@ function AutoUpdater({
|
|
|
456952
457569
|
return;
|
|
456953
457570
|
}
|
|
456954
457571
|
if (false) {}
|
|
456955
|
-
const currentVersion = { VERSION: "0.2.
|
|
457572
|
+
const currentVersion = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457573
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
456957
457574
|
let latestVersion = await getLatestVersion(channel2);
|
|
456958
457575
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -457087,7 +457704,7 @@ function AutoUpdater({
|
|
|
457087
457704
|
" ",
|
|
457088
457705
|
/* @__PURE__ */ jsx_runtime414.jsx(ThemedText, {
|
|
457089
457706
|
bold: true,
|
|
457090
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
457707
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.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.73", BUILD_TIME: "1970-01-01T00:00:00.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
457708
|
})
|
|
457092
457709
|
]
|
|
457093
457710
|
})
|
|
@@ -457164,12 +457781,12 @@ function NativeAutoUpdater({
|
|
|
457164
457781
|
logEvent("theus_native_auto_updater_start", {});
|
|
457165
457782
|
try {
|
|
457166
457783
|
const maxVersion = await getMaxVersion();
|
|
457167
|
-
if (maxVersion && gt({ VERSION: "0.2.
|
|
457784
|
+
if (maxVersion && gt({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457785
|
const msg = await getMaxVersionMessage();
|
|
457169
457786
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
457170
457787
|
}
|
|
457171
457788
|
const result = await installLatest(channel2);
|
|
457172
|
-
const currentVersion = { VERSION: "0.2.
|
|
457789
|
+
const currentVersion = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457790
|
const latencyMs = Date.now() - startTime2;
|
|
457174
457791
|
if (result.lockFailed) {
|
|
457175
457792
|
logEvent("theus_native_auto_updater_lock_contention", {
|
|
@@ -457306,17 +457923,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
457306
457923
|
const maxVersion = await getMaxVersion();
|
|
457307
457924
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
457308
457925
|
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.
|
|
457926
|
+
if (gte({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
457927
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457928
|
setUpdateAvailable(false);
|
|
457312
457929
|
return;
|
|
457313
457930
|
}
|
|
457314
457931
|
latest = maxVersion;
|
|
457315
457932
|
}
|
|
457316
|
-
const hasUpdate = latest && !gte({ VERSION: "0.2.
|
|
457933
|
+
const hasUpdate = latest && !gte({ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457934
|
setUpdateAvailable(!!hasUpdate);
|
|
457318
457935
|
if (hasUpdate) {
|
|
457319
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.
|
|
457936
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457937
|
}
|
|
457321
457938
|
};
|
|
457322
457939
|
$2[0] = t1;
|
|
@@ -457350,7 +457967,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
457350
457967
|
wrap: "truncate",
|
|
457351
457968
|
children: [
|
|
457352
457969
|
"versi\xF3n actual: ",
|
|
457353
|
-
{ VERSION: "0.2.
|
|
457970
|
+
{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
457971
|
]
|
|
457355
457972
|
});
|
|
457356
457973
|
$2[3] = verbose;
|
|
@@ -463988,8 +464605,8 @@ function findTextObject(text2, offset, objectType2, isInner) {
|
|
|
463988
464605
|
return findWordObject(text2, offset, isInner, (ch2) => !isVimWhitespace(ch2));
|
|
463989
464606
|
const pair = PAIRS[objectType2];
|
|
463990
464607
|
if (pair) {
|
|
463991
|
-
const [
|
|
463992
|
-
return
|
|
464608
|
+
const [open25, close] = pair;
|
|
464609
|
+
return open25 === close ? findQuoteObject(text2, offset, open25, isInner) : findBracketObject(text2, offset, open25, close, isInner);
|
|
463993
464610
|
}
|
|
463994
464611
|
return null;
|
|
463995
464612
|
}
|
|
@@ -464064,13 +464681,13 @@ function findQuoteObject(text2, offset, quote2, isInner) {
|
|
|
464064
464681
|
}
|
|
464065
464682
|
return null;
|
|
464066
464683
|
}
|
|
464067
|
-
function findBracketObject(text2, offset,
|
|
464684
|
+
function findBracketObject(text2, offset, open25, close, isInner) {
|
|
464068
464685
|
let depth = 0;
|
|
464069
464686
|
let start = -1;
|
|
464070
464687
|
for (let i3 = offset;i3 >= 0; i3--) {
|
|
464071
464688
|
if (text2[i3] === close && i3 !== offset)
|
|
464072
464689
|
depth++;
|
|
464073
|
-
else if (text2[i3] ===
|
|
464690
|
+
else if (text2[i3] === open25) {
|
|
464074
464691
|
if (depth === 0) {
|
|
464075
464692
|
start = i3;
|
|
464076
464693
|
break;
|
|
@@ -464083,7 +464700,7 @@ function findBracketObject(text2, offset, open22, close, isInner) {
|
|
|
464083
464700
|
depth = 0;
|
|
464084
464701
|
let end = -1;
|
|
464085
464702
|
for (let i3 = start + 1;i3 < text2.length; i3++) {
|
|
464086
|
-
if (text2[i3] ===
|
|
464703
|
+
if (text2[i3] === open25)
|
|
464087
464704
|
depth++;
|
|
464088
464705
|
else if (text2[i3] === close) {
|
|
464089
464706
|
if (depth === 0) {
|
|
@@ -465213,7 +465830,7 @@ function buildStatusLineCommandInput(permissionMode2, exceeds200kTokens, setting
|
|
|
465213
465830
|
project_dir: getOriginalCwd(),
|
|
465214
465831
|
added_dirs: addedDirs
|
|
465215
465832
|
},
|
|
465216
|
-
version: { VERSION: "0.2.
|
|
465833
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
465834
|
output_style: {
|
|
465218
465835
|
name: outputStyleName
|
|
465219
465836
|
},
|
|
@@ -471201,9 +471818,9 @@ function initSkillImprovement() {
|
|
|
471201
471818
|
async function applySkillImprovement(skillName, updates) {
|
|
471202
471819
|
if (!skillName)
|
|
471203
471820
|
return;
|
|
471204
|
-
const { join:
|
|
471821
|
+
const { join: join170 } = await import("path");
|
|
471205
471822
|
const fs5 = await import("fs/promises");
|
|
471206
|
-
const filePath =
|
|
471823
|
+
const filePath = join170(getCwd(), ".theus", "skills", skillName, "SKILL.md");
|
|
471207
471824
|
let currentContent;
|
|
471208
471825
|
try {
|
|
471209
471826
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -471355,7 +471972,7 @@ function useMoreRight(_args) {
|
|
|
471355
471972
|
}
|
|
471356
471973
|
|
|
471357
471974
|
// utils/cleanup.ts
|
|
471358
|
-
import { join as
|
|
471975
|
+
import { join as join170 } from "path";
|
|
471359
471976
|
function getCutoffDate() {
|
|
471360
471977
|
const settings = getSettings_DEPRECATED() || {};
|
|
471361
471978
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -471380,7 +471997,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
471380
471997
|
try {
|
|
471381
471998
|
const timestamp2 = convertFileNameToDate(file2.name);
|
|
471382
471999
|
if (timestamp2 < cutoffDate) {
|
|
471383
|
-
await getFsImplementation().unlink(
|
|
472000
|
+
await getFsImplementation().unlink(join170(dirPath, file2.name));
|
|
471384
472001
|
if (isMessagePath) {
|
|
471385
472002
|
result.messages++;
|
|
471386
472003
|
} else {
|
|
@@ -471411,7 +472028,7 @@ async function cleanupOldMessageFiles() {
|
|
|
471411
472028
|
} catch {
|
|
471412
472029
|
return result;
|
|
471413
472030
|
}
|
|
471414
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
472031
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join170(baseCachePath, dirent.name));
|
|
471415
472032
|
for (const mcpLogDir of mcpLogDirs) {
|
|
471416
472033
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
471417
472034
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -471450,7 +472067,7 @@ async function cleanupOldSessionFiles() {
|
|
|
471450
472067
|
for (const projectDirent of projectDirents) {
|
|
471451
472068
|
if (!projectDirent.isDirectory())
|
|
471452
472069
|
continue;
|
|
471453
|
-
const projectDir =
|
|
472070
|
+
const projectDir = join170(projectsDir, projectDirent.name);
|
|
471454
472071
|
let entries;
|
|
471455
472072
|
try {
|
|
471456
472073
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -471464,15 +472081,15 @@ async function cleanupOldSessionFiles() {
|
|
|
471464
472081
|
continue;
|
|
471465
472082
|
}
|
|
471466
472083
|
try {
|
|
471467
|
-
if (await unlinkIfOld(
|
|
472084
|
+
if (await unlinkIfOld(join170(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
471468
472085
|
result.messages++;
|
|
471469
472086
|
}
|
|
471470
472087
|
} catch {
|
|
471471
472088
|
result.errors++;
|
|
471472
472089
|
}
|
|
471473
472090
|
} else if (entry.isDirectory()) {
|
|
471474
|
-
const sessionDir =
|
|
471475
|
-
const toolResultsDir =
|
|
472091
|
+
const sessionDir = join170(projectDir, entry.name);
|
|
472092
|
+
const toolResultsDir = join170(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
471476
472093
|
let toolDirs;
|
|
471477
472094
|
try {
|
|
471478
472095
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -471483,14 +472100,14 @@ async function cleanupOldSessionFiles() {
|
|
|
471483
472100
|
for (const toolEntry of toolDirs) {
|
|
471484
472101
|
if (toolEntry.isFile()) {
|
|
471485
472102
|
try {
|
|
471486
|
-
if (await unlinkIfOld(
|
|
472103
|
+
if (await unlinkIfOld(join170(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
471487
472104
|
result.messages++;
|
|
471488
472105
|
}
|
|
471489
472106
|
} catch {
|
|
471490
472107
|
result.errors++;
|
|
471491
472108
|
}
|
|
471492
472109
|
} else if (toolEntry.isDirectory()) {
|
|
471493
|
-
const toolDirPath =
|
|
472110
|
+
const toolDirPath = join170(toolResultsDir, toolEntry.name);
|
|
471494
472111
|
let toolFiles;
|
|
471495
472112
|
try {
|
|
471496
472113
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -471501,7 +472118,7 @@ async function cleanupOldSessionFiles() {
|
|
|
471501
472118
|
if (!tf.isFile())
|
|
471502
472119
|
continue;
|
|
471503
472120
|
try {
|
|
471504
|
-
if (await unlinkIfOld(
|
|
472121
|
+
if (await unlinkIfOld(join170(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
471505
472122
|
result.messages++;
|
|
471506
472123
|
}
|
|
471507
472124
|
} catch {
|
|
@@ -471533,7 +472150,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
471533
472150
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
471534
472151
|
continue;
|
|
471535
472152
|
try {
|
|
471536
|
-
if (await unlinkIfOld(
|
|
472153
|
+
if (await unlinkIfOld(join170(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
471537
472154
|
result.messages++;
|
|
471538
472155
|
}
|
|
471539
472156
|
} catch {
|
|
@@ -471546,7 +472163,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
471546
472163
|
return result;
|
|
471547
472164
|
}
|
|
471548
472165
|
function cleanupOldPlanFiles() {
|
|
471549
|
-
const plansDir =
|
|
472166
|
+
const plansDir = join170(getTheusConfigHomeDir(), "plans");
|
|
471550
472167
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
471551
472168
|
}
|
|
471552
472169
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -471555,14 +472172,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
471555
472172
|
const fsImpl = getFsImplementation();
|
|
471556
472173
|
try {
|
|
471557
472174
|
const configDir = getTheusConfigHomeDir();
|
|
471558
|
-
const fileHistoryStorageDir =
|
|
472175
|
+
const fileHistoryStorageDir = join170(configDir, "file-history");
|
|
471559
472176
|
let dirents;
|
|
471560
472177
|
try {
|
|
471561
472178
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
471562
472179
|
} catch {
|
|
471563
472180
|
return result;
|
|
471564
472181
|
}
|
|
471565
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
472182
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join170(fileHistoryStorageDir, dirent.name));
|
|
471566
472183
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
471567
472184
|
try {
|
|
471568
472185
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -471589,14 +472206,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
471589
472206
|
const fsImpl = getFsImplementation();
|
|
471590
472207
|
try {
|
|
471591
472208
|
const configDir = getTheusConfigHomeDir();
|
|
471592
|
-
const sessionEnvBaseDir =
|
|
472209
|
+
const sessionEnvBaseDir = join170(configDir, "session-env");
|
|
471593
472210
|
let dirents;
|
|
471594
472211
|
try {
|
|
471595
472212
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
471596
472213
|
} catch {
|
|
471597
472214
|
return result;
|
|
471598
472215
|
}
|
|
471599
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
472216
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join170(sessionEnvBaseDir, dirent.name));
|
|
471600
472217
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
471601
472218
|
try {
|
|
471602
472219
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -471618,7 +472235,7 @@ async function cleanupOldDebugLogs() {
|
|
|
471618
472235
|
const cutoffDate = getCutoffDate();
|
|
471619
472236
|
const result = { messages: 0, errors: 0 };
|
|
471620
472237
|
const fsImpl = getFsImplementation();
|
|
471621
|
-
const debugDir =
|
|
472238
|
+
const debugDir = join170(getTheusConfigHomeDir(), "debug");
|
|
471622
472239
|
let dirents;
|
|
471623
472240
|
try {
|
|
471624
472241
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -471630,7 +472247,7 @@ async function cleanupOldDebugLogs() {
|
|
|
471630
472247
|
continue;
|
|
471631
472248
|
}
|
|
471632
472249
|
try {
|
|
471633
|
-
if (await unlinkIfOld(
|
|
472250
|
+
if (await unlinkIfOld(join170(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
471634
472251
|
result.messages++;
|
|
471635
472252
|
}
|
|
471636
472253
|
} catch {
|
|
@@ -474842,7 +475459,7 @@ __export(exports_asciicast, {
|
|
|
474842
475459
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
474843
475460
|
});
|
|
474844
475461
|
import { appendFile as appendFile8, rename as rename12 } from "fs/promises";
|
|
474845
|
-
import { basename as basename65, dirname as
|
|
475462
|
+
import { basename as basename65, dirname as dirname73, join as join172 } from "path";
|
|
474846
475463
|
function getRecordFilePath() {
|
|
474847
475464
|
if (recordingState.filePath !== null) {
|
|
474848
475465
|
return recordingState.filePath;
|
|
@@ -474853,10 +475470,10 @@ function getRecordFilePath() {
|
|
|
474853
475470
|
if (!isEnvTruthy(process.env.THEUS_CODE_TERMINAL_RECORDING)) {
|
|
474854
475471
|
return null;
|
|
474855
475472
|
}
|
|
474856
|
-
const projectsDir =
|
|
474857
|
-
const projectDir =
|
|
475473
|
+
const projectsDir = join172(getTheusConfigHomeDir(), "projects");
|
|
475474
|
+
const projectDir = join172(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
474858
475475
|
recordingState.timestamp = Date.now();
|
|
474859
|
-
recordingState.filePath =
|
|
475476
|
+
recordingState.filePath = join172(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
474860
475477
|
return recordingState.filePath;
|
|
474861
475478
|
}
|
|
474862
475479
|
function _resetRecordingStateForTesting() {
|
|
@@ -474865,13 +475482,13 @@ function _resetRecordingStateForTesting() {
|
|
|
474865
475482
|
}
|
|
474866
475483
|
function getSessionRecordingPaths() {
|
|
474867
475484
|
const sessionId = getSessionId();
|
|
474868
|
-
const projectsDir =
|
|
474869
|
-
const projectDir =
|
|
475485
|
+
const projectsDir = join172(getTheusConfigHomeDir(), "projects");
|
|
475486
|
+
const projectDir = join172(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
474870
475487
|
try {
|
|
474871
475488
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
474872
475489
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
474873
475490
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
474874
|
-
return files2.map((f) =>
|
|
475491
|
+
return files2.map((f) => join172(projectDir, f));
|
|
474875
475492
|
} catch {
|
|
474876
475493
|
return [];
|
|
474877
475494
|
}
|
|
@@ -474881,9 +475498,9 @@ async function renameRecordingForSession() {
|
|
|
474881
475498
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
474882
475499
|
return;
|
|
474883
475500
|
}
|
|
474884
|
-
const projectsDir =
|
|
474885
|
-
const projectDir =
|
|
474886
|
-
const newPath =
|
|
475501
|
+
const projectsDir = join172(getTheusConfigHomeDir(), "projects");
|
|
475502
|
+
const projectDir = join172(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
475503
|
+
const newPath = join172(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
474887
475504
|
if (oldPath === newPath) {
|
|
474888
475505
|
return;
|
|
474889
475506
|
}
|
|
@@ -474924,7 +475541,7 @@ function installAsciicastRecorder() {
|
|
|
474924
475541
|
}
|
|
474925
475542
|
});
|
|
474926
475543
|
try {
|
|
474927
|
-
getFsImplementation().mkdirSync(
|
|
475544
|
+
getFsImplementation().mkdirSync(dirname73(filePath));
|
|
474928
475545
|
} catch {}
|
|
474929
475546
|
getFsImplementation().appendFileSync(filePath, header + `
|
|
474930
475547
|
`, { mode: 384 });
|
|
@@ -474993,7 +475610,7 @@ var init_asciicast = __esm(() => {
|
|
|
474993
475610
|
});
|
|
474994
475611
|
|
|
474995
475612
|
// utils/sessionRestore.ts
|
|
474996
|
-
import { dirname as
|
|
475613
|
+
import { dirname as dirname74 } from "path";
|
|
474997
475614
|
function extractTodosFromTranscript(messages) {
|
|
474998
475615
|
for (let i3 = messages.length - 1;i3 >= 0; i3--) {
|
|
474999
475616
|
const msg = messages[i3];
|
|
@@ -475118,7 +475735,7 @@ async function processResumedConversation(result, opts, context3) {
|
|
|
475118
475735
|
if (!opts.forkSession) {
|
|
475119
475736
|
const sid = opts.sessionIdOverride ?? result.sessionId;
|
|
475120
475737
|
if (sid) {
|
|
475121
|
-
switchSession(asSessionId(sid), opts.transcriptPath ?
|
|
475738
|
+
switchSession(asSessionId(sid), opts.transcriptPath ? dirname74(opts.transcriptPath) : null);
|
|
475122
475739
|
await renameRecordingForSession();
|
|
475123
475740
|
await resetSessionFilePointer();
|
|
475124
475741
|
restoreCostStateForSession(sid);
|
|
@@ -476493,7 +477110,7 @@ function useSurveyState({
|
|
|
476493
477110
|
setState("submitted");
|
|
476494
477111
|
setTimeout(setState, hideThanksAfterMs, "closed");
|
|
476495
477112
|
}, [hideThanksAfterMs]);
|
|
476496
|
-
const
|
|
477113
|
+
const open25 = import_react301.useCallback(() => {
|
|
476497
477114
|
if (state2 !== "closed") {
|
|
476498
477115
|
return;
|
|
476499
477116
|
}
|
|
@@ -476544,7 +477161,7 @@ function useSurveyState({
|
|
|
476544
477161
|
return {
|
|
476545
477162
|
state: state2,
|
|
476546
477163
|
lastResponse,
|
|
476547
|
-
open:
|
|
477164
|
+
open: open25,
|
|
476548
477165
|
handleSelect,
|
|
476549
477166
|
handleTranscriptSelect
|
|
476550
477167
|
};
|
|
@@ -476680,7 +477297,7 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
476680
477297
|
const {
|
|
476681
477298
|
state: state2,
|
|
476682
477299
|
lastResponse,
|
|
476683
|
-
open:
|
|
477300
|
+
open: open25,
|
|
476684
477301
|
handleSelect,
|
|
476685
477302
|
handleTranscriptSelect
|
|
476686
477303
|
} = useSurveyState({
|
|
@@ -476761,9 +477378,9 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
476761
477378
|
}, [state2, isLoading, hasActivePrompt, isModelAllowed2, feedbackSurvey.timeLastShown, feedbackSurvey.submitCountAtLastAppearance, submitCount, config3.minTimeBetweenFeedbackMs, config3.minTimeBetweenGlobalFeedbackMs, config3.minUserTurnsBetweenFeedback, config3.minTimeBeforeFeedbackMs, config3.minUserTurnsBeforeFeedback, config3.probability, settingsRate]);
|
|
476762
477379
|
import_react302.useEffect(() => {
|
|
476763
477380
|
if (shouldOpen) {
|
|
476764
|
-
|
|
477381
|
+
open25();
|
|
476765
477382
|
}
|
|
476766
|
-
}, [shouldOpen,
|
|
477383
|
+
}, [shouldOpen, open25]);
|
|
476767
477384
|
return {
|
|
476768
477385
|
state: state2,
|
|
476769
477386
|
lastResponse,
|
|
@@ -476907,7 +477524,7 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
476907
477524
|
const {
|
|
476908
477525
|
state: state2,
|
|
476909
477526
|
lastResponse,
|
|
476910
|
-
open:
|
|
477527
|
+
open: open25,
|
|
476911
477528
|
handleSelect,
|
|
476912
477529
|
handleTranscriptSelect
|
|
476913
477530
|
} = useSurveyState({
|
|
@@ -476960,9 +477577,9 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
476960
477577
|
return;
|
|
476961
477578
|
}
|
|
476962
477579
|
if (Math.random() < SURVEY_PROBABILITY) {
|
|
476963
|
-
|
|
477580
|
+
open25();
|
|
476964
477581
|
}
|
|
476965
|
-
}, [enabled, state2, isLoading, hasActivePrompt, lastAssistant, messages,
|
|
477582
|
+
}, [enabled, state2, isLoading, hasActivePrompt, lastAssistant, messages, open25]);
|
|
476966
477583
|
return {
|
|
476967
477584
|
state: state2,
|
|
476968
477585
|
lastResponse,
|
|
@@ -477044,7 +477661,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477044
477661
|
const {
|
|
477045
477662
|
state: state2,
|
|
477046
477663
|
lastResponse,
|
|
477047
|
-
open:
|
|
477664
|
+
open: open25,
|
|
477048
477665
|
handleSelect
|
|
477049
477666
|
} = useSurveyState(t5);
|
|
477050
477667
|
let t6;
|
|
@@ -477076,7 +477693,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477076
477693
|
const currentCompactBoundaries = t8;
|
|
477077
477694
|
let t10;
|
|
477078
477695
|
let t9;
|
|
477079
|
-
if ($2[9] !== currentCompactBoundaries || $2[10] !== enabled || $2[11] !== gateEnabled || $2[12] !== hasActivePrompt || $2[13] !== isLoading || $2[14] !== messages || $2[15] !==
|
|
477696
|
+
if ($2[9] !== currentCompactBoundaries || $2[10] !== enabled || $2[11] !== gateEnabled || $2[12] !== hasActivePrompt || $2[13] !== isLoading || $2[14] !== messages || $2[15] !== open25 || $2[16] !== state2) {
|
|
477080
477697
|
t9 = () => {
|
|
477081
477698
|
if (!enabled) {
|
|
477082
477699
|
return;
|
|
@@ -477100,7 +477717,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477100
477717
|
if (hasMessageAfterBoundary(messages, pendingCompactBoundaryUuid.current)) {
|
|
477101
477718
|
pendingCompactBoundaryUuid.current = null;
|
|
477102
477719
|
if (Math.random() < SURVEY_PROBABILITY2) {
|
|
477103
|
-
|
|
477720
|
+
open25();
|
|
477104
477721
|
}
|
|
477105
477722
|
return;
|
|
477106
477723
|
}
|
|
@@ -477111,14 +477728,14 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
477111
477728
|
pendingCompactBoundaryUuid.current = newBoundaries[newBoundaries.length - 1];
|
|
477112
477729
|
}
|
|
477113
477730
|
};
|
|
477114
|
-
t10 = [enabled, currentCompactBoundaries, state2, isLoading, hasActivePrompt, gateEnabled, messages,
|
|
477731
|
+
t10 = [enabled, currentCompactBoundaries, state2, isLoading, hasActivePrompt, gateEnabled, messages, open25];
|
|
477115
477732
|
$2[9] = currentCompactBoundaries;
|
|
477116
477733
|
$2[10] = enabled;
|
|
477117
477734
|
$2[11] = gateEnabled;
|
|
477118
477735
|
$2[12] = hasActivePrompt;
|
|
477119
477736
|
$2[13] = isLoading;
|
|
477120
477737
|
$2[14] = messages;
|
|
477121
|
-
$2[15] =
|
|
477738
|
+
$2[15] = open25;
|
|
477122
477739
|
$2[16] = state2;
|
|
477123
477740
|
$2[17] = t10;
|
|
477124
477741
|
$2[18] = t9;
|
|
@@ -477645,8 +478262,8 @@ var init_useAwaySummary = __esm(() => {
|
|
|
477645
478262
|
});
|
|
477646
478263
|
|
|
477647
478264
|
// utils/theusInChrome/setupPortable.ts
|
|
477648
|
-
import { readdir as
|
|
477649
|
-
import { join as
|
|
478265
|
+
import { readdir as readdir37 } from "fs/promises";
|
|
478266
|
+
import { join as join173 } from "path";
|
|
477650
478267
|
function getExtensionIds() {
|
|
477651
478268
|
return [THEUS_BROWSER_EXTENSION_ID];
|
|
477652
478269
|
}
|
|
@@ -477659,7 +478276,7 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
477659
478276
|
for (const { browser, path: browserBasePath } of browserPaths) {
|
|
477660
478277
|
let browserProfileEntries = [];
|
|
477661
478278
|
try {
|
|
477662
|
-
browserProfileEntries = await
|
|
478279
|
+
browserProfileEntries = await readdir37(browserBasePath, {
|
|
477663
478280
|
withFileTypes: true
|
|
477664
478281
|
});
|
|
477665
478282
|
} catch (e) {
|
|
@@ -477673,9 +478290,9 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
477673
478290
|
}
|
|
477674
478291
|
for (const profile of profileDirs) {
|
|
477675
478292
|
for (const extensionId of extensionIds) {
|
|
477676
|
-
const extensionPath =
|
|
478293
|
+
const extensionPath = join173(browserBasePath, profile, "Extensions", extensionId);
|
|
477677
478294
|
try {
|
|
477678
|
-
await
|
|
478295
|
+
await readdir37(extensionPath);
|
|
477679
478296
|
log2?.(`[Theus in Chrome] Extension ${extensionId} found in ${browser} ${profile}`);
|
|
477680
478297
|
return { isInstalled: true, browser };
|
|
477681
478298
|
} catch {}
|
|
@@ -477695,9 +478312,9 @@ var init_setupPortable = __esm(() => {
|
|
|
477695
478312
|
});
|
|
477696
478313
|
|
|
477697
478314
|
// utils/theusInChrome/setup.ts
|
|
477698
|
-
import { chmod as chmod15, mkdir as mkdir55, readFile as
|
|
478315
|
+
import { chmod as chmod15, mkdir as mkdir55, readFile as readFile65, writeFile as writeFile54 } from "fs/promises";
|
|
477699
478316
|
import { homedir as homedir50 } from "os";
|
|
477700
|
-
import { join as
|
|
478317
|
+
import { join as join174 } from "path";
|
|
477701
478318
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
477702
478319
|
function isTheusInChromeEngineAvailable() {
|
|
477703
478320
|
return Array.isArray(BROWSER_TOOLS);
|
|
@@ -477761,8 +478378,8 @@ function setupTheusInChrome() {
|
|
|
477761
478378
|
};
|
|
477762
478379
|
} else {
|
|
477763
478380
|
const __filename3 = fileURLToPath8(import.meta.url);
|
|
477764
|
-
const __dirname3 =
|
|
477765
|
-
const cliPath =
|
|
478381
|
+
const __dirname3 = join174(__filename3, "..");
|
|
478382
|
+
const cliPath = join174(__dirname3, "cli.js");
|
|
477766
478383
|
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
478384
|
const mcpConfig = {
|
|
477768
478385
|
[THEUS_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -477784,8 +478401,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
477784
478401
|
const platform7 = getPlatform();
|
|
477785
478402
|
if (platform7 === "windows") {
|
|
477786
478403
|
const home = homedir50();
|
|
477787
|
-
const appData = process.env.APPDATA ||
|
|
477788
|
-
return [
|
|
478404
|
+
const appData = process.env.APPDATA || join174(home, "AppData", "Local");
|
|
478405
|
+
return [join174(appData, "Theus", "ChromeNativeHost")];
|
|
477789
478406
|
}
|
|
477790
478407
|
return getAllNativeMessagingHostsDirs().map(({ path: path21 }) => path21);
|
|
477791
478408
|
}
|
|
@@ -477804,8 +478421,8 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
477804
478421
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
477805
478422
|
let anyManifestUpdated = false;
|
|
477806
478423
|
for (const manifestDir of manifestDirs) {
|
|
477807
|
-
const manifestPath =
|
|
477808
|
-
const existingContent = await
|
|
478424
|
+
const manifestPath = join174(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
478425
|
+
const existingContent = await readFile65(manifestPath, "utf-8").catch(() => null);
|
|
477809
478426
|
if (existingContent === manifestContent) {
|
|
477810
478427
|
continue;
|
|
477811
478428
|
}
|
|
@@ -477819,7 +478436,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
477819
478436
|
}
|
|
477820
478437
|
}
|
|
477821
478438
|
if (getPlatform() === "windows") {
|
|
477822
|
-
const manifestPath =
|
|
478439
|
+
const manifestPath = join174(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
477823
478440
|
registerWindowsNativeHosts(manifestPath);
|
|
477824
478441
|
}
|
|
477825
478442
|
if (anyManifestUpdated) {
|
|
@@ -477857,8 +478474,8 @@ function registerWindowsNativeHosts(manifestPath) {
|
|
|
477857
478474
|
}
|
|
477858
478475
|
async function createWrapperScript(command9) {
|
|
477859
478476
|
const platform7 = getPlatform();
|
|
477860
|
-
const chromeDir =
|
|
477861
|
-
const wrapperPath = platform7 === "windows" ?
|
|
478477
|
+
const chromeDir = join174(getTheusConfigHomeDir(), "chrome");
|
|
478478
|
+
const wrapperPath = platform7 === "windows" ? join174(chromeDir, "chrome-native-host.bat") : join174(chromeDir, "chrome-native-host");
|
|
477862
478479
|
const scriptContent = platform7 === "windows" ? `@echo off
|
|
477863
478480
|
REM Chrome native host wrapper script
|
|
477864
478481
|
REM Generated by Theus - do not edit manually
|
|
@@ -477868,7 +478485,7 @@ ${command9}
|
|
|
477868
478485
|
# Generated by Theus - do not edit manually
|
|
477869
478486
|
exec ${command9}
|
|
477870
478487
|
`;
|
|
477871
|
-
const existingContent = await
|
|
478488
|
+
const existingContent = await readFile65(wrapperPath, "utf-8").catch(() => null);
|
|
477872
478489
|
if (existingContent === scriptContent) {
|
|
477873
478490
|
return wrapperPath;
|
|
477874
478491
|
}
|
|
@@ -477987,7 +478604,7 @@ var init_useChromeExtensionNotification = __esm(() => {
|
|
|
477987
478604
|
});
|
|
477988
478605
|
|
|
477989
478606
|
// utils/plugins/officialMarketplaceStartupCheck.ts
|
|
477990
|
-
import { join as
|
|
478607
|
+
import { join as join175 } from "path";
|
|
477991
478608
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
477992
478609
|
if (isEnvTruthy(process.env.THEUS_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)) {
|
|
477993
478610
|
return true;
|
|
@@ -478065,7 +478682,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
478065
478682
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
478066
478683
|
}
|
|
478067
478684
|
const cacheDir = getMarketplacesCacheDir();
|
|
478068
|
-
const installLocation =
|
|
478685
|
+
const installLocation = join175(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
478069
478686
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
478070
478687
|
if (gcsSha !== null) {
|
|
478071
478688
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -480849,7 +481466,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
480849
481466
|
});
|
|
480850
481467
|
|
|
480851
481468
|
// hooks/useLspPluginRecommendation.tsx
|
|
480852
|
-
import { extname as extname20, join as
|
|
481469
|
+
import { extname as extname20, join as join176 } from "path";
|
|
480853
481470
|
function useLspPluginRecommendation() {
|
|
480854
481471
|
const $2 = c3(12);
|
|
480855
481472
|
const trackedFiles = useAppState(_temp202);
|
|
@@ -480934,7 +481551,7 @@ function useLspPluginRecommendation() {
|
|
|
480934
481551
|
case "yes": {
|
|
480935
481552
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
480936
481553
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
480937
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
481554
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join176(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
480938
481555
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
480939
481556
|
const settings = getSettingsForSource("userSettings");
|
|
480940
481557
|
updateSettingsForSource("userSettings", {
|
|
@@ -484138,7 +484755,7 @@ var exports_REPL = {};
|
|
|
484138
484755
|
__export(exports_REPL, {
|
|
484139
484756
|
REPL: () => REPL
|
|
484140
484757
|
});
|
|
484141
|
-
import { dirname as
|
|
484758
|
+
import { dirname as dirname75, join as join177 } from "path";
|
|
484142
484759
|
import { tmpdir as tmpdir16 } from "os";
|
|
484143
484760
|
import { writeFile as writeFile55 } from "fs/promises";
|
|
484144
484761
|
import { randomUUID as randomUUID61 } from "crypto";
|
|
@@ -485084,7 +485701,7 @@ function REPL({
|
|
|
485084
485701
|
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
485085
485702
|
saveCurrentSessionCosts();
|
|
485086
485703
|
resetCostState();
|
|
485087
|
-
switchSession(asSessionId(sessionId), log2.fullPath ?
|
|
485704
|
+
switchSession(asSessionId(sessionId), log2.fullPath ? dirname75(log2.fullPath) : null);
|
|
485088
485705
|
const {
|
|
485089
485706
|
renameRecordingForSession: renameRecordingForSession2
|
|
485090
485707
|
} = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
|
|
@@ -486772,7 +487389,7 @@ Note: ctrl + z now suspends Theus, ctrl + _ undoes input.
|
|
|
486772
487389
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
486773
487390
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
486774
487391
|
const text2 = raw.replace(/[ \t]+$/gm, "");
|
|
486775
|
-
const path21 =
|
|
487392
|
+
const path21 = join177(tmpdir16(), `cc-transcript-${Date.now()}.txt`);
|
|
486776
487393
|
await writeFile55(path21, text2);
|
|
486777
487394
|
const opened = openFileInExternalEditor(path21);
|
|
486778
487395
|
setStatus(opened ? `opening ${path21}` : `wrote ${path21} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -489536,7 +490153,7 @@ function completeOnboarding() {
|
|
|
489536
490153
|
saveGlobalConfig((current) => ({
|
|
489537
490154
|
...current,
|
|
489538
490155
|
hasCompletedOnboarding: true,
|
|
489539
|
-
lastOnboardingVersion: { VERSION: "0.2.
|
|
490156
|
+
lastOnboardingVersion: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
490157
|
}));
|
|
489541
490158
|
}
|
|
489542
490159
|
function showDialog(root2, renderer) {
|
|
@@ -489766,18 +490383,18 @@ var init_interactiveHelpers = __esm(() => {
|
|
|
489766
490383
|
});
|
|
489767
490384
|
|
|
489768
490385
|
// components/Theus/arsenalStats.ts
|
|
489769
|
-
import { existsSync as
|
|
489770
|
-
import { dirname as
|
|
490386
|
+
import { existsSync as existsSync30, readdirSync as readdirSync6 } from "fs";
|
|
490387
|
+
import { dirname as dirname76, join as join178 } from "path";
|
|
489771
490388
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
489772
490389
|
function countBundledArsenalSkills() {
|
|
489773
490390
|
try {
|
|
489774
|
-
const here =
|
|
490391
|
+
const here = dirname76(fileURLToPath9(import.meta.url));
|
|
489775
490392
|
for (const dir of [
|
|
489776
|
-
|
|
489777
|
-
|
|
489778
|
-
|
|
490393
|
+
join178(here, "..", "..", "vendor", "theus-arsenal", "skills"),
|
|
490394
|
+
join178(here, "vendor", "theus-arsenal", "skills"),
|
|
490395
|
+
join178(here, "..", "vendor", "theus-arsenal", "skills")
|
|
489779
490396
|
]) {
|
|
489780
|
-
if (!
|
|
490397
|
+
if (!existsSync30(dir))
|
|
489781
490398
|
continue;
|
|
489782
490399
|
let count4 = 0;
|
|
489783
490400
|
for (const entry of readdirSync6(dir, { withFileTypes: true })) {
|
|
@@ -489857,13 +490474,13 @@ var init_arsenalStats = __esm(() => {
|
|
|
489857
490474
|
});
|
|
489858
490475
|
|
|
489859
490476
|
// services/import/detect/global.ts
|
|
489860
|
-
import { existsSync as
|
|
489861
|
-
import { open as
|
|
489862
|
-
import { join as
|
|
490477
|
+
import { existsSync as existsSync31 } from "fs";
|
|
490478
|
+
import { open as open25, readdir as readdir38, stat as stat56 } from "fs/promises";
|
|
490479
|
+
import { join as join179 } from "path";
|
|
489863
490480
|
async function rutaDelTranscript(fichero) {
|
|
489864
490481
|
let crudo;
|
|
489865
490482
|
try {
|
|
489866
|
-
const fh = await
|
|
490483
|
+
const fh = await open25(fichero, "r");
|
|
489867
490484
|
try {
|
|
489868
490485
|
const buf = Buffer.alloc(65536);
|
|
489869
490486
|
const { bytesRead } = await fh.read(buf, 0, buf.length, 0);
|
|
@@ -489890,19 +490507,19 @@ async function rutaDelTranscript(fichero) {
|
|
|
489890
490507
|
return null;
|
|
489891
490508
|
}
|
|
489892
490509
|
async function explorarTodoElTrabajo(entorno) {
|
|
489893
|
-
const raiz =
|
|
490510
|
+
const raiz = join179(directorioConfig(entorno), "projects");
|
|
489894
490511
|
let directorios;
|
|
489895
490512
|
try {
|
|
489896
|
-
directorios = await
|
|
490513
|
+
directorios = await readdir38(raiz);
|
|
489897
490514
|
} catch {
|
|
489898
490515
|
return [];
|
|
489899
490516
|
}
|
|
489900
490517
|
const salida = [];
|
|
489901
490518
|
for (const dir of directorios) {
|
|
489902
|
-
const ruta =
|
|
490519
|
+
const ruta = join179(raiz, dir);
|
|
489903
490520
|
let sesiones;
|
|
489904
490521
|
try {
|
|
489905
|
-
sesiones = (await
|
|
490522
|
+
sesiones = (await readdir38(ruta)).filter((n3) => n3.endsWith(".jsonl"));
|
|
489906
490523
|
} catch {
|
|
489907
490524
|
continue;
|
|
489908
490525
|
}
|
|
@@ -489913,7 +490530,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
489913
490530
|
let ficheroMasReciente = sesiones[0];
|
|
489914
490531
|
for (const nombre of sesiones) {
|
|
489915
490532
|
try {
|
|
489916
|
-
const info = await
|
|
490533
|
+
const info = await stat56(join179(ruta, nombre));
|
|
489917
490534
|
bytes += info.size;
|
|
489918
490535
|
if (info.mtimeMs > masReciente) {
|
|
489919
490536
|
masReciente = info.mtimeMs;
|
|
@@ -489921,7 +490538,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
489921
490538
|
}
|
|
489922
490539
|
} catch {}
|
|
489923
490540
|
}
|
|
489924
|
-
const proyecto = await rutaDelTranscript(
|
|
490541
|
+
const proyecto = await rutaDelTranscript(join179(ruta, ficheroMasReciente));
|
|
489925
490542
|
if (!proyecto)
|
|
489926
490543
|
continue;
|
|
489927
490544
|
salida.push({
|
|
@@ -489932,7 +490549,7 @@ async function explorarTodoElTrabajo(entorno) {
|
|
|
489932
490549
|
masReciente,
|
|
489933
490550
|
bytes,
|
|
489934
490551
|
proyecto,
|
|
489935
|
-
existe:
|
|
490552
|
+
existe: existsSync31(proyecto)
|
|
489936
490553
|
});
|
|
489937
490554
|
}
|
|
489938
490555
|
return salida.sort((a2, b) => {
|
|
@@ -490024,8 +490641,8 @@ __export(exports_OnboardingWizard, {
|
|
|
490024
490641
|
default: () => OnboardingWizard_default,
|
|
490025
490642
|
OnboardingWizard: () => OnboardingWizard
|
|
490026
490643
|
});
|
|
490027
|
-
import { existsSync as
|
|
490028
|
-
import { join as
|
|
490644
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync15, writeFileSync as writeFileSync14 } from "fs";
|
|
490645
|
+
import { join as join180 } from "path";
|
|
490029
490646
|
function hasSeenOnboardingWizard() {
|
|
490030
490647
|
if (isEnvTruthy(process.env.THEUS_FORCE_ONBOARDING_WIZARD))
|
|
490031
490648
|
return false;
|
|
@@ -490033,7 +490650,7 @@ function hasSeenOnboardingWizard() {
|
|
|
490033
490650
|
return true;
|
|
490034
490651
|
}
|
|
490035
490652
|
try {
|
|
490036
|
-
return
|
|
490653
|
+
return existsSync32(join180(getTheusConfigHome(), WIZARD_MARKER));
|
|
490037
490654
|
} catch {
|
|
490038
490655
|
return true;
|
|
490039
490656
|
}
|
|
@@ -490042,7 +490659,7 @@ function markOnboardingWizardSeen() {
|
|
|
490042
490659
|
try {
|
|
490043
490660
|
const home = getTheusConfigHome();
|
|
490044
490661
|
mkdirSync15(home, { recursive: true });
|
|
490045
|
-
writeFileSync14(
|
|
490662
|
+
writeFileSync14(join180(home, WIZARD_MARKER), `${JSON.stringify({
|
|
490046
490663
|
seenAt: new Date().toISOString(),
|
|
490047
490664
|
version: globalThis.MACRO?.VERSION ?? null
|
|
490048
490665
|
})}
|
|
@@ -491408,7 +492025,7 @@ var init_TheusMissionLaunch = __esm(() => {
|
|
|
491408
492025
|
});
|
|
491409
492026
|
|
|
491410
492027
|
// replLauncher.tsx
|
|
491411
|
-
import { readFile as
|
|
492028
|
+
import { readFile as readFile66 } from "fs/promises";
|
|
491412
492029
|
function shouldShowStartMenu(replProps) {
|
|
491413
492030
|
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
492031
|
}
|
|
@@ -491440,7 +492057,7 @@ function withTimeout2(promise3, ms, fallback) {
|
|
|
491440
492057
|
async function readMemoryFacts() {
|
|
491441
492058
|
try {
|
|
491442
492059
|
const { getGraphPath: getGraphPath2 } = await Promise.resolve().then(() => (init_paths2(), exports_paths));
|
|
491443
|
-
const raw = await
|
|
492060
|
+
const raw = await readFile66(getGraphPath2(getCwd()), "utf8");
|
|
491444
492061
|
const data = JSON.parse(raw);
|
|
491445
492062
|
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
491446
492063
|
let facts = 0;
|
|
@@ -492726,7 +493343,7 @@ var exports_ResumeConversation = {};
|
|
|
492726
493343
|
__export(exports_ResumeConversation, {
|
|
492727
493344
|
ResumeConversation: () => ResumeConversation
|
|
492728
493345
|
});
|
|
492729
|
-
import { dirname as
|
|
493346
|
+
import { dirname as dirname77 } from "path";
|
|
492730
493347
|
function parsePrIdentifier(value) {
|
|
492731
493348
|
const directNumber = parseInt(value, 10);
|
|
492732
493349
|
if (!isNaN(directNumber) && directNumber > 0) {
|
|
@@ -492858,7 +493475,7 @@ function ResumeConversation({
|
|
|
492858
493475
|
}
|
|
492859
493476
|
if (false) {}
|
|
492860
493477
|
if (result_3.sessionId && !forkSession) {
|
|
492861
|
-
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ?
|
|
493478
|
+
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname77(log_0.fullPath) : null);
|
|
492862
493479
|
await renameRecordingForSession();
|
|
492863
493480
|
await resetSessionFilePointer();
|
|
492864
493481
|
restoreCostStateForSession(result_3.sessionId);
|
|
@@ -493522,7 +494139,7 @@ var init_theusInChrome = __esm(() => {
|
|
|
493522
494139
|
});
|
|
493523
494140
|
|
|
493524
494141
|
// skills/bundled/debug.ts
|
|
493525
|
-
import { open as
|
|
494142
|
+
import { open as open26, stat as stat57 } from "fs/promises";
|
|
493526
494143
|
function registerDebugSkill() {
|
|
493527
494144
|
registerBundledSkill({
|
|
493528
494145
|
name: "debug",
|
|
@@ -493536,10 +494153,10 @@ function registerDebugSkill() {
|
|
|
493536
494153
|
const debugLogPath = getDebugLogPath();
|
|
493537
494154
|
let logInfo;
|
|
493538
494155
|
try {
|
|
493539
|
-
const stats2 = await
|
|
494156
|
+
const stats2 = await stat57(debugLogPath);
|
|
493540
494157
|
const readSize = Math.min(stats2.size, TAIL_READ_BYTES);
|
|
493541
494158
|
const startOffset = stats2.size - readSize;
|
|
493542
|
-
const fd2 = await
|
|
494159
|
+
const fd2 = await open26(debugLogPath, "r");
|
|
493543
494160
|
try {
|
|
493544
494161
|
const { buffer, bytesRead } = await fd2.read({
|
|
493545
494162
|
buffer: Buffer.alloc(readSize),
|
|
@@ -496122,10 +496739,10 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
496122
496739
|
});
|
|
496123
496740
|
|
|
496124
496741
|
// utils/releaseNotes.ts
|
|
496125
|
-
import { mkdir as mkdir56, readFile as
|
|
496126
|
-
import { dirname as
|
|
496742
|
+
import { mkdir as mkdir56, readFile as readFile67, writeFile as writeFile56 } from "fs/promises";
|
|
496743
|
+
import { dirname as dirname78, join as join181 } from "path";
|
|
496127
496744
|
function getChangelogCachePath() {
|
|
496128
|
-
return
|
|
496745
|
+
return join181(getTheusConfigHomeDir(), "cache", "changelog.md");
|
|
496129
496746
|
}
|
|
496130
496747
|
async function migrateChangelogFromConfig() {
|
|
496131
496748
|
const config3 = getGlobalConfig();
|
|
@@ -496134,7 +496751,7 @@ async function migrateChangelogFromConfig() {
|
|
|
496134
496751
|
}
|
|
496135
496752
|
const cachePath2 = getChangelogCachePath();
|
|
496136
496753
|
try {
|
|
496137
|
-
await mkdir56(
|
|
496754
|
+
await mkdir56(dirname78(cachePath2), { recursive: true });
|
|
496138
496755
|
await writeFile56(cachePath2, config3.cachedChangelog, {
|
|
496139
496756
|
encoding: "utf-8",
|
|
496140
496757
|
flag: "wx"
|
|
@@ -496156,7 +496773,7 @@ async function fetchAndStoreChangelog() {
|
|
|
496156
496773
|
return;
|
|
496157
496774
|
}
|
|
496158
496775
|
const cachePath2 = getChangelogCachePath();
|
|
496159
|
-
await mkdir56(
|
|
496776
|
+
await mkdir56(dirname78(cachePath2), { recursive: true });
|
|
496160
496777
|
await writeFile56(cachePath2, changelogContent, { encoding: "utf-8" });
|
|
496161
496778
|
changelogMemoryCache = changelogContent;
|
|
496162
496779
|
const changelogLastFetched = Date.now();
|
|
@@ -496172,7 +496789,7 @@ async function getStoredChangelog() {
|
|
|
496172
496789
|
}
|
|
496173
496790
|
const cachePath2 = getChangelogCachePath();
|
|
496174
496791
|
try {
|
|
496175
|
-
const content = await
|
|
496792
|
+
const content = await readFile67(cachePath2, "utf-8");
|
|
496176
496793
|
changelogMemoryCache = content;
|
|
496177
496794
|
return content;
|
|
496178
496795
|
} catch {
|
|
@@ -496225,7 +496842,7 @@ function getRecentReleaseNotes(currentVersion, previousVersion, changelogContent
|
|
|
496225
496842
|
}
|
|
496226
496843
|
return [];
|
|
496227
496844
|
}
|
|
496228
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.
|
|
496845
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
496846
|
if (false) {}
|
|
496230
496847
|
const cachedChangelog = await getStoredChangelog();
|
|
496231
496848
|
if (lastSeenVersion !== currentVersion || !cachedChangelog) {
|
|
@@ -496323,7 +496940,7 @@ __export(exports_setup2, {
|
|
|
496323
496940
|
setupComputerUse: () => setupComputerUse,
|
|
496324
496941
|
COMPUTER_USE_SYSTEM_HINT: () => COMPUTER_USE_SYSTEM_HINT
|
|
496325
496942
|
});
|
|
496326
|
-
import { dirname as
|
|
496943
|
+
import { dirname as dirname79, join as join182 } from "path";
|
|
496327
496944
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
496328
496945
|
function setupComputerUse() {
|
|
496329
496946
|
const allowedTools = COMPUTER_USE_TOOL_NAMES.map((name) => buildMcpToolName(COMPUTER_USE_SERVER_NAME, name));
|
|
@@ -496350,11 +496967,11 @@ function resolveComputerUseLauncher() {
|
|
|
496350
496967
|
return { command: process.execPath, args: [entry, COMPUTER_USE_FLAG] };
|
|
496351
496968
|
}
|
|
496352
496969
|
if (entry) {
|
|
496353
|
-
const launcher =
|
|
496970
|
+
const launcher = join182(dirname79(entry), "..", "bin", "theus");
|
|
496354
496971
|
return { command: launcher, args: [COMPUTER_USE_FLAG] };
|
|
496355
496972
|
}
|
|
496356
496973
|
return {
|
|
496357
|
-
command:
|
|
496974
|
+
command: join182(fileURLToPath10(import.meta.url), "..", "..", "..", "bin", "theus"),
|
|
496358
496975
|
args: [COMPUTER_USE_FLAG]
|
|
496359
496976
|
};
|
|
496360
496977
|
}
|
|
@@ -496371,19 +496988,19 @@ __export(exports_arsenalBundled, {
|
|
|
496371
496988
|
isArsenalAutoInstallEnabled: () => isArsenalAutoInstallEnabled,
|
|
496372
496989
|
ensureBundledArsenalInstalled: () => ensureBundledArsenalInstalled
|
|
496373
496990
|
});
|
|
496374
|
-
import { existsSync as
|
|
496375
|
-
import { dirname as
|
|
496991
|
+
import { existsSync as existsSync33, readFileSync as readFileSync33 } from "fs";
|
|
496992
|
+
import { dirname as dirname80, join as join183 } from "path";
|
|
496376
496993
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
496377
496994
|
function isArsenalAutoInstallEnabled() {
|
|
496378
496995
|
return process.env.THEUS_NO_ARSENAL !== "1";
|
|
496379
496996
|
}
|
|
496380
496997
|
function findBundledArsenalDir() {
|
|
496381
|
-
const here =
|
|
496998
|
+
const here = dirname80(fileURLToPath11(import.meta.url));
|
|
496382
496999
|
for (const candidate of [
|
|
496383
|
-
|
|
496384
|
-
|
|
497000
|
+
join183(here, "vendor", "theus-arsenal"),
|
|
497001
|
+
join183(here, "..", "vendor", "theus-arsenal")
|
|
496385
497002
|
]) {
|
|
496386
|
-
if (
|
|
497003
|
+
if (existsSync33(join183(candidate, ".theus-plugin", "plugin.json"))) {
|
|
496387
497004
|
return candidate;
|
|
496388
497005
|
}
|
|
496389
497006
|
}
|
|
@@ -496391,7 +497008,7 @@ function findBundledArsenalDir() {
|
|
|
496391
497008
|
}
|
|
496392
497009
|
function readBundledVersion(bundledDir) {
|
|
496393
497010
|
try {
|
|
496394
|
-
const manifest = JSON.parse(readFileSync33(
|
|
497011
|
+
const manifest = JSON.parse(readFileSync33(join183(bundledDir, ".theus-plugin", "plugin.json"), "utf8"));
|
|
496395
497012
|
return typeof manifest.version === "string" ? manifest.version : null;
|
|
496396
497013
|
} catch {
|
|
496397
497014
|
return null;
|
|
@@ -496629,9 +497246,9 @@ var init_sessionMemory = __esm(() => {
|
|
|
496629
497246
|
});
|
|
496630
497247
|
|
|
496631
497248
|
// utils/iTermBackup.ts
|
|
496632
|
-
import { copyFile as copyFile10, stat as
|
|
497249
|
+
import { copyFile as copyFile10, stat as stat58 } from "fs/promises";
|
|
496633
497250
|
import { homedir as homedir52 } from "os";
|
|
496634
|
-
import { join as
|
|
497251
|
+
import { join as join184 } from "path";
|
|
496635
497252
|
function markITerm2SetupComplete() {
|
|
496636
497253
|
saveGlobalConfig((current) => ({
|
|
496637
497254
|
...current,
|
|
@@ -496646,7 +497263,7 @@ function getIterm2RecoveryInfo() {
|
|
|
496646
497263
|
};
|
|
496647
497264
|
}
|
|
496648
497265
|
function getITerm2PlistPath() {
|
|
496649
|
-
return
|
|
497266
|
+
return join184(homedir52(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
496650
497267
|
}
|
|
496651
497268
|
async function checkAndRestoreITerm2Backup() {
|
|
496652
497269
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -496658,7 +497275,7 @@ async function checkAndRestoreITerm2Backup() {
|
|
|
496658
497275
|
return { status: "no_backup" };
|
|
496659
497276
|
}
|
|
496660
497277
|
try {
|
|
496661
|
-
await
|
|
497278
|
+
await stat58(backupPath);
|
|
496662
497279
|
} catch {
|
|
496663
497280
|
markITerm2SetupComplete();
|
|
496664
497281
|
return { status: "no_backup" };
|
|
@@ -498153,11 +498770,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
498153
498770
|
});
|
|
498154
498771
|
|
|
498155
498772
|
// utils/plugins/zipCacheAdapters.ts
|
|
498156
|
-
import { readFile as
|
|
498157
|
-
import { join as
|
|
498773
|
+
import { readFile as readFile68 } from "fs/promises";
|
|
498774
|
+
import { join as join185 } from "path";
|
|
498158
498775
|
async function readZipCacheKnownMarketplaces() {
|
|
498159
498776
|
try {
|
|
498160
|
-
const content = await
|
|
498777
|
+
const content = await readFile68(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
498161
498778
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
498162
498779
|
if (!parsed.success) {
|
|
498163
498780
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -498179,18 +498796,18 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
498179
498796
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
498180
498797
|
if (content !== null) {
|
|
498181
498798
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
498182
|
-
await atomicWriteToZipCache(
|
|
498799
|
+
await atomicWriteToZipCache(join185(zipCachePath, relPath), content);
|
|
498183
498800
|
}
|
|
498184
498801
|
}
|
|
498185
498802
|
async function readMarketplaceJsonContent(dir) {
|
|
498186
498803
|
const candidates = [
|
|
498187
|
-
|
|
498188
|
-
|
|
498804
|
+
join185(dir, ".theus-plugin", "marketplace.json"),
|
|
498805
|
+
join185(dir, "marketplace.json"),
|
|
498189
498806
|
dir
|
|
498190
498807
|
];
|
|
498191
498808
|
for (const candidate of candidates) {
|
|
498192
498809
|
try {
|
|
498193
|
-
return await
|
|
498810
|
+
return await readFile68(candidate, "utf-8");
|
|
498194
498811
|
} catch {}
|
|
498195
498812
|
}
|
|
498196
498813
|
return null;
|
|
@@ -498320,8 +498937,8 @@ __export(exports_print, {
|
|
|
498320
498937
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
498321
498938
|
canBatchWith: () => canBatchWith
|
|
498322
498939
|
});
|
|
498323
|
-
import { readFile as
|
|
498324
|
-
import { dirname as
|
|
498940
|
+
import { readFile as readFile69, stat as stat59 } from "fs/promises";
|
|
498941
|
+
import { dirname as dirname81 } from "path";
|
|
498325
498942
|
import { cwd as cwd2 } from "process";
|
|
498326
498943
|
import { randomUUID as randomUUID64 } from "crypto";
|
|
498327
498944
|
function trackReceivedMessageUuid(uuid3) {
|
|
@@ -499709,9 +500326,9 @@ ${m.text}
|
|
|
499709
500326
|
} else if (request.subtype === "seed_read_state") {
|
|
499710
500327
|
try {
|
|
499711
500328
|
const normalizedPath = expandPath(request.path);
|
|
499712
|
-
const diskMtime = Math.floor((await
|
|
500329
|
+
const diskMtime = Math.floor((await stat59(normalizedPath)).mtimeMs);
|
|
499713
500330
|
if (diskMtime <= request.mtime) {
|
|
499714
|
-
const raw = await
|
|
500331
|
+
const raw = await readFile69(normalizedPath, "utf-8");
|
|
499715
500332
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
499716
500333
|
`, `
|
|
499717
500334
|
`);
|
|
@@ -500809,7 +501426,7 @@ async function loadInitialMessages(setAppState, options2) {
|
|
|
500809
501426
|
if (false) {}
|
|
500810
501427
|
if (!options2.forkSession) {
|
|
500811
501428
|
if (result.sessionId) {
|
|
500812
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
501429
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname81(result.fullPath) : null);
|
|
500813
501430
|
if (persistSession) {
|
|
500814
501431
|
await resetSessionFilePointer();
|
|
500815
501432
|
}
|
|
@@ -500907,7 +501524,7 @@ async function loadInitialMessages(setAppState, options2) {
|
|
|
500907
501524
|
}
|
|
500908
501525
|
if (false) {}
|
|
500909
501526
|
if (!options2.forkSession && result.sessionId) {
|
|
500910
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
501527
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname81(result.fullPath) : null);
|
|
500911
501528
|
if (persistSession) {
|
|
500912
501529
|
await resetSessionFilePointer();
|
|
500913
501530
|
}
|
|
@@ -501758,7 +502375,7 @@ async function startMCPServer(cwd3, debug3, verbose) {
|
|
|
501758
502375
|
setCwd(cwd3);
|
|
501759
502376
|
const server2 = new Server({
|
|
501760
502377
|
name: "theus/tengu",
|
|
501761
|
-
version: { VERSION: "0.2.
|
|
502378
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
502379
|
}, {
|
|
501763
502380
|
capabilities: {
|
|
501764
502381
|
tools: {}
|
|
@@ -501888,37 +502505,37 @@ __export(exports_theusDesktop, {
|
|
|
501888
502505
|
readTheusDesktopMcpServers: () => readTheusDesktopMcpServers,
|
|
501889
502506
|
getTheusDesktopConfigPath: () => getTheusDesktopConfigPath
|
|
501890
502507
|
});
|
|
501891
|
-
import { readdir as
|
|
502508
|
+
import { readdir as readdir39, readFile as readFile70, stat as stat60 } from "fs/promises";
|
|
501892
502509
|
import { homedir as homedir53 } from "os";
|
|
501893
|
-
import { join as
|
|
502510
|
+
import { join as join186 } from "path";
|
|
501894
502511
|
async function getTheusDesktopConfigPath() {
|
|
501895
502512
|
const platform7 = getPlatform();
|
|
501896
502513
|
if (!SUPPORTED_PLATFORMS.includes(platform7)) {
|
|
501897
502514
|
throw new Error(`Unsupported platform: ${platform7} - Theus Desktop integration only works on macOS and WSL.`);
|
|
501898
502515
|
}
|
|
501899
502516
|
if (platform7 === "macos") {
|
|
501900
|
-
return
|
|
502517
|
+
return join186(homedir53(), "Library", "Application Support", "Theus", "theus_desktop_config.json");
|
|
501901
502518
|
}
|
|
501902
502519
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
501903
502520
|
if (windowsHome) {
|
|
501904
502521
|
const wslPath = windowsHome.replace(/^[A-Z]:/, "");
|
|
501905
502522
|
const configPath2 = `/mnt/c${wslPath}/AppData/Roaming/Theus/theus_desktop_config.json`;
|
|
501906
502523
|
try {
|
|
501907
|
-
await
|
|
502524
|
+
await stat60(configPath2);
|
|
501908
502525
|
return configPath2;
|
|
501909
502526
|
} catch {}
|
|
501910
502527
|
}
|
|
501911
502528
|
try {
|
|
501912
502529
|
const usersDir = "/mnt/c/Users";
|
|
501913
502530
|
try {
|
|
501914
|
-
const userDirs = await
|
|
502531
|
+
const userDirs = await readdir39(usersDir, { withFileTypes: true });
|
|
501915
502532
|
for (const user of userDirs) {
|
|
501916
502533
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
501917
502534
|
continue;
|
|
501918
502535
|
}
|
|
501919
|
-
const potentialConfigPath =
|
|
502536
|
+
const potentialConfigPath = join186(usersDir, user.name, "AppData", "Roaming", "Theus", "theus_desktop_config.json");
|
|
501920
502537
|
try {
|
|
501921
|
-
await
|
|
502538
|
+
await stat60(potentialConfigPath);
|
|
501922
502539
|
return potentialConfigPath;
|
|
501923
502540
|
} catch {}
|
|
501924
502541
|
}
|
|
@@ -501936,7 +502553,7 @@ async function readTheusDesktopMcpServers() {
|
|
|
501936
502553
|
const configPath2 = await getTheusDesktopConfigPath();
|
|
501937
502554
|
let configContent;
|
|
501938
502555
|
try {
|
|
501939
|
-
configContent = await
|
|
502556
|
+
configContent = await readFile70(configPath2, { encoding: "utf8" });
|
|
501940
502557
|
} catch (e) {
|
|
501941
502558
|
const code = getErrnoCode(e);
|
|
501942
502559
|
if (code === "ENOENT") {
|
|
@@ -501987,7 +502604,7 @@ __export(exports_mcp3, {
|
|
|
501987
502604
|
mcpAddJsonHandler: () => mcpAddJsonHandler,
|
|
501988
502605
|
mcpAddFromDesktopHandler: () => mcpAddFromDesktopHandler
|
|
501989
502606
|
});
|
|
501990
|
-
import { stat as
|
|
502607
|
+
import { stat as stat61 } from "fs/promises";
|
|
501991
502608
|
import { cwd as cwd3 } from "process";
|
|
501992
502609
|
async function checkMcpServerHealth(name, server2) {
|
|
501993
502610
|
try {
|
|
@@ -502010,7 +502627,7 @@ async function mcpServeHandler({
|
|
|
502010
502627
|
const providedCwd = cwd3();
|
|
502011
502628
|
logEvent("theus_mcp_start", {});
|
|
502012
502629
|
try {
|
|
502013
|
-
await
|
|
502630
|
+
await stat61(providedCwd);
|
|
502014
502631
|
} catch (error40) {
|
|
502015
502632
|
if (isFsInaccessible(error40)) {
|
|
502016
502633
|
cliError(`Error: Directory ${providedCwd} does not exist`);
|
|
@@ -502312,7 +502929,7 @@ __export(exports_plugins, {
|
|
|
502312
502929
|
VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
|
|
502313
502930
|
VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
|
|
502314
502931
|
});
|
|
502315
|
-
import { basename as basename68, dirname as
|
|
502932
|
+
import { basename as basename68, dirname as dirname82 } from "path";
|
|
502316
502933
|
function handleMarketplaceError(error40, action2) {
|
|
502317
502934
|
logError2(error40);
|
|
502318
502935
|
cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error40)}`);
|
|
@@ -502345,9 +502962,9 @@ async function pluginValidateHandler(manifestPath, options2) {
|
|
|
502345
502962
|
printValidationResult(result);
|
|
502346
502963
|
let contentResults = [];
|
|
502347
502964
|
if (result.fileType === "plugin") {
|
|
502348
|
-
const manifestDir =
|
|
502965
|
+
const manifestDir = dirname82(result.filePath);
|
|
502349
502966
|
if (basename68(manifestDir) === ".theus-plugin") {
|
|
502350
|
-
contentResults = await validatePluginContents(
|
|
502967
|
+
contentResults = await validatePluginContents(dirname82(manifestDir));
|
|
502351
502968
|
for (const r of contentResults) {
|
|
502352
502969
|
console.log(`Validating ${r.fileType}: ${r.filePath}
|
|
502353
502970
|
`);
|
|
@@ -502825,12 +503442,12 @@ __export(exports_install, {
|
|
|
502825
503442
|
install: () => install
|
|
502826
503443
|
});
|
|
502827
503444
|
import { homedir as homedir54 } from "os";
|
|
502828
|
-
import { join as
|
|
503445
|
+
import { join as join187 } from "path";
|
|
502829
503446
|
function getInstallationPath2() {
|
|
502830
503447
|
const isWindows2 = env3.platform === "win32";
|
|
502831
503448
|
const homeDir = homedir54();
|
|
502832
503449
|
if (isWindows2) {
|
|
502833
|
-
const windowsPath =
|
|
503450
|
+
const windowsPath = join187(homeDir, ".local", "bin", "theus.exe");
|
|
502834
503451
|
return windowsPath.replace(/\//g, "\\");
|
|
502835
503452
|
}
|
|
502836
503453
|
return "~/.local/bin/theus";
|
|
@@ -503200,7 +503817,7 @@ async function setupTokenHandler(root2) {
|
|
|
503200
503817
|
gap: 1,
|
|
503201
503818
|
children: [
|
|
503202
503819
|
/* @__PURE__ */ jsx_runtime502.jsx(TheusBanner, {
|
|
503203
|
-
version: { VERSION: "0.2.
|
|
503820
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
503821
|
}),
|
|
503205
503822
|
showAuthWarning && /* @__PURE__ */ jsx_runtime502.jsxs(ThemedBox_default, {
|
|
503206
503823
|
flexDirection: "column",
|
|
@@ -503369,7 +503986,7 @@ var exports_import2 = {};
|
|
|
503369
503986
|
__export(exports_import2, {
|
|
503370
503987
|
importHandler: () => importHandler
|
|
503371
503988
|
});
|
|
503372
|
-
import { readFile as
|
|
503989
|
+
import { readFile as readFile71 } from "fs/promises";
|
|
503373
503990
|
import { homedir as homedir55 } from "os";
|
|
503374
503991
|
import { resolve as resolve59 } from "path";
|
|
503375
503992
|
function resolvePath4(raw) {
|
|
@@ -503391,7 +504008,7 @@ async function importHandler(file2, options2 = {}) {
|
|
|
503391
504008
|
const abs = resolvePath4(file2);
|
|
503392
504009
|
let bytes;
|
|
503393
504010
|
try {
|
|
503394
|
-
bytes = await
|
|
504011
|
+
bytes = await readFile71(abs);
|
|
503395
504012
|
} catch {
|
|
503396
504013
|
process.stderr.write(`\u2717 No pude leer el archivo: ${abs}
|
|
503397
504014
|
`);
|
|
@@ -504785,7 +505402,7 @@ ${assistantAddendum}` : assistantAddendum;
|
|
|
504785
505402
|
}
|
|
504786
505403
|
}
|
|
504787
505404
|
logForDiagnosticsNoPII("info", "started", {
|
|
504788
|
-
version: { VERSION: "0.2.
|
|
505405
|
+
version: { VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
505406
|
is_native_binary: isInBundledMode()
|
|
504790
505407
|
});
|
|
504791
505408
|
registerCleanup(async () => {
|
|
@@ -505653,7 +506270,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
505653
506270
|
pendingHookMessages
|
|
505654
506271
|
}, renderAndRun);
|
|
505655
506272
|
}
|
|
505656
|
-
}).version(`${{ VERSION: "0.2.
|
|
506273
|
+
}).version(`${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
506274
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
505658
506275
|
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
506276
|
if (canUserConfigureAdvisor()) {
|
|
@@ -506254,7 +506871,7 @@ if (false) {}
|
|
|
506254
506871
|
async function main2() {
|
|
506255
506872
|
const args = process.argv.slice(2);
|
|
506256
506873
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
506257
|
-
console.log(`${{ VERSION: "0.2.
|
|
506874
|
+
console.log(`${{ VERSION: "0.2.73", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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
506875
|
return;
|
|
506259
506876
|
}
|
|
506260
506877
|
if (args[0] === "login" || args[0] === "signin" || args[0] === "entrar" || args[0] === "iniciar-sesion") {
|