theus-cli 0.1.12 → 0.1.14
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 +704 -672
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -58283,7 +58283,7 @@ async function _executeApiKeyHelper(isNonInteractiveSession) {
|
|
|
58283
58283
|
if (isApiKeyHelperFromProjectOrLocalSettings()) {
|
|
58284
58284
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58285
58285
|
if (!hasTrust && !isNonInteractiveSession) {
|
|
58286
|
-
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58286
|
+
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
|
|
58287
58287
|
logAntError("apiKeyHelper invoked before trust check", error40);
|
|
58288
58288
|
logEvent("tengu_apiKeyHelper_missing_trust11", {});
|
|
58289
58289
|
return null;
|
|
@@ -58327,7 +58327,7 @@ async function runAwsAuthRefresh() {
|
|
|
58327
58327
|
if (isAwsAuthRefreshFromProjectSettings()) {
|
|
58328
58328
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58329
58329
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58330
|
-
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58330
|
+
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
|
|
58331
58331
|
logAntError("awsAuthRefresh invoked before trust check", error40);
|
|
58332
58332
|
logEvent("tengu_awsAuthRefresh_missing_trust", {});
|
|
58333
58333
|
return false;
|
|
@@ -58387,7 +58387,7 @@ async function getAwsCredsFromCredentialExport() {
|
|
|
58387
58387
|
if (isAwsCredentialExportFromProjectSettings()) {
|
|
58388
58388
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58389
58389
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58390
|
-
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58390
|
+
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
|
|
58391
58391
|
logAntError("awsCredentialExport invoked before trust check", error40);
|
|
58392
58392
|
logEvent("tengu_awsCredentialExport_missing_trust", {});
|
|
58393
58393
|
return null;
|
|
@@ -58472,7 +58472,7 @@ async function runGcpAuthRefresh() {
|
|
|
58472
58472
|
if (isGcpAuthRefreshFromProjectSettings()) {
|
|
58473
58473
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58474
58474
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58475
|
-
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
58475
|
+
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
|
|
58476
58476
|
logAntError("gcpAuthRefresh invoked before trust check", error40);
|
|
58477
58477
|
logEvent("tengu_gcpAuthRefresh_missing_trust", {});
|
|
58478
58478
|
return false;
|
|
@@ -59167,7 +59167,7 @@ var init_auth = __esm(() => {
|
|
|
59167
59167
|
|
|
59168
59168
|
// utils/userAgent.ts
|
|
59169
59169
|
function getTheusCodeUserAgent() {
|
|
59170
|
-
return `theus-code/${{ VERSION: "0.1.
|
|
59170
|
+
return `theus-code/${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`;
|
|
59171
59171
|
}
|
|
59172
59172
|
|
|
59173
59173
|
// utils/workloadContext.ts
|
|
@@ -59189,7 +59189,7 @@ function getUserAgent() {
|
|
|
59189
59189
|
const clientApp = process.env.THEUS_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}` : "";
|
|
59190
59190
|
const workload = getWorkload();
|
|
59191
59191
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
59192
|
-
return `theus-cli/${{ VERSION: "0.1.
|
|
59192
|
+
return `theus-cli/${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (${process.env.USER_TYPE}, ${process.env.THEUS_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
59193
59193
|
}
|
|
59194
59194
|
function getMCPUserAgent() {
|
|
59195
59195
|
const parts = [];
|
|
@@ -59203,7 +59203,7 @@ function getMCPUserAgent() {
|
|
|
59203
59203
|
parts.push(`client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}`);
|
|
59204
59204
|
}
|
|
59205
59205
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
59206
|
-
return `theus-code/${{ VERSION: "0.1.
|
|
59206
|
+
return `theus-code/${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}${suffix}`;
|
|
59207
59207
|
}
|
|
59208
59208
|
function getWebFetchUserAgent() {
|
|
59209
59209
|
return `Theus-User (${getTheusCodeUserAgent()}; +https://support.theus.pe/)`;
|
|
@@ -59341,7 +59341,7 @@ var init_user = __esm(() => {
|
|
|
59341
59341
|
deviceId,
|
|
59342
59342
|
sessionId: getSessionId(),
|
|
59343
59343
|
email: getEmail(),
|
|
59344
|
-
appVersion: { VERSION: "0.1.
|
|
59344
|
+
appVersion: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
59345
59345
|
platform: getHostPlatformForAnalytics(),
|
|
59346
59346
|
organizationUuid,
|
|
59347
59347
|
accountUuid,
|
|
@@ -61056,7 +61056,7 @@ var init_metadata = __esm(() => {
|
|
|
61056
61056
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
61057
61057
|
WHITESPACE_REGEX = /\s+/;
|
|
61058
61058
|
getVersionBase = memoize_default(() => {
|
|
61059
|
-
const match = { VERSION: "0.1.
|
|
61059
|
+
const match = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
61060
61060
|
return match ? match[0] : undefined;
|
|
61061
61061
|
});
|
|
61062
61062
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -61096,9 +61096,9 @@ var init_metadata = __esm(() => {
|
|
|
61096
61096
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
61097
61097
|
isTheusCodeAction: isEnvTruthy(process.env.THEUS_CODE_ACTION),
|
|
61098
61098
|
isTheusAiAuth: isTheusAISubscriber(),
|
|
61099
|
-
version: { VERSION: "0.1.
|
|
61099
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
61100
61100
|
versionBase: getVersionBase(),
|
|
61101
|
-
buildTime: { VERSION: "0.1.
|
|
61101
|
+
buildTime: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME,
|
|
61102
61102
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
61103
61103
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
61104
61104
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -61764,7 +61764,7 @@ function initialize1PEventLogging() {
|
|
|
61764
61764
|
const platform2 = getPlatform();
|
|
61765
61765
|
const attributes = {
|
|
61766
61766
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
61767
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.
|
|
61767
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
61768
61768
|
};
|
|
61769
61769
|
if (platform2 === "wsl") {
|
|
61770
61770
|
const wslVersion = getWslVersion();
|
|
@@ -61791,7 +61791,7 @@ function initialize1PEventLogging() {
|
|
|
61791
61791
|
})
|
|
61792
61792
|
]
|
|
61793
61793
|
});
|
|
61794
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
61794
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
61795
61795
|
}
|
|
61796
61796
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
61797
61797
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -63662,7 +63662,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
63662
63662
|
if (!isAttributionHeaderEnabled()) {
|
|
63663
63663
|
return "";
|
|
63664
63664
|
}
|
|
63665
|
-
const version2 = `${{ VERSION: "0.1.
|
|
63665
|
+
const version2 = `${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}.${fingerprint}`;
|
|
63666
63666
|
const entrypoint = process.env.THEUS_CODE_ENTRYPOINT ?? "unknown";
|
|
63667
63667
|
const cch = "";
|
|
63668
63668
|
const workload = getWorkload();
|
|
@@ -107180,7 +107180,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
107180
107180
|
}
|
|
107181
107181
|
function getFeedbackGuideline() {
|
|
107182
107182
|
if (isUsing3PServices()) {
|
|
107183
|
-
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.1.
|
|
107183
|
+
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER}`;
|
|
107184
107184
|
}
|
|
107185
107185
|
return "- When you cannot find an answer or the feature doesn't exist, direct the user to use /feedback to report a feature request or bug";
|
|
107186
107186
|
}
|
|
@@ -165877,7 +165877,7 @@ function getTelemetryAttributes() {
|
|
|
165877
165877
|
attributes["session.id"] = sessionId;
|
|
165878
165878
|
}
|
|
165879
165879
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
165880
|
-
attributes["app.version"] = { VERSION: "0.1.
|
|
165880
|
+
attributes["app.version"] = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
165881
165881
|
}
|
|
165882
165882
|
const oauthAccount = getOauthAccountInfo();
|
|
165883
165883
|
if (oauthAccount) {
|
|
@@ -201923,7 +201923,7 @@ function getInstallationEnv() {
|
|
|
201923
201923
|
return;
|
|
201924
201924
|
}
|
|
201925
201925
|
function getTheusCodeVersion() {
|
|
201926
|
-
return { VERSION: "0.1.
|
|
201926
|
+
return { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
201927
201927
|
}
|
|
201928
201928
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
201929
201929
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -203441,7 +203441,7 @@ async function getMcpHeadersFromHelper(serverName, config2) {
|
|
|
203441
203441
|
if ("scope" in config2 && isMcpServerFromProjectOrLocalSettings(config2) && !getIsNonInteractiveSession()) {
|
|
203442
203442
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
203443
203443
|
if (!hasTrust) {
|
|
203444
|
-
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
203444
|
+
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
|
|
203445
203445
|
logAntError("MCP headersHelper invoked before trust check", error40);
|
|
203446
203446
|
logEvent("tengu_mcp_headersHelper_missing_trust", {});
|
|
203447
203447
|
return null;
|
|
@@ -204651,7 +204651,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
204651
204651
|
const client2 = new Client({
|
|
204652
204652
|
name: "theus-code",
|
|
204653
204653
|
title: "Theus",
|
|
204654
|
-
version: { VERSION: "0.1.
|
|
204654
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
|
|
204655
204655
|
description: "Theus's agentic coding tool",
|
|
204656
204656
|
websiteUrl: PRODUCT_URL
|
|
204657
204657
|
}, {
|
|
@@ -205005,7 +205005,7 @@ var init_client5 = __esm(() => {
|
|
|
205005
205005
|
const client2 = new Client({
|
|
205006
205006
|
name: "theus-code",
|
|
205007
205007
|
title: "Theus",
|
|
205008
|
-
version: { VERSION: "0.1.
|
|
205008
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
|
|
205009
205009
|
description: "Theus's agentic coding tool",
|
|
205010
205010
|
websiteUrl: PRODUCT_URL
|
|
205011
205011
|
}, {
|
|
@@ -215564,7 +215564,7 @@ async function initializeBetaTracing(resource) {
|
|
|
215564
215564
|
});
|
|
215565
215565
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215566
215566
|
setLoggerProvider(loggerProvider);
|
|
215567
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215567
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215568
215568
|
setEventLogger(eventLogger);
|
|
215569
215569
|
process.on("beforeExit", async () => {
|
|
215570
215570
|
await loggerProvider?.forceFlush();
|
|
@@ -215604,7 +215604,7 @@ async function initializeTelemetry() {
|
|
|
215604
215604
|
const platform4 = getPlatform();
|
|
215605
215605
|
const baseAttributes = {
|
|
215606
215606
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
215607
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.
|
|
215607
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
215608
215608
|
};
|
|
215609
215609
|
if (platform4 === "wsl") {
|
|
215610
215610
|
const wslVersion = getWslVersion();
|
|
@@ -215649,7 +215649,7 @@ async function initializeTelemetry() {
|
|
|
215649
215649
|
} catch {}
|
|
215650
215650
|
};
|
|
215651
215651
|
registerCleanup(shutdownTelemetry2);
|
|
215652
|
-
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215652
|
+
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215653
215653
|
}
|
|
215654
215654
|
const meterProvider = new MeterProvider({
|
|
215655
215655
|
resource,
|
|
@@ -215669,7 +215669,7 @@ async function initializeTelemetry() {
|
|
|
215669
215669
|
});
|
|
215670
215670
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215671
215671
|
setLoggerProvider(loggerProvider);
|
|
215672
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215672
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215673
215673
|
setEventLogger(eventLogger);
|
|
215674
215674
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
215675
215675
|
process.on("beforeExit", async () => {
|
|
@@ -215731,7 +215731,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
215731
215731
|
}
|
|
215732
215732
|
};
|
|
215733
215733
|
registerCleanup(shutdownTelemetry);
|
|
215734
|
-
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215734
|
+
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215735
215735
|
}
|
|
215736
215736
|
async function flushTelemetry() {
|
|
215737
215737
|
const meterProvider = getMeterProvider();
|
|
@@ -216271,7 +216271,7 @@ async function installOrUpdateTheusPackage(channel2, specificVersion) {
|
|
|
216271
216271
|
return "install_failed";
|
|
216272
216272
|
}
|
|
216273
216273
|
const versionSpec = specificVersion ? specificVersion : channel2 === "stable" ? "stable" : "latest";
|
|
216274
|
-
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.
|
|
216274
|
+
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${versionSpec}`], { cwd: getLocalInstallDir(), maxBuffer: 1e6 });
|
|
216275
216275
|
if (result.code !== 0) {
|
|
216276
216276
|
const error40 = new Error(`Failed to install Theus CLI package: ${result.stderr}`);
|
|
216277
216277
|
logError2(error40);
|
|
@@ -216417,9 +216417,9 @@ async function assertMinVersion() {
|
|
|
216417
216417
|
if (false) {}
|
|
216418
216418
|
try {
|
|
216419
216419
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
216420
|
-
if (versionConfig.minVersion && lt({ VERSION: "0.1.
|
|
216420
|
+
if (versionConfig.minVersion && lt({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, versionConfig.minVersion)) {
|
|
216421
216421
|
console.error(`
|
|
216422
|
-
It looks like your version of Theus (${{ VERSION: "0.1.
|
|
216422
|
+
It looks like your version of Theus (${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}) needs an update.
|
|
216423
216423
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
216424
216424
|
|
|
216425
216425
|
To update, please run:
|
|
@@ -216560,7 +216560,7 @@ async function getInstallationPrefix() {
|
|
|
216560
216560
|
return prefixResult.stdout.trim();
|
|
216561
216561
|
}
|
|
216562
216562
|
function getGlobalInstallPackageManager() {
|
|
216563
|
-
if ({ VERSION: "0.1.
|
|
216563
|
+
if ({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL === "theus-cli") {
|
|
216564
216564
|
return "npm";
|
|
216565
216565
|
}
|
|
216566
216566
|
return env3.isRunningWithBun() ? "bun" : "npm";
|
|
@@ -216585,7 +216585,7 @@ async function checkGlobalInstallPermissions() {
|
|
|
216585
216585
|
}
|
|
216586
216586
|
async function getLatestVersion(channel2) {
|
|
216587
216587
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
216588
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.
|
|
216588
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
|
|
216589
216589
|
if (result.code !== 0) {
|
|
216590
216590
|
logForDebugging(`npm view failed with code ${result.code}`);
|
|
216591
216591
|
if (result.stderr) {
|
|
@@ -216601,7 +216601,7 @@ async function getLatestVersion(channel2) {
|
|
|
216601
216601
|
return result.stdout.trim();
|
|
216602
216602
|
}
|
|
216603
216603
|
async function getNpmDistTags() {
|
|
216604
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.
|
|
216604
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL, "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
|
|
216605
216605
|
if (result.code !== 0) {
|
|
216606
216606
|
logForDebugging(`npm view dist-tags failed with code ${result.code}`);
|
|
216607
216607
|
return { latest: null, stable: null };
|
|
@@ -216641,7 +216641,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216641
216641
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
216642
216642
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
216643
216643
|
pid: process.pid,
|
|
216644
|
-
currentVersion: { VERSION: "0.1.
|
|
216644
|
+
currentVersion: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
216645
216645
|
});
|
|
216646
216646
|
return "in_progress";
|
|
216647
216647
|
}
|
|
@@ -216650,7 +216650,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216650
216650
|
if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
|
|
216651
216651
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
216652
216652
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
216653
|
-
currentVersion: { VERSION: "0.1.
|
|
216653
|
+
currentVersion: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
216654
216654
|
});
|
|
216655
216655
|
console.error(`
|
|
216656
216656
|
Error: Windows NPM detected in WSL
|
|
@@ -216669,7 +216669,7 @@ To fix this issue:
|
|
|
216669
216669
|
if (!hasPermissions) {
|
|
216670
216670
|
return "no_permissions";
|
|
216671
216671
|
}
|
|
216672
|
-
const packageSpec = specificVersion ? `${{ VERSION: "0.1.
|
|
216672
|
+
const packageSpec = specificVersion ? `${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${specificVersion}` : { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL;
|
|
216673
216673
|
const packageManager = getGlobalInstallPackageManager();
|
|
216674
216674
|
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir18() });
|
|
216675
216675
|
if (installResult.code !== 0) {
|
|
@@ -216997,8 +216997,8 @@ async function detectMultipleInstallations() {
|
|
|
216997
216997
|
installations.push({ type: "npm-local", path: localPath });
|
|
216998
216998
|
}
|
|
216999
216999
|
const packagesToCheck = ["@theus-ai/theus-code"];
|
|
217000
|
-
if ({ VERSION: "0.1.
|
|
217001
|
-
packagesToCheck.push({ VERSION: "0.1.
|
|
217000
|
+
if ({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
|
|
217001
|
+
packagesToCheck.push({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
|
|
217002
217002
|
}
|
|
217003
217003
|
const npmResult = await execFileNoThrow("npm", [
|
|
217004
217004
|
"-g",
|
|
@@ -217181,7 +217181,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
217181
217181
|
}
|
|
217182
217182
|
async function getDoctorDiagnostic() {
|
|
217183
217183
|
const installationType = await getCurrentInstallationType();
|
|
217184
|
-
const version2 = { VERSION: "0.1.
|
|
217184
|
+
const version2 = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "unknown";
|
|
217185
217185
|
const installationPath = await getInstallationPath();
|
|
217186
217186
|
const invokedBinary = getInvokedBinary();
|
|
217187
217187
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -217193,8 +217193,8 @@ async function getDoctorDiagnostic() {
|
|
|
217193
217193
|
for (const install of npmInstalls) {
|
|
217194
217194
|
if (install.type === "npm-global") {
|
|
217195
217195
|
let uninstallCmd = "npm -g uninstall @theus-ai/theus-code";
|
|
217196
|
-
if ({ VERSION: "0.1.
|
|
217197
|
-
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.
|
|
217196
|
+
if ({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
|
|
217197
|
+
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`;
|
|
217198
217198
|
}
|
|
217199
217199
|
warnings.push({
|
|
217200
217200
|
issue: `Leftover npm global installation at ${install.path}`,
|
|
@@ -217306,7 +217306,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217306
217306
|
const startTime2 = Date.now();
|
|
217307
217307
|
const { stdout, code, stderr } = await execFileNoThrowWithCwd("npm", [
|
|
217308
217308
|
"view",
|
|
217309
|
-
`${{ VERSION: "0.1.
|
|
217309
|
+
`${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2}`,
|
|
217310
217310
|
"version",
|
|
217311
217311
|
"--prefer-online",
|
|
217312
217312
|
"--registry",
|
|
@@ -217330,7 +217330,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217330
217330
|
latency_ms: latencyMs,
|
|
217331
217331
|
source_npm: true
|
|
217332
217332
|
});
|
|
217333
|
-
logForDebugging(`npm view ${{ VERSION: "0.1.
|
|
217333
|
+
logForDebugging(`npm view ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2} version: ${stdout}`);
|
|
217334
217334
|
const latestVersion = stdout.trim();
|
|
217335
217335
|
return latestVersion;
|
|
217336
217336
|
}
|
|
@@ -217386,7 +217386,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217386
217386
|
const fs3 = getFsImplementation();
|
|
217387
217387
|
await fs3.rm(stagingPath, { recursive: true, force: true });
|
|
217388
217388
|
const platform4 = getPlatform2();
|
|
217389
|
-
const platformPackageName = `${{ VERSION: "0.1.
|
|
217389
|
+
const platformPackageName = `${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}-${platform4}`;
|
|
217390
217390
|
logForDebugging(`Fetching integrity hash for ${platformPackageName}@${version2}`);
|
|
217391
217391
|
const {
|
|
217392
217392
|
stdout: integrityOutput,
|
|
@@ -217415,7 +217415,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217415
217415
|
name: "theus-native-installer",
|
|
217416
217416
|
version: "0.0.1",
|
|
217417
217417
|
dependencies: {
|
|
217418
|
-
[{ VERSION: "0.1.
|
|
217418
|
+
[{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
|
|
217419
217419
|
}
|
|
217420
217420
|
};
|
|
217421
217421
|
const packageLock = {
|
|
@@ -217428,10 +217428,10 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217428
217428
|
name: "theus-native-installer",
|
|
217429
217429
|
version: "0.0.1",
|
|
217430
217430
|
dependencies: {
|
|
217431
|
-
[{ VERSION: "0.1.
|
|
217431
|
+
[{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
|
|
217432
217432
|
}
|
|
217433
217433
|
},
|
|
217434
|
-
[`node_modules/${{ VERSION: "0.1.
|
|
217434
|
+
[`node_modules/${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}`]: {
|
|
217435
217435
|
version: version2,
|
|
217436
217436
|
optionalDependencies: {
|
|
217437
217437
|
[platformPackageName]: version2
|
|
@@ -217453,7 +217453,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217453
217453
|
if (result.code !== 0) {
|
|
217454
217454
|
throw new Error(`npm ci failed with code ${result.code}: ${result.stderr}`);
|
|
217455
217455
|
}
|
|
217456
|
-
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.
|
|
217456
|
+
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${version2}`);
|
|
217457
217457
|
}
|
|
217458
217458
|
function getStallTimeoutMs() {
|
|
217459
217459
|
return Number(process.env.THEUS_CODE_STALL_TIMEOUT_MS_FOR_TESTING) || DEFAULT_STALL_TIMEOUT_MS;
|
|
@@ -218116,8 +218116,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218116
218116
|
const maxVersion = await getMaxVersion();
|
|
218117
218117
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
218118
218118
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
218119
|
-
if (gte({ VERSION: "0.1.
|
|
218120
|
-
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.
|
|
218119
|
+
if (gte({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
|
|
218120
|
+
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
218121
218121
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
218122
218122
|
latency_ms: Date.now() - startTime2,
|
|
218123
218123
|
max_version: maxVersion,
|
|
@@ -218128,7 +218128,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218128
218128
|
version2 = maxVersion;
|
|
218129
218129
|
}
|
|
218130
218130
|
}
|
|
218131
|
-
if (!forceReinstall && version2 === { VERSION: "0.1.
|
|
218131
|
+
if (!forceReinstall && version2 === { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION && await versionIsAvailable(version2) && await isPossibleTheusBinary(executablePath)) {
|
|
218132
218132
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
218133
218133
|
logEvent("tengu_native_update_complete", {
|
|
218134
218134
|
latency_ms: Date.now() - startTime2,
|
|
@@ -218870,8 +218870,8 @@ async function cleanupNpmInstallations() {
|
|
|
218870
218870
|
} else if (codePackageResult.error) {
|
|
218871
218871
|
errors4.push(codePackageResult.error);
|
|
218872
218872
|
}
|
|
218873
|
-
if ({ VERSION: "0.1.
|
|
218874
|
-
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.
|
|
218873
|
+
if ({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
218874
|
+
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
|
|
218875
218875
|
if (macroPackageResult.success) {
|
|
218876
218876
|
removed++;
|
|
218877
218877
|
if (macroPackageResult.warning) {
|
|
@@ -244707,6 +244707,59 @@ var init_dashboardHtml = __esm(() => {
|
|
|
244707
244707
|
init_branding();
|
|
244708
244708
|
});
|
|
244709
244709
|
|
|
244710
|
+
// services/mcpNaupa/common.ts
|
|
244711
|
+
var exports_common = {};
|
|
244712
|
+
__export(exports_common, {
|
|
244713
|
+
resolveNaupaBinary: () => resolveNaupaBinary,
|
|
244714
|
+
isNaupaEnabled: () => isNaupaEnabled,
|
|
244715
|
+
NAUPA_SERVER_NAME: () => NAUPA_SERVER_NAME,
|
|
244716
|
+
NAUPA_READONLY_TOOLS: () => NAUPA_READONLY_TOOLS
|
|
244717
|
+
});
|
|
244718
|
+
import { existsSync as existsSync6 } from "fs";
|
|
244719
|
+
import { homedir as homedir24 } from "os";
|
|
244720
|
+
import { join as join72 } from "path";
|
|
244721
|
+
function resolveNaupaBinary() {
|
|
244722
|
+
const fromEnv = (process.env.THEUS_NAUPA_BIN ?? "").trim();
|
|
244723
|
+
if (fromEnv) {
|
|
244724
|
+
return existsSync6(fromEnv) ? fromEnv : null;
|
|
244725
|
+
}
|
|
244726
|
+
const candidates = [
|
|
244727
|
+
join72(homedir24(), ".local", "bin", "naupa"),
|
|
244728
|
+
"/opt/homebrew/bin/naupa",
|
|
244729
|
+
"/usr/local/bin/naupa"
|
|
244730
|
+
];
|
|
244731
|
+
for (const candidate of candidates) {
|
|
244732
|
+
if (existsSync6(candidate))
|
|
244733
|
+
return candidate;
|
|
244734
|
+
}
|
|
244735
|
+
if (typeof Bun !== "undefined" && typeof Bun.which === "function") {
|
|
244736
|
+
const fromPath = Bun.which("naupa");
|
|
244737
|
+
if (fromPath)
|
|
244738
|
+
return fromPath;
|
|
244739
|
+
}
|
|
244740
|
+
return null;
|
|
244741
|
+
}
|
|
244742
|
+
function isNaupaEnabled() {
|
|
244743
|
+
if (process.env.THEUS_NO_NAUPA === "1")
|
|
244744
|
+
return false;
|
|
244745
|
+
return resolveNaupaBinary() !== null;
|
|
244746
|
+
}
|
|
244747
|
+
var NAUPA_SERVER_NAME = "theus-naupa", NAUPA_READONLY_TOOLS;
|
|
244748
|
+
var init_common3 = __esm(() => {
|
|
244749
|
+
NAUPA_READONLY_TOOLS = [
|
|
244750
|
+
"search_graph",
|
|
244751
|
+
"trace_path",
|
|
244752
|
+
"query_graph",
|
|
244753
|
+
"get_graph_schema",
|
|
244754
|
+
"get_architecture",
|
|
244755
|
+
"get_code_snippet",
|
|
244756
|
+
"search_code",
|
|
244757
|
+
"detect_changes",
|
|
244758
|
+
"index_status",
|
|
244759
|
+
"list_projects"
|
|
244760
|
+
];
|
|
244761
|
+
});
|
|
244762
|
+
|
|
244710
244763
|
// services/projectIntelligence/index.ts
|
|
244711
244764
|
var exports_projectIntelligence = {};
|
|
244712
244765
|
__export(exports_projectIntelligence, {
|
|
@@ -244720,7 +244773,7 @@ import { mkdir as mkdir17, writeFile as writeFile19 } from "fs/promises";
|
|
|
244720
244773
|
import {
|
|
244721
244774
|
createServer as createServer5
|
|
244722
244775
|
} from "http";
|
|
244723
|
-
import { dirname as dirname28, join as
|
|
244776
|
+
import { dirname as dirname28, join as join73, resolve as resolve23 } from "path";
|
|
244724
244777
|
import { spawn as spawn4 } from "child_process";
|
|
244725
244778
|
function getLiveStore(projectRoot) {
|
|
244726
244779
|
return liveStores.get(resolve23(projectRoot)) ?? null;
|
|
@@ -244765,7 +244818,7 @@ async function startFresh(projectRoot) {
|
|
|
244765
244818
|
await store.save();
|
|
244766
244819
|
const database = await discoverDatabaseSchema(projectRoot);
|
|
244767
244820
|
const knowledgeDir = getKnowledgeDir(projectRoot);
|
|
244768
|
-
const indexPath =
|
|
244821
|
+
const indexPath = join73(knowledgeDir, "project-index.json");
|
|
244769
244822
|
const graphPath = getGraphPath(projectRoot);
|
|
244770
244823
|
await mkdir17(dirname28(indexPath), { recursive: true });
|
|
244771
244824
|
const summary = summarizeIndex(index);
|
|
@@ -244908,12 +244961,34 @@ async function startFresh(projectRoot) {
|
|
|
244908
244961
|
});
|
|
244909
244962
|
return handle;
|
|
244910
244963
|
}
|
|
244964
|
+
async function waitForNaupaUi(timeoutMs) {
|
|
244965
|
+
const deadline = Date.now() + timeoutMs;
|
|
244966
|
+
while (Date.now() < deadline) {
|
|
244967
|
+
try {
|
|
244968
|
+
const res = await fetch(NAUPA_UI_URL, {
|
|
244969
|
+
signal: AbortSignal.timeout(1000)
|
|
244970
|
+
});
|
|
244971
|
+
if (res.ok)
|
|
244972
|
+
return true;
|
|
244973
|
+
} catch {}
|
|
244974
|
+
await new Promise((resolve24) => setTimeout(resolve24, 500));
|
|
244975
|
+
}
|
|
244976
|
+
return false;
|
|
244977
|
+
}
|
|
244911
244978
|
async function openProjectDashboard(handle) {
|
|
244912
244979
|
if (process.env.THEUS_NO_OPEN_DASHBOARD === "1")
|
|
244913
244980
|
return false;
|
|
244914
244981
|
if (openedDashboards.has(handle.status.projectRoot))
|
|
244915
244982
|
return false;
|
|
244916
244983
|
openedDashboards.add(handle.status.projectRoot);
|
|
244984
|
+
if (process.env.THEUS_DASHBOARD !== "neural") {
|
|
244985
|
+
try {
|
|
244986
|
+
const { isNaupaEnabled: isNaupaEnabled2 } = await Promise.resolve().then(() => (init_common3(), exports_common));
|
|
244987
|
+
if (isNaupaEnabled2() && await waitForNaupaUi(15000)) {
|
|
244988
|
+
return openLocalUrl(NAUPA_UI_URL);
|
|
244989
|
+
}
|
|
244990
|
+
} catch {}
|
|
244991
|
+
}
|
|
244917
244992
|
return openLocalUrl(handle.status.dashboardUrl);
|
|
244918
244993
|
}
|
|
244919
244994
|
function isDisabled() {
|
|
@@ -245029,7 +245104,7 @@ function sendHtml(res, html2) {
|
|
|
245029
245104
|
});
|
|
245030
245105
|
res.end(html2);
|
|
245031
245106
|
}
|
|
245032
|
-
var running, openedDashboards, liveStores, LOOPBACK_HOSTNAMES2;
|
|
245107
|
+
var running, openedDashboards, liveStores, NAUPA_UI_URL = "http://127.0.0.1:9749/", LOOPBACK_HOSTNAMES2;
|
|
245033
245108
|
var init_projectIntelligence = __esm(() => {
|
|
245034
245109
|
init_branding();
|
|
245035
245110
|
init_indexer();
|
|
@@ -246871,7 +246946,7 @@ import {
|
|
|
246871
246946
|
stat as stat22,
|
|
246872
246947
|
unlink as unlink9
|
|
246873
246948
|
} from "fs/promises";
|
|
246874
|
-
import { dirname as dirname29, isAbsolute as isAbsolute13, join as
|
|
246949
|
+
import { dirname as dirname29, isAbsolute as isAbsolute13, join as join74, relative as relative11 } from "path";
|
|
246875
246950
|
import { inspect as inspect3 } from "util";
|
|
246876
246951
|
function fileHistoryEnabled() {
|
|
246877
246952
|
if (getIsNonInteractiveSession()) {
|
|
@@ -247290,7 +247365,7 @@ function getBackupFileName(filePath, version2) {
|
|
|
247290
247365
|
}
|
|
247291
247366
|
function resolveBackupPath(backupFileName, sessionId) {
|
|
247292
247367
|
const configDir = getTheusConfigHomeDir();
|
|
247293
|
-
return
|
|
247368
|
+
return join74(configDir, "file-history", sessionId || getSessionId(), backupFileName);
|
|
247294
247369
|
}
|
|
247295
247370
|
async function createBackup(filePath, version2) {
|
|
247296
247371
|
if (filePath === null) {
|
|
@@ -247372,7 +247447,7 @@ function maybeExpandFilePath(filePath) {
|
|
|
247372
247447
|
if (isAbsolute13(filePath)) {
|
|
247373
247448
|
return filePath;
|
|
247374
247449
|
}
|
|
247375
|
-
return
|
|
247450
|
+
return join74(getOriginalCwd(), filePath);
|
|
247376
247451
|
}
|
|
247377
247452
|
function fileHistoryRestoreStateFromLog(fileHistorySnapshots, onUpdateState) {
|
|
247378
247453
|
if (!fileHistoryEnabled()) {
|
|
@@ -247418,14 +247493,14 @@ async function copyFileHistoryForResume(log) {
|
|
|
247418
247493
|
return;
|
|
247419
247494
|
}
|
|
247420
247495
|
try {
|
|
247421
|
-
const newBackupDir =
|
|
247496
|
+
const newBackupDir = join74(getTheusConfigHomeDir(), "file-history", sessionId);
|
|
247422
247497
|
await mkdir18(newBackupDir, { recursive: true });
|
|
247423
247498
|
let failedSnapshots = 0;
|
|
247424
247499
|
await Promise.allSettled(fileHistorySnapshots.map(async (snapshot2) => {
|
|
247425
247500
|
const backupEntries = Object.values(snapshot2.trackedFileBackups).filter((backup) => backup.backupFileName !== null);
|
|
247426
247501
|
const results = await Promise.allSettled(backupEntries.map(async ({ backupFileName }) => {
|
|
247427
247502
|
const oldBackupPath = resolveBackupPath(backupFileName, previousSessionId);
|
|
247428
|
-
const newBackupPath =
|
|
247503
|
+
const newBackupPath = join74(newBackupDir, backupFileName);
|
|
247429
247504
|
try {
|
|
247430
247505
|
await link3(oldBackupPath, newBackupPath);
|
|
247431
247506
|
} catch (e) {
|
|
@@ -248304,7 +248379,7 @@ var init_words = __esm(() => {
|
|
|
248304
248379
|
// utils/plans.ts
|
|
248305
248380
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
248306
248381
|
import { copyFile as copyFile4, writeFile as writeFile20 } from "fs/promises";
|
|
248307
|
-
import { join as
|
|
248382
|
+
import { join as join75, resolve as resolve24, sep as sep14 } from "path";
|
|
248308
248383
|
function getPlanSlug(sessionId) {
|
|
248309
248384
|
const id = sessionId ?? getSessionId();
|
|
248310
248385
|
const cache2 = getPlanSlugCache();
|
|
@@ -248313,7 +248388,7 @@ function getPlanSlug(sessionId) {
|
|
|
248313
248388
|
const plansDir = getPlansDirectory();
|
|
248314
248389
|
for (let i3 = 0;i3 < MAX_SLUG_RETRIES; i3++) {
|
|
248315
248390
|
slug = generateWordSlug();
|
|
248316
|
-
const filePath =
|
|
248391
|
+
const filePath = join75(plansDir, `${slug}.md`);
|
|
248317
248392
|
if (!getFsImplementation().existsSync(filePath)) {
|
|
248318
248393
|
break;
|
|
248319
248394
|
}
|
|
@@ -248331,9 +248406,9 @@ function clearAllPlanSlugs() {
|
|
|
248331
248406
|
function getPlanFilePath(agentId) {
|
|
248332
248407
|
const planSlug = getPlanSlug(getSessionId());
|
|
248333
248408
|
if (!agentId) {
|
|
248334
|
-
return
|
|
248409
|
+
return join75(getPlansDirectory(), `${planSlug}.md`);
|
|
248335
248410
|
}
|
|
248336
|
-
return
|
|
248411
|
+
return join75(getPlansDirectory(), `${planSlug}-agent-${agentId}.md`);
|
|
248337
248412
|
}
|
|
248338
248413
|
function getPlan(agentId) {
|
|
248339
248414
|
const filePath = getPlanFilePath(agentId);
|
|
@@ -248356,7 +248431,7 @@ async function copyPlanForResume(log, targetSessionId) {
|
|
|
248356
248431
|
}
|
|
248357
248432
|
const sessionId = targetSessionId ?? getSessionId();
|
|
248358
248433
|
setPlanSlug(sessionId, slug);
|
|
248359
|
-
const planPath =
|
|
248434
|
+
const planPath = join75(getPlansDirectory(), `${slug}.md`);
|
|
248360
248435
|
try {
|
|
248361
248436
|
await getFsImplementation().readFile(planPath, { encoding: "utf-8" });
|
|
248362
248437
|
return true;
|
|
@@ -248399,9 +248474,9 @@ async function copyPlanForFork(log, targetSessionId) {
|
|
|
248399
248474
|
return false;
|
|
248400
248475
|
}
|
|
248401
248476
|
const plansDir = getPlansDirectory();
|
|
248402
|
-
const originalPlanPath =
|
|
248477
|
+
const originalPlanPath = join75(plansDir, `${originalSlug}.md`);
|
|
248403
248478
|
const newSlug = getPlanSlug(targetSessionId);
|
|
248404
|
-
const newPlanPath =
|
|
248479
|
+
const newPlanPath = join75(plansDir, `${newSlug}.md`);
|
|
248405
248480
|
try {
|
|
248406
248481
|
await copyFile4(originalPlanPath, newPlanPath);
|
|
248407
248482
|
return true;
|
|
@@ -248516,12 +248591,12 @@ var init_plans = __esm(() => {
|
|
|
248516
248591
|
const resolved = resolve24(cwd2, settingsDir);
|
|
248517
248592
|
if (!resolved.startsWith(cwd2 + sep14) && resolved !== cwd2) {
|
|
248518
248593
|
logError2(new Error(`plansDirectory must be within project root: ${settingsDir}`));
|
|
248519
|
-
plansPath =
|
|
248594
|
+
plansPath = join75(getTheusConfigHomeDir(), "plans");
|
|
248520
248595
|
} else {
|
|
248521
248596
|
plansPath = resolved;
|
|
248522
248597
|
}
|
|
248523
248598
|
} else {
|
|
248524
|
-
plansPath =
|
|
248599
|
+
plansPath = join75(getTheusConfigHomeDir(), "plans");
|
|
248525
248600
|
}
|
|
248526
248601
|
try {
|
|
248527
248602
|
getFsImplementation().mkdirSync(plansPath);
|
|
@@ -248534,21 +248609,21 @@ var init_plans = __esm(() => {
|
|
|
248534
248609
|
|
|
248535
248610
|
// utils/sessionEnvironment.ts
|
|
248536
248611
|
import { mkdir as mkdir19, readdir as readdir13, readFile as readFile22, writeFile as writeFile21 } from "fs/promises";
|
|
248537
|
-
import { join as
|
|
248612
|
+
import { join as join76 } from "path";
|
|
248538
248613
|
async function getSessionEnvDirPath() {
|
|
248539
|
-
const sessionEnvDir =
|
|
248614
|
+
const sessionEnvDir = join76(getTheusConfigHomeDir(), "session-env", getSessionId());
|
|
248540
248615
|
await mkdir19(sessionEnvDir, { recursive: true });
|
|
248541
248616
|
return sessionEnvDir;
|
|
248542
248617
|
}
|
|
248543
248618
|
async function getHookEnvFilePath(hookEvent, hookIndex) {
|
|
248544
248619
|
const prefix = hookEvent.toLowerCase();
|
|
248545
|
-
return
|
|
248620
|
+
return join76(await getSessionEnvDirPath(), `${prefix}-hook-${hookIndex}.sh`);
|
|
248546
248621
|
}
|
|
248547
248622
|
async function clearCwdEnvFiles() {
|
|
248548
248623
|
try {
|
|
248549
248624
|
const dir = await getSessionEnvDirPath();
|
|
248550
248625
|
const files = await readdir13(dir);
|
|
248551
|
-
await Promise.all(files.filter((f) => (f.startsWith("filechanged-hook-") || f.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f)).map((f) => writeFile21(
|
|
248626
|
+
await Promise.all(files.filter((f) => (f.startsWith("filechanged-hook-") || f.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f)).map((f) => writeFile21(join76(dir, f), "")));
|
|
248552
248627
|
} catch (e) {
|
|
248553
248628
|
const code = getErrnoCode(e);
|
|
248554
248629
|
if (code !== "ENOENT") {
|
|
@@ -248589,7 +248664,7 @@ async function getSessionEnvironmentScript() {
|
|
|
248589
248664
|
const files = await readdir13(sessionEnvDir);
|
|
248590
248665
|
const hookFiles = files.filter((f) => HOOK_ENV_REGEX.test(f)).sort(sortHookEnvFiles);
|
|
248591
248666
|
for (const file2 of hookFiles) {
|
|
248592
|
-
const filePath =
|
|
248667
|
+
const filePath = join76(sessionEnvDir, file2);
|
|
248593
248668
|
try {
|
|
248594
248669
|
const content = (await readFile22(filePath, "utf8")).trim();
|
|
248595
248670
|
if (content) {
|
|
@@ -248702,7 +248777,7 @@ var init_hooksConfigSnapshot = __esm(() => {
|
|
|
248702
248777
|
});
|
|
248703
248778
|
|
|
248704
248779
|
// utils/hooks/fileChangedWatcher.ts
|
|
248705
|
-
import { isAbsolute as isAbsolute14, join as
|
|
248780
|
+
import { isAbsolute as isAbsolute14, join as join77 } from "path";
|
|
248706
248781
|
function setEnvHookNotifier(cb) {
|
|
248707
248782
|
notifyCallback = cb;
|
|
248708
248783
|
}
|
|
@@ -248730,7 +248805,7 @@ function resolveWatchPaths(config2) {
|
|
|
248730
248805
|
for (const name of m.matcher.split("|").map((s) => s.trim())) {
|
|
248731
248806
|
if (!name)
|
|
248732
248807
|
continue;
|
|
248733
|
-
staticPaths.push(isAbsolute14(name) ? name :
|
|
248808
|
+
staticPaths.push(isAbsolute14(name) ? name : join77(currentCwd, name));
|
|
248734
248809
|
}
|
|
248735
248810
|
}
|
|
248736
248811
|
return [...new Set([...staticPaths, ...dynamicWatchPaths])];
|
|
@@ -249730,10 +249805,10 @@ var init_filesApi = __esm(() => {
|
|
|
249730
249805
|
// utils/tempfile.ts
|
|
249731
249806
|
import { createHash as createHash18, randomUUID as randomUUID15 } from "crypto";
|
|
249732
249807
|
import { tmpdir as tmpdir4 } from "os";
|
|
249733
|
-
import { join as
|
|
249808
|
+
import { join as join79 } from "path";
|
|
249734
249809
|
function generateTempFilePath(prefix = "theus-prompt", extension = ".md", options2) {
|
|
249735
249810
|
const id = options2?.contentHash ? createHash18("sha256").update(options2.contentHash).digest("hex").slice(0, 16) : randomUUID15();
|
|
249736
|
-
return
|
|
249811
|
+
return join79(tmpdir4(), `${prefix}-${id}${extension}`);
|
|
249737
249812
|
}
|
|
249738
249813
|
var init_tempfile = () => {};
|
|
249739
249814
|
|
|
@@ -252130,7 +252205,7 @@ var init_LSPDiagnosticRegistry = __esm(() => {
|
|
|
252130
252205
|
|
|
252131
252206
|
// utils/plugins/lspPluginIntegration.ts
|
|
252132
252207
|
import { readFile as readFile24 } from "fs/promises";
|
|
252133
|
-
import { join as
|
|
252208
|
+
import { join as join80, relative as relative13, resolve as resolve25 } from "path";
|
|
252134
252209
|
function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
252135
252210
|
const resolvedPluginPath = resolve25(pluginPath);
|
|
252136
252211
|
const resolvedFilePath = resolve25(pluginPath, relativePath);
|
|
@@ -252142,7 +252217,7 @@ function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
|
252142
252217
|
}
|
|
252143
252218
|
async function loadPluginLspServers(plugin, errors4 = []) {
|
|
252144
252219
|
const servers = {};
|
|
252145
|
-
const lspJsonPath =
|
|
252220
|
+
const lspJsonPath = join80(plugin.path, ".lsp.json");
|
|
252146
252221
|
try {
|
|
252147
252222
|
const content = await readFile24(lspJsonPath, "utf-8");
|
|
252148
252223
|
const parsed = jsonParse(content);
|
|
@@ -257690,7 +257765,7 @@ var init_bashPipeCommand = __esm(() => {
|
|
|
257690
257765
|
import { execFile as execFile4 } from "child_process";
|
|
257691
257766
|
import { mkdir as mkdir21, stat as stat24 } from "fs/promises";
|
|
257692
257767
|
import * as os4 from "os";
|
|
257693
|
-
import { join as
|
|
257768
|
+
import { join as join81 } from "path";
|
|
257694
257769
|
function createArgv0ShellFunction(funcName, argv0, binaryPath, prependArgs = []) {
|
|
257695
257770
|
const quotedPath = quote([binaryPath]);
|
|
257696
257771
|
const argSuffix = prependArgs.length > 0 ? `${prependArgs.join(" ")} "$@"` : '"$@"';
|
|
@@ -257746,7 +257821,7 @@ function createFindGrepShellIntegration() {
|
|
|
257746
257821
|
}
|
|
257747
257822
|
function getConfigFile(shellPath) {
|
|
257748
257823
|
const fileName = shellPath.includes("zsh") ? ".zshrc" : shellPath.includes("bash") ? ".bashrc" : ".profile";
|
|
257749
|
-
const configPath =
|
|
257824
|
+
const configPath = join81(os4.homedir(), fileName);
|
|
257750
257825
|
return configPath;
|
|
257751
257826
|
}
|
|
257752
257827
|
function getUserSnapshotContent(configFile) {
|
|
@@ -257900,9 +257975,9 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
257900
257975
|
}
|
|
257901
257976
|
const timestamp = Date.now();
|
|
257902
257977
|
const randomId = Math.random().toString(36).substring(2, 8);
|
|
257903
|
-
const snapshotsDir =
|
|
257978
|
+
const snapshotsDir = join81(getTheusConfigHomeDir(), "shell-snapshots");
|
|
257904
257979
|
logForDebugging(`Snapshots directory: ${snapshotsDir}`);
|
|
257905
|
-
const shellSnapshotPath =
|
|
257980
|
+
const shellSnapshotPath = join81(snapshotsDir, `snapshot-${shellType}-${timestamp}-${randomId}.sh`);
|
|
257906
257981
|
await mkdir21(snapshotsDir, { recursive: true });
|
|
257907
257982
|
const snapshotScript = await getSnapshotScript(binShell, shellSnapshotPath, configFileExists);
|
|
257908
257983
|
logForDebugging(`Creating snapshot at: ${shellSnapshotPath}`);
|
|
@@ -258457,7 +258532,7 @@ var init_powershellDetection = __esm(() => {
|
|
|
258457
258532
|
|
|
258458
258533
|
// utils/shell/powershellProvider.ts
|
|
258459
258534
|
import { tmpdir as tmpdir5 } from "os";
|
|
258460
|
-
import { join as
|
|
258535
|
+
import { join as join82 } from "path";
|
|
258461
258536
|
import { join as posixJoin2 } from "path/posix";
|
|
258462
258537
|
function buildPowerShellArgs(cmd) {
|
|
258463
258538
|
return ["-NoProfile", "-NonInteractive", "-Command", cmd];
|
|
@@ -258473,7 +258548,7 @@ function createPowerShellProvider(shellPath) {
|
|
|
258473
258548
|
detached: false,
|
|
258474
258549
|
async buildExecCommand(command, opts) {
|
|
258475
258550
|
currentSandboxTmpDir = opts.useSandbox ? opts.sandboxTmpDir : undefined;
|
|
258476
|
-
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `theus-pwd-ps-${opts.id}`) :
|
|
258551
|
+
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `theus-pwd-ps-${opts.id}`) : join82(tmpdir5(), `theus-pwd-ps-${opts.id}`);
|
|
258477
258552
|
const escapedCwdFilePath = cwdFilePath.replace(/'/g, "''");
|
|
258478
258553
|
const cwdTracking = `
|
|
258479
258554
|
; $_ec = if ($null -ne $LASTEXITCODE) { $LASTEXITCODE } elseif ($?) { 0 } else { 1 }
|
|
@@ -261903,7 +261978,7 @@ var init_modeValidation = __esm(() => {
|
|
|
261903
261978
|
});
|
|
261904
261979
|
|
|
261905
261980
|
// tools/PowerShellTool/pathValidation.ts
|
|
261906
|
-
import { homedir as
|
|
261981
|
+
import { homedir as homedir26 } from "os";
|
|
261907
261982
|
import { isAbsolute as isAbsolute16, resolve as resolve29 } from "path";
|
|
261908
261983
|
function matchesParam(paramLower, paramList) {
|
|
261909
261984
|
for (const p of paramList) {
|
|
@@ -261926,7 +262001,7 @@ function formatDirectoryList2(directories) {
|
|
|
261926
262001
|
}
|
|
261927
262002
|
function expandTilde2(filePath) {
|
|
261928
262003
|
if (filePath === "~" || filePath.startsWith("~/") || filePath.startsWith("~\\")) {
|
|
261929
|
-
return
|
|
262004
|
+
return homedir26() + filePath.slice(1);
|
|
261930
262005
|
}
|
|
261931
262006
|
return filePath;
|
|
261932
262007
|
}
|
|
@@ -265924,16 +265999,16 @@ import {
|
|
|
265924
265999
|
basename as basename23,
|
|
265925
266000
|
dirname as dirname31,
|
|
265926
266001
|
isAbsolute as isAbsolute17,
|
|
265927
|
-
join as
|
|
266002
|
+
join as join83,
|
|
265928
266003
|
sep as pathSep,
|
|
265929
266004
|
relative as relative14
|
|
265930
266005
|
} from "path";
|
|
265931
266006
|
function getSkillsPath(source, dir) {
|
|
265932
266007
|
switch (source) {
|
|
265933
266008
|
case "policySettings":
|
|
265934
|
-
return
|
|
266009
|
+
return join83(getManagedFilePath(), ".theus", dir);
|
|
265935
266010
|
case "userSettings":
|
|
265936
|
-
return
|
|
266011
|
+
return join83(getTheusConfigHomeDir(), dir);
|
|
265937
266012
|
case "projectSettings":
|
|
265938
266013
|
return `.theus/${dir}`;
|
|
265939
266014
|
case "plugin":
|
|
@@ -266103,8 +266178,8 @@ async function loadSkillsFromSkillsDir(basePath, source) {
|
|
|
266103
266178
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
266104
266179
|
return null;
|
|
266105
266180
|
}
|
|
266106
|
-
const skillDirPath =
|
|
266107
|
-
const skillFilePath =
|
|
266181
|
+
const skillDirPath = join83(basePath, entry.name);
|
|
266182
|
+
const skillFilePath = join83(skillDirPath, "SKILL.md");
|
|
266108
266183
|
let content;
|
|
266109
266184
|
try {
|
|
266110
266185
|
content = await fs4.readFile(skillFilePath, { encoding: "utf-8" });
|
|
@@ -266259,7 +266334,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd2) {
|
|
|
266259
266334
|
for (const filePath of filePaths) {
|
|
266260
266335
|
let currentDir = dirname31(filePath);
|
|
266261
266336
|
while (currentDir.startsWith(resolvedCwd + pathSep)) {
|
|
266262
|
-
const skillDir =
|
|
266337
|
+
const skillDir = join83(currentDir, ".theus", "skills");
|
|
266263
266338
|
if (!dynamicSkillDirs.has(skillDir)) {
|
|
266264
266339
|
dynamicSkillDirs.add(skillDir);
|
|
266265
266340
|
try {
|
|
@@ -266382,8 +266457,8 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
266382
266457
|
init_types3();
|
|
266383
266458
|
import_ignore2 = __toESM(require_ignore(), 1);
|
|
266384
266459
|
getSkillDirCommands = memoize_default(async (cwd2) => {
|
|
266385
|
-
const userSkillsDir =
|
|
266386
|
-
const managedSkillsDir =
|
|
266460
|
+
const userSkillsDir = join83(getTheusConfigHomeDir(), "skills");
|
|
266461
|
+
const managedSkillsDir = join83(getManagedFilePath(), ".theus", "skills");
|
|
266387
266462
|
const projectSkillsDirs = getProjectDirsUpToHome("skills", cwd2);
|
|
266388
266463
|
logForDebugging(`Loading skills from: managed=${managedSkillsDir}, user=${userSkillsDir}, project=[${projectSkillsDirs.join(", ")}]`);
|
|
266389
266464
|
const additionalDirs = getAdditionalDirectoriesForTheusMd();
|
|
@@ -266394,7 +266469,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
266394
266469
|
logForDebugging(`[bare] Skipping skill dir discovery (${additionalDirs.length === 0 ? "no --add-dir" : "projectSettings disabled or skillsLocked"})`);
|
|
266395
266470
|
return [];
|
|
266396
266471
|
}
|
|
266397
|
-
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
266472
|
+
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join83(dir, ".theus", "skills"), "projectSettings")));
|
|
266398
266473
|
return additionalSkillsNested2.flat().map((s) => s.skill);
|
|
266399
266474
|
}
|
|
266400
266475
|
const [
|
|
@@ -266407,7 +266482,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
266407
266482
|
isEnvTruthy(process.env.THEUS_CODE_DISABLE_POLICY_SKILLS) ? Promise.resolve([]) : loadSkillsFromSkillsDir(managedSkillsDir, "policySettings"),
|
|
266408
266483
|
isSettingSourceEnabled("userSettings") && !skillsLocked ? loadSkillsFromSkillsDir(userSkillsDir, "userSettings") : Promise.resolve([]),
|
|
266409
266484
|
projectSettingsEnabled ? Promise.all(projectSkillsDirs.map((dir) => loadSkillsFromSkillsDir(dir, "projectSettings"))) : Promise.resolve([]),
|
|
266410
|
-
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
266485
|
+
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join83(dir, ".theus", "skills"), "projectSettings"))) : Promise.resolve([]),
|
|
266411
266486
|
skillsLocked ? Promise.resolve([]) : loadSkillsFromCommandsDir(cwd2)
|
|
266412
266487
|
]);
|
|
266413
266488
|
const allSkillsWithPaths = [
|
|
@@ -266775,7 +266850,7 @@ var init_fileOperationAnalytics = __esm(() => {
|
|
|
266775
266850
|
|
|
266776
266851
|
// utils/gitDiff.ts
|
|
266777
266852
|
import { access as access5, readFile as readFile26 } from "fs/promises";
|
|
266778
|
-
import { dirname as dirname32, join as
|
|
266853
|
+
import { dirname as dirname32, join as join84, relative as relative15, sep as sep17 } from "path";
|
|
266779
266854
|
async function fetchGitDiff() {
|
|
266780
266855
|
const isGit = await getIsGit();
|
|
266781
266856
|
if (!isGit)
|
|
@@ -266926,7 +267001,7 @@ async function isInTransientGitState() {
|
|
|
266926
267001
|
"CHERRY_PICK_HEAD",
|
|
266927
267002
|
"REVERT_HEAD"
|
|
266928
267003
|
];
|
|
266929
|
-
const results = await Promise.all(transientFiles.map((file2) => access5(
|
|
267004
|
+
const results = await Promise.all(transientFiles.map((file2) => access5(join84(gitDir, file2)).then(() => true).catch(() => false)));
|
|
266930
267005
|
return results.some(Boolean);
|
|
266931
267006
|
}
|
|
266932
267007
|
async function fetchUntrackedFiles(maxFiles) {
|
|
@@ -270541,9 +270616,9 @@ var init_FileWriteTool = __esm(() => {
|
|
|
270541
270616
|
});
|
|
270542
270617
|
|
|
270543
270618
|
// utils/plugins/orphanedPluginFilter.ts
|
|
270544
|
-
import { dirname as dirname35, isAbsolute as isAbsolute20, join as
|
|
270619
|
+
import { dirname as dirname35, isAbsolute as isAbsolute20, join as join85, normalize as normalize10, relative as relative18, sep as sep20 } from "path";
|
|
270545
270620
|
async function getGlobExclusionsForPluginCache(searchPath) {
|
|
270546
|
-
const cachePath2 = normalize10(
|
|
270621
|
+
const cachePath2 = normalize10(join85(getPluginsDirectory(), "cache"));
|
|
270547
270622
|
if (searchPath && !pathsOverlap(searchPath, cachePath2)) {
|
|
270548
270623
|
return [];
|
|
270549
270624
|
}
|
|
@@ -270591,7 +270666,7 @@ var init_orphanedPluginFilter = __esm(() => {
|
|
|
270591
270666
|
});
|
|
270592
270667
|
|
|
270593
270668
|
// utils/glob.ts
|
|
270594
|
-
import { basename as basename24, dirname as dirname36, isAbsolute as isAbsolute21, join as
|
|
270669
|
+
import { basename as basename24, dirname as dirname36, isAbsolute as isAbsolute21, join as join86, sep as sep21 } from "path";
|
|
270595
270670
|
function extractGlobBaseDirectory(pattern) {
|
|
270596
270671
|
const globChars = /[*?[{]/;
|
|
270597
270672
|
const match = pattern.match(globChars);
|
|
@@ -270643,7 +270718,7 @@ async function glob(filePattern, cwd2, { limit, offset }, abortSignal, toolPermi
|
|
|
270643
270718
|
args.push("--glob", exclusion);
|
|
270644
270719
|
}
|
|
270645
270720
|
const allPaths = await ripGrep(args, searchDir, abortSignal);
|
|
270646
|
-
const absolutePaths = allPaths.map((p) => isAbsolute21(p) ? p :
|
|
270721
|
+
const absolutePaths = allPaths.map((p) => isAbsolute21(p) ? p : join86(searchDir, p));
|
|
270647
270722
|
const truncated = absolutePaths.length > offset + limit;
|
|
270648
270723
|
const files = absolutePaths.slice(offset, offset + limit);
|
|
270649
270724
|
return { files, truncated };
|
|
@@ -273047,7 +273122,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
273047
273122
|
|
|
273048
273123
|
// utils/listSessionsImpl.ts
|
|
273049
273124
|
import { readdir as readdir14, stat as stat27 } from "fs/promises";
|
|
273050
|
-
import { basename as basename25, join as
|
|
273125
|
+
import { basename as basename25, join as join87 } from "path";
|
|
273051
273126
|
async function listCandidates(projectDir, doStat, projectPath) {
|
|
273052
273127
|
let names;
|
|
273053
273128
|
try {
|
|
@@ -273061,7 +273136,7 @@ async function listCandidates(projectDir, doStat, projectPath) {
|
|
|
273061
273136
|
const sessionId = validateUuid(name.slice(0, -6));
|
|
273062
273137
|
if (!sessionId)
|
|
273063
273138
|
return null;
|
|
273064
|
-
const filePath =
|
|
273139
|
+
const filePath = join87(projectDir, name);
|
|
273065
273140
|
if (!doStat)
|
|
273066
273141
|
return { sessionId, filePath, mtime: 0, projectPath };
|
|
273067
273142
|
try {
|
|
@@ -273080,9 +273155,9 @@ var init_listSessionsImpl = __esm(() => {
|
|
|
273080
273155
|
|
|
273081
273156
|
// services/autoDream/consolidationLock.ts
|
|
273082
273157
|
import { mkdir as mkdir23, readFile as readFile27, stat as stat28, unlink as unlink12, utimes, writeFile as writeFile23 } from "fs/promises";
|
|
273083
|
-
import { join as
|
|
273158
|
+
import { join as join88 } from "path";
|
|
273084
273159
|
function lockPath() {
|
|
273085
|
-
return
|
|
273160
|
+
return join88(getAutoMemPath(), LOCK_FILE);
|
|
273086
273161
|
}
|
|
273087
273162
|
async function readLastConsolidatedAt() {
|
|
273088
273163
|
try {
|
|
@@ -274128,7 +274203,7 @@ var init_memory = () => {};
|
|
|
274128
274203
|
// services/knowledge/memdirBridge.ts
|
|
274129
274204
|
import { createHash as createHash21 } from "crypto";
|
|
274130
274205
|
import { mkdir as mkdir24, readFile as readFile28, writeFile as writeFile24 } from "fs/promises";
|
|
274131
|
-
import { join as
|
|
274206
|
+
import { join as join89 } from "path";
|
|
274132
274207
|
function memdirKey(text) {
|
|
274133
274208
|
const normalized = text.toLowerCase().replace(/\s+/g, " ").trim();
|
|
274134
274209
|
return `memdir-${createHash21("sha256").update(normalized).digest("hex").slice(0, 12)}`;
|
|
@@ -274169,7 +274244,7 @@ async function syncMemdirToGraph(store, _projectRoot) {
|
|
|
274169
274244
|
for (const entry of entries) {
|
|
274170
274245
|
if (entry.file) {
|
|
274171
274246
|
try {
|
|
274172
|
-
const topic = await readFile28(
|
|
274247
|
+
const topic = await readFile28(join89(memdir, entry.file), "utf8");
|
|
274173
274248
|
if (/^origen:\s*grafo\s*$/m.test(topic.slice(0, 400)))
|
|
274174
274249
|
continue;
|
|
274175
274250
|
} catch {}
|
|
@@ -274207,7 +274282,7 @@ ${text}`).digest("hex").slice(0, 6);
|
|
|
274207
274282
|
""
|
|
274208
274283
|
].join(`
|
|
274209
274284
|
`);
|
|
274210
|
-
await writeFile24(
|
|
274285
|
+
await writeFile24(join89(memdir, fileName), topic, "utf8");
|
|
274211
274286
|
const entrypoint = getAutoMemEntrypoint();
|
|
274212
274287
|
let index = "";
|
|
274213
274288
|
try {
|
|
@@ -275337,14 +275412,14 @@ var init_directSearch = __esm(() => {
|
|
|
275337
275412
|
});
|
|
275338
275413
|
|
|
275339
275414
|
// tools/WebSearchTool/providerSupport.ts
|
|
275340
|
-
import { existsSync as
|
|
275415
|
+
import { existsSync as existsSync7, readFileSync as readFileSync14 } from "fs";
|
|
275341
275416
|
function env4(name) {
|
|
275342
275417
|
const value = process.env[name];
|
|
275343
275418
|
return value && value.trim() ? value.trim() : undefined;
|
|
275344
275419
|
}
|
|
275345
275420
|
function loadProvidersConfig() {
|
|
275346
275421
|
const path13 = defaultProvidersConfigPath();
|
|
275347
|
-
if (!
|
|
275422
|
+
if (!existsSync7(path13))
|
|
275348
275423
|
return null;
|
|
275349
275424
|
try {
|
|
275350
275425
|
return JSON.parse(readFileSync14(path13, "utf8"));
|
|
@@ -280883,22 +280958,22 @@ var init_UI25 = __esm(() => {
|
|
|
280883
280958
|
|
|
280884
280959
|
// daemon/projectsRegistry.js
|
|
280885
280960
|
import {
|
|
280886
|
-
existsSync as
|
|
280961
|
+
existsSync as existsSync8,
|
|
280887
280962
|
mkdirSync as mkdirSync6,
|
|
280888
280963
|
readFileSync as readFileSync15,
|
|
280889
280964
|
rmSync as rmSync3,
|
|
280890
280965
|
writeFileSync as writeFileSync4
|
|
280891
280966
|
} from "fs";
|
|
280892
|
-
import { homedir as
|
|
280893
|
-
import { join as
|
|
280894
|
-
function daemonDir(home =
|
|
280895
|
-
return
|
|
280967
|
+
import { homedir as homedir27 } from "os";
|
|
280968
|
+
import { join as join90, resolve as resolve33 } from "path";
|
|
280969
|
+
function daemonDir(home = homedir27()) {
|
|
280970
|
+
return join90(home, ".theus", "daemon");
|
|
280896
280971
|
}
|
|
280897
|
-
function projectsPath(home =
|
|
280898
|
-
return
|
|
280972
|
+
function projectsPath(home = homedir27()) {
|
|
280973
|
+
return join90(daemonDir(home), "projects.json");
|
|
280899
280974
|
}
|
|
280900
|
-
function lockPath2(home =
|
|
280901
|
-
return
|
|
280975
|
+
function lockPath2(home = homedir27()) {
|
|
280976
|
+
return join90(daemonDir(home), "projects.json.lock");
|
|
280902
280977
|
}
|
|
280903
280978
|
function acquireLock2(home) {
|
|
280904
280979
|
const path14 = lockPath2(home);
|
|
@@ -280931,7 +281006,7 @@ function acquireLock2(home) {
|
|
|
280931
281006
|
} catch {}
|
|
280932
281007
|
};
|
|
280933
281008
|
}
|
|
280934
|
-
function readProjects(home =
|
|
281009
|
+
function readProjects(home = homedir27()) {
|
|
280935
281010
|
let raw;
|
|
280936
281011
|
try {
|
|
280937
281012
|
raw = readFileSync15(projectsPath(home), "utf8");
|
|
@@ -280948,7 +281023,7 @@ function readProjects(home = homedir26()) {
|
|
|
280948
281023
|
const projects = list2.filter((p) => p && typeof p.dir === "string" && p.dir.length > 0).map((p) => ({ dir: p.dir, enabled: p.enabled !== false }));
|
|
280949
281024
|
return { projects };
|
|
280950
281025
|
}
|
|
280951
|
-
function upsertProject(dir, home =
|
|
281026
|
+
function upsertProject(dir, home = homedir27()) {
|
|
280952
281027
|
if (typeof dir !== "string" || dir.length === 0)
|
|
280953
281028
|
return false;
|
|
280954
281029
|
const abs = resolve33(dir);
|
|
@@ -280971,7 +281046,7 @@ function upsertProject(dir, home = homedir26()) {
|
|
|
280971
281046
|
release();
|
|
280972
281047
|
}
|
|
280973
281048
|
}
|
|
280974
|
-
function listProjects(home =
|
|
281049
|
+
function listProjects(home = homedir27()) {
|
|
280975
281050
|
return readProjects(home);
|
|
280976
281051
|
}
|
|
280977
281052
|
var init_projectsRegistry = () => {};
|
|
@@ -281659,9 +281734,9 @@ var init_TeamDeleteTool = __esm(() => {
|
|
|
281659
281734
|
|
|
281660
281735
|
// utils/concurrentSessions.ts
|
|
281661
281736
|
import { chmod as chmod7, mkdir as mkdir25, readdir as readdir15, readFile as readFile29, unlink as unlink13, writeFile as writeFile26 } from "fs/promises";
|
|
281662
|
-
import { join as
|
|
281737
|
+
import { join as join91 } from "path";
|
|
281663
281738
|
function getSessionsDir() {
|
|
281664
|
-
return
|
|
281739
|
+
return join91(getTheusConfigHomeDir(), "sessions");
|
|
281665
281740
|
}
|
|
281666
281741
|
function envSessionKind() {
|
|
281667
281742
|
if (false) {}
|
|
@@ -281672,7 +281747,7 @@ async function registerSession() {
|
|
|
281672
281747
|
return false;
|
|
281673
281748
|
const kind = envSessionKind() ?? "interactive";
|
|
281674
281749
|
const dir = getSessionsDir();
|
|
281675
|
-
const pidFile =
|
|
281750
|
+
const pidFile = join91(dir, `${process.pid}.json`);
|
|
281676
281751
|
registerCleanup(async () => {
|
|
281677
281752
|
try {
|
|
281678
281753
|
await unlink13(pidFile);
|
|
@@ -281701,7 +281776,7 @@ async function registerSession() {
|
|
|
281701
281776
|
}
|
|
281702
281777
|
}
|
|
281703
281778
|
async function updatePidFile(patch) {
|
|
281704
|
-
const pidFile =
|
|
281779
|
+
const pidFile = join91(getSessionsDir(), `${process.pid}.json`);
|
|
281705
281780
|
try {
|
|
281706
281781
|
const data = jsonParse(await readFile29(pidFile, "utf8"));
|
|
281707
281782
|
await writeFile26(pidFile, jsonStringify({ ...data, ...patch }));
|
|
@@ -281740,7 +281815,7 @@ async function countConcurrentSessions() {
|
|
|
281740
281815
|
if (isProcessRunning(pid)) {
|
|
281741
281816
|
count3++;
|
|
281742
281817
|
} else if (getPlatform() !== "wsl") {
|
|
281743
|
-
unlink13(
|
|
281818
|
+
unlink13(join91(dir, file2)).catch(() => {});
|
|
281744
281819
|
}
|
|
281745
281820
|
}
|
|
281746
281821
|
return count3;
|
|
@@ -292334,13 +292409,13 @@ var init_memoryTypes = __esm(() => {
|
|
|
292334
292409
|
|
|
292335
292410
|
// memdir/memoryScan.ts
|
|
292336
292411
|
import { readdir as readdir16 } from "fs/promises";
|
|
292337
|
-
import { basename as basename26, join as
|
|
292412
|
+
import { basename as basename26, join as join92 } from "path";
|
|
292338
292413
|
async function scanMemoryFiles(memoryDir, signal) {
|
|
292339
292414
|
try {
|
|
292340
292415
|
const entries = await readdir16(memoryDir, { recursive: true });
|
|
292341
292416
|
const mdFiles = entries.filter((f) => f.endsWith(".md") && basename26(f) !== "MEMORY.md");
|
|
292342
292417
|
const headerResults = await Promise.allSettled(mdFiles.map(async (relativePath) => {
|
|
292343
|
-
const filePath =
|
|
292418
|
+
const filePath = join92(memoryDir, relativePath);
|
|
292344
292419
|
const { content, mtimeMs } = await readFileInRange(filePath, 0, FRONTMATTER_MAX_LINES, undefined, signal);
|
|
292345
292420
|
const { frontmatter } = parseFrontmatter(content, filePath);
|
|
292346
292421
|
return {
|
|
@@ -293174,7 +293249,7 @@ var init_knownModels = __esm(() => {
|
|
|
293174
293249
|
});
|
|
293175
293250
|
|
|
293176
293251
|
// services/router/registry.ts
|
|
293177
|
-
import { existsSync as
|
|
293252
|
+
import { existsSync as existsSync9, readFileSync as readFileSync16 } from "fs";
|
|
293178
293253
|
function readEntryOptions(entry) {
|
|
293179
293254
|
return entry.options ?? {};
|
|
293180
293255
|
}
|
|
@@ -293268,7 +293343,7 @@ function entryContributesModels(entry) {
|
|
|
293268
293343
|
}
|
|
293269
293344
|
function loadConfig(path14) {
|
|
293270
293345
|
try {
|
|
293271
|
-
if (!
|
|
293346
|
+
if (!existsSync9(path14))
|
|
293272
293347
|
return { providers: [] };
|
|
293273
293348
|
return JSON.parse(readFileSync16(path14, "utf8"));
|
|
293274
293349
|
} catch {
|
|
@@ -293337,7 +293412,7 @@ var init_registry3 = __esm(() => {
|
|
|
293337
293412
|
});
|
|
293338
293413
|
|
|
293339
293414
|
// services/router/userRules.ts
|
|
293340
|
-
import { existsSync as
|
|
293415
|
+
import { existsSync as existsSync10, readFileSync as readFileSync17 } from "fs";
|
|
293341
293416
|
function defaultUserRoutingRules() {
|
|
293342
293417
|
return { optimizeFor: "balanced", pin: [], deny: [] };
|
|
293343
293418
|
}
|
|
@@ -293398,7 +293473,7 @@ function parseUserRoutingRules(config2) {
|
|
|
293398
293473
|
}
|
|
293399
293474
|
function loadUserRoutingRules(configPath = defaultProvidersConfigPath()) {
|
|
293400
293475
|
try {
|
|
293401
|
-
if (!
|
|
293476
|
+
if (!existsSync10(configPath))
|
|
293402
293477
|
return defaultUserRoutingRules();
|
|
293403
293478
|
const parsed = JSON.parse(readFileSync17(configPath, "utf8"));
|
|
293404
293479
|
return parseUserRoutingRules(parsed);
|
|
@@ -294057,27 +294132,27 @@ var init_llmJudgeRouter = __esm(() => {
|
|
|
294057
294132
|
// services/router/telemetry.ts
|
|
294058
294133
|
import {
|
|
294059
294134
|
appendFileSync as appendFileSync4,
|
|
294060
|
-
existsSync as
|
|
294135
|
+
existsSync as existsSync11,
|
|
294061
294136
|
mkdirSync as mkdirSync7,
|
|
294062
294137
|
readFileSync as readFileSync18,
|
|
294063
294138
|
renameSync as renameSync2,
|
|
294064
294139
|
statSync as statSync8
|
|
294065
294140
|
} from "fs";
|
|
294066
|
-
import { dirname as dirname37, join as
|
|
294141
|
+
import { dirname as dirname37, join as join93 } from "path";
|
|
294067
294142
|
function defaultTelemetryPath() {
|
|
294068
294143
|
const override = process.env.THEUS_ROUTER_TELEMETRY;
|
|
294069
294144
|
if (override)
|
|
294070
294145
|
return override;
|
|
294071
|
-
return
|
|
294146
|
+
return join93(getTheusConfigHomeDir(), "router-telemetry.jsonl");
|
|
294072
294147
|
}
|
|
294073
294148
|
function ensureDir(filePath) {
|
|
294074
294149
|
const dir = dirname37(filePath);
|
|
294075
|
-
if (!
|
|
294150
|
+
if (!existsSync11(dir))
|
|
294076
294151
|
mkdirSync7(dir, { recursive: true, mode: 448 });
|
|
294077
294152
|
}
|
|
294078
294153
|
function rotateIfNeeded(filePath, maxBytes) {
|
|
294079
294154
|
try {
|
|
294080
|
-
if (!
|
|
294155
|
+
if (!existsSync11(filePath))
|
|
294081
294156
|
return;
|
|
294082
294157
|
if (statSync8(filePath).size < maxBytes)
|
|
294083
294158
|
return;
|
|
@@ -295236,9 +295311,9 @@ function getTheusEnvMetadata() {
|
|
|
295236
295311
|
};
|
|
295237
295312
|
}
|
|
295238
295313
|
function getBuildAgeMinutes() {
|
|
295239
|
-
if (!{ VERSION: "0.1.
|
|
295314
|
+
if (!{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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)
|
|
295240
295315
|
return;
|
|
295241
|
-
const buildTime = new Date({ VERSION: "0.1.
|
|
295316
|
+
const buildTime = new Date({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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();
|
|
295242
295317
|
if (isNaN(buildTime))
|
|
295243
295318
|
return;
|
|
295244
295319
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -296315,7 +296390,7 @@ __export(exports_episodes, {
|
|
|
296315
296390
|
persistEpisode: () => persistEpisode
|
|
296316
296391
|
});
|
|
296317
296392
|
import { mkdir as mkdir26, writeFile as writeFile27 } from "fs/promises";
|
|
296318
|
-
import { join as
|
|
296393
|
+
import { join as join94 } from "path";
|
|
296319
296394
|
async function persistEpisode(projectRoot, summaryText, meta) {
|
|
296320
296395
|
try {
|
|
296321
296396
|
if (isEnvTruthy(process.env.THEUS_NO_EPISODES))
|
|
@@ -296330,7 +296405,7 @@ async function persistEpisode(projectRoot, summaryText, meta) {
|
|
|
296330
296405
|
const fecha = now2.toISOString();
|
|
296331
296406
|
const stamp = fecha.slice(0, 19).replace(/[T:]/g, "-");
|
|
296332
296407
|
try {
|
|
296333
|
-
const dir =
|
|
296408
|
+
const dir = join94(getAutoMemPath(), "episodios");
|
|
296334
296409
|
await mkdir26(dir, { recursive: true });
|
|
296335
296410
|
const lines = [
|
|
296336
296411
|
"---",
|
|
@@ -296346,7 +296421,7 @@ async function persistEpisode(projectRoot, summaryText, meta) {
|
|
|
296346
296421
|
lines.push(` - ${f}`);
|
|
296347
296422
|
}
|
|
296348
296423
|
lines.push("---", "", summary, "");
|
|
296349
|
-
await writeFile27(
|
|
296424
|
+
await writeFile27(join94(dir, `${stamp}-${slugify(title)}.md`), lines.join(`
|
|
296350
296425
|
`), "utf8");
|
|
296351
296426
|
} catch {}
|
|
296352
296427
|
try {
|
|
@@ -297298,7 +297373,7 @@ var init_postCompactCleanup = __esm(() => {
|
|
|
297298
297373
|
|
|
297299
297374
|
// services/SessionMemory/prompts.ts
|
|
297300
297375
|
import { readFile as readFile32 } from "fs/promises";
|
|
297301
|
-
import { join as
|
|
297376
|
+
import { join as join95 } from "path";
|
|
297302
297377
|
function getDefaultUpdatePrompt() {
|
|
297303
297378
|
return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "note-taking", "session notes extraction", or these update instructions in the notes content.
|
|
297304
297379
|
|
|
@@ -297339,7 +297414,7 @@ You ONLY update the actual content that comes AFTER these two preserved lines. T
|
|
|
297339
297414
|
REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edits. Only include insights from the actual user conversation, never from these note-taking instructions. Do not delete or change section headers or italic _section descriptions_.`;
|
|
297340
297415
|
}
|
|
297341
297416
|
async function loadSessionMemoryTemplate() {
|
|
297342
|
-
const templatePath =
|
|
297417
|
+
const templatePath = join95(getTheusConfigHomeDir(), "session-memory", "config", "template.md");
|
|
297343
297418
|
try {
|
|
297344
297419
|
return await readFile32(templatePath, { encoding: "utf-8" });
|
|
297345
297420
|
} catch (e) {
|
|
@@ -297352,7 +297427,7 @@ async function loadSessionMemoryTemplate() {
|
|
|
297352
297427
|
}
|
|
297353
297428
|
}
|
|
297354
297429
|
async function loadSessionMemoryPrompt() {
|
|
297355
|
-
const promptPath =
|
|
297430
|
+
const promptPath = join95(getTheusConfigHomeDir(), "session-memory", "config", "prompt.md");
|
|
297356
297431
|
try {
|
|
297357
297432
|
return await readFile32(promptPath, { encoding: "utf-8" });
|
|
297358
297433
|
} catch (e) {
|
|
@@ -298970,7 +299045,7 @@ var init_toolSearch = __esm(() => {
|
|
|
298970
299045
|
// services/vcr.ts
|
|
298971
299046
|
import { createHash as createHash23, randomUUID as randomUUID22 } from "crypto";
|
|
298972
299047
|
import { mkdir as mkdir27, readFile as readFile33, writeFile as writeFile28 } from "fs/promises";
|
|
298973
|
-
import { dirname as dirname38, join as
|
|
299048
|
+
import { dirname as dirname38, join as join96 } from "path";
|
|
298974
299049
|
function shouldUseVCR() {
|
|
298975
299050
|
if (false) {}
|
|
298976
299051
|
if (process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.FORCE_VCR)) {
|
|
@@ -298983,7 +299058,7 @@ async function withFixture(input, fixtureName, f) {
|
|
|
298983
299058
|
return await f();
|
|
298984
299059
|
}
|
|
298985
299060
|
const hash = createHash23("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
|
|
298986
|
-
const filename =
|
|
299061
|
+
const filename = join96(process.env.THEUS_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
|
|
298987
299062
|
try {
|
|
298988
299063
|
const cached3 = jsonParse(await readFile33(filename, { encoding: "utf8" }));
|
|
298989
299064
|
return cached3;
|
|
@@ -299017,7 +299092,7 @@ async function withVCR(messages, f) {
|
|
|
299017
299092
|
return true;
|
|
299018
299093
|
}));
|
|
299019
299094
|
const dehydratedInput = mapMessages(messagesForAPI.map((_) => _.message.content), dehydrateValue);
|
|
299020
|
-
const filename =
|
|
299095
|
+
const filename = join96(process.env.THEUS_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) => createHash23("sha1").update(jsonStringify(_)).digest("hex").slice(0, 6)).join("-")}.json`);
|
|
299021
299096
|
try {
|
|
299022
299097
|
const cached3 = jsonParse(await readFile33(filename, { encoding: "utf8" }));
|
|
299023
299098
|
cached3.output.forEach(addCachedCostToTotalSessionCost);
|
|
@@ -299484,7 +299559,7 @@ var init_tokenEstimation = __esm(() => {
|
|
|
299484
299559
|
// utils/pdf.ts
|
|
299485
299560
|
import { randomUUID as randomUUID23 } from "crypto";
|
|
299486
299561
|
import { mkdir as mkdir28, readdir as readdir17, readFile as readFile34 } from "fs/promises";
|
|
299487
|
-
import { join as
|
|
299562
|
+
import { join as join97 } from "path";
|
|
299488
299563
|
async function readPDF(filePath) {
|
|
299489
299564
|
try {
|
|
299490
299565
|
const fs4 = getFsImplementation();
|
|
@@ -299594,9 +299669,9 @@ async function extractPDFPages(filePath, options2) {
|
|
|
299594
299669
|
};
|
|
299595
299670
|
}
|
|
299596
299671
|
const uuid3 = randomUUID23();
|
|
299597
|
-
const outputDir =
|
|
299672
|
+
const outputDir = join97(getToolResultsDir(), `pdf-${uuid3}`);
|
|
299598
299673
|
await mkdir28(outputDir, { recursive: true });
|
|
299599
|
-
const prefix =
|
|
299674
|
+
const prefix = join97(outputDir, "page");
|
|
299600
299675
|
const args = ["-jpeg", "-r", "100"];
|
|
299601
299676
|
if (options2?.firstPage) {
|
|
299602
299677
|
args.push("-f", String(options2.firstPage));
|
|
@@ -302797,7 +302872,7 @@ var init_attachments2 = __esm(() => {
|
|
|
302797
302872
|
});
|
|
302798
302873
|
|
|
302799
302874
|
// utils/plugins/loadPluginCommands.ts
|
|
302800
|
-
import { basename as basename28, dirname as dirname40, join as
|
|
302875
|
+
import { basename as basename28, dirname as dirname40, join as join99 } from "path";
|
|
302801
302876
|
function isSkillFile2(filePath) {
|
|
302802
302877
|
return /^skill\.md$/i.test(basename28(filePath));
|
|
302803
302878
|
}
|
|
@@ -302976,7 +303051,7 @@ function clearPluginCommandCache() {
|
|
|
302976
303051
|
async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, pluginManifest, pluginPath, loadedPaths) {
|
|
302977
303052
|
const fs4 = getFsImplementation();
|
|
302978
303053
|
const skills = [];
|
|
302979
|
-
const directSkillPath =
|
|
303054
|
+
const directSkillPath = join99(skillsPath, "SKILL.md");
|
|
302980
303055
|
let directSkillContent = null;
|
|
302981
303056
|
try {
|
|
302982
303057
|
directSkillContent = await fs4.readFile(directSkillPath, {
|
|
@@ -303027,8 +303102,8 @@ async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, plugi
|
|
|
303027
303102
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
303028
303103
|
return;
|
|
303029
303104
|
}
|
|
303030
|
-
const skillDirPath =
|
|
303031
|
-
const skillFilePath =
|
|
303105
|
+
const skillDirPath = join99(skillsPath, entry.name);
|
|
303106
|
+
const skillFilePath = join99(skillDirPath, "SKILL.md");
|
|
303032
303107
|
let content;
|
|
303033
303108
|
try {
|
|
303034
303109
|
content = await fs4.readFile(skillFilePath, { encoding: "utf-8" });
|
|
@@ -303132,7 +303207,7 @@ var init_loadPluginCommands = __esm(() => {
|
|
|
303132
303207
|
if (plugin.commandsMetadata) {
|
|
303133
303208
|
for (const [name, metadata] of Object.entries(plugin.commandsMetadata)) {
|
|
303134
303209
|
if (metadata.source) {
|
|
303135
|
-
const fullMetadataPath =
|
|
303210
|
+
const fullMetadataPath = join99(plugin.path, metadata.source);
|
|
303136
303211
|
if (commandPath === fullMetadataPath) {
|
|
303137
303212
|
commandName = `${plugin.name}:${name}`;
|
|
303138
303213
|
metadataOverride = metadata;
|
|
@@ -303286,7 +303361,7 @@ import {
|
|
|
303286
303361
|
writeFile as writeFile29
|
|
303287
303362
|
} from "fs/promises";
|
|
303288
303363
|
import { tmpdir as tmpdir6 } from "os";
|
|
303289
|
-
import { basename as basename29, dirname as dirname41, join as
|
|
303364
|
+
import { basename as basename29, dirname as dirname41, join as join100 } from "path";
|
|
303290
303365
|
function isPluginZipCacheEnabled() {
|
|
303291
303366
|
return isEnvTruthy(process.env.THEUS_CODE_PLUGIN_USE_ZIP_CACHE);
|
|
303292
303367
|
}
|
|
@@ -303302,21 +303377,21 @@ function getZipCacheKnownMarketplacesPath() {
|
|
|
303302
303377
|
if (!cachePath2) {
|
|
303303
303378
|
throw new Error("Plugin zip cache is not enabled");
|
|
303304
303379
|
}
|
|
303305
|
-
return
|
|
303380
|
+
return join100(cachePath2, "known_marketplaces.json");
|
|
303306
303381
|
}
|
|
303307
303382
|
function getZipCacheMarketplacesDir() {
|
|
303308
303383
|
const cachePath2 = getPluginZipCachePath();
|
|
303309
303384
|
if (!cachePath2) {
|
|
303310
303385
|
throw new Error("Plugin zip cache is not enabled");
|
|
303311
303386
|
}
|
|
303312
|
-
return
|
|
303387
|
+
return join100(cachePath2, "marketplaces");
|
|
303313
303388
|
}
|
|
303314
303389
|
function getZipCachePluginsDir() {
|
|
303315
303390
|
const cachePath2 = getPluginZipCachePath();
|
|
303316
303391
|
if (!cachePath2) {
|
|
303317
303392
|
throw new Error("Plugin zip cache is not enabled");
|
|
303318
303393
|
}
|
|
303319
|
-
return
|
|
303394
|
+
return join100(cachePath2, "plugins");
|
|
303320
303395
|
}
|
|
303321
303396
|
async function getSessionPluginCachePath() {
|
|
303322
303397
|
if (sessionPluginCachePath) {
|
|
@@ -303325,7 +303400,7 @@ async function getSessionPluginCachePath() {
|
|
|
303325
303400
|
if (!sessionPluginCachePromise) {
|
|
303326
303401
|
sessionPluginCachePromise = (async () => {
|
|
303327
303402
|
const suffix = randomBytes12(8).toString("hex");
|
|
303328
|
-
const dir =
|
|
303403
|
+
const dir = join100(tmpdir6(), `theus-plugin-session-${suffix}`);
|
|
303329
303404
|
await getFsImplementation().mkdir(dir);
|
|
303330
303405
|
sessionPluginCachePath = dir;
|
|
303331
303406
|
logForDebugging(`Created session plugin cache at ${dir}`);
|
|
@@ -303352,7 +303427,7 @@ async function atomicWriteToZipCache(targetPath, data) {
|
|
|
303352
303427
|
const dir = dirname41(targetPath);
|
|
303353
303428
|
await getFsImplementation().mkdir(dir);
|
|
303354
303429
|
const tmpName = `.${basename29(targetPath)}.tmp.${randomBytes12(4).toString("hex")}`;
|
|
303355
|
-
const tmpPath =
|
|
303430
|
+
const tmpPath = join100(dir, tmpName);
|
|
303356
303431
|
try {
|
|
303357
303432
|
if (typeof data === "string") {
|
|
303358
303433
|
await writeFile29(tmpPath, data, { encoding: "utf-8" });
|
|
@@ -303377,7 +303452,7 @@ async function createZipFromDirectory(sourceDir) {
|
|
|
303377
303452
|
return zipData;
|
|
303378
303453
|
}
|
|
303379
303454
|
async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
303380
|
-
const currentDir = relativePath ?
|
|
303455
|
+
const currentDir = relativePath ? join100(baseDir, relativePath) : baseDir;
|
|
303381
303456
|
let entries;
|
|
303382
303457
|
try {
|
|
303383
303458
|
entries = await readdir20(currentDir);
|
|
@@ -303401,7 +303476,7 @@ async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
|
303401
303476
|
if (entry === ".git") {
|
|
303402
303477
|
continue;
|
|
303403
303478
|
}
|
|
303404
|
-
const fullPath =
|
|
303479
|
+
const fullPath = join100(currentDir, entry);
|
|
303405
303480
|
const relPath = relativePath ? `${relativePath}/${entry}` : entry;
|
|
303406
303481
|
let fileStat;
|
|
303407
303482
|
try {
|
|
@@ -303442,10 +303517,10 @@ async function extractZipToDirectory(zipPath, targetDir) {
|
|
|
303442
303517
|
await getFsImplementation().mkdir(targetDir);
|
|
303443
303518
|
for (const [relPath, data] of Object.entries(files)) {
|
|
303444
303519
|
if (relPath.endsWith("/")) {
|
|
303445
|
-
await getFsImplementation().mkdir(
|
|
303520
|
+
await getFsImplementation().mkdir(join100(targetDir, relPath));
|
|
303446
303521
|
continue;
|
|
303447
303522
|
}
|
|
303448
|
-
const fullPath =
|
|
303523
|
+
const fullPath = join100(targetDir, relPath);
|
|
303449
303524
|
await getFsImplementation().mkdir(dirname41(fullPath));
|
|
303450
303525
|
await writeFile29(fullPath, data);
|
|
303451
303526
|
const mode = modes[relPath];
|
|
@@ -303462,7 +303537,7 @@ async function convertDirectoryToZipInPlace(dirPath, zipPath) {
|
|
|
303462
303537
|
}
|
|
303463
303538
|
function getMarketplaceJsonRelativePath(marketplaceName) {
|
|
303464
303539
|
const sanitized = marketplaceName.replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
303465
|
-
return
|
|
303540
|
+
return join100("marketplaces", `${sanitized}.json`);
|
|
303466
303541
|
}
|
|
303467
303542
|
function isMarketplaceSourceSupportedByZipCache(source) {
|
|
303468
303543
|
return ["github", "git", "url", "settings"].includes(source.source);
|
|
@@ -303478,7 +303553,7 @@ var init_zipCache = __esm(() => {
|
|
|
303478
303553
|
|
|
303479
303554
|
// utils/plugins/cacheUtils.ts
|
|
303480
303555
|
import { readdir as readdir21, rm as rm6, stat as stat34, unlink as unlink14, writeFile as writeFile30 } from "fs/promises";
|
|
303481
|
-
import { join as
|
|
303556
|
+
import { join as join101 } from "path";
|
|
303482
303557
|
function clearAllPluginCaches() {
|
|
303483
303558
|
clearPluginCache();
|
|
303484
303559
|
clearPluginCommandCache();
|
|
@@ -303515,11 +303590,11 @@ async function cleanupOrphanedPluginVersionsInBackground() {
|
|
|
303515
303590
|
const now2 = Date.now();
|
|
303516
303591
|
await Promise.all([...installedVersions].map((p) => removeOrphanedAtMarker(p)));
|
|
303517
303592
|
for (const marketplace of await readSubdirs(cachePath2)) {
|
|
303518
|
-
const marketplacePath =
|
|
303593
|
+
const marketplacePath = join101(cachePath2, marketplace);
|
|
303519
303594
|
for (const plugin of await readSubdirs(marketplacePath)) {
|
|
303520
|
-
const pluginPath =
|
|
303595
|
+
const pluginPath = join101(marketplacePath, plugin);
|
|
303521
303596
|
for (const version2 of await readSubdirs(pluginPath)) {
|
|
303522
|
-
const versionPath =
|
|
303597
|
+
const versionPath = join101(pluginPath, version2);
|
|
303523
303598
|
if (installedVersions.has(versionPath))
|
|
303524
303599
|
continue;
|
|
303525
303600
|
await processOrphanedPluginVersion(versionPath, now2);
|
|
@@ -303533,7 +303608,7 @@ async function cleanupOrphanedPluginVersionsInBackground() {
|
|
|
303533
303608
|
}
|
|
303534
303609
|
}
|
|
303535
303610
|
function getOrphanedAtPath(versionPath) {
|
|
303536
|
-
return
|
|
303611
|
+
return join101(versionPath, ORPHANED_AT_FILENAME2);
|
|
303537
303612
|
}
|
|
303538
303613
|
async function removeOrphanedAtMarker(versionPath) {
|
|
303539
303614
|
const orphanedAtPath = getOrphanedAtPath(versionPath);
|
|
@@ -303936,7 +304011,7 @@ var init_marketplaceHelpers = __esm(() => {
|
|
|
303936
304011
|
|
|
303937
304012
|
// utils/plugins/officialMarketplaceGcs.ts
|
|
303938
304013
|
import { chmod as chmod9, mkdir as mkdir29, readFile as readFile36, rename as rename4, rm as rm7, writeFile as writeFile31 } from "fs/promises";
|
|
303939
|
-
import { dirname as dirname42, join as
|
|
304014
|
+
import { dirname as dirname42, join as join102, resolve as resolve35, sep as sep22 } from "path";
|
|
303940
304015
|
async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
|
|
303941
304016
|
const cacheDir = resolve35(marketplacesCacheDir);
|
|
303942
304017
|
const resolvedLoc = resolve35(installLocation);
|
|
@@ -303959,7 +304034,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
303959
304034
|
if (!sha) {
|
|
303960
304035
|
throw new Error("latest pointer returned empty body");
|
|
303961
304036
|
}
|
|
303962
|
-
const sentinelPath =
|
|
304037
|
+
const sentinelPath = join102(installLocation, ".gcs-sha");
|
|
303963
304038
|
const currentSha = await readFile36(sentinelPath, "utf8").then((s) => s.trim(), () => null);
|
|
303964
304039
|
if (currentSha === sha) {
|
|
303965
304040
|
outcome = "noop";
|
|
@@ -303982,7 +304057,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
303982
304057
|
const rel = arcPath.slice(ARC_PREFIX.length);
|
|
303983
304058
|
if (!rel || rel.endsWith("/"))
|
|
303984
304059
|
continue;
|
|
303985
|
-
const dest =
|
|
304060
|
+
const dest = join102(staging, rel);
|
|
303986
304061
|
await mkdir29(dirname42(dest), { recursive: true });
|
|
303987
304062
|
await writeFile31(dest, data);
|
|
303988
304063
|
const mode = modes[arcPath];
|
|
@@ -303990,7 +304065,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
303990
304065
|
await chmod9(dest, mode & 511).catch(() => {});
|
|
303991
304066
|
}
|
|
303992
304067
|
}
|
|
303993
|
-
await writeFile31(
|
|
304068
|
+
await writeFile31(join102(staging, ".gcs-sha"), sha);
|
|
303994
304069
|
await rm7(installLocation, { recursive: true, force: true });
|
|
303995
304070
|
await rename4(staging, installLocation);
|
|
303996
304071
|
outcome = "updated";
|
|
@@ -304057,12 +304132,12 @@ var init_officialMarketplaceGcs = __esm(() => {
|
|
|
304057
304132
|
|
|
304058
304133
|
// utils/plugins/marketplaceManager.ts
|
|
304059
304134
|
import { writeFile as writeFile32 } from "fs/promises";
|
|
304060
|
-
import { basename as basename30, dirname as dirname43, isAbsolute as isAbsolute23, join as
|
|
304135
|
+
import { basename as basename30, dirname as dirname43, isAbsolute as isAbsolute23, join as join103, resolve as resolve36, sep as sep23 } from "path";
|
|
304061
304136
|
function getKnownMarketplacesFile() {
|
|
304062
|
-
return
|
|
304137
|
+
return join103(getPluginsDirectory(), "known_marketplaces.json");
|
|
304063
304138
|
}
|
|
304064
304139
|
function getMarketplacesCacheDir() {
|
|
304065
|
-
return
|
|
304140
|
+
return join103(getPluginsDirectory(), "marketplaces");
|
|
304066
304141
|
}
|
|
304067
304142
|
function clearMarketplacesCache() {
|
|
304068
304143
|
getMarketplace.cache?.clear?.();
|
|
@@ -304149,7 +304224,7 @@ async function saveKnownMarketplacesConfig(config2) {
|
|
|
304149
304224
|
throw new ConfigParseError(`Invalid marketplace config: ${parsed.error.message}`, configFile, config2);
|
|
304150
304225
|
}
|
|
304151
304226
|
const fs4 = getFsImplementation();
|
|
304152
|
-
const dir =
|
|
304227
|
+
const dir = join103(configFile, "..");
|
|
304153
304228
|
await fs4.mkdir(dir);
|
|
304154
304229
|
writeFileSync_DEPRECATED(configFile, jsonStringify(parsed.data, null, 2), {
|
|
304155
304230
|
encoding: "utf-8",
|
|
@@ -304196,7 +304271,7 @@ async function registerSeedMarketplaces() {
|
|
|
304196
304271
|
return false;
|
|
304197
304272
|
}
|
|
304198
304273
|
async function readSeedKnownMarketplaces(seedDir) {
|
|
304199
|
-
const seedJsonPath =
|
|
304274
|
+
const seedJsonPath = join103(seedDir, "known_marketplaces.json");
|
|
304200
304275
|
try {
|
|
304201
304276
|
const content = await getFsImplementation().readFile(seedJsonPath, {
|
|
304202
304277
|
encoding: "utf-8"
|
|
@@ -304215,8 +304290,8 @@ async function readSeedKnownMarketplaces(seedDir) {
|
|
|
304215
304290
|
}
|
|
304216
304291
|
}
|
|
304217
304292
|
async function findSeedMarketplaceLocation(seedDir, name) {
|
|
304218
|
-
const dirCandidate =
|
|
304219
|
-
const jsonCandidate =
|
|
304293
|
+
const dirCandidate = join103(seedDir, "marketplaces", name);
|
|
304294
|
+
const jsonCandidate = join103(seedDir, "marketplaces", `${name}.json`);
|
|
304220
304295
|
for (const candidate of [dirCandidate, jsonCandidate]) {
|
|
304221
304296
|
try {
|
|
304222
304297
|
await readCachedMarketplace(candidate);
|
|
@@ -304268,7 +304343,7 @@ async function gitPull(cwd2, ref, options2) {
|
|
|
304268
304343
|
async function gitSubmoduleUpdate(cwd2, credentialArgs, env5, sparsePaths) {
|
|
304269
304344
|
if (sparsePaths && sparsePaths.length > 0)
|
|
304270
304345
|
return;
|
|
304271
|
-
const hasGitmodules = await getFsImplementation().stat(
|
|
304346
|
+
const hasGitmodules = await getFsImplementation().stat(join103(cwd2, ".gitmodules")).then(() => true, () => false);
|
|
304272
304347
|
if (!hasGitmodules)
|
|
304273
304348
|
return;
|
|
304274
304349
|
const result = await execFileNoThrowWithCwd(gitExe(), [
|
|
@@ -304630,7 +304705,7 @@ Technical details: ${error40.message}`);
|
|
|
304630
304705
|
}
|
|
304631
304706
|
logPluginFetch("marketplace_url", url3, "success", performance.now() - fetchStarted);
|
|
304632
304707
|
safeCallProgress(onProgress, "Saving marketplace to cache");
|
|
304633
|
-
const cacheDir =
|
|
304708
|
+
const cacheDir = join103(cachePath2, "..");
|
|
304634
304709
|
await fs4.mkdir(cacheDir);
|
|
304635
304710
|
writeFileSync_DEPRECATED(cachePath2, jsonStringify(result.data, null, 2), {
|
|
304636
304711
|
encoding: "utf-8",
|
|
@@ -304667,7 +304742,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
304667
304742
|
try {
|
|
304668
304743
|
switch (source.source) {
|
|
304669
304744
|
case "url": {
|
|
304670
|
-
temporaryCachePath =
|
|
304745
|
+
temporaryCachePath = join103(cacheDir, `${tempName}.json`);
|
|
304671
304746
|
cleanupNeeded = true;
|
|
304672
304747
|
await cacheMarketplaceFromUrl(source.url, temporaryCachePath, source.headers, onProgress);
|
|
304673
304748
|
marketplacePath = temporaryCachePath;
|
|
@@ -304676,7 +304751,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
304676
304751
|
case "github": {
|
|
304677
304752
|
const sshUrl = `git@github.com:${source.repo}.git`;
|
|
304678
304753
|
const httpsUrl = `https://github.com/${source.repo}.git`;
|
|
304679
|
-
temporaryCachePath =
|
|
304754
|
+
temporaryCachePath = join103(cacheDir, tempName);
|
|
304680
304755
|
cleanupNeeded = true;
|
|
304681
304756
|
let lastError = null;
|
|
304682
304757
|
const sshConfigured = await isGitHubSshLikelyConfigured();
|
|
@@ -304721,14 +304796,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
304721
304796
|
if (lastError) {
|
|
304722
304797
|
throw lastError;
|
|
304723
304798
|
}
|
|
304724
|
-
marketplacePath =
|
|
304799
|
+
marketplacePath = join103(temporaryCachePath, source.path || ".theus-plugin/marketplace.json");
|
|
304725
304800
|
break;
|
|
304726
304801
|
}
|
|
304727
304802
|
case "git": {
|
|
304728
|
-
temporaryCachePath =
|
|
304803
|
+
temporaryCachePath = join103(cacheDir, tempName);
|
|
304729
304804
|
cleanupNeeded = true;
|
|
304730
304805
|
await cacheMarketplaceFromGit(source.url, temporaryCachePath, source.ref, source.sparsePaths, onProgress);
|
|
304731
|
-
marketplacePath =
|
|
304806
|
+
marketplacePath = join103(temporaryCachePath, source.path || ".theus-plugin/marketplace.json");
|
|
304732
304807
|
break;
|
|
304733
304808
|
}
|
|
304734
304809
|
case "npm": {
|
|
@@ -304743,14 +304818,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
304743
304818
|
}
|
|
304744
304819
|
case "directory": {
|
|
304745
304820
|
const absPath = resolve36(source.path);
|
|
304746
|
-
marketplacePath =
|
|
304821
|
+
marketplacePath = join103(absPath, ".theus-plugin", "marketplace.json");
|
|
304747
304822
|
temporaryCachePath = absPath;
|
|
304748
304823
|
cleanupNeeded = false;
|
|
304749
304824
|
break;
|
|
304750
304825
|
}
|
|
304751
304826
|
case "settings": {
|
|
304752
|
-
temporaryCachePath =
|
|
304753
|
-
marketplacePath =
|
|
304827
|
+
temporaryCachePath = join103(cacheDir, source.name);
|
|
304828
|
+
marketplacePath = join103(temporaryCachePath, ".theus-plugin", "marketplace.json");
|
|
304754
304829
|
cleanupNeeded = false;
|
|
304755
304830
|
await fs4.mkdir(dirname43(marketplacePath));
|
|
304756
304831
|
await writeFile32(marketplacePath, jsonStringify({
|
|
@@ -304773,7 +304848,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
304773
304848
|
}
|
|
304774
304849
|
throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage(e)}`);
|
|
304775
304850
|
}
|
|
304776
|
-
const finalCachePath =
|
|
304851
|
+
const finalCachePath = join103(cacheDir, marketplace.name);
|
|
304777
304852
|
const resolvedFinal = resolve36(finalCachePath);
|
|
304778
304853
|
const resolvedCacheDir = resolve36(cacheDir);
|
|
304779
304854
|
if (!resolvedFinal.startsWith(resolvedCacheDir + sep23)) {
|
|
@@ -304894,9 +304969,9 @@ async function removeMarketplaceSource(name) {
|
|
|
304894
304969
|
await saveKnownMarketplacesConfig(config2);
|
|
304895
304970
|
const fs4 = getFsImplementation();
|
|
304896
304971
|
const cacheDir = getMarketplacesCacheDir();
|
|
304897
|
-
const cachePath2 =
|
|
304972
|
+
const cachePath2 = join103(cacheDir, name);
|
|
304898
304973
|
await fs4.rm(cachePath2, { recursive: true, force: true });
|
|
304899
|
-
const jsonCachePath =
|
|
304974
|
+
const jsonCachePath = join103(cacheDir, `${name}.json`);
|
|
304900
304975
|
await fs4.rm(jsonCachePath, { force: true });
|
|
304901
304976
|
const editableSources = ["userSettings", "projectSettings", "localSettings"];
|
|
304902
304977
|
for (const source of editableSources) {
|
|
@@ -304947,7 +305022,7 @@ async function removeMarketplaceSource(name) {
|
|
|
304947
305022
|
logForDebugging(`Removed marketplace source: ${name}`);
|
|
304948
305023
|
}
|
|
304949
305024
|
async function readCachedMarketplace(installLocation) {
|
|
304950
|
-
const nestedPath =
|
|
305025
|
+
const nestedPath = join103(installLocation, ".theus-plugin", "marketplace.json");
|
|
304951
305026
|
try {
|
|
304952
305027
|
return await parseFileWithSchema(nestedPath, PluginMarketplaceSchema());
|
|
304953
305028
|
} catch (e) {
|
|
@@ -305247,12 +305322,12 @@ var init_marketplaceManager = __esm(() => {
|
|
|
305247
305322
|
});
|
|
305248
305323
|
|
|
305249
305324
|
// utils/plugins/installedPluginsManager.ts
|
|
305250
|
-
import { dirname as dirname44, join as
|
|
305325
|
+
import { dirname as dirname44, join as join104 } from "path";
|
|
305251
305326
|
function getInstalledPluginsFilePath() {
|
|
305252
|
-
return
|
|
305327
|
+
return join104(getPluginsDirectory(), "installed_plugins.json");
|
|
305253
305328
|
}
|
|
305254
305329
|
function getInstalledPluginsV2FilePath() {
|
|
305255
|
-
return
|
|
305330
|
+
return join104(getPluginsDirectory(), "installed_plugins_v2.json");
|
|
305256
305331
|
}
|
|
305257
305332
|
function migrateToSinglePluginFile() {
|
|
305258
305333
|
if (migrationCompleted) {
|
|
@@ -305320,12 +305395,12 @@ function cleanupLegacyCache(v2Data) {
|
|
|
305320
305395
|
continue;
|
|
305321
305396
|
}
|
|
305322
305397
|
const entry = dirent.name;
|
|
305323
|
-
const entryPath =
|
|
305398
|
+
const entryPath = join104(cachePath2, entry);
|
|
305324
305399
|
const subEntries = fs4.readdirSync(entryPath);
|
|
305325
305400
|
const hasVersionedStructure = subEntries.some((subDirent) => {
|
|
305326
305401
|
if (!subDirent.isDirectory())
|
|
305327
305402
|
return false;
|
|
305328
|
-
const subPath =
|
|
305403
|
+
const subPath = join104(entryPath, subDirent.name);
|
|
305329
305404
|
const versionEntries = fs4.readdirSync(subPath);
|
|
305330
305405
|
return versionEntries.some((vDirent) => vDirent.isDirectory());
|
|
305331
305406
|
});
|
|
@@ -305580,7 +305655,7 @@ async function getGitCommitSha(dirPath) {
|
|
|
305580
305655
|
}
|
|
305581
305656
|
function getPluginVersionFromManifest(pluginCachePath, pluginId) {
|
|
305582
305657
|
const fs4 = getFsImplementation();
|
|
305583
|
-
const manifestPath =
|
|
305658
|
+
const manifestPath = join104(pluginCachePath, ".theus-plugin", "plugin.json");
|
|
305584
305659
|
try {
|
|
305585
305660
|
const manifestContent = fs4.readFileSync(manifestPath, { encoding: "utf-8" });
|
|
305586
305661
|
const manifest = jsonParse(manifestContent);
|
|
@@ -305674,13 +305749,13 @@ async function migrateFromEnabledPlugins() {
|
|
|
305674
305749
|
let version2 = "unknown";
|
|
305675
305750
|
let gitCommitSha = undefined;
|
|
305676
305751
|
if (typeof entry.source === "string") {
|
|
305677
|
-
installPath =
|
|
305752
|
+
installPath = join104(marketplaceInstallLocation, entry.source);
|
|
305678
305753
|
version2 = getPluginVersionFromManifest(installPath, pluginId);
|
|
305679
305754
|
gitCommitSha = await getGitCommitSha(installPath);
|
|
305680
305755
|
} else {
|
|
305681
305756
|
const cachePath2 = getPluginCachePath();
|
|
305682
305757
|
const sanitizedName = pluginName.replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
305683
|
-
const pluginCachePath =
|
|
305758
|
+
const pluginCachePath = join104(cachePath2, sanitizedName);
|
|
305684
305759
|
let dirEntries;
|
|
305685
305760
|
try {
|
|
305686
305761
|
dirEntries = (await getFsImplementation().readdir(pluginCachePath)).map((e) => typeof e === "string" ? e : e.name);
|
|
@@ -305813,7 +305888,7 @@ var init_pluginVersioning = __esm(() => {
|
|
|
305813
305888
|
// utils/plugins/pluginInstallationHelpers.ts
|
|
305814
305889
|
import { randomBytes as randomBytes13 } from "crypto";
|
|
305815
305890
|
import { rename as rename5, rm as rm8 } from "fs/promises";
|
|
305816
|
-
import { dirname as dirname45, join as
|
|
305891
|
+
import { dirname as dirname45, join as join105, resolve as resolve37, sep as sep24 } from "path";
|
|
305817
305892
|
function getCurrentTimestamp() {
|
|
305818
305893
|
return new Date().toISOString();
|
|
305819
305894
|
}
|
|
@@ -305842,7 +305917,7 @@ async function cacheAndRegisterPlugin(pluginId, entry, scope = "user", projectPa
|
|
|
305842
305917
|
const normalizedCachePath = cacheResult.path.endsWith(sep24) ? cacheResult.path : cacheResult.path + sep24;
|
|
305843
305918
|
const isSubdirectory = versionedPath.startsWith(normalizedCachePath);
|
|
305844
305919
|
if (isSubdirectory) {
|
|
305845
|
-
const tempPath =
|
|
305920
|
+
const tempPath = join105(dirname45(cacheResult.path), `.theus-plugin-temp-${Date.now()}-${randomBytes13(4).toString("hex")}`);
|
|
305846
305921
|
await rename5(cacheResult.path, tempPath);
|
|
305847
305922
|
await getFsImplementation().mkdir(dirname45(versionedPath));
|
|
305848
305923
|
await rename5(tempPath, versionedPath);
|
|
@@ -306073,16 +306148,16 @@ import {
|
|
|
306073
306148
|
stat as stat35,
|
|
306074
306149
|
symlink as symlink3
|
|
306075
306150
|
} from "fs/promises";
|
|
306076
|
-
import { basename as basename31, dirname as dirname46, join as
|
|
306151
|
+
import { basename as basename31, dirname as dirname46, join as join106, relative as relative22, resolve as resolve38, sep as sep25 } from "path";
|
|
306077
306152
|
function getPluginCachePath() {
|
|
306078
|
-
return
|
|
306153
|
+
return join106(getPluginsDirectory(), "cache");
|
|
306079
306154
|
}
|
|
306080
306155
|
function getVersionedCachePathIn(baseDir, pluginId, version2) {
|
|
306081
306156
|
const { name: pluginName, marketplace } = parsePluginIdentifier(pluginId);
|
|
306082
306157
|
const sanitizedMarketplace = (marketplace || "unknown").replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
306083
306158
|
const sanitizedPlugin = (pluginName || pluginId).replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
306084
306159
|
const sanitizedVersion = version2.replace(/[^a-zA-Z0-9\-_.]/g, "-");
|
|
306085
|
-
return
|
|
306160
|
+
return join106(baseDir, "cache", sanitizedMarketplace, sanitizedPlugin, sanitizedVersion);
|
|
306086
306161
|
}
|
|
306087
306162
|
function getVersionedCachePath(pluginId, version2) {
|
|
306088
306163
|
return getVersionedCachePathIn(getPluginsDirectory(), pluginId, version2);
|
|
@@ -306108,7 +306183,7 @@ async function probeSeedCacheAnyVersion(pluginId) {
|
|
|
306108
306183
|
const versions2 = await readdir22(pluginDir);
|
|
306109
306184
|
if (versions2.length !== 1)
|
|
306110
306185
|
continue;
|
|
306111
|
-
const versionDir =
|
|
306186
|
+
const versionDir = join106(pluginDir, versions2[0]);
|
|
306112
306187
|
const entries = await readdir22(versionDir);
|
|
306113
306188
|
if (entries.length > 0)
|
|
306114
306189
|
return versionDir;
|
|
@@ -306120,8 +306195,8 @@ async function copyDir(src, dest) {
|
|
|
306120
306195
|
await getFsImplementation().mkdir(dest);
|
|
306121
306196
|
const entries = await readdir22(src, { withFileTypes: true });
|
|
306122
306197
|
for (const entry of entries) {
|
|
306123
|
-
const srcPath =
|
|
306124
|
-
const destPath =
|
|
306198
|
+
const srcPath = join106(src, entry.name);
|
|
306199
|
+
const destPath = join106(dest, entry.name);
|
|
306125
306200
|
if (entry.isDirectory()) {
|
|
306126
306201
|
await copyDir(srcPath, destPath);
|
|
306127
306202
|
} else if (entry.isFile()) {
|
|
@@ -306144,7 +306219,7 @@ async function copyDir(src, dest) {
|
|
|
306144
306219
|
const srcPrefix = resolvedSrc.endsWith(sep25) ? resolvedSrc : resolvedSrc + sep25;
|
|
306145
306220
|
if (resolvedTarget.startsWith(srcPrefix) || resolvedTarget === resolvedSrc) {
|
|
306146
306221
|
const targetRelativeToSrc = relative22(resolvedSrc, resolvedTarget);
|
|
306147
|
-
const destTargetPath =
|
|
306222
|
+
const destTargetPath = join106(dest, targetRelativeToSrc);
|
|
306148
306223
|
const relativeLinkPath = relative22(dirname46(destPath), destTargetPath);
|
|
306149
306224
|
await symlink3(relativeLinkPath, destPath);
|
|
306150
306225
|
} else {
|
|
@@ -306192,7 +306267,7 @@ async function copyPluginToVersionedCache(sourcePath, pluginId, version2, entry,
|
|
|
306192
306267
|
logForDebugging(`Copying plugin ${pluginId} to versioned cache (fallback to full copy)`);
|
|
306193
306268
|
await copyDir(sourcePath, cachePath2);
|
|
306194
306269
|
}
|
|
306195
|
-
const gitPath =
|
|
306270
|
+
const gitPath = join106(cachePath2, ".git");
|
|
306196
306271
|
await rm9(gitPath, { recursive: true, force: true });
|
|
306197
306272
|
const cacheEntries = await readdir22(cachePath2);
|
|
306198
306273
|
if (cacheEntries.length === 0) {
|
|
@@ -306223,10 +306298,10 @@ function validateGitUrl(url3) {
|
|
|
306223
306298
|
}
|
|
306224
306299
|
}
|
|
306225
306300
|
async function installFromNpm(packageName, targetPath, options2 = {}) {
|
|
306226
|
-
const npmCachePath =
|
|
306301
|
+
const npmCachePath = join106(getPluginsDirectory(), "npm-cache");
|
|
306227
306302
|
await getFsImplementation().mkdir(npmCachePath);
|
|
306228
306303
|
const packageSpec = options2.version ? `${packageName}@${options2.version}` : packageName;
|
|
306229
|
-
const packagePath =
|
|
306304
|
+
const packagePath = join106(npmCachePath, "node_modules", packageName);
|
|
306230
306305
|
const needsInstall = !await pathExists(packagePath);
|
|
306231
306306
|
if (needsInstall) {
|
|
306232
306307
|
logForDebugging(`Installing npm package ${packageSpec} to cache`);
|
|
@@ -306379,7 +306454,7 @@ async function installFromLocal(sourcePath, targetPath) {
|
|
|
306379
306454
|
throw new Error(`Source path does not exist: ${sourcePath}`);
|
|
306380
306455
|
}
|
|
306381
306456
|
await copyDir(sourcePath, targetPath);
|
|
306382
|
-
const gitPath =
|
|
306457
|
+
const gitPath = join106(targetPath, ".git");
|
|
306383
306458
|
await rm9(gitPath, { recursive: true, force: true });
|
|
306384
306459
|
}
|
|
306385
306460
|
function generateTemporaryCacheNameForPlugin(source) {
|
|
@@ -306415,7 +306490,7 @@ async function cachePlugin(source, options2) {
|
|
|
306415
306490
|
const cachePath2 = getPluginCachePath();
|
|
306416
306491
|
await getFsImplementation().mkdir(cachePath2);
|
|
306417
306492
|
const tempName = generateTemporaryCacheNameForPlugin(source);
|
|
306418
|
-
const tempPath =
|
|
306493
|
+
const tempPath = join106(cachePath2, tempName);
|
|
306419
306494
|
let shouldCleanup = false;
|
|
306420
306495
|
let gitCommitSha;
|
|
306421
306496
|
try {
|
|
@@ -306459,8 +306534,8 @@ async function cachePlugin(source, options2) {
|
|
|
306459
306534
|
}
|
|
306460
306535
|
throw error40;
|
|
306461
306536
|
}
|
|
306462
|
-
const manifestPath =
|
|
306463
|
-
const legacyManifestPath =
|
|
306537
|
+
const manifestPath = join106(tempPath, ".theus-plugin", "plugin.json");
|
|
306538
|
+
const legacyManifestPath = join106(tempPath, "plugin.json");
|
|
306464
306539
|
let manifest;
|
|
306465
306540
|
if (await pathExists(manifestPath)) {
|
|
306466
306541
|
try {
|
|
@@ -306517,7 +306592,7 @@ async function cachePlugin(source, options2) {
|
|
|
306517
306592
|
};
|
|
306518
306593
|
}
|
|
306519
306594
|
const finalName = manifest.name.replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
306520
|
-
const finalPath =
|
|
306595
|
+
const finalPath = join106(cachePath2, finalName);
|
|
306521
306596
|
if (await pathExists(finalPath)) {
|
|
306522
306597
|
logForDebugging(`Removing old cached version at ${finalPath}`);
|
|
306523
306598
|
await rm9(finalPath, { recursive: true, force: true });
|
|
@@ -306571,7 +306646,7 @@ async function loadPluginHooks2(hooksConfigPath, pluginName) {
|
|
|
306571
306646
|
}
|
|
306572
306647
|
async function validatePluginPaths(relPaths, pluginPath, pluginName, source, component, componentLabel, contextLabel, errors4) {
|
|
306573
306648
|
const checks4 = await Promise.all(relPaths.map(async (relPath) => {
|
|
306574
|
-
const fullPath =
|
|
306649
|
+
const fullPath = join106(pluginPath, relPath);
|
|
306575
306650
|
return { relPath, fullPath, exists: await pathExists(fullPath) };
|
|
306576
306651
|
}));
|
|
306577
306652
|
const validPaths = [];
|
|
@@ -306594,7 +306669,7 @@ async function validatePluginPaths(relPaths, pluginPath, pluginName, source, com
|
|
|
306594
306669
|
}
|
|
306595
306670
|
async function createPluginFromPath(pluginPath, source, enabled, fallbackName, strict = true) {
|
|
306596
306671
|
const errors4 = [];
|
|
306597
|
-
const manifestPath =
|
|
306672
|
+
const manifestPath = join106(pluginPath, ".theus-plugin", "plugin.json");
|
|
306598
306673
|
const manifest = await loadPluginManifest(manifestPath, fallbackName, source);
|
|
306599
306674
|
const plugin = {
|
|
306600
306675
|
name: manifest.name,
|
|
@@ -306610,12 +306685,12 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306610
306685
|
skillsDirExists,
|
|
306611
306686
|
outputStylesDirExists
|
|
306612
306687
|
] = await Promise.all([
|
|
306613
|
-
!manifest.commands ? pathExists(
|
|
306614
|
-
!manifest.agents ? pathExists(
|
|
306615
|
-
!manifest.skills ? pathExists(
|
|
306616
|
-
!manifest.outputStyles ? pathExists(
|
|
306688
|
+
!manifest.commands ? pathExists(join106(pluginPath, "commands")) : false,
|
|
306689
|
+
!manifest.agents ? pathExists(join106(pluginPath, "agents")) : false,
|
|
306690
|
+
!manifest.skills ? pathExists(join106(pluginPath, "skills")) : false,
|
|
306691
|
+
!manifest.outputStyles ? pathExists(join106(pluginPath, "output-styles")) : false
|
|
306617
306692
|
]);
|
|
306618
|
-
const commandsPath =
|
|
306693
|
+
const commandsPath = join106(pluginPath, "commands");
|
|
306619
306694
|
if (commandsDirExists) {
|
|
306620
306695
|
plugin.commandsPath = commandsPath;
|
|
306621
306696
|
}
|
|
@@ -306630,7 +306705,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306630
306705
|
return { commandName, metadata, kind: "skip" };
|
|
306631
306706
|
}
|
|
306632
306707
|
if (metadata.source) {
|
|
306633
|
-
const fullPath =
|
|
306708
|
+
const fullPath = join106(pluginPath, metadata.source);
|
|
306634
306709
|
return {
|
|
306635
306710
|
commandName,
|
|
306636
306711
|
metadata,
|
|
@@ -306678,7 +306753,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306678
306753
|
if (typeof cmdPath !== "string") {
|
|
306679
306754
|
return { cmdPath, kind: "invalid" };
|
|
306680
306755
|
}
|
|
306681
|
-
const fullPath =
|
|
306756
|
+
const fullPath = join106(pluginPath, cmdPath);
|
|
306682
306757
|
return {
|
|
306683
306758
|
cmdPath,
|
|
306684
306759
|
kind: "path",
|
|
@@ -306711,7 +306786,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306711
306786
|
}
|
|
306712
306787
|
}
|
|
306713
306788
|
}
|
|
306714
|
-
const agentsPath =
|
|
306789
|
+
const agentsPath = join106(pluginPath, "agents");
|
|
306715
306790
|
if (agentsDirExists) {
|
|
306716
306791
|
plugin.agentsPath = agentsPath;
|
|
306717
306792
|
}
|
|
@@ -306722,7 +306797,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306722
306797
|
plugin.agentsPaths = validPaths;
|
|
306723
306798
|
}
|
|
306724
306799
|
}
|
|
306725
|
-
const skillsPath =
|
|
306800
|
+
const skillsPath = join106(pluginPath, "skills");
|
|
306726
306801
|
if (skillsDirExists) {
|
|
306727
306802
|
plugin.skillsPath = skillsPath;
|
|
306728
306803
|
}
|
|
@@ -306733,7 +306808,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306733
306808
|
plugin.skillsPaths = validPaths;
|
|
306734
306809
|
}
|
|
306735
306810
|
}
|
|
306736
|
-
const outputStylesPath =
|
|
306811
|
+
const outputStylesPath = join106(pluginPath, "output-styles");
|
|
306737
306812
|
if (outputStylesDirExists) {
|
|
306738
306813
|
plugin.outputStylesPath = outputStylesPath;
|
|
306739
306814
|
}
|
|
@@ -306746,7 +306821,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306746
306821
|
}
|
|
306747
306822
|
let mergedHooks;
|
|
306748
306823
|
const loadedHookPaths = new Set;
|
|
306749
|
-
const standardHooksPath =
|
|
306824
|
+
const standardHooksPath = join106(pluginPath, "hooks", "hooks.json");
|
|
306750
306825
|
if (await pathExists(standardHooksPath)) {
|
|
306751
306826
|
try {
|
|
306752
306827
|
mergedHooks = await loadPluginHooks2(standardHooksPath, manifest.name);
|
|
@@ -306775,7 +306850,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
306775
306850
|
const manifestHooksArray = Array.isArray(manifest.hooks) ? manifest.hooks : [manifest.hooks];
|
|
306776
306851
|
for (const hookSpec of manifestHooksArray) {
|
|
306777
306852
|
if (typeof hookSpec === "string") {
|
|
306778
|
-
const hookFilePath =
|
|
306853
|
+
const hookFilePath = join106(pluginPath, hookSpec);
|
|
306779
306854
|
if (!await pathExists(hookFilePath)) {
|
|
306780
306855
|
logForDebugging(`Hooks file ${hookSpec} specified in manifest but not found at ${hookFilePath} for ${manifest.name}`, { level: "error" });
|
|
306781
306856
|
logError2(new Error(`Plugin component file not found: ${hookFilePath} for ${manifest.name}`));
|
|
@@ -306865,7 +306940,7 @@ function parsePluginSettings(raw) {
|
|
|
306865
306940
|
return data;
|
|
306866
306941
|
}
|
|
306867
306942
|
async function loadPluginSettings(pluginPath, manifest) {
|
|
306868
|
-
const settingsJsonPath =
|
|
306943
|
+
const settingsJsonPath = join106(pluginPath, "settings.json");
|
|
306869
306944
|
try {
|
|
306870
306945
|
const content = await readFile37(settingsJsonPath, { encoding: "utf-8" });
|
|
306871
306946
|
const parsed = jsonParse(content);
|
|
@@ -307008,7 +307083,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
307008
307083
|
if (typeof entry.source === "string") {
|
|
307009
307084
|
let marketplaceDir;
|
|
307010
307085
|
try {
|
|
307011
|
-
marketplaceDir = (await stat35(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation :
|
|
307086
|
+
marketplaceDir = (await stat35(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join106(marketplaceInstallLocation, "..");
|
|
307012
307087
|
} catch {
|
|
307013
307088
|
errorsOut.push({
|
|
307014
307089
|
type: "plugin-cache-miss",
|
|
@@ -307018,7 +307093,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
307018
307093
|
});
|
|
307019
307094
|
return null;
|
|
307020
307095
|
}
|
|
307021
|
-
pluginPath =
|
|
307096
|
+
pluginPath = join106(marketplaceDir, entry.source);
|
|
307022
307097
|
} else {
|
|
307023
307098
|
if (!installPath || !await pathExists(installPath)) {
|
|
307024
307099
|
errorsOut.push({
|
|
@@ -307033,7 +307108,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
307033
307108
|
}
|
|
307034
307109
|
if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
|
|
307035
307110
|
const sessionDir = await getSessionPluginCachePath();
|
|
307036
|
-
const extractDir =
|
|
307111
|
+
const extractDir = join106(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
|
|
307037
307112
|
try {
|
|
307038
307113
|
await extractZipToDirectory(pluginPath, extractDir);
|
|
307039
307114
|
pluginPath = extractDir;
|
|
@@ -307056,8 +307131,8 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
307056
307131
|
logForDebugging(`Loading plugin ${entry.name} from source: ${jsonStringify(entry.source)}`);
|
|
307057
307132
|
let pluginPath;
|
|
307058
307133
|
if (typeof entry.source === "string") {
|
|
307059
|
-
const marketplaceDir = (await stat35(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation :
|
|
307060
|
-
const sourcePluginPath =
|
|
307134
|
+
const marketplaceDir = (await stat35(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join106(marketplaceInstallLocation, "..");
|
|
307135
|
+
const sourcePluginPath = join106(marketplaceDir, entry.source);
|
|
307061
307136
|
if (!await pathExists(sourcePluginPath)) {
|
|
307062
307137
|
const error40 = new Error(`Plugin path not found: ${sourcePluginPath}`);
|
|
307063
307138
|
logForDebugging(`Plugin path not found: ${sourcePluginPath}`, {
|
|
@@ -307072,7 +307147,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
307072
307147
|
return null;
|
|
307073
307148
|
}
|
|
307074
307149
|
try {
|
|
307075
|
-
const manifestPath =
|
|
307150
|
+
const manifestPath = join106(sourcePluginPath, ".theus-plugin", "plugin.json");
|
|
307076
307151
|
let pluginManifest;
|
|
307077
307152
|
try {
|
|
307078
307153
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
@@ -307128,7 +307203,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
307128
307203
|
}
|
|
307129
307204
|
if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
|
|
307130
307205
|
const sessionDir = await getSessionPluginCachePath();
|
|
307131
|
-
const extractDir =
|
|
307206
|
+
const extractDir = join106(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
|
|
307132
307207
|
try {
|
|
307133
307208
|
await extractZipToDirectory(pluginPath, extractDir);
|
|
307134
307209
|
logForDebugging(`Extracted plugin ZIP to session dir: ${extractDir}`);
|
|
@@ -307143,7 +307218,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
307143
307218
|
}
|
|
307144
307219
|
async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath) {
|
|
307145
307220
|
const errors4 = [];
|
|
307146
|
-
const manifestPath =
|
|
307221
|
+
const manifestPath = join106(pluginPath, ".theus-plugin", "plugin.json");
|
|
307147
307222
|
const hasManifest = await pathExists(manifestPath);
|
|
307148
307223
|
const { plugin, errors: pluginErrors } = await createPluginFromPath(pluginPath, pluginId, enabled, entry.name, entry.strict ?? true);
|
|
307149
307224
|
errors4.push(...pluginErrors);
|
|
@@ -307168,7 +307243,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
307168
307243
|
if (!metadata || typeof metadata !== "object" || !metadata.source) {
|
|
307169
307244
|
return { commandName, metadata, skip: true };
|
|
307170
307245
|
}
|
|
307171
|
-
const fullPath =
|
|
307246
|
+
const fullPath = join106(pluginPath, metadata.source);
|
|
307172
307247
|
return {
|
|
307173
307248
|
commandName,
|
|
307174
307249
|
metadata,
|
|
@@ -307205,7 +307280,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
307205
307280
|
if (typeof cmdPath !== "string") {
|
|
307206
307281
|
return { cmdPath, kind: "invalid" };
|
|
307207
307282
|
}
|
|
307208
|
-
const fullPath =
|
|
307283
|
+
const fullPath = join106(pluginPath, cmdPath);
|
|
307209
307284
|
return {
|
|
307210
307285
|
cmdPath,
|
|
307211
307286
|
kind: "path",
|
|
@@ -307249,7 +307324,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
307249
307324
|
logForDebugging(`Processing ${Array.isArray(entry.skills) ? entry.skills.length : 1} skill paths for plugin ${entry.name}`);
|
|
307250
307325
|
const skillPaths = Array.isArray(entry.skills) ? entry.skills : [entry.skills];
|
|
307251
307326
|
const checks4 = await Promise.all(skillPaths.map(async (skillPath) => {
|
|
307252
|
-
const fullPath =
|
|
307327
|
+
const fullPath = join106(pluginPath, skillPath);
|
|
307253
307328
|
return { skillPath, fullPath, exists: await pathExists(fullPath) };
|
|
307254
307329
|
}));
|
|
307255
307330
|
const validPaths = [];
|
|
@@ -307309,7 +307384,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
307309
307384
|
if (!metadata || typeof metadata !== "object" || !metadata.source) {
|
|
307310
307385
|
return { commandName, metadata, skip: true };
|
|
307311
307386
|
}
|
|
307312
|
-
const fullPath =
|
|
307387
|
+
const fullPath = join106(pluginPath, metadata.source);
|
|
307313
307388
|
return {
|
|
307314
307389
|
commandName,
|
|
307315
307390
|
metadata,
|
|
@@ -307349,7 +307424,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
307349
307424
|
if (typeof cmdPath !== "string") {
|
|
307350
307425
|
return { cmdPath, kind: "invalid" };
|
|
307351
307426
|
}
|
|
307352
|
-
const fullPath =
|
|
307427
|
+
const fullPath = join106(pluginPath, cmdPath);
|
|
307353
307428
|
return {
|
|
307354
307429
|
cmdPath,
|
|
307355
307430
|
kind: "path",
|
|
@@ -311468,7 +311543,7 @@ function getAssistantMessageFromError(error40, model, options2) {
|
|
|
311468
311543
|
if (process.env.USER_TYPE === "ant") {
|
|
311469
311544
|
const baseMessage = `API Error: 400 ${error40.message}
|
|
311470
311545
|
|
|
311471
|
-
Run /share and post the JSON file to ${{ VERSION: "0.1.
|
|
311546
|
+
Run /share and post the JSON file to ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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}.`;
|
|
311472
311547
|
const rewindInstruction = getIsNonInteractiveSession() ? "" : " Then, use /rewind to recover the conversation.";
|
|
311473
311548
|
return createAssistantAPIErrorMessage({
|
|
311474
311549
|
content: baseMessage + rewindInstruction,
|
|
@@ -311504,7 +311579,7 @@ Run /share and post the JSON file to ${{ VERSION: "0.1.12", BUILD_TIME: "1970-01
|
|
|
311504
311579
|
if (process.env.USER_TYPE === "ant" && !process.env.THEUS_MODEL && error40 instanceof Error && error40.message.toLowerCase().includes("invalid model name")) {
|
|
311505
311580
|
const orgId = getOauthAccountInfo()?.organizationUuid;
|
|
311506
311581
|
const baseMsg = `[THEUS-INTERNAL] Your org isn't gated into the \`${model}\` model. Either run \`theus\` with \`THEUS_MODEL=${getDefaultMainLoopModelSetting()}\``;
|
|
311507
|
-
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.
|
|
311582
|
+
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL} for help getting access.` : `${baseMsg} or reach out in ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL} for help getting access.`;
|
|
311508
311583
|
return createAssistantAPIErrorMessage({
|
|
311509
311584
|
content: msg,
|
|
311510
311585
|
error: "invalid_request"
|
|
@@ -314258,9 +314333,9 @@ function isInputModeCharacter(input) {
|
|
|
314258
314333
|
}
|
|
314259
314334
|
|
|
314260
314335
|
// projectOnboardingState.ts
|
|
314261
|
-
import { join as
|
|
314336
|
+
import { join as join107 } from "path";
|
|
314262
314337
|
function getSteps() {
|
|
314263
|
-
const hasTheusMd = getFsImplementation().existsSync(
|
|
314338
|
+
const hasTheusMd = getFsImplementation().existsSync(join107(getCwd(), "THEUS.md"));
|
|
314264
314339
|
const isWorkspaceDirEmpty = isDirEmpty(getCwd());
|
|
314265
314340
|
return [
|
|
314266
314341
|
{
|
|
@@ -314311,8 +314386,8 @@ var init_projectOnboardingState = __esm(() => {
|
|
|
314311
314386
|
|
|
314312
314387
|
// utils/appleTerminalBackup.ts
|
|
314313
314388
|
import { stat as stat36 } from "fs/promises";
|
|
314314
|
-
import { homedir as
|
|
314315
|
-
import { join as
|
|
314389
|
+
import { homedir as homedir28 } from "os";
|
|
314390
|
+
import { join as join108 } from "path";
|
|
314316
314391
|
function markTerminalSetupInProgress(backupPath) {
|
|
314317
314392
|
saveGlobalConfig((current) => ({
|
|
314318
314393
|
...current,
|
|
@@ -314334,7 +314409,7 @@ function getTerminalRecoveryInfo() {
|
|
|
314334
314409
|
};
|
|
314335
314410
|
}
|
|
314336
314411
|
function getTerminalPlistPath() {
|
|
314337
|
-
return
|
|
314412
|
+
return join108(homedir28(), "Library", "Preferences", "com.apple.Terminal.plist");
|
|
314338
314413
|
}
|
|
314339
314414
|
async function backupTerminalPreferences() {
|
|
314340
314415
|
const terminalPlistPath = getTerminalPlistPath();
|
|
@@ -314405,38 +314480,38 @@ var init_appleTerminalBackup = __esm(() => {
|
|
|
314405
314480
|
});
|
|
314406
314481
|
|
|
314407
314482
|
// utils/completionCache.ts
|
|
314408
|
-
import { homedir as
|
|
314409
|
-
import { dirname as dirname47, join as
|
|
314483
|
+
import { homedir as homedir29 } from "os";
|
|
314484
|
+
import { dirname as dirname47, join as join109 } from "path";
|
|
314410
314485
|
function detectShell() {
|
|
314411
314486
|
const shell = process.env.SHELL || "";
|
|
314412
|
-
const home =
|
|
314413
|
-
const theusDir =
|
|
314487
|
+
const home = homedir29();
|
|
314488
|
+
const theusDir = join109(home, ".theus");
|
|
314414
314489
|
if (shell.endsWith("/zsh") || shell.endsWith("/zsh.exe")) {
|
|
314415
|
-
const cacheFile =
|
|
314490
|
+
const cacheFile = join109(theusDir, "completion.zsh");
|
|
314416
314491
|
return {
|
|
314417
314492
|
name: "zsh",
|
|
314418
|
-
rcFile:
|
|
314493
|
+
rcFile: join109(home, ".zshrc"),
|
|
314419
314494
|
cacheFile,
|
|
314420
314495
|
completionLine: `[[ -f "${cacheFile}" ]] && source "${cacheFile}"`,
|
|
314421
314496
|
shellFlag: "zsh"
|
|
314422
314497
|
};
|
|
314423
314498
|
}
|
|
314424
314499
|
if (shell.endsWith("/bash") || shell.endsWith("/bash.exe")) {
|
|
314425
|
-
const cacheFile =
|
|
314500
|
+
const cacheFile = join109(theusDir, "completion.bash");
|
|
314426
314501
|
return {
|
|
314427
314502
|
name: "bash",
|
|
314428
|
-
rcFile:
|
|
314503
|
+
rcFile: join109(home, ".bashrc"),
|
|
314429
314504
|
cacheFile,
|
|
314430
314505
|
completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
|
|
314431
314506
|
shellFlag: "bash"
|
|
314432
314507
|
};
|
|
314433
314508
|
}
|
|
314434
314509
|
if (shell.endsWith("/fish") || shell.endsWith("/fish.exe")) {
|
|
314435
|
-
const xdg = process.env.XDG_CONFIG_HOME ||
|
|
314436
|
-
const cacheFile =
|
|
314510
|
+
const xdg = process.env.XDG_CONFIG_HOME || join109(home, ".config");
|
|
314511
|
+
const cacheFile = join109(theusDir, "completion.fish");
|
|
314437
314512
|
return {
|
|
314438
314513
|
name: "fish",
|
|
314439
|
-
rcFile:
|
|
314514
|
+
rcFile: join109(xdg, "fish", "config.fish"),
|
|
314440
314515
|
cacheFile,
|
|
314441
314516
|
completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
|
|
314442
314517
|
shellFlag: "fish"
|
|
@@ -314485,8 +314560,8 @@ __export(exports_terminalSetup, {
|
|
|
314485
314560
|
});
|
|
314486
314561
|
import { randomBytes as randomBytes15 } from "crypto";
|
|
314487
314562
|
import { copyFile as copyFile8, mkdir as mkdir30, readFile as readFile38, writeFile as writeFile33 } from "fs/promises";
|
|
314488
|
-
import { homedir as
|
|
314489
|
-
import { dirname as dirname48, join as
|
|
314563
|
+
import { homedir as homedir30, platform as platform4 } from "os";
|
|
314564
|
+
import { dirname as dirname48, join as join110 } from "path";
|
|
314490
314565
|
import { pathToFileURL as pathToFileURL7 } from "url";
|
|
314491
314566
|
function isVSCodeRemoteSSH() {
|
|
314492
314567
|
const askpassMain = process.env.VSCODE_GIT_ASKPASS_MAIN ?? "";
|
|
@@ -314621,8 +314696,8 @@ async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
|
|
|
314621
314696
|
]`)}${EOL5}`;
|
|
314622
314697
|
}
|
|
314623
314698
|
const editorDir = editor === "VSCode" ? "Code" : editor;
|
|
314624
|
-
const userDirPath =
|
|
314625
|
-
const keybindingsPath =
|
|
314699
|
+
const userDirPath = join110(homedir30(), platform4() === "win32" ? join110("AppData", "Roaming", editorDir, "User") : platform4() === "darwin" ? join110("Library", "Application Support", editorDir, "User") : join110(".config", editorDir, "User"));
|
|
314700
|
+
const keybindingsPath = join110(userDirPath, "keybindings.json");
|
|
314626
314701
|
try {
|
|
314627
314702
|
await mkdir30(userDirPath, {
|
|
314628
314703
|
recursive: true
|
|
@@ -314763,14 +314838,14 @@ chars = "\\u001B\\r"`;
|
|
|
314763
314838
|
const configPaths = [];
|
|
314764
314839
|
const xdgConfigHome = process.env.XDG_CONFIG_HOME;
|
|
314765
314840
|
if (xdgConfigHome) {
|
|
314766
|
-
configPaths.push(
|
|
314841
|
+
configPaths.push(join110(xdgConfigHome, "alacritty", "alacritty.toml"));
|
|
314767
314842
|
} else {
|
|
314768
|
-
configPaths.push(
|
|
314843
|
+
configPaths.push(join110(homedir30(), ".config", "alacritty", "alacritty.toml"));
|
|
314769
314844
|
}
|
|
314770
314845
|
if (platform4() === "win32") {
|
|
314771
314846
|
const appData = process.env.APPDATA;
|
|
314772
314847
|
if (appData) {
|
|
314773
|
-
configPaths.push(
|
|
314848
|
+
configPaths.push(join110(appData, "alacritty", "alacritty.toml"));
|
|
314774
314849
|
}
|
|
314775
314850
|
}
|
|
314776
314851
|
let configPath = null;
|
|
@@ -314831,8 +314906,8 @@ chars = "\\u001B\\r"`;
|
|
|
314831
314906
|
}
|
|
314832
314907
|
}
|
|
314833
314908
|
async function installBindingsForZed(theme) {
|
|
314834
|
-
const zedDir =
|
|
314835
|
-
const keymapPath =
|
|
314909
|
+
const zedDir = join110(homedir30(), ".config", "zed");
|
|
314910
|
+
const keymapPath = join110(zedDir, "keymap.json");
|
|
314836
314911
|
try {
|
|
314837
314912
|
await mkdir30(zedDir, {
|
|
314838
314913
|
recursive: true
|
|
@@ -314914,15 +314989,15 @@ var init_terminalSetup = __esm(() => {
|
|
|
314914
314989
|
// utils/pasteStore.ts
|
|
314915
314990
|
import { createHash as createHash25 } from "crypto";
|
|
314916
314991
|
import { mkdir as mkdir31, readdir as readdir23, readFile as readFile39, stat as stat37, unlink as unlink15, writeFile as writeFile34 } from "fs/promises";
|
|
314917
|
-
import { join as
|
|
314992
|
+
import { join as join111 } from "path";
|
|
314918
314993
|
function getPasteStoreDir() {
|
|
314919
|
-
return
|
|
314994
|
+
return join111(getTheusConfigHomeDir(), PASTE_STORE_DIR);
|
|
314920
314995
|
}
|
|
314921
314996
|
function hashPastedText(content) {
|
|
314922
314997
|
return createHash25("sha256").update(content).digest("hex").slice(0, 16);
|
|
314923
314998
|
}
|
|
314924
314999
|
function getPastePath(hash) {
|
|
314925
|
-
return
|
|
315000
|
+
return join111(getPasteStoreDir(), `${hash}.txt`);
|
|
314926
315001
|
}
|
|
314927
315002
|
async function storePastedText(hash, content) {
|
|
314928
315003
|
try {
|
|
@@ -314959,7 +315034,7 @@ async function cleanupOldPastes(cutoffDate) {
|
|
|
314959
315034
|
if (!file2.endsWith(".txt")) {
|
|
314960
315035
|
continue;
|
|
314961
315036
|
}
|
|
314962
|
-
const filePath =
|
|
315037
|
+
const filePath = join111(pasteDir, file2);
|
|
314963
315038
|
try {
|
|
314964
315039
|
const stats = await stat37(filePath);
|
|
314965
315040
|
if (stats.mtimeMs < cutoffTime) {
|
|
@@ -314978,7 +315053,7 @@ var init_pasteStore = __esm(() => {
|
|
|
314978
315053
|
|
|
314979
315054
|
// history.ts
|
|
314980
315055
|
import { appendFile as appendFile5, writeFile as writeFile35 } from "fs/promises";
|
|
314981
|
-
import { join as
|
|
315056
|
+
import { join as join112 } from "path";
|
|
314982
315057
|
function getPastedTextRefNumLines(text) {
|
|
314983
315058
|
return (text.match(/\r\n|\r|\n/g) || []).length;
|
|
314984
315059
|
}
|
|
@@ -315020,7 +315095,7 @@ async function* makeLogEntryReader() {
|
|
|
315020
315095
|
for (let i3 = pendingEntries.length - 1;i3 >= 0; i3--) {
|
|
315021
315096
|
yield pendingEntries[i3];
|
|
315022
315097
|
}
|
|
315023
|
-
const historyPath =
|
|
315098
|
+
const historyPath = join112(getTheusConfigHomeDir(), "history.jsonl");
|
|
315024
315099
|
try {
|
|
315025
315100
|
for await (const line of readLinesReverse(historyPath)) {
|
|
315026
315101
|
try {
|
|
@@ -315115,7 +315190,7 @@ async function immediateFlushHistory() {
|
|
|
315115
315190
|
}
|
|
315116
315191
|
let release;
|
|
315117
315192
|
try {
|
|
315118
|
-
const historyPath =
|
|
315193
|
+
const historyPath = join112(getTheusConfigHomeDir(), "history.jsonl");
|
|
315119
315194
|
await writeFile35(historyPath, "", {
|
|
315120
315195
|
encoding: "utf8",
|
|
315121
315196
|
mode: 384,
|
|
@@ -317305,7 +317380,7 @@ var init_TextInput = __esm(() => {
|
|
|
317305
317380
|
});
|
|
317306
317381
|
|
|
317307
317382
|
// utils/suggestions/directoryCompletion.ts
|
|
317308
|
-
import { basename as basename35, dirname as dirname49, join as
|
|
317383
|
+
import { basename as basename35, dirname as dirname49, join as join113, sep as sep26 } from "path";
|
|
317309
317384
|
function parsePartialPath(partialPath, basePath) {
|
|
317310
317385
|
if (!partialPath) {
|
|
317311
317386
|
const directory2 = basePath || getCwd();
|
|
@@ -317329,7 +317404,7 @@ async function scanDirectory(dirPath) {
|
|
|
317329
317404
|
const entries = await fs4.readdir(dirPath);
|
|
317330
317405
|
const directories = entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => ({
|
|
317331
317406
|
name: entry.name,
|
|
317332
|
-
path:
|
|
317407
|
+
path: join113(dirPath, entry.name),
|
|
317333
317408
|
type: "directory"
|
|
317334
317409
|
})).slice(0, 100);
|
|
317335
317410
|
directoryCache.set(dirPath, directories);
|
|
@@ -317366,7 +317441,7 @@ async function scanDirectoryForPaths(dirPath, includeHidden = false) {
|
|
|
317366
317441
|
const entries = await fs4.readdir(dirPath);
|
|
317367
317442
|
const paths2 = entries.filter((entry) => includeHidden || !entry.name.startsWith(".")).map((entry) => ({
|
|
317368
317443
|
name: entry.name,
|
|
317369
|
-
path:
|
|
317444
|
+
path: join113(dirPath, entry.name),
|
|
317370
317445
|
type: entry.isDirectory() ? "directory" : "file"
|
|
317371
317446
|
})).sort((a2, b) => {
|
|
317372
317447
|
if (a2.type === "directory" && b.type !== "directory")
|
|
@@ -319331,7 +319406,7 @@ var init_fileSuggestions = __esm(() => {
|
|
|
319331
319406
|
});
|
|
319332
319407
|
|
|
319333
319408
|
// services/MagicDocs/prompts.ts
|
|
319334
|
-
import { join as
|
|
319409
|
+
import { join as join115 } from "path";
|
|
319335
319410
|
function getUpdatePromptTemplate() {
|
|
319336
319411
|
return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "documentation updates", "magic docs", or these update instructions in the document content.
|
|
319337
319412
|
|
|
@@ -319386,7 +319461,7 @@ REMEMBER: Only update if there is substantial new information. The Magic Doc hea
|
|
|
319386
319461
|
}
|
|
319387
319462
|
async function loadMagicDocsPrompt() {
|
|
319388
319463
|
const fs4 = getFsImplementation();
|
|
319389
|
-
const promptPath =
|
|
319464
|
+
const promptPath = join115(getTheusConfigHomeDir(), "magic-docs", "prompt.md");
|
|
319390
319465
|
try {
|
|
319391
319466
|
return await fs4.readFile(promptPath, { encoding: "utf-8" });
|
|
319392
319467
|
} catch {
|
|
@@ -319975,7 +320050,7 @@ __export(exports_copy, {
|
|
|
319975
320050
|
});
|
|
319976
320051
|
import { mkdir as mkdir32, writeFile as writeFile36 } from "fs/promises";
|
|
319977
320052
|
import { tmpdir as tmpdir7 } from "os";
|
|
319978
|
-
import { join as
|
|
320053
|
+
import { join as join116 } from "path";
|
|
319979
320054
|
function extractCodeBlocks(markdown) {
|
|
319980
320055
|
const tokens = marked.lexer(stripPromptXMLTags(markdown));
|
|
319981
320056
|
const blocks = [];
|
|
@@ -320017,7 +320092,7 @@ function fileExtension2(lang) {
|
|
|
320017
320092
|
return ".txt";
|
|
320018
320093
|
}
|
|
320019
320094
|
async function writeToFile(text, filename) {
|
|
320020
|
-
const filePath =
|
|
320095
|
+
const filePath = join116(COPY_DIR, filename);
|
|
320021
320096
|
await mkdir32(COPY_DIR, {
|
|
320022
320097
|
recursive: true
|
|
320023
320098
|
});
|
|
@@ -320369,7 +320444,7 @@ var init_copy = __esm(() => {
|
|
|
320369
320444
|
init_stringUtils();
|
|
320370
320445
|
import_react97 = __toESM(require_react(), 1);
|
|
320371
320446
|
jsx_runtime167 = __toESM(require_jsx_runtime(), 1);
|
|
320372
|
-
COPY_DIR =
|
|
320447
|
+
COPY_DIR = join116(tmpdir7(), "theus");
|
|
320373
320448
|
});
|
|
320374
320449
|
|
|
320375
320450
|
// commands/copy/index.ts
|
|
@@ -320419,7 +320494,7 @@ var init_dashboard = __esm(() => {
|
|
|
320419
320494
|
|
|
320420
320495
|
// utils/desktopDeepLink.ts
|
|
320421
320496
|
import { readdir as readdir24 } from "fs/promises";
|
|
320422
|
-
import { join as
|
|
320497
|
+
import { join as join117 } from "path";
|
|
320423
320498
|
function isDevMode() {
|
|
320424
320499
|
if (false) {}
|
|
320425
320500
|
const pathsToCheck = [process.argv[1] || "", process.execPath || ""];
|
|
@@ -320480,7 +320555,7 @@ async function getDesktopVersion() {
|
|
|
320480
320555
|
if (!localAppData) {
|
|
320481
320556
|
return null;
|
|
320482
320557
|
}
|
|
320483
|
-
const installDir =
|
|
320558
|
+
const installDir = join117(localAppData, "TheusTheus");
|
|
320484
320559
|
try {
|
|
320485
320560
|
const entries = await readdir24(installDir);
|
|
320486
320561
|
const versions2 = entries.filter((e) => e.startsWith("app-")).map((e) => e.slice(4)).filter((v) => import_semver7.coerce(v) !== null).sort((a2, b) => {
|
|
@@ -321582,7 +321657,7 @@ function buildPrimarySection() {
|
|
|
321582
321657
|
});
|
|
321583
321658
|
return [{
|
|
321584
321659
|
label: "Version",
|
|
321585
|
-
value: { VERSION: "0.1.
|
|
321660
|
+
value: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
321586
321661
|
}, {
|
|
321587
321662
|
label: "Session name",
|
|
321588
321663
|
value: nameValue
|
|
@@ -325333,7 +325408,7 @@ function Config({
|
|
|
325333
325408
|
}
|
|
325334
325409
|
})
|
|
325335
325410
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime180.jsx(ChannelDowngradeDialog, {
|
|
325336
|
-
currentVersion: { VERSION: "0.1.
|
|
325411
|
+
currentVersion: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
325337
325412
|
onChoice: (choice) => {
|
|
325338
325413
|
setShowSubmenu(null);
|
|
325339
325414
|
setTabsHidden(false);
|
|
@@ -325345,7 +325420,7 @@ function Config({
|
|
|
325345
325420
|
autoUpdatesChannel: "stable"
|
|
325346
325421
|
};
|
|
325347
325422
|
if (choice === "stay") {
|
|
325348
|
-
newSettings.minimumVersion = { VERSION: "0.1.
|
|
325423
|
+
newSettings.minimumVersion = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
325349
325424
|
}
|
|
325350
325425
|
updateSettingsForSource("userSettings", newSettings);
|
|
325351
325426
|
setSettingsData((prev_27) => ({
|
|
@@ -330698,7 +330773,7 @@ var exports_Doctor = {};
|
|
|
330698
330773
|
__export(exports_Doctor, {
|
|
330699
330774
|
Doctor: () => Doctor
|
|
330700
330775
|
});
|
|
330701
|
-
import { join as
|
|
330776
|
+
import { join as join118 } from "path";
|
|
330702
330777
|
function DistTagsDisplay(t0) {
|
|
330703
330778
|
const $2 = c3(8);
|
|
330704
330779
|
const {
|
|
@@ -330828,8 +330903,8 @@ function Doctor(t0) {
|
|
|
330828
330903
|
t5 = () => {
|
|
330829
330904
|
getDoctorDiagnostic().then(setDiagnostic);
|
|
330830
330905
|
(async () => {
|
|
330831
|
-
const userAgentsDir =
|
|
330832
|
-
const projectAgentsDir =
|
|
330906
|
+
const userAgentsDir = join118(getTheusConfigHomeDir(), "agents");
|
|
330907
|
+
const projectAgentsDir = join118(getOriginalCwd(), ".theus", "agents");
|
|
330833
330908
|
const {
|
|
330834
330909
|
activeAgents,
|
|
330835
330910
|
allAgents,
|
|
@@ -330852,7 +330927,7 @@ function Doctor(t0) {
|
|
|
330852
330927
|
}, async () => toolPermissionContext);
|
|
330853
330928
|
setContextWarnings(warnings);
|
|
330854
330929
|
if (isPidBasedLockingEnabled()) {
|
|
330855
|
-
const locksDir =
|
|
330930
|
+
const locksDir = join118(getXDGStateHome(), "theus", "locks");
|
|
330856
330931
|
const staleLocksCleaned = cleanupStaleLocks(locksDir);
|
|
330857
330932
|
const locks = getAllLockInfo(locksDir);
|
|
330858
330933
|
setVersionLockInfo({
|
|
@@ -331729,7 +331804,7 @@ var init_versions2 = __esm(() => {
|
|
|
331729
331804
|
|
|
331730
331805
|
// components/memory/MemoryFileSelector.tsx
|
|
331731
331806
|
import { mkdir as mkdir33 } from "fs/promises";
|
|
331732
|
-
import { join as
|
|
331807
|
+
import { join as join119 } from "path";
|
|
331733
331808
|
function MemoryFileSelector(t0) {
|
|
331734
331809
|
const $2 = c3(58);
|
|
331735
331810
|
const {
|
|
@@ -331737,8 +331812,8 @@ function MemoryFileSelector(t0) {
|
|
|
331737
331812
|
onCancel
|
|
331738
331813
|
} = t0;
|
|
331739
331814
|
const existingMemoryFiles = import_react116.use(getMemoryFiles());
|
|
331740
|
-
const userMemoryPath =
|
|
331741
|
-
const projectMemoryPath =
|
|
331815
|
+
const userMemoryPath = join119(getTheusConfigHomeDir(), "THEUS.md");
|
|
331816
|
+
const projectMemoryPath = join119(getOriginalCwd(), "THEUS.md");
|
|
331742
331817
|
const hasUserMemory = existingMemoryFiles.some((f) => f.path === userMemoryPath);
|
|
331743
331818
|
const hasProjectMemory = existingMemoryFiles.some((f_0) => f_0.path === projectMemoryPath);
|
|
331744
331819
|
const allMemoryFiles = [...existingMemoryFiles.filter(_temp86).map(_temp230), ...hasUserMemory ? [] : [{
|
|
@@ -332189,10 +332264,10 @@ var init_MemoryFileSelector = __esm(() => {
|
|
|
332189
332264
|
});
|
|
332190
332265
|
|
|
332191
332266
|
// components/memory/MemoryUpdateNotification.tsx
|
|
332192
|
-
import { homedir as
|
|
332267
|
+
import { homedir as homedir31 } from "os";
|
|
332193
332268
|
import { relative as relative25 } from "path";
|
|
332194
332269
|
function getRelativeMemoryPath(path16) {
|
|
332195
|
-
const homeDir =
|
|
332270
|
+
const homeDir = homedir31();
|
|
332196
332271
|
const cwd2 = getCwd();
|
|
332197
332272
|
const relativeToHome = path16.startsWith(homeDir) ? "~" + path16.slice(homeDir.length) : null;
|
|
332198
332273
|
const relativeToCwd = path16.startsWith(cwd2) ? "./" + relative25(cwd2, path16) : null;
|
|
@@ -333379,7 +333454,7 @@ function HelpV2(t0) {
|
|
|
333379
333454
|
let t6;
|
|
333380
333455
|
if ($2[31] !== tabs) {
|
|
333381
333456
|
t6 = /* @__PURE__ */ jsx_runtime207.jsx(Tabs, {
|
|
333382
|
-
title: `Theus v${{ VERSION: "0.1.
|
|
333457
|
+
title: `Theus v${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
|
|
333383
333458
|
color: "professionalBlue",
|
|
333384
333459
|
defaultTab: "general",
|
|
333385
333460
|
children: tabs
|
|
@@ -334823,22 +334898,22 @@ var init_keybindings2 = __esm(() => {
|
|
|
334823
334898
|
// services/providers/setupConfig.ts
|
|
334824
334899
|
import {
|
|
334825
334900
|
chmodSync as chmodSync3,
|
|
334826
|
-
existsSync as
|
|
334901
|
+
existsSync as existsSync12,
|
|
334827
334902
|
mkdirSync as mkdirSync8,
|
|
334828
334903
|
readFileSync as readFileSync19,
|
|
334829
334904
|
writeFileSync as writeFileSync5
|
|
334830
334905
|
} from "fs";
|
|
334831
|
-
import { homedir as
|
|
334832
|
-
import { dirname as dirname52, join as
|
|
334906
|
+
import { homedir as homedir32 } from "os";
|
|
334907
|
+
import { dirname as dirname52, join as join120 } from "path";
|
|
334833
334908
|
function configPath() {
|
|
334834
334909
|
const override = process.env.THEUS_PROVIDERS_CONFIG;
|
|
334835
334910
|
if (override)
|
|
334836
334911
|
return override;
|
|
334837
|
-
return
|
|
334912
|
+
return join120(homedir32(), CONFIG_DIR_NAME, "providers.json");
|
|
334838
334913
|
}
|
|
334839
334914
|
function ensureConfigDir(path17) {
|
|
334840
334915
|
const dir = dirname52(path17);
|
|
334841
|
-
if (!
|
|
334916
|
+
if (!existsSync12(dir))
|
|
334842
334917
|
mkdirSync8(dir, { recursive: true, mode: 448 });
|
|
334843
334918
|
else {
|
|
334844
334919
|
try {
|
|
@@ -334868,7 +334943,7 @@ function baseConfig() {
|
|
|
334868
334943
|
function loadProvidersConfig2() {
|
|
334869
334944
|
const path17 = configPath();
|
|
334870
334945
|
try {
|
|
334871
|
-
if (!
|
|
334946
|
+
if (!existsSync12(path17))
|
|
334872
334947
|
return baseConfig();
|
|
334873
334948
|
const parsed = JSON.parse(readFileSync19(path17, "utf8"));
|
|
334874
334949
|
if (!parsed || !Array.isArray(parsed.providers))
|
|
@@ -335019,7 +335094,7 @@ function upsertProvider(config3, entry) {
|
|
|
335019
335094
|
function saveProviderSetup(preset, options2 = {}) {
|
|
335020
335095
|
const path17 = configPath();
|
|
335021
335096
|
ensureConfigDir(path17);
|
|
335022
|
-
const existed =
|
|
335097
|
+
const existed = existsSync12(path17);
|
|
335023
335098
|
const current = loadProvidersConfig2();
|
|
335024
335099
|
const { entry, storage } = buildEntry(preset, options2);
|
|
335025
335100
|
let next = upsertProvider(current, entry);
|
|
@@ -335045,7 +335120,7 @@ function saveProviderSetup(preset, options2 = {}) {
|
|
|
335045
335120
|
}
|
|
335046
335121
|
function removeProvider(id) {
|
|
335047
335122
|
const path17 = configPath();
|
|
335048
|
-
if (!
|
|
335123
|
+
if (!existsSync12(path17))
|
|
335049
335124
|
return null;
|
|
335050
335125
|
ensureConfigDir(path17);
|
|
335051
335126
|
const current = loadProvidersConfig2();
|
|
@@ -335153,7 +335228,7 @@ var init_setupConfig = __esm(() => {
|
|
|
335153
335228
|
import { createServer as createServer6 } from "http";
|
|
335154
335229
|
import { createHash as createHash26, randomBytes as randomBytes16 } from "crypto";
|
|
335155
335230
|
import { mkdir as mkdir36, writeFile as writeFile39 } from "fs/promises";
|
|
335156
|
-
import { join as
|
|
335231
|
+
import { join as join121 } from "path";
|
|
335157
335232
|
function parseTheusWebLoginArgs(argv) {
|
|
335158
335233
|
const options2 = {};
|
|
335159
335234
|
for (let i3 = 0;i3 < argv.length; i3 += 1) {
|
|
@@ -335511,7 +335586,7 @@ async function installTheusSession(payload, webUrl) {
|
|
|
335511
335586
|
priority: 250,
|
|
335512
335587
|
enabled: true
|
|
335513
335588
|
});
|
|
335514
|
-
await writeFile39(
|
|
335589
|
+
await writeFile39(join121(configDir, "session.json"), JSON.stringify({
|
|
335515
335590
|
product: "Theus",
|
|
335516
335591
|
webUrl,
|
|
335517
335592
|
email: payload.email,
|
|
@@ -339748,7 +339823,7 @@ __export(exports_pluginStartupCheck, {
|
|
|
339748
339823
|
findMissingPlugins: () => findMissingPlugins,
|
|
339749
339824
|
checkEnabledPlugins: () => checkEnabledPlugins
|
|
339750
339825
|
});
|
|
339751
|
-
import { join as
|
|
339826
|
+
import { join as join122 } from "path";
|
|
339752
339827
|
async function checkEnabledPlugins() {
|
|
339753
339828
|
const settings = getInitialSettings();
|
|
339754
339829
|
const enabledPlugins = [];
|
|
@@ -339883,7 +339958,7 @@ async function installSelectedPlugins(pluginsToInstall, onProgress, scope = "use
|
|
|
339883
339958
|
} else {
|
|
339884
339959
|
registerPluginInstallation({
|
|
339885
339960
|
pluginId,
|
|
339886
|
-
installPath:
|
|
339961
|
+
installPath: join122(marketplaceInstallLocation, entry.source),
|
|
339887
339962
|
version: entry.version
|
|
339888
339963
|
}, scope, projectPath);
|
|
339889
339964
|
}
|
|
@@ -339915,7 +339990,7 @@ var init_pluginStartupCheck = __esm(() => {
|
|
|
339915
339990
|
});
|
|
339916
339991
|
|
|
339917
339992
|
// utils/plugins/parseMarketplaceInput.ts
|
|
339918
|
-
import { homedir as
|
|
339993
|
+
import { homedir as homedir33 } from "os";
|
|
339919
339994
|
import { resolve as resolve41 } from "path";
|
|
339920
339995
|
async function parseMarketplaceInput(input) {
|
|
339921
339996
|
const trimmed = input.trim();
|
|
@@ -339951,7 +340026,7 @@ async function parseMarketplaceInput(input) {
|
|
|
339951
340026
|
const isWindows2 = process.platform === "win32";
|
|
339952
340027
|
const isWindowsPath = isWindows2 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
|
|
339953
340028
|
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
|
|
339954
|
-
const resolvedPath = resolve41(trimmed.startsWith("~") ? trimmed.replace(/^~/,
|
|
340029
|
+
const resolvedPath = resolve41(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir33()) : trimmed);
|
|
339955
340030
|
let stats;
|
|
339956
340031
|
try {
|
|
339957
340032
|
stats = await fs4.stat(resolvedPath);
|
|
@@ -340203,9 +340278,9 @@ var init_AddMarketplace = __esm(() => {
|
|
|
340203
340278
|
// utils/plugins/installCounts.ts
|
|
340204
340279
|
import { randomBytes as randomBytes17 } from "crypto";
|
|
340205
340280
|
import { readFile as readFile40, rename as rename7, unlink as unlink16, writeFile as writeFile40 } from "fs/promises";
|
|
340206
|
-
import { join as
|
|
340281
|
+
import { join as join123 } from "path";
|
|
340207
340282
|
function getInstallCountsCachePath() {
|
|
340208
|
-
return
|
|
340283
|
+
return join123(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
340209
340284
|
}
|
|
340210
340285
|
async function loadInstallCountsCache() {
|
|
340211
340286
|
const cachePath2 = getInstallCountsCachePath();
|
|
@@ -342951,7 +343026,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
342951
343026
|
});
|
|
342952
343027
|
|
|
342953
343028
|
// services/plugins/pluginOperations.ts
|
|
342954
|
-
import { dirname as dirname53, join as
|
|
343029
|
+
import { dirname as dirname53, join as join124 } from "path";
|
|
342955
343030
|
function assertInstallableScope(scope) {
|
|
342956
343031
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
342957
343032
|
throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
|
|
@@ -343429,7 +343504,7 @@ async function performPluginUpdate({
|
|
|
343429
343504
|
throw e;
|
|
343430
343505
|
}
|
|
343431
343506
|
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname53(marketplaceInstallLocation);
|
|
343432
|
-
sourcePath =
|
|
343507
|
+
sourcePath = join124(marketplaceDir, entry.source);
|
|
343433
343508
|
try {
|
|
343434
343509
|
await fs4.stat(sourcePath);
|
|
343435
343510
|
} catch (e) {
|
|
@@ -343444,7 +343519,7 @@ async function performPluginUpdate({
|
|
|
343444
343519
|
throw e;
|
|
343445
343520
|
}
|
|
343446
343521
|
let pluginManifest;
|
|
343447
|
-
const manifestPath =
|
|
343522
|
+
const manifestPath = join124(sourcePath, ".theus-plugin", "plugin.json");
|
|
343448
343523
|
try {
|
|
343449
343524
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
343450
343525
|
} catch {}
|
|
@@ -344664,9 +344739,9 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
344664
344739
|
// utils/plugins/pluginFlagging.ts
|
|
344665
344740
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
344666
344741
|
import { readFile as readFile41, rename as rename8, unlink as unlink17, writeFile as writeFile41 } from "fs/promises";
|
|
344667
|
-
import { join as
|
|
344742
|
+
import { join as join125 } from "path";
|
|
344668
344743
|
function getFlaggedPluginsPath() {
|
|
344669
|
-
return
|
|
344744
|
+
return join125(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
344670
344745
|
}
|
|
344671
344746
|
function parsePluginsData(content) {
|
|
344672
344747
|
const parsed = jsonParse(content);
|
|
@@ -350690,9 +350765,9 @@ var init_providers3 = __esm(() => {
|
|
|
350690
350765
|
|
|
350691
350766
|
// utils/releaseNotes.ts
|
|
350692
350767
|
import { mkdir as mkdir37, readFile as readFile44, writeFile as writeFile42 } from "fs/promises";
|
|
350693
|
-
import { dirname as dirname55, join as
|
|
350768
|
+
import { dirname as dirname55, join as join128 } from "path";
|
|
350694
350769
|
function getChangelogCachePath() {
|
|
350695
|
-
return
|
|
350770
|
+
return join128(getTheusConfigHomeDir(), "cache", "changelog.md");
|
|
350696
350771
|
}
|
|
350697
350772
|
async function migrateChangelogFromConfig() {
|
|
350698
350773
|
const config3 = getGlobalConfig();
|
|
@@ -350810,9 +350885,9 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
350810
350885
|
return [];
|
|
350811
350886
|
}
|
|
350812
350887
|
}
|
|
350813
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.
|
|
350888
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
350814
350889
|
if (process.env.USER_TYPE === "ant") {
|
|
350815
|
-
const changelog = { VERSION: "0.1.
|
|
350890
|
+
const changelog = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION_CHANGELOG;
|
|
350816
350891
|
if (changelog) {
|
|
350817
350892
|
const commits = changelog.trim().split(`
|
|
350818
350893
|
`).filter(Boolean);
|
|
@@ -355006,7 +355081,7 @@ var init_Messages = __esm(() => {
|
|
|
355006
355081
|
let t1;
|
|
355007
355082
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
355008
355083
|
t1 = /* @__PURE__ */ jsx_runtime245.jsx(TheusBanner, {
|
|
355009
|
-
version: { VERSION: "0.1.
|
|
355084
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
355010
355085
|
});
|
|
355011
355086
|
$2[0] = t1;
|
|
355012
355087
|
} else {
|
|
@@ -369243,7 +369318,7 @@ __export(exports_thinkback, {
|
|
|
369243
369318
|
call: () => call38
|
|
369244
369319
|
});
|
|
369245
369320
|
import { readFile as readFile45 } from "fs/promises";
|
|
369246
|
-
import { join as
|
|
369321
|
+
import { join as join129 } from "path";
|
|
369247
369322
|
function getMarketplaceName() {
|
|
369248
369323
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
369249
369324
|
}
|
|
@@ -369261,15 +369336,15 @@ async function getThinkbackSkillDir() {
|
|
|
369261
369336
|
if (!thinkbackPlugin) {
|
|
369262
369337
|
return null;
|
|
369263
369338
|
}
|
|
369264
|
-
const skillDir =
|
|
369339
|
+
const skillDir = join129(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
369265
369340
|
if (await pathExists(skillDir)) {
|
|
369266
369341
|
return skillDir;
|
|
369267
369342
|
}
|
|
369268
369343
|
return null;
|
|
369269
369344
|
}
|
|
369270
369345
|
async function playAnimation(skillDir) {
|
|
369271
|
-
const dataPath =
|
|
369272
|
-
const playerPath =
|
|
369346
|
+
const dataPath = join129(skillDir, "year_in_review.js");
|
|
369347
|
+
const playerPath = join129(skillDir, "player.js");
|
|
369273
369348
|
try {
|
|
369274
369349
|
await readFile45(dataPath);
|
|
369275
369350
|
} catch (e) {
|
|
@@ -369317,7 +369392,7 @@ async function playAnimation(skillDir) {
|
|
|
369317
369392
|
} catch {} finally {
|
|
369318
369393
|
inkInstance.exitAlternateScreen();
|
|
369319
369394
|
}
|
|
369320
|
-
const htmlPath =
|
|
369395
|
+
const htmlPath = join129(skillDir, "year_in_review.html");
|
|
369321
369396
|
if (await pathExists(htmlPath)) {
|
|
369322
369397
|
const platform5 = getPlatform();
|
|
369323
369398
|
const openCmd = platform5 === "macos" ? "open" : platform5 === "windows" ? "start" : "xdg-open";
|
|
@@ -369653,7 +369728,7 @@ function ThinkbackFlow(t0) {
|
|
|
369653
369728
|
if (!skillDir) {
|
|
369654
369729
|
return;
|
|
369655
369730
|
}
|
|
369656
|
-
const dataPath =
|
|
369731
|
+
const dataPath = join129(skillDir, "year_in_review.js");
|
|
369657
369732
|
pathExists(dataPath).then((exists) => {
|
|
369658
369733
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
369659
369734
|
setHasGenerated(exists);
|
|
@@ -369827,7 +369902,7 @@ var exports_thinkback_play = {};
|
|
|
369827
369902
|
__export(exports_thinkback_play, {
|
|
369828
369903
|
call: () => call39
|
|
369829
369904
|
});
|
|
369830
|
-
import { join as
|
|
369905
|
+
import { join as join130 } from "path";
|
|
369831
369906
|
function getPluginId2() {
|
|
369832
369907
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
369833
369908
|
return `thinkback@${marketplaceName}`;
|
|
@@ -369849,7 +369924,7 @@ async function call39() {
|
|
|
369849
369924
|
value: "Thinkback plugin installation path not found."
|
|
369850
369925
|
};
|
|
369851
369926
|
}
|
|
369852
|
-
const skillDir =
|
|
369927
|
+
const skillDir = join130(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
369853
369928
|
const result = await playAnimation(skillDir);
|
|
369854
369929
|
return { type: "text", value: result.message };
|
|
369855
369930
|
}
|
|
@@ -376365,7 +376440,7 @@ var init_types13 = __esm(() => {
|
|
|
376365
376440
|
|
|
376366
376441
|
// components/agents/agentFileUtils.ts
|
|
376367
376442
|
import { mkdir as mkdir39, open as open12, unlink as unlink18 } from "fs/promises";
|
|
376368
|
-
import { join as
|
|
376443
|
+
import { join as join131 } from "path";
|
|
376369
376444
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
376370
376445
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
376371
376446
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -376392,26 +376467,26 @@ function getAgentDirectoryPath(location) {
|
|
|
376392
376467
|
case "flagSettings":
|
|
376393
376468
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
376394
376469
|
case "userSettings":
|
|
376395
|
-
return
|
|
376470
|
+
return join131(getTheusConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
376396
376471
|
case "projectSettings":
|
|
376397
|
-
return
|
|
376472
|
+
return join131(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
376398
376473
|
case "policySettings":
|
|
376399
|
-
return
|
|
376474
|
+
return join131(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
376400
376475
|
case "localSettings":
|
|
376401
|
-
return
|
|
376476
|
+
return join131(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
376402
376477
|
}
|
|
376403
376478
|
}
|
|
376404
376479
|
function getRelativeAgentDirectoryPath(location) {
|
|
376405
376480
|
switch (location) {
|
|
376406
376481
|
case "projectSettings":
|
|
376407
|
-
return
|
|
376482
|
+
return join131(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
376408
376483
|
default:
|
|
376409
376484
|
return getAgentDirectoryPath(location);
|
|
376410
376485
|
}
|
|
376411
376486
|
}
|
|
376412
376487
|
function getNewAgentFilePath(agent) {
|
|
376413
376488
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
376414
|
-
return
|
|
376489
|
+
return join131(dirPath, `${agent.agentType}.md`);
|
|
376415
376490
|
}
|
|
376416
376491
|
function getActualAgentFilePath(agent) {
|
|
376417
376492
|
if (agent.source === "built-in") {
|
|
@@ -376422,14 +376497,14 @@ function getActualAgentFilePath(agent) {
|
|
|
376422
376497
|
}
|
|
376423
376498
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
376424
376499
|
const filename = agent.filename || agent.agentType;
|
|
376425
|
-
return
|
|
376500
|
+
return join131(dirPath, `${filename}.md`);
|
|
376426
376501
|
}
|
|
376427
376502
|
function getNewRelativeAgentFilePath(agent) {
|
|
376428
376503
|
if (agent.source === "built-in") {
|
|
376429
376504
|
return "Built-in";
|
|
376430
376505
|
}
|
|
376431
376506
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
376432
|
-
return
|
|
376507
|
+
return join131(dirPath, `${agent.agentType}.md`);
|
|
376433
376508
|
}
|
|
376434
376509
|
function getActualRelativeAgentFilePath(agent) {
|
|
376435
376510
|
if (isBuiltInAgent(agent)) {
|
|
@@ -376443,7 +376518,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
376443
376518
|
}
|
|
376444
376519
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
376445
376520
|
const filename = agent.filename || agent.agentType;
|
|
376446
|
-
return
|
|
376521
|
+
return join131(dirPath, `${filename}.md`);
|
|
376447
376522
|
}
|
|
376448
376523
|
async function ensureAgentDirectoryExists(source) {
|
|
376449
376524
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -382456,7 +382531,7 @@ var init_rewind = __esm(() => {
|
|
|
382456
382531
|
// utils/heapDumpService.ts
|
|
382457
382532
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync6 } from "fs";
|
|
382458
382533
|
import { readdir as readdir27, readFile as readFile47, writeFile as writeFile44 } from "fs/promises";
|
|
382459
|
-
import { join as
|
|
382534
|
+
import { join as join132 } from "path";
|
|
382460
382535
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
382461
382536
|
import {
|
|
382462
382537
|
getHeapSnapshot,
|
|
@@ -382546,7 +382621,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
382546
382621
|
smapsRollup,
|
|
382547
382622
|
platform: process.platform,
|
|
382548
382623
|
nodeVersion: process.version,
|
|
382549
|
-
ccVersion: { VERSION: "0.1.
|
|
382624
|
+
ccVersion: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
382550
382625
|
};
|
|
382551
382626
|
}
|
|
382552
382627
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -382564,8 +382639,8 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
382564
382639
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
382565
382640
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
382566
382641
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
382567
|
-
const heapPath =
|
|
382568
|
-
const diagPath =
|
|
382642
|
+
const heapPath = join132(dumpDir, heapFilename);
|
|
382643
|
+
const diagPath = join132(dumpDir, diagFilename);
|
|
382569
382644
|
await writeFile44(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
382570
382645
|
mode: 384
|
|
382571
382646
|
});
|
|
@@ -383132,7 +383207,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
383132
383207
|
var call54 = async () => {
|
|
383133
383208
|
return {
|
|
383134
383209
|
type: "text",
|
|
383135
|
-
value: { VERSION: "0.1.
|
|
383210
|
+
value: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME ? `${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (built ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME})` : { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
383136
383211
|
};
|
|
383137
383212
|
}, version2, version_default;
|
|
383138
383213
|
var init_version = __esm(() => {
|
|
@@ -384498,7 +384573,7 @@ var init_advisor2 = __esm(() => {
|
|
|
384498
384573
|
// skills/bundledSkills.ts
|
|
384499
384574
|
import { constants as fsConstants5 } from "fs";
|
|
384500
384575
|
import { mkdir as mkdir40, open as open13 } from "fs/promises";
|
|
384501
|
-
import { dirname as dirname56, isAbsolute as isAbsolute24, join as
|
|
384576
|
+
import { dirname as dirname56, isAbsolute as isAbsolute24, join as join133, normalize as normalize12, sep as pathSep2 } from "path";
|
|
384502
384577
|
function registerBundledSkill(definition) {
|
|
384503
384578
|
const { files: files2 } = definition;
|
|
384504
384579
|
let skillRoot;
|
|
@@ -384546,7 +384621,7 @@ function getBundledSkills() {
|
|
|
384546
384621
|
return [...bundledSkills];
|
|
384547
384622
|
}
|
|
384548
384623
|
function getBundledSkillExtractDir(skillName) {
|
|
384549
|
-
return
|
|
384624
|
+
return join133(getBundledSkillsRoot(), skillName);
|
|
384550
384625
|
}
|
|
384551
384626
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
384552
384627
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -384588,7 +384663,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
384588
384663
|
if (isAbsolute24(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
384589
384664
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
384590
384665
|
}
|
|
384591
|
-
return
|
|
384666
|
+
return join133(baseDir, normalized);
|
|
384592
384667
|
}
|
|
384593
384668
|
function prependBaseDir(blocks, baseDir) {
|
|
384594
384669
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -384949,7 +385024,7 @@ var init_exit2 = __esm(() => {
|
|
|
384949
385024
|
});
|
|
384950
385025
|
|
|
384951
385026
|
// components/ExportDialog.tsx
|
|
384952
|
-
import { join as
|
|
385027
|
+
import { join as join134 } from "path";
|
|
384953
385028
|
function ExportDialog({
|
|
384954
385029
|
content,
|
|
384955
385030
|
defaultFilename,
|
|
@@ -384982,7 +385057,7 @@ function ExportDialog({
|
|
|
384982
385057
|
};
|
|
384983
385058
|
const handleFilenameSubmit = () => {
|
|
384984
385059
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
384985
|
-
const filepath =
|
|
385060
|
+
const filepath = join134(getCwd(), finalFilename);
|
|
384986
385061
|
try {
|
|
384987
385062
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
384988
385063
|
encoding: "utf-8",
|
|
@@ -385205,7 +385280,7 @@ __export(exports_export, {
|
|
|
385205
385280
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
385206
385281
|
call: () => call58
|
|
385207
385282
|
});
|
|
385208
|
-
import { join as
|
|
385283
|
+
import { join as join135 } from "path";
|
|
385209
385284
|
function formatTimestamp(date6) {
|
|
385210
385285
|
const year = date6.getFullYear();
|
|
385211
385286
|
const month = String(date6.getMonth() + 1).padStart(2, "0");
|
|
@@ -385249,7 +385324,7 @@ async function call58(onDone, context3, args) {
|
|
|
385249
385324
|
const filename = args.trim();
|
|
385250
385325
|
if (filename) {
|
|
385251
385326
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
385252
|
-
const filepath =
|
|
385327
|
+
const filepath = join135(getCwd(), finalFilename);
|
|
385253
385328
|
try {
|
|
385254
385329
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
385255
385330
|
encoding: "utf-8",
|
|
@@ -385302,10 +385377,10 @@ var init_export2 = __esm(() => {
|
|
|
385302
385377
|
});
|
|
385303
385378
|
|
|
385304
385379
|
// services/providers/sessionCatalog.ts
|
|
385305
|
-
import { existsSync as
|
|
385380
|
+
import { existsSync as existsSync13, readFileSync as readFileSync20 } from "fs";
|
|
385306
385381
|
function loadConfig2() {
|
|
385307
385382
|
const path19 = defaultProvidersConfigPath();
|
|
385308
|
-
if (!
|
|
385383
|
+
if (!existsSync13(path19))
|
|
385309
385384
|
return null;
|
|
385310
385385
|
try {
|
|
385311
385386
|
const parsed = JSON.parse(readFileSync20(path19, "utf8"));
|
|
@@ -386867,7 +386942,7 @@ __export(exports_update, {
|
|
|
386867
386942
|
});
|
|
386868
386943
|
async function update() {
|
|
386869
386944
|
logEvent("tengu_update_check", {});
|
|
386870
|
-
writeToStdout(`Current version: ${{ VERSION: "0.1.
|
|
386945
|
+
writeToStdout(`Current version: ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
386871
386946
|
`);
|
|
386872
386947
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
386873
386948
|
writeToStdout(`Checking for updates to ${channel2} version...
|
|
@@ -386942,8 +387017,8 @@ async function update() {
|
|
|
386942
387017
|
writeToStdout(`Theus is managed by Homebrew.
|
|
386943
387018
|
`);
|
|
386944
387019
|
const latest = await getLatestVersion(channel2);
|
|
386945
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
386946
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
387020
|
+
if (latest && !gte({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
387021
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
386947
387022
|
`);
|
|
386948
387023
|
writeToStdout(`
|
|
386949
387024
|
`);
|
|
@@ -386959,8 +387034,8 @@ async function update() {
|
|
|
386959
387034
|
writeToStdout(`Theus is managed by winget.
|
|
386960
387035
|
`);
|
|
386961
387036
|
const latest = await getLatestVersion(channel2);
|
|
386962
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
386963
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
387037
|
+
if (latest && !gte({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
387038
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
386964
387039
|
`);
|
|
386965
387040
|
writeToStdout(`
|
|
386966
387041
|
`);
|
|
@@ -386976,8 +387051,8 @@ async function update() {
|
|
|
386976
387051
|
writeToStdout(`Theus is managed by apk.
|
|
386977
387052
|
`);
|
|
386978
387053
|
const latest = await getLatestVersion(channel2);
|
|
386979
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
386980
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
387054
|
+
if (latest && !gte({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
387055
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
386981
387056
|
`);
|
|
386982
387057
|
writeToStdout(`
|
|
386983
387058
|
`);
|
|
@@ -387042,11 +387117,11 @@ async function update() {
|
|
|
387042
387117
|
`);
|
|
387043
387118
|
await gracefulShutdown(1);
|
|
387044
387119
|
}
|
|
387045
|
-
if (result.latestVersion === { VERSION: "0.1.
|
|
387046
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
387120
|
+
if (result.latestVersion === { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
387121
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
387047
387122
|
`);
|
|
387048
387123
|
} else {
|
|
387049
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
387124
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${result.latestVersion}`) + `
|
|
387050
387125
|
`);
|
|
387051
387126
|
await regenerateCompletionCache();
|
|
387052
387127
|
}
|
|
@@ -387065,9 +387140,9 @@ async function update() {
|
|
|
387065
387140
|
await removeInstalledSymlink();
|
|
387066
387141
|
}
|
|
387067
387142
|
logForDebugging("update: Checking npm registry for latest version");
|
|
387068
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.
|
|
387143
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
387069
387144
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
387070
|
-
const npmCommand = `npm view ${{ VERSION: "0.1.
|
|
387145
|
+
const npmCommand = `npm view ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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`;
|
|
387071
387146
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
387072
387147
|
const latestVersion = await getLatestVersion(channel2);
|
|
387073
387148
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -387087,7 +387162,7 @@ async function update() {
|
|
|
387087
387162
|
`);
|
|
387088
387163
|
process.stderr.write(` \u2022 Corporate proxy/firewall blocking npm
|
|
387089
387164
|
`);
|
|
387090
|
-
if ({ VERSION: "0.1.
|
|
387165
|
+
if ({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && !{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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")) {
|
|
387091
387166
|
process.stderr.write(` \u2022 Internal/development build not published to npm
|
|
387092
387167
|
`);
|
|
387093
387168
|
}
|
|
@@ -387099,19 +387174,19 @@ async function update() {
|
|
|
387099
387174
|
`);
|
|
387100
387175
|
process.stderr.write(` \u2022 Run with --debug flag for more details
|
|
387101
387176
|
`);
|
|
387102
|
-
const packageName = { VERSION: "0.1.
|
|
387177
|
+
const packageName = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL || (process.env.USER_TYPE === "ant" ? "@theus-ai/theus-cli" : "@theus-ai/theus-code");
|
|
387103
387178
|
process.stderr.write(` \u2022 Manually check: npm view ${packageName} version
|
|
387104
387179
|
`);
|
|
387105
387180
|
process.stderr.write(` \u2022 Check if you need to login: npm whoami
|
|
387106
387181
|
`);
|
|
387107
387182
|
await gracefulShutdown(1);
|
|
387108
387183
|
}
|
|
387109
|
-
if (gte({ VERSION: "0.1.
|
|
387110
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
387184
|
+
if (gte({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
387185
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
387111
387186
|
`);
|
|
387112
387187
|
await gracefulShutdown(0);
|
|
387113
387188
|
}
|
|
387114
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.
|
|
387189
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
387115
387190
|
`);
|
|
387116
387191
|
writeToStdout(`Installing update...
|
|
387117
387192
|
`);
|
|
@@ -387156,7 +387231,7 @@ async function update() {
|
|
|
387156
387231
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
387157
387232
|
switch (status2) {
|
|
387158
387233
|
case "success":
|
|
387159
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
387234
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} to version ${latestVersion}`) + `
|
|
387160
387235
|
`);
|
|
387161
387236
|
await regenerateCompletionCache();
|
|
387162
387237
|
break;
|
|
@@ -387166,7 +387241,7 @@ async function update() {
|
|
|
387166
387241
|
if (useLocalUpdate) {
|
|
387167
387242
|
process.stderr.write(`Try manually updating with:
|
|
387168
387243
|
`);
|
|
387169
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
387244
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387170
387245
|
`);
|
|
387171
387246
|
} else {
|
|
387172
387247
|
process.stderr.write(`Try running with sudo or fix npm permissions
|
|
@@ -387182,7 +387257,7 @@ async function update() {
|
|
|
387182
387257
|
if (useLocalUpdate) {
|
|
387183
387258
|
process.stderr.write(`Try manually updating with:
|
|
387184
387259
|
`);
|
|
387185
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
387260
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387186
387261
|
`);
|
|
387187
387262
|
} else {
|
|
387188
387263
|
process.stderr.write(`Or consider using native installation with: theus install
|
|
@@ -387879,7 +387954,7 @@ var require_asciichart = __commonJS((exports) => {
|
|
|
387879
387954
|
// utils/statsCache.ts
|
|
387880
387955
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
387881
387956
|
import { open as open14 } from "fs/promises";
|
|
387882
|
-
import { join as
|
|
387957
|
+
import { join as join136 } from "path";
|
|
387883
387958
|
async function withStatsCacheLock(fn) {
|
|
387884
387959
|
while (statsCacheLockPromise) {
|
|
387885
387960
|
await statsCacheLockPromise;
|
|
@@ -387896,7 +387971,7 @@ async function withStatsCacheLock(fn) {
|
|
|
387896
387971
|
}
|
|
387897
387972
|
}
|
|
387898
387973
|
function getStatsCachePath() {
|
|
387899
|
-
return
|
|
387974
|
+
return join136(getTheusConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
387900
387975
|
}
|
|
387901
387976
|
function getEmptyCache() {
|
|
387902
387977
|
return {
|
|
@@ -388564,12 +388639,12 @@ var init_ansiToPng = __esm(() => {
|
|
|
388564
388639
|
// utils/screenshotClipboard.ts
|
|
388565
388640
|
import { mkdir as mkdir41, unlink as unlink19, writeFile as writeFile45 } from "fs/promises";
|
|
388566
388641
|
import { tmpdir as tmpdir8 } from "os";
|
|
388567
|
-
import { join as
|
|
388642
|
+
import { join as join137 } from "path";
|
|
388568
388643
|
async function copyAnsiToClipboard(ansiText, options2) {
|
|
388569
388644
|
try {
|
|
388570
|
-
const tempDir =
|
|
388645
|
+
const tempDir = join137(tmpdir8(), "theus-code-screenshots");
|
|
388571
388646
|
await mkdir41(tempDir, { recursive: true });
|
|
388572
|
-
const pngPath =
|
|
388647
|
+
const pngPath = join137(tempDir, `screenshot-${Date.now()}.png`);
|
|
388573
388648
|
const pngBuffer = ansiToPng(ansiText, options2);
|
|
388574
388649
|
await writeFile45(pngPath, pngBuffer);
|
|
388575
388650
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -388640,7 +388715,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
388640
388715
|
|
|
388641
388716
|
// utils/stats.ts
|
|
388642
388717
|
import { open as open15 } from "fs/promises";
|
|
388643
|
-
import { basename as basename40, join as
|
|
388718
|
+
import { basename as basename40, join as join138, sep as sep31 } from "path";
|
|
388644
388719
|
async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
388645
388720
|
const { fromDate, toDate } = options2;
|
|
388646
388721
|
const fs5 = getFsImplementation();
|
|
@@ -388818,17 +388893,17 @@ async function getAllSessionFiles() {
|
|
|
388818
388893
|
return [];
|
|
388819
388894
|
throw e;
|
|
388820
388895
|
}
|
|
388821
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
388896
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join138(projectsDir, dirent.name));
|
|
388822
388897
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
388823
388898
|
try {
|
|
388824
388899
|
const entries = await fs5.readdir(projectDir);
|
|
388825
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
388900
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join138(projectDir, dirent.name));
|
|
388826
388901
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
388827
388902
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
388828
|
-
const subagentsDir =
|
|
388903
|
+
const subagentsDir = join138(projectDir, sessionDir.name, "subagents");
|
|
388829
388904
|
try {
|
|
388830
388905
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
388831
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
388906
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join138(subagentsDir, dirent.name));
|
|
388832
388907
|
} catch {
|
|
388833
388908
|
return [];
|
|
388834
388909
|
}
|
|
@@ -391254,7 +391329,7 @@ import {
|
|
|
391254
391329
|
unlink as unlink20,
|
|
391255
391330
|
writeFile as writeFile46
|
|
391256
391331
|
} from "fs/promises";
|
|
391257
|
-
import { basename as basename41, dirname as dirname58, join as
|
|
391332
|
+
import { basename as basename41, dirname as dirname58, join as join139 } from "path";
|
|
391258
391333
|
function isTranscriptMessage(entry) {
|
|
391259
391334
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
391260
391335
|
}
|
|
@@ -391268,18 +391343,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
391268
391343
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
391269
391344
|
}
|
|
391270
391345
|
function getProjectsDir2() {
|
|
391271
|
-
return
|
|
391346
|
+
return join139(getTheusConfigHomeDir(), "projects");
|
|
391272
391347
|
}
|
|
391273
391348
|
function getTranscriptPath() {
|
|
391274
391349
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
391275
|
-
return
|
|
391350
|
+
return join139(projectDir, `${getSessionId()}.jsonl`);
|
|
391276
391351
|
}
|
|
391277
391352
|
function getTranscriptPathForSession(sessionId) {
|
|
391278
391353
|
if (sessionId === getSessionId()) {
|
|
391279
391354
|
return getTranscriptPath();
|
|
391280
391355
|
}
|
|
391281
391356
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
391282
|
-
return
|
|
391357
|
+
return join139(projectDir, `${sessionId}.jsonl`);
|
|
391283
391358
|
}
|
|
391284
391359
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
391285
391360
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -391291,8 +391366,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
391291
391366
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
391292
391367
|
const sessionId = getSessionId();
|
|
391293
391368
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
391294
|
-
const base2 = subdir ?
|
|
391295
|
-
return
|
|
391369
|
+
const base2 = subdir ? join139(projectDir, sessionId, "subagents", subdir) : join139(projectDir, sessionId, "subagents");
|
|
391370
|
+
return join139(base2, `agent-${agentId}.jsonl`);
|
|
391296
391371
|
}
|
|
391297
391372
|
function getAgentMetadataPath(agentId) {
|
|
391298
391373
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -391315,10 +391390,10 @@ async function readAgentMetadata(agentId) {
|
|
|
391315
391390
|
}
|
|
391316
391391
|
function getRemoteAgentsDir() {
|
|
391317
391392
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
391318
|
-
return
|
|
391393
|
+
return join139(projectDir, getSessionId(), "remote-agents");
|
|
391319
391394
|
}
|
|
391320
391395
|
function getRemoteAgentMetadataPath(taskId) {
|
|
391321
|
-
return
|
|
391396
|
+
return join139(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
391322
391397
|
}
|
|
391323
391398
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
391324
391399
|
const path19 = getRemoteAgentMetadataPath(taskId);
|
|
@@ -391361,7 +391436,7 @@ async function listRemoteAgentMetadata() {
|
|
|
391361
391436
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
391362
391437
|
continue;
|
|
391363
391438
|
try {
|
|
391364
|
-
const raw = await readFile48(
|
|
391439
|
+
const raw = await readFile48(join139(dir, entry.name), "utf-8");
|
|
391365
391440
|
results.push(JSON.parse(raw));
|
|
391366
391441
|
} catch (e) {
|
|
391367
391442
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -391371,7 +391446,7 @@ async function listRemoteAgentMetadata() {
|
|
|
391371
391446
|
}
|
|
391372
391447
|
function sessionIdExists(sessionId) {
|
|
391373
391448
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
391374
|
-
const sessionFile =
|
|
391449
|
+
const sessionFile = join139(projectDir, `${sessionId}.jsonl`);
|
|
391375
391450
|
const fs5 = getFsImplementation();
|
|
391376
391451
|
try {
|
|
391377
391452
|
fs5.statSync(sessionFile);
|
|
@@ -393340,7 +393415,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
393340
393415
|
};
|
|
393341
393416
|
}
|
|
393342
393417
|
async function loadSessionFile(sessionId) {
|
|
393343
|
-
const sessionFile =
|
|
393418
|
+
const sessionFile = join139(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
393344
393419
|
return loadTranscriptFile(sessionFile);
|
|
393345
393420
|
}
|
|
393346
393421
|
function clearSessionMessagesCache() {
|
|
@@ -393408,7 +393483,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
393408
393483
|
} catch {
|
|
393409
393484
|
return [];
|
|
393410
393485
|
}
|
|
393411
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
393486
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join139(projectsDir, dirent.name));
|
|
393412
393487
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
393413
393488
|
const allLogs = logsPerProject.flat();
|
|
393414
393489
|
const deduped = new Map;
|
|
@@ -393433,7 +393508,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
393433
393508
|
} catch {
|
|
393434
393509
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
393435
393510
|
}
|
|
393436
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
393511
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join139(projectsDir, dirent.name));
|
|
393437
393512
|
const rawLogs = [];
|
|
393438
393513
|
for (const projectDir of projectDirs) {
|
|
393439
393514
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -393494,7 +393569,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
393494
393569
|
for (const { path: wtPath, prefix } of indexed) {
|
|
393495
393570
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
393496
393571
|
seenDirs.add(dirName);
|
|
393497
|
-
allLogs.push(...await getSessionFilesLite(
|
|
393572
|
+
allLogs.push(...await getSessionFilesLite(join139(projectsDir, dirent.name), undefined, wtPath));
|
|
393498
393573
|
break;
|
|
393499
393574
|
}
|
|
393500
393575
|
}
|
|
@@ -393563,7 +393638,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
393563
393638
|
return transcripts;
|
|
393564
393639
|
}
|
|
393565
393640
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
393566
|
-
const subagentsDir =
|
|
393641
|
+
const subagentsDir = join139(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
393567
393642
|
let entries;
|
|
393568
393643
|
try {
|
|
393569
393644
|
entries = await readdir28(subagentsDir, { withFileTypes: true });
|
|
@@ -393691,7 +393766,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
393691
393766
|
const sessionId = validateUuid2(basename41(dirent.name, ".jsonl"));
|
|
393692
393767
|
if (!sessionId)
|
|
393693
393768
|
continue;
|
|
393694
|
-
candidates.push({ sessionId, filePath:
|
|
393769
|
+
candidates.push({ sessionId, filePath: join139(projectDir, dirent.name) });
|
|
393695
393770
|
}
|
|
393696
393771
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
393697
393772
|
try {
|
|
@@ -394077,7 +394152,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
394077
394152
|
init_settings2();
|
|
394078
394153
|
init_slowOperations();
|
|
394079
394154
|
init_uuid();
|
|
394080
|
-
VERSION4 = { VERSION: "0.1.
|
|
394155
|
+
VERSION4 = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
394081
394156
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
394082
394157
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
394083
394158
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -394089,7 +394164,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
394089
394164
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
394090
394165
|
agentTranscriptSubdirs = new Map;
|
|
394091
394166
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
394092
|
-
return
|
|
394167
|
+
return join139(getProjectsDir2(), sanitizePath2(projectDir));
|
|
394093
394168
|
});
|
|
394094
394169
|
METADATA_TYPE_MARKERS = [
|
|
394095
394170
|
'"type":"summary"',
|
|
@@ -394327,41 +394402,41 @@ var init_memdir = __esm(() => {
|
|
|
394327
394402
|
});
|
|
394328
394403
|
|
|
394329
394404
|
// tools/AgentTool/agentMemory.ts
|
|
394330
|
-
import { join as
|
|
394405
|
+
import { join as join140, normalize as normalize13, sep as sep32 } from "path";
|
|
394331
394406
|
function sanitizeAgentTypeForPath(agentType) {
|
|
394332
394407
|
return agentType.replace(/:/g, "-");
|
|
394333
394408
|
}
|
|
394334
394409
|
function getLocalAgentMemoryDir(dirName) {
|
|
394335
394410
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
394336
|
-
return
|
|
394411
|
+
return join140(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep32;
|
|
394337
394412
|
}
|
|
394338
|
-
return
|
|
394413
|
+
return join140(getCwd(), ".theus", "agent-memory-local", dirName) + sep32;
|
|
394339
394414
|
}
|
|
394340
394415
|
function getAgentMemoryDir(agentType, scope) {
|
|
394341
394416
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
394342
394417
|
switch (scope) {
|
|
394343
394418
|
case "project":
|
|
394344
|
-
return
|
|
394419
|
+
return join140(getCwd(), ".theus", "agent-memory", dirName) + sep32;
|
|
394345
394420
|
case "local":
|
|
394346
394421
|
return getLocalAgentMemoryDir(dirName);
|
|
394347
394422
|
case "user":
|
|
394348
|
-
return
|
|
394423
|
+
return join140(getMemoryBaseDir(), "agent-memory", dirName) + sep32;
|
|
394349
394424
|
}
|
|
394350
394425
|
}
|
|
394351
394426
|
function isAgentMemoryPath(absolutePath) {
|
|
394352
394427
|
const normalizedPath = normalize13(absolutePath);
|
|
394353
394428
|
const memoryBase = getMemoryBaseDir();
|
|
394354
|
-
if (normalizedPath.startsWith(
|
|
394429
|
+
if (normalizedPath.startsWith(join140(memoryBase, "agent-memory") + sep32)) {
|
|
394355
394430
|
return true;
|
|
394356
394431
|
}
|
|
394357
|
-
if (normalizedPath.startsWith(
|
|
394432
|
+
if (normalizedPath.startsWith(join140(getCwd(), ".theus", "agent-memory") + sep32)) {
|
|
394358
394433
|
return true;
|
|
394359
394434
|
}
|
|
394360
394435
|
if (process.env.THEUS_CODE_REMOTE_MEMORY_DIR) {
|
|
394361
|
-
if (normalizedPath.includes(sep32 + "agent-memory-local" + sep32) && normalizedPath.startsWith(
|
|
394436
|
+
if (normalizedPath.includes(sep32 + "agent-memory-local" + sep32) && normalizedPath.startsWith(join140(process.env.THEUS_CODE_REMOTE_MEMORY_DIR, "projects") + sep32)) {
|
|
394362
394437
|
return true;
|
|
394363
394438
|
}
|
|
394364
|
-
} else if (normalizedPath.startsWith(
|
|
394439
|
+
} else if (normalizedPath.startsWith(join140(getCwd(), ".theus", "agent-memory-local") + sep32)) {
|
|
394365
394440
|
return true;
|
|
394366
394441
|
}
|
|
394367
394442
|
return false;
|
|
@@ -394369,7 +394444,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
394369
394444
|
function getMemoryScopeDisplay(memory2) {
|
|
394370
394445
|
switch (memory2) {
|
|
394371
394446
|
case "user":
|
|
394372
|
-
return `User (${
|
|
394447
|
+
return `User (${join140(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
394373
394448
|
case "project":
|
|
394374
394449
|
return "Project (.theus/agent-memory/)";
|
|
394375
394450
|
case "local":
|
|
@@ -394411,8 +394486,8 @@ var init_agentMemory = __esm(() => {
|
|
|
394411
394486
|
|
|
394412
394487
|
// utils/permissions/filesystem.ts
|
|
394413
394488
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
394414
|
-
import { homedir as
|
|
394415
|
-
import { join as
|
|
394489
|
+
import { homedir as homedir34, tmpdir as tmpdir9 } from "os";
|
|
394490
|
+
import { join as join141, normalize as normalize14, posix as posix8, sep as sep33 } from "path";
|
|
394416
394491
|
function normalizeCaseForComparison(path19) {
|
|
394417
394492
|
return path19.toLowerCase();
|
|
394418
394493
|
}
|
|
@@ -394421,11 +394496,11 @@ function getTheusSkillScope(filePath) {
|
|
|
394421
394496
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
394422
394497
|
const bases = [
|
|
394423
394498
|
{
|
|
394424
|
-
dir: expandPath(
|
|
394499
|
+
dir: expandPath(join141(getOriginalCwd(), ".theus", "skills")),
|
|
394425
394500
|
prefix: "/.theus/skills/"
|
|
394426
394501
|
},
|
|
394427
394502
|
{
|
|
394428
|
-
dir: expandPath(
|
|
394503
|
+
dir: expandPath(join141(homedir34(), ".theus", "skills")),
|
|
394429
394504
|
prefix: "~/.theus/skills/"
|
|
394430
394505
|
}
|
|
394431
394506
|
];
|
|
@@ -394480,21 +394555,21 @@ function isTheusConfigFilePath(filePath) {
|
|
|
394480
394555
|
if (isTheusSettingsPath(filePath)) {
|
|
394481
394556
|
return true;
|
|
394482
394557
|
}
|
|
394483
|
-
const commandsDir =
|
|
394484
|
-
const agentsDir =
|
|
394485
|
-
const skillsDir =
|
|
394558
|
+
const commandsDir = join141(getOriginalCwd(), ".theus", "commands");
|
|
394559
|
+
const agentsDir = join141(getOriginalCwd(), ".theus", "agents");
|
|
394560
|
+
const skillsDir = join141(getOriginalCwd(), ".theus", "skills");
|
|
394486
394561
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
394487
394562
|
}
|
|
394488
394563
|
function isSessionPlanFile(absolutePath) {
|
|
394489
|
-
const expectedPrefix =
|
|
394564
|
+
const expectedPrefix = join141(getPlansDirectory(), getPlanSlug());
|
|
394490
394565
|
const normalizedPath = normalize14(absolutePath);
|
|
394491
394566
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
394492
394567
|
}
|
|
394493
394568
|
function getSessionMemoryDir() {
|
|
394494
|
-
return
|
|
394569
|
+
return join141(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep33;
|
|
394495
394570
|
}
|
|
394496
394571
|
function getSessionMemoryPath() {
|
|
394497
|
-
return
|
|
394572
|
+
return join141(getSessionMemoryDir(), "summary.md");
|
|
394498
394573
|
}
|
|
394499
394574
|
function isSessionMemoryPath(absolutePath) {
|
|
394500
394575
|
const normalizedPath = normalize14(absolutePath);
|
|
@@ -394516,10 +394591,10 @@ function getTheusTempDirName() {
|
|
|
394516
394591
|
return `theus-${uid}`;
|
|
394517
394592
|
}
|
|
394518
394593
|
function getProjectTempDir() {
|
|
394519
|
-
return
|
|
394594
|
+
return join141(getTheusTempDir(), sanitizePath2(getOriginalCwd())) + sep33;
|
|
394520
394595
|
}
|
|
394521
394596
|
function getScratchpadDir() {
|
|
394522
|
-
return
|
|
394597
|
+
return join141(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
394523
394598
|
}
|
|
394524
394599
|
async function ensureScratchpadDir() {
|
|
394525
394600
|
if (!isScratchpadEnabled()) {
|
|
@@ -394739,7 +394814,7 @@ function patternWithRoot(pattern, source) {
|
|
|
394739
394814
|
} else if (pattern.startsWith(`~${DIR_SEP}`)) {
|
|
394740
394815
|
return {
|
|
394741
394816
|
relativePattern: pattern.slice(1),
|
|
394742
|
-
root:
|
|
394817
|
+
root: homedir34().normalize("NFC")
|
|
394743
394818
|
};
|
|
394744
394819
|
} else if (pattern.startsWith(DIR_SEP)) {
|
|
394745
394820
|
return {
|
|
@@ -395097,7 +395172,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
395097
395172
|
}
|
|
395098
395173
|
};
|
|
395099
395174
|
}
|
|
395100
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
395175
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join141(getOriginalCwd(), ".theus", "launch.json"))) {
|
|
395101
395176
|
return {
|
|
395102
395177
|
behavior: "allow",
|
|
395103
395178
|
updatedInput: input,
|
|
@@ -395194,7 +395269,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
395194
395269
|
}
|
|
395195
395270
|
};
|
|
395196
395271
|
}
|
|
395197
|
-
const tasksDir =
|
|
395272
|
+
const tasksDir = join141(getTheusConfigHomeDir(), "tasks") + sep33;
|
|
395198
395273
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
395199
395274
|
return {
|
|
395200
395275
|
behavior: "allow",
|
|
@@ -395205,7 +395280,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
395205
395280
|
}
|
|
395206
395281
|
};
|
|
395207
395282
|
}
|
|
395208
|
-
const teamsReadDir =
|
|
395283
|
+
const teamsReadDir = join141(getTheusConfigHomeDir(), "teams") + sep33;
|
|
395209
395284
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
395210
395285
|
return {
|
|
395211
395286
|
behavior: "allow",
|
|
@@ -395278,11 +395353,11 @@ var init_filesystem = __esm(() => {
|
|
|
395278
395353
|
try {
|
|
395279
395354
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
395280
395355
|
} catch {}
|
|
395281
|
-
return
|
|
395356
|
+
return join141(resolvedBaseTmpDir, getTheusTempDirName()) + sep33;
|
|
395282
395357
|
});
|
|
395283
395358
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
395284
395359
|
const nonce = randomBytes20(16).toString("hex");
|
|
395285
|
-
return
|
|
395360
|
+
return join141(getTheusTempDir(), "bundled-skills", { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
395286
395361
|
});
|
|
395287
395362
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
395288
395363
|
});
|
|
@@ -395296,10 +395371,10 @@ import {
|
|
|
395296
395371
|
symlink as symlink4,
|
|
395297
395372
|
unlink as unlink21
|
|
395298
395373
|
} from "fs/promises";
|
|
395299
|
-
import { join as
|
|
395374
|
+
import { join as join142 } from "path";
|
|
395300
395375
|
function getTaskOutputDir() {
|
|
395301
395376
|
if (_taskOutputDir === undefined) {
|
|
395302
|
-
_taskOutputDir =
|
|
395377
|
+
_taskOutputDir = join142(getProjectTempDir(), getSessionId(), "tasks");
|
|
395303
395378
|
}
|
|
395304
395379
|
return _taskOutputDir;
|
|
395305
395380
|
}
|
|
@@ -395307,7 +395382,7 @@ async function ensureOutputDir() {
|
|
|
395307
395382
|
await mkdir43(getTaskOutputDir(), { recursive: true });
|
|
395308
395383
|
}
|
|
395309
395384
|
function getTaskOutputPath(taskId) {
|
|
395310
|
-
return
|
|
395385
|
+
return join142(getTaskOutputDir(), `${taskId}.output`);
|
|
395311
395386
|
}
|
|
395312
395387
|
function track(p) {
|
|
395313
395388
|
_pendingOps.add(p);
|
|
@@ -399575,7 +399650,7 @@ import {
|
|
|
399575
399650
|
symlink as symlink5,
|
|
399576
399651
|
utimes as utimes2
|
|
399577
399652
|
} from "fs/promises";
|
|
399578
|
-
import { basename as basename43, dirname as dirname59, join as
|
|
399653
|
+
import { basename as basename43, dirname as dirname59, join as join143 } from "path";
|
|
399579
399654
|
function validateWorktreeSlug(slug) {
|
|
399580
399655
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
399581
399656
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -399598,8 +399673,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
399598
399673
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
399599
399674
|
continue;
|
|
399600
399675
|
}
|
|
399601
|
-
const sourcePath =
|
|
399602
|
-
const destPath =
|
|
399676
|
+
const sourcePath = join143(repoRootPath, dir);
|
|
399677
|
+
const destPath = join143(worktreePath, dir);
|
|
399603
399678
|
try {
|
|
399604
399679
|
await symlink5(sourcePath, destPath, "dir");
|
|
399605
399680
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -399623,7 +399698,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
399623
399698
|
return combined.replace(/[/.]/g, "_");
|
|
399624
399699
|
}
|
|
399625
399700
|
function worktreesDir(repoRoot) {
|
|
399626
|
-
return
|
|
399701
|
+
return join143(repoRoot, ".theus", "worktrees");
|
|
399627
399702
|
}
|
|
399628
399703
|
function flattenSlug(slug) {
|
|
399629
399704
|
return slug.replaceAll("/", "+");
|
|
@@ -399632,7 +399707,7 @@ function worktreeBranchName(slug) {
|
|
|
399632
399707
|
return `worktree-${flattenSlug(slug)}`;
|
|
399633
399708
|
}
|
|
399634
399709
|
function worktreePathFor(repoRoot, slug) {
|
|
399635
|
-
return
|
|
399710
|
+
return join143(worktreesDir(repoRoot), flattenSlug(slug));
|
|
399636
399711
|
}
|
|
399637
399712
|
async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
399638
399713
|
const worktreePath = worktreePathFor(repoRoot, slug);
|
|
@@ -399713,7 +399788,7 @@ async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
|
399713
399788
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
399714
399789
|
let includeContent;
|
|
399715
399790
|
try {
|
|
399716
|
-
includeContent = await readFile49(
|
|
399791
|
+
includeContent = await readFile49(join143(repoRoot, ".worktreeinclude"), "utf-8");
|
|
399717
399792
|
} catch {
|
|
399718
399793
|
return [];
|
|
399719
399794
|
}
|
|
@@ -399768,8 +399843,8 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
399768
399843
|
}
|
|
399769
399844
|
const copied = [];
|
|
399770
399845
|
for (const relativePath2 of files2) {
|
|
399771
|
-
const srcPath =
|
|
399772
|
-
const destPath =
|
|
399846
|
+
const srcPath = join143(repoRoot, relativePath2);
|
|
399847
|
+
const destPath = join143(worktreePath, relativePath2);
|
|
399773
399848
|
try {
|
|
399774
399849
|
await mkdir44(dirname59(destPath), { recursive: true });
|
|
399775
399850
|
await copyFile9(srcPath, destPath);
|
|
@@ -399785,9 +399860,9 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
399785
399860
|
}
|
|
399786
399861
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
399787
399862
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
399788
|
-
const sourceSettingsLocal =
|
|
399863
|
+
const sourceSettingsLocal = join143(repoRoot, localSettingsRelativePath);
|
|
399789
399864
|
try {
|
|
399790
|
-
const destSettingsLocal =
|
|
399865
|
+
const destSettingsLocal = join143(worktreePath, localSettingsRelativePath);
|
|
399791
399866
|
await mkdirRecursive(dirname59(destSettingsLocal));
|
|
399792
399867
|
await copyFile9(sourceSettingsLocal, destSettingsLocal);
|
|
399793
399868
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
@@ -399797,8 +399872,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
399797
399872
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
399798
399873
|
}
|
|
399799
399874
|
}
|
|
399800
|
-
const huskyPath =
|
|
399801
|
-
const gitHooksPath =
|
|
399875
|
+
const huskyPath = join143(repoRoot, ".husky");
|
|
399876
|
+
const gitHooksPath = join143(repoRoot, ".git", "hooks");
|
|
399802
399877
|
let hooksPath = null;
|
|
399803
399878
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
399804
399879
|
try {
|
|
@@ -400073,7 +400148,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
400073
400148
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p) => p.test(slug))) {
|
|
400074
400149
|
continue;
|
|
400075
400150
|
}
|
|
400076
|
-
const worktreePath =
|
|
400151
|
+
const worktreePath = join143(dir, slug);
|
|
400077
400152
|
if (currentPath === worktreePath) {
|
|
400078
400153
|
continue;
|
|
400079
400154
|
}
|
|
@@ -400457,7 +400532,7 @@ function getSimpleDoingTasksSection() {
|
|
|
400457
400532
|
];
|
|
400458
400533
|
const userHelpSubitems = [
|
|
400459
400534
|
`/help: Get help with using Theus`,
|
|
400460
|
-
`To give feedback, users should ${{ VERSION: "0.1.
|
|
400535
|
+
`To give feedback, users should ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
400461
400536
|
];
|
|
400462
400537
|
const items = [
|
|
400463
400538
|
`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.`,
|
|
@@ -401280,7 +401355,7 @@ function computeFingerprint(messageText, version3) {
|
|
|
401280
401355
|
}
|
|
401281
401356
|
function computeFingerprintFromMessages(messages) {
|
|
401282
401357
|
const firstMessageText = extractFirstMessageText(messages);
|
|
401283
|
-
return computeFingerprint(firstMessageText, { VERSION: "0.1.
|
|
401358
|
+
return computeFingerprint(firstMessageText, { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
401284
401359
|
}
|
|
401285
401360
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
401286
401361
|
var init_fingerprint = () => {};
|
|
@@ -403080,7 +403155,7 @@ var init_theusEngine = __esm(() => {
|
|
|
403080
403155
|
});
|
|
403081
403156
|
|
|
403082
403157
|
// services/api/theus.ts
|
|
403083
|
-
import { existsSync as
|
|
403158
|
+
import { existsSync as existsSync14, readFileSync as readFileSync21 } from "fs";
|
|
403084
403159
|
import { randomUUID as randomUUID33 } from "crypto";
|
|
403085
403160
|
function env5(name) {
|
|
403086
403161
|
const value = process.env[name];
|
|
@@ -403091,7 +403166,7 @@ function trimBaseURL2(baseURL) {
|
|
|
403091
403166
|
}
|
|
403092
403167
|
function loadProvidersConfig3() {
|
|
403093
403168
|
const path19 = defaultProvidersConfigPath();
|
|
403094
|
-
if (!
|
|
403169
|
+
if (!existsSync14(path19))
|
|
403095
403170
|
return null;
|
|
403096
403171
|
try {
|
|
403097
403172
|
return JSON.parse(readFileSync21(path19, "utf8"));
|
|
@@ -403765,7 +403840,7 @@ async function sideQuery(opts) {
|
|
|
403765
403840
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
403766
403841
|
}
|
|
403767
403842
|
const messageText = extractFirstUserMessageText(messages);
|
|
403768
|
-
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.
|
|
403843
|
+
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
403769
403844
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
403770
403845
|
const systemBlocks = [
|
|
403771
403846
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -404050,8 +404125,8 @@ import {
|
|
|
404050
404125
|
unlink as unlink22
|
|
404051
404126
|
} from "fs/promises";
|
|
404052
404127
|
import { createServer as createServer7 } from "net";
|
|
404053
|
-
import { homedir as
|
|
404054
|
-
import { join as
|
|
404128
|
+
import { homedir as homedir35, platform as platform5 } from "os";
|
|
404129
|
+
import { join as join144 } from "path";
|
|
404055
404130
|
function log(message, ...args) {
|
|
404056
404131
|
if (LOG_FILE) {
|
|
404057
404132
|
const timestamp = new Date().toISOString();
|
|
@@ -404118,7 +404193,7 @@ class ChromeNativeHost {
|
|
|
404118
404193
|
try {
|
|
404119
404194
|
process.kill(pid, 0);
|
|
404120
404195
|
} catch {
|
|
404121
|
-
await unlink22(
|
|
404196
|
+
await unlink22(join144(socketDir, file2)).catch(() => {});
|
|
404122
404197
|
log(`Removed stale socket for PID ${pid}`);
|
|
404123
404198
|
}
|
|
404124
404199
|
}
|
|
@@ -404389,7 +404464,7 @@ var init_chromeNativeHost = __esm(() => {
|
|
|
404389
404464
|
init_slowOperations();
|
|
404390
404465
|
init_common2();
|
|
404391
404466
|
MAX_MESSAGE_SIZE = 1024 * 1024;
|
|
404392
|
-
LOG_FILE = process.env.USER_TYPE === "ant" ?
|
|
404467
|
+
LOG_FILE = process.env.USER_TYPE === "ant" ? join144(homedir35(), ".theus", "debug", "chrome-native-host.txt") : undefined;
|
|
404393
404468
|
messageSchema = lazySchema(() => exports_external2.object({
|
|
404394
404469
|
type: exports_external2.string()
|
|
404395
404470
|
}).passthrough());
|
|
@@ -405068,7 +405143,7 @@ async function handleMemories(state) {
|
|
|
405068
405143
|
async function runProjectContextMcpServer() {
|
|
405069
405144
|
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
405070
405145
|
const state = new ProjectContextState(projectRoot);
|
|
405071
|
-
const server = new Server({ name: SERVER_NAME, version: { VERSION: "0.1.
|
|
405146
|
+
const server = new Server({ name: SERVER_NAME, version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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: {} } });
|
|
405072
405147
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
405073
405148
|
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
405074
405149
|
name: t.name,
|
|
@@ -405194,13 +405269,13 @@ var init_server4 = __esm(() => {
|
|
|
405194
405269
|
|
|
405195
405270
|
// services/mcpComputerUse/macos.ts
|
|
405196
405271
|
import { execFile as execFile5 } from "child_process";
|
|
405197
|
-
import { existsSync as
|
|
405198
|
-
import { homedir as
|
|
405199
|
-
import { join as
|
|
405272
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync22, statSync as statSync10, unlinkSync as unlinkSync3, writeFileSync as writeFileSync7 } from "fs";
|
|
405273
|
+
import { homedir as homedir36, tmpdir as tmpdir10 } from "os";
|
|
405274
|
+
import { join as join145 } from "path";
|
|
405200
405275
|
import { promisify as promisify4 } from "util";
|
|
405201
405276
|
function cuDir() {
|
|
405202
|
-
const dir =
|
|
405203
|
-
if (!
|
|
405277
|
+
const dir = join145(homedir36(), ".theus", "cu");
|
|
405278
|
+
if (!existsSync15(dir))
|
|
405204
405279
|
mkdirSync9(dir, { recursive: true });
|
|
405205
405280
|
return dir;
|
|
405206
405281
|
}
|
|
@@ -405213,7 +405288,7 @@ function resolveBin(name, extra = []) {
|
|
|
405213
405288
|
`/usr/sbin/${name}`
|
|
405214
405289
|
];
|
|
405215
405290
|
for (const candidate of candidates) {
|
|
405216
|
-
if (
|
|
405291
|
+
if (existsSync15(candidate))
|
|
405217
405292
|
return candidate;
|
|
405218
405293
|
}
|
|
405219
405294
|
return name;
|
|
@@ -405247,9 +405322,9 @@ async function getScreenGeometry(force = false) {
|
|
|
405247
405322
|
return cachedGeometry;
|
|
405248
405323
|
}
|
|
405249
405324
|
async function checkPermissions() {
|
|
405250
|
-
const probe =
|
|
405325
|
+
const probe = join145(tmpdir10(), `theus-cu-probe-${process.pid}.jpg`);
|
|
405251
405326
|
const cap = await run2(SCREENCAPTURE, ["-x", "-t", "jpg", probe], { timeoutMs: 8000 });
|
|
405252
|
-
const screenRecording =
|
|
405327
|
+
const screenRecording = existsSync15(probe) && (() => {
|
|
405253
405328
|
try {
|
|
405254
405329
|
return statSync10(probe).size > 0;
|
|
405255
405330
|
} catch {
|
|
@@ -405257,7 +405332,7 @@ async function checkPermissions() {
|
|
|
405257
405332
|
}
|
|
405258
405333
|
})();
|
|
405259
405334
|
try {
|
|
405260
|
-
if (
|
|
405335
|
+
if (existsSync15(probe))
|
|
405261
405336
|
unlinkSync3(probe);
|
|
405262
405337
|
} catch {}
|
|
405263
405338
|
const cc = await run2(CLICLICK, ["p"], { timeoutMs: 5000 });
|
|
@@ -405276,14 +405351,14 @@ async function checkPermissions() {
|
|
|
405276
405351
|
async function captureScreenshot(opts = {}) {
|
|
405277
405352
|
const maxSide = opts.maxSide ?? 1400;
|
|
405278
405353
|
const quality = Math.min(Math.max(opts.quality ?? 72, 1), 100);
|
|
405279
|
-
const raw =
|
|
405280
|
-
const out =
|
|
405354
|
+
const raw = join145(cuDir(), `shot-${process.pid}.png`);
|
|
405355
|
+
const out = join145(cuDir(), `shot-${process.pid}.jpg`);
|
|
405281
405356
|
const capArgs = ["-x", "-t", "png", "-o"];
|
|
405282
405357
|
if (opts.displayIndex && opts.displayIndex > 0)
|
|
405283
405358
|
capArgs.push("-D", String(opts.displayIndex));
|
|
405284
405359
|
capArgs.push(raw);
|
|
405285
405360
|
const cap = await run2(SCREENCAPTURE, capArgs, { timeoutMs: 12000 });
|
|
405286
|
-
if (!
|
|
405361
|
+
if (!existsSync15(raw) || statSync10(raw).size === 0) {
|
|
405287
405362
|
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.");
|
|
405288
405363
|
}
|
|
405289
405364
|
await run2(SIPS, [
|
|
@@ -405299,7 +405374,7 @@ async function captureScreenshot(opts = {}) {
|
|
|
405299
405374
|
"--out",
|
|
405300
405375
|
out
|
|
405301
405376
|
], { timeoutMs: 12000 });
|
|
405302
|
-
if (!
|
|
405377
|
+
if (!existsSync15(out) || statSync10(out).size === 0) {
|
|
405303
405378
|
throw new ComputerUseError("sips no pudo reescalar la captura a JPEG.");
|
|
405304
405379
|
}
|
|
405305
405380
|
const dims = await run2(SIPS, ["-g", "pixelWidth", "-g", "pixelHeight", out]);
|
|
@@ -405440,15 +405515,15 @@ async function ensureScrollHelper() {
|
|
|
405440
405515
|
if (scrollBinPromise)
|
|
405441
405516
|
return scrollBinPromise;
|
|
405442
405517
|
scrollBinPromise = (async () => {
|
|
405443
|
-
if (!
|
|
405444
|
-
const src =
|
|
405445
|
-
const bin =
|
|
405446
|
-
if (
|
|
405518
|
+
if (!existsSync15(SWIFTC) && SWIFTC === "swiftc") {}
|
|
405519
|
+
const src = join145(cuDir(), "scroll.swift");
|
|
405520
|
+
const bin = join145(cuDir(), "theus-cu-scroll");
|
|
405521
|
+
if (existsSync15(bin))
|
|
405447
405522
|
return bin;
|
|
405448
405523
|
try {
|
|
405449
405524
|
writeFileSync7(src, SCROLL_SWIFT, "utf8");
|
|
405450
405525
|
const res = await run2(SWIFTC, ["-O", "-o", bin, src], { timeoutMs: 60000 });
|
|
405451
|
-
if (
|
|
405526
|
+
if (existsSync15(bin))
|
|
405452
405527
|
return bin;
|
|
405453
405528
|
process.stderr.write(`[computer-use] no se pudo compilar el helper de scroll: ${res.stderr}
|
|
405454
405529
|
`);
|
|
@@ -405493,8 +405568,8 @@ var init_macos = __esm(() => {
|
|
|
405493
405568
|
});
|
|
405494
405569
|
|
|
405495
405570
|
// services/mcpComputerUse/common.ts
|
|
405496
|
-
var
|
|
405497
|
-
__export(
|
|
405571
|
+
var exports_common2 = {};
|
|
405572
|
+
__export(exports_common2, {
|
|
405498
405573
|
isComputerUseEnabled: () => isComputerUseEnabled,
|
|
405499
405574
|
COMPUTER_USE_TOOL_NAMES: () => COMPUTER_USE_TOOL_NAMES,
|
|
405500
405575
|
COMPUTER_USE_SERVER_NAME: () => COMPUTER_USE_SERVER_NAME
|
|
@@ -405504,7 +405579,7 @@ function isComputerUseEnabled() {
|
|
|
405504
405579
|
return v === "1" || v === "true" || v === "yes" || v === "on";
|
|
405505
405580
|
}
|
|
405506
405581
|
var COMPUTER_USE_SERVER_NAME = "theus-computer-use", COMPUTER_USE_TOOL_NAMES;
|
|
405507
|
-
var
|
|
405582
|
+
var init_common4 = __esm(() => {
|
|
405508
405583
|
COMPUTER_USE_TOOL_NAMES = [
|
|
405509
405584
|
"screenshot",
|
|
405510
405585
|
"left_click",
|
|
@@ -405670,7 +405745,7 @@ var init_server5 = __esm(() => {
|
|
|
405670
405745
|
init_stdio2();
|
|
405671
405746
|
init_types();
|
|
405672
405747
|
init_macos();
|
|
405673
|
-
|
|
405748
|
+
init_common4();
|
|
405674
405749
|
COORD = {
|
|
405675
405750
|
x: { type: "number", description: "Coordenada X en p\xEDxeles dentro del \xFAltimo screenshot" },
|
|
405676
405751
|
y: { type: "number", description: "Coordenada Y en p\xEDxeles dentro del \xFAltimo screenshot" }
|
|
@@ -405772,9 +405847,9 @@ var exports_selftest = {};
|
|
|
405772
405847
|
__export(exports_selftest, {
|
|
405773
405848
|
runComputerUseSelfTest: () => runComputerUseSelfTest
|
|
405774
405849
|
});
|
|
405775
|
-
import { existsSync as
|
|
405776
|
-
import { join as
|
|
405777
|
-
import { homedir as
|
|
405850
|
+
import { existsSync as existsSync16, writeFileSync as writeFileSync8 } from "fs";
|
|
405851
|
+
import { join as join146 } from "path";
|
|
405852
|
+
import { homedir as homedir37 } from "os";
|
|
405778
405853
|
async function runComputerUseSelfTest() {
|
|
405779
405854
|
let pass = 0;
|
|
405780
405855
|
let fail = 0;
|
|
@@ -405794,7 +405869,7 @@ Theus computer-use \u2014 self-test (macOS)
|
|
|
405794
405869
|
`);
|
|
405795
405870
|
const tools = toolingReport();
|
|
405796
405871
|
for (const [name, path19] of Object.entries(tools)) {
|
|
405797
|
-
if (
|
|
405872
|
+
if (existsSync16(path19))
|
|
405798
405873
|
ok(`${name}: ${path19}`);
|
|
405799
405874
|
else if (name === "swiftc")
|
|
405800
405875
|
warn(`${name}: no encontrado (scroll quedar\xE1 deshabilitado; el resto funciona)`);
|
|
@@ -405823,7 +405898,7 @@ Geometr\xEDa y captura:`);
|
|
|
405823
405898
|
let captureOk = false;
|
|
405824
405899
|
try {
|
|
405825
405900
|
const shot = await captureScreenshot();
|
|
405826
|
-
const outPath =
|
|
405901
|
+
const outPath = join146(homedir37(), ".theus", "cu", "selftest-shot.jpg");
|
|
405827
405902
|
writeFileSync8(outPath, Buffer.from(shot.base64, "base64"));
|
|
405828
405903
|
ok(`Captura ${shot.width}\xD7${shot.height} px, ${Math.round(shot.base64.length * 0.75 / 1024)} KB \u2192 ${outPath}`);
|
|
405829
405904
|
captureOk = true;
|
|
@@ -405876,9 +405951,9 @@ var init_selftest = __esm(() => {
|
|
|
405876
405951
|
|
|
405877
405952
|
// utils/cronTasksLock.ts
|
|
405878
405953
|
import { mkdir as mkdir46, readFile as readFile50, unlink as unlink23, writeFile as writeFile47 } from "fs/promises";
|
|
405879
|
-
import { dirname as dirname60, join as
|
|
405954
|
+
import { dirname as dirname60, join as join147 } from "path";
|
|
405880
405955
|
function getLockPath(dir) {
|
|
405881
|
-
return
|
|
405956
|
+
return join147(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
405882
405957
|
}
|
|
405883
405958
|
async function readLock(dir) {
|
|
405884
405959
|
let raw;
|
|
@@ -405984,7 +406059,7 @@ var init_cronTasksLock = __esm(() => {
|
|
|
405984
406059
|
init_genericProcessUtils();
|
|
405985
406060
|
init_json();
|
|
405986
406061
|
init_slowOperations();
|
|
405987
|
-
LOCK_FILE_REL =
|
|
406062
|
+
LOCK_FILE_REL = join147(".theus", "scheduled_tasks.lock");
|
|
405988
406063
|
schedulerLockSchema = lazySchema(() => exports_external.object({
|
|
405989
406064
|
sessionId: exports_external.string(),
|
|
405990
406065
|
pid: exports_external.number(),
|
|
@@ -406284,11 +406359,11 @@ __export(exports_workerRegistry, {
|
|
|
406284
406359
|
import { spawn as spawn9 } from "child_process";
|
|
406285
406360
|
import { randomUUID as randomUUID34 } from "crypto";
|
|
406286
406361
|
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync10, readFileSync as readFileSync23, writeFileSync as writeFileSync9 } from "fs";
|
|
406287
|
-
import { homedir as
|
|
406288
|
-
import { dirname as dirname61, join as
|
|
406362
|
+
import { homedir as homedir38 } from "os";
|
|
406363
|
+
import { dirname as dirname61, join as join148 } from "path";
|
|
406289
406364
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
406290
406365
|
function projectsConfigPath() {
|
|
406291
|
-
return
|
|
406366
|
+
return join148(homedir38(), ".theus", "daemon", "projects.json");
|
|
406292
406367
|
}
|
|
406293
406368
|
function readEnabledProjects() {
|
|
406294
406369
|
let raw;
|
|
@@ -406307,17 +406382,17 @@ function readEnabledProjects() {
|
|
|
406307
406382
|
return list2.filter((p) => p && typeof p.dir === "string" && p.enabled !== false);
|
|
406308
406383
|
}
|
|
406309
406384
|
function daemonDir2() {
|
|
406310
|
-
return
|
|
406385
|
+
return join148(homedir38(), ".theus", "daemon");
|
|
406311
406386
|
}
|
|
406312
406387
|
function daemonLogPath() {
|
|
406313
|
-
return
|
|
406388
|
+
return join148(daemonDir2(), "daemon.log");
|
|
406314
406389
|
}
|
|
406315
406390
|
function resolveWorkerBin() {
|
|
406316
406391
|
const override = process.env.THEUS_DAEMON_WORKER_BIN;
|
|
406317
406392
|
if (typeof override === "string" && override.length > 0)
|
|
406318
406393
|
return override;
|
|
406319
406394
|
const here = dirname61(fileURLToPath6(import.meta.url));
|
|
406320
|
-
return
|
|
406395
|
+
return join148(here, "..", "bin", "theus");
|
|
406321
406396
|
}
|
|
406322
406397
|
function turnTimeoutMs() {
|
|
406323
406398
|
const raw = process.env.THEUS_DAEMON_TURN_TIMEOUT_MS;
|
|
@@ -406350,10 +406425,10 @@ function logDaemonLine(line) {
|
|
|
406350
406425
|
}
|
|
406351
406426
|
function writeRunHistory(record3) {
|
|
406352
406427
|
try {
|
|
406353
|
-
const dir =
|
|
406428
|
+
const dir = join148(daemonDir2(), "runs", record3.taskId);
|
|
406354
406429
|
mkdirSync10(dir, { recursive: true });
|
|
406355
406430
|
const stamp = record3.startedAt.replace(/:/g, "-");
|
|
406356
|
-
writeFileSync9(
|
|
406431
|
+
writeFileSync9(join148(dir, `${stamp}.json`), JSON.stringify(record3, null, 2), "utf8");
|
|
406357
406432
|
} catch (e) {
|
|
406358
406433
|
logDaemonLine(`[daemon:cron] ERROR guardando historial task=${record3.taskId}: ${e?.message}`);
|
|
406359
406434
|
}
|
|
@@ -406495,22 +406570,22 @@ __export(exports_main, {
|
|
|
406495
406570
|
daemonMain: () => daemonMain
|
|
406496
406571
|
});
|
|
406497
406572
|
import {
|
|
406498
|
-
existsSync as
|
|
406573
|
+
existsSync as existsSync17,
|
|
406499
406574
|
mkdirSync as mkdirSync11,
|
|
406500
406575
|
readFileSync as readFileSync24,
|
|
406501
406576
|
rmSync as rmSync4,
|
|
406502
406577
|
writeFileSync as writeFileSync10
|
|
406503
406578
|
} from "fs";
|
|
406504
|
-
import { homedir as
|
|
406505
|
-
import { dirname as dirname62, join as
|
|
406579
|
+
import { homedir as homedir39 } from "os";
|
|
406580
|
+
import { dirname as dirname62, join as join149 } from "path";
|
|
406506
406581
|
function daemonDir3() {
|
|
406507
|
-
return
|
|
406582
|
+
return join149(homedir39(), ".theus", "daemon");
|
|
406508
406583
|
}
|
|
406509
406584
|
function pidFilePath() {
|
|
406510
|
-
return
|
|
406585
|
+
return join149(daemonDir3(), "theus-daemon.pid");
|
|
406511
406586
|
}
|
|
406512
406587
|
function logFilePath() {
|
|
406513
|
-
return
|
|
406588
|
+
return join149(daemonDir3(), "daemon.log");
|
|
406514
406589
|
}
|
|
406515
406590
|
function ensureDaemonDir() {
|
|
406516
406591
|
mkdirSync11(daemonDir3(), { recursive: true });
|
|
@@ -406584,7 +406659,7 @@ function doStatus() {
|
|
|
406584
406659
|
}
|
|
406585
406660
|
function doLogs() {
|
|
406586
406661
|
const path19 = logFilePath();
|
|
406587
|
-
if (!
|
|
406662
|
+
if (!existsSync17(path19)) {
|
|
406588
406663
|
console.log(`Sin registro de daemon todav\xEDa (${path19}).`);
|
|
406589
406664
|
return;
|
|
406590
406665
|
}
|
|
@@ -406608,7 +406683,7 @@ function resolveTheusBin() {
|
|
|
406608
406683
|
return "theus";
|
|
406609
406684
|
}
|
|
406610
406685
|
function macosServiceSpec() {
|
|
406611
|
-
const path19 =
|
|
406686
|
+
const path19 = join149(homedir39(), "Library", "LaunchAgents", "pe.theus.daemon.plist");
|
|
406612
406687
|
const bin = resolveTheusBin();
|
|
406613
406688
|
const logDir = daemonDir3();
|
|
406614
406689
|
const content = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -406635,9 +406710,9 @@ function macosServiceSpec() {
|
|
|
406635
406710
|
<key>KeepAlive</key>
|
|
406636
406711
|
<true/>
|
|
406637
406712
|
<key>StandardOutPath</key>
|
|
406638
|
-
<string>${
|
|
406713
|
+
<string>${join149(logDir, "launchd.out.log")}</string>
|
|
406639
406714
|
<key>StandardErrorPath</key>
|
|
406640
|
-
<string>${
|
|
406715
|
+
<string>${join149(logDir, "launchd.err.log")}</string>
|
|
406641
406716
|
</dict>
|
|
406642
406717
|
</plist>
|
|
406643
406718
|
`;
|
|
@@ -406652,7 +406727,7 @@ function macosServiceSpec() {
|
|
|
406652
406727
|
};
|
|
406653
406728
|
}
|
|
406654
406729
|
function linuxServiceSpec() {
|
|
406655
|
-
const path19 =
|
|
406730
|
+
const path19 = join149(homedir39(), ".config", "systemd", "user", "theus-daemon.service");
|
|
406656
406731
|
const bin = resolveTheusBin();
|
|
406657
406732
|
const content = `[Unit]
|
|
406658
406733
|
Description=Theus daemon (cron/agent supervisor)
|
|
@@ -406736,11 +406811,11 @@ function doUninstall(args) {
|
|
|
406736
406811
|
if (!hasConfirm(args)) {
|
|
406737
406812
|
console.log(`[dry-run] Desinstalaci\xF3n del daemon de Theus (${spec.platform}).
|
|
406738
406813
|
` + `Se eliminar\xEDa: ${spec.path}
|
|
406739
|
-
` + (
|
|
406814
|
+
` + (existsSync17(spec.path) ? "El archivo existe y ser\xEDa borrado." : "El archivo no existe actualmente (nada que borrar).") + `
|
|
406740
406815
|
Vuelve a ejecutar con --confirm para eliminarlo.`);
|
|
406741
406816
|
return;
|
|
406742
406817
|
}
|
|
406743
|
-
if (!
|
|
406818
|
+
if (!existsSync17(spec.path)) {
|
|
406744
406819
|
console.log(`No hay archivo de servicio que eliminar en: ${spec.path}`);
|
|
406745
406820
|
return;
|
|
406746
406821
|
}
|
|
@@ -409120,8 +409195,8 @@ __export(exports_upstreamproxy, {
|
|
|
409120
409195
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
409121
409196
|
});
|
|
409122
409197
|
import { mkdir as mkdir47, readFile as readFile51, unlink as unlink24, writeFile as writeFile48 } from "fs/promises";
|
|
409123
|
-
import { homedir as
|
|
409124
|
-
import { join as
|
|
409198
|
+
import { homedir as homedir40 } from "os";
|
|
409199
|
+
import { join as join150 } from "path";
|
|
409125
409200
|
async function initUpstreamProxy(opts) {
|
|
409126
409201
|
if (!isEnvTruthy(process.env.THEUS_CODE_REMOTE)) {
|
|
409127
409202
|
return state;
|
|
@@ -409142,7 +409217,7 @@ async function initUpstreamProxy(opts) {
|
|
|
409142
409217
|
}
|
|
409143
409218
|
setNonDumpable();
|
|
409144
409219
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.THEUS_BASE_URL ?? "https://api.theus.pe";
|
|
409145
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
409220
|
+
const caBundlePath = opts?.caBundlePath ?? join150(homedir40(), ".ccr", "ca-bundle.crt");
|
|
409146
409221
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
409147
409222
|
if (!caOk)
|
|
409148
409223
|
return state;
|
|
@@ -409242,7 +409317,7 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
409242
409317
|
}
|
|
409243
409318
|
const ccrCa = await resp.text();
|
|
409244
409319
|
const systemCa = await readFile51(systemCaPath, "utf8").catch(() => "");
|
|
409245
|
-
await mkdir47(
|
|
409320
|
+
await mkdir47(join150(outPath, ".."), { recursive: true });
|
|
409246
409321
|
await writeFile48(outPath, systemCa + `
|
|
409247
409322
|
` + ccrCa, "utf8");
|
|
409248
409323
|
return true;
|
|
@@ -410745,7 +410820,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
410745
410820
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
410746
410821
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
410747
410822
|
betas: getSdkBetas(),
|
|
410748
|
-
theus_code_version: { VERSION: "0.1.
|
|
410823
|
+
theus_code_version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
410749
410824
|
output_style: outputStyle2,
|
|
410750
410825
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
410751
410826
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -417130,8 +417205,8 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
417130
417205
|
});
|
|
417131
417206
|
|
|
417132
417207
|
// components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
417133
|
-
import { homedir as
|
|
417134
|
-
import { basename as basename47, join as
|
|
417208
|
+
import { homedir as homedir41 } from "os";
|
|
417209
|
+
import { basename as basename47, join as join151, sep as sep34 } from "path";
|
|
417135
417210
|
function isInTheusFolder(filePath) {
|
|
417136
417211
|
const absolutePath = expandPath(filePath);
|
|
417137
417212
|
const theusFolderPath = expandPath(`${getOriginalCwd()}/.theus`);
|
|
@@ -417141,7 +417216,7 @@ function isInTheusFolder(filePath) {
|
|
|
417141
417216
|
}
|
|
417142
417217
|
function isInGlobalTheusFolder(filePath) {
|
|
417143
417218
|
const absolutePath = expandPath(filePath);
|
|
417144
|
-
const globalTheusFolderPath =
|
|
417219
|
+
const globalTheusFolderPath = join151(homedir41(), ".theus");
|
|
417145
417220
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
417146
417221
|
const normalizedGlobalTheusFolderPath = normalizeCaseForComparison(globalTheusFolderPath);
|
|
417147
417222
|
return normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + sep34.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalTheusFolderPath + "/");
|
|
@@ -425379,7 +425454,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
425379
425454
|
function getSemverPart(version3) {
|
|
425380
425455
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
425381
425456
|
}
|
|
425382
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.
|
|
425457
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
425383
425458
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react215.useState(() => getSemverPart(initialVersion));
|
|
425384
425459
|
if (!updatedVersion) {
|
|
425385
425460
|
return null;
|
|
@@ -425419,7 +425494,7 @@ function AutoUpdater({
|
|
|
425419
425494
|
return;
|
|
425420
425495
|
}
|
|
425421
425496
|
if (false) {}
|
|
425422
|
-
const currentVersion = { VERSION: "0.1.
|
|
425497
|
+
const currentVersion = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
425423
425498
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
425424
425499
|
let latestVersion = await getLatestVersion(channel2);
|
|
425425
425500
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -425555,7 +425630,7 @@ function AutoUpdater({
|
|
|
425555
425630
|
" ",
|
|
425556
425631
|
/* @__PURE__ */ jsx_runtime383.jsx(ThemedText, {
|
|
425557
425632
|
bold: true,
|
|
425558
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
425633
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}` : `npm i -g ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
425559
425634
|
})
|
|
425560
425635
|
]
|
|
425561
425636
|
})
|
|
@@ -425632,12 +425707,12 @@ function NativeAutoUpdater({
|
|
|
425632
425707
|
logEvent("tengu_native_auto_updater_start", {});
|
|
425633
425708
|
try {
|
|
425634
425709
|
const maxVersion = await getMaxVersion();
|
|
425635
|
-
if (maxVersion && gt({ VERSION: "0.1.
|
|
425710
|
+
if (maxVersion && gt({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
425636
425711
|
const msg = await getMaxVersionMessage();
|
|
425637
425712
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
425638
425713
|
}
|
|
425639
425714
|
const result = await installLatest(channel2);
|
|
425640
|
-
const currentVersion = { VERSION: "0.1.
|
|
425715
|
+
const currentVersion = { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
425641
425716
|
const latencyMs = Date.now() - startTime2;
|
|
425642
425717
|
if (result.lockFailed) {
|
|
425643
425718
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -425774,17 +425849,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
425774
425849
|
const maxVersion = await getMaxVersion();
|
|
425775
425850
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
425776
425851
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
425777
|
-
if (gte({ VERSION: "0.1.
|
|
425778
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.
|
|
425852
|
+
if (gte({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
425853
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
425779
425854
|
setUpdateAvailable(false);
|
|
425780
425855
|
return;
|
|
425781
425856
|
}
|
|
425782
425857
|
latest = maxVersion;
|
|
425783
425858
|
}
|
|
425784
|
-
const hasUpdate = latest && !gte({ VERSION: "0.1.
|
|
425859
|
+
const hasUpdate = latest && !gte({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
425785
425860
|
setUpdateAvailable(!!hasUpdate);
|
|
425786
425861
|
if (hasUpdate) {
|
|
425787
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.
|
|
425862
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`);
|
|
425788
425863
|
}
|
|
425789
425864
|
};
|
|
425790
425865
|
$2[0] = t1;
|
|
@@ -425818,7 +425893,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
425818
425893
|
wrap: "truncate",
|
|
425819
425894
|
children: [
|
|
425820
425895
|
"currentVersion: ",
|
|
425821
|
-
{ VERSION: "0.1.
|
|
425896
|
+
{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
425822
425897
|
]
|
|
425823
425898
|
});
|
|
425824
425899
|
$2[3] = verbose;
|
|
@@ -433691,7 +433766,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
433691
433766
|
project_dir: getOriginalCwd(),
|
|
433692
433767
|
added_dirs: addedDirs
|
|
433693
433768
|
},
|
|
433694
|
-
version: { VERSION: "0.1.
|
|
433769
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
433695
433770
|
output_style: {
|
|
433696
433771
|
name: outputStyleName
|
|
433697
433772
|
},
|
|
@@ -439821,9 +439896,9 @@ function initSkillImprovement() {
|
|
|
439821
439896
|
async function applySkillImprovement(skillName, updates) {
|
|
439822
439897
|
if (!skillName)
|
|
439823
439898
|
return;
|
|
439824
|
-
const { join:
|
|
439899
|
+
const { join: join152 } = await import("path");
|
|
439825
439900
|
const fs5 = await import("fs/promises");
|
|
439826
|
-
const filePath =
|
|
439901
|
+
const filePath = join152(getCwd(), ".theus", "skills", skillName, "SKILL.md");
|
|
439827
439902
|
let currentContent;
|
|
439828
439903
|
try {
|
|
439829
439904
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -439976,8 +440051,8 @@ function useMoreRight(_args) {
|
|
|
439976
440051
|
|
|
439977
440052
|
// utils/cleanup.ts
|
|
439978
440053
|
import * as fs5 from "fs/promises";
|
|
439979
|
-
import { homedir as
|
|
439980
|
-
import { join as
|
|
440054
|
+
import { homedir as homedir42 } from "os";
|
|
440055
|
+
import { join as join152 } from "path";
|
|
439981
440056
|
function getCutoffDate() {
|
|
439982
440057
|
const settings = getSettings_DEPRECATED() || {};
|
|
439983
440058
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -440002,7 +440077,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
440002
440077
|
try {
|
|
440003
440078
|
const timestamp = convertFileNameToDate(file2.name);
|
|
440004
440079
|
if (timestamp < cutoffDate) {
|
|
440005
|
-
await getFsImplementation().unlink(
|
|
440080
|
+
await getFsImplementation().unlink(join152(dirPath, file2.name));
|
|
440006
440081
|
if (isMessagePath) {
|
|
440007
440082
|
result.messages++;
|
|
440008
440083
|
} else {
|
|
@@ -440033,7 +440108,7 @@ async function cleanupOldMessageFiles() {
|
|
|
440033
440108
|
} catch {
|
|
440034
440109
|
return result;
|
|
440035
440110
|
}
|
|
440036
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
440111
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join152(baseCachePath, dirent.name));
|
|
440037
440112
|
for (const mcpLogDir of mcpLogDirs) {
|
|
440038
440113
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
440039
440114
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -440072,7 +440147,7 @@ async function cleanupOldSessionFiles() {
|
|
|
440072
440147
|
for (const projectDirent of projectDirents) {
|
|
440073
440148
|
if (!projectDirent.isDirectory())
|
|
440074
440149
|
continue;
|
|
440075
|
-
const projectDir =
|
|
440150
|
+
const projectDir = join152(projectsDir, projectDirent.name);
|
|
440076
440151
|
let entries;
|
|
440077
440152
|
try {
|
|
440078
440153
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -440086,15 +440161,15 @@ async function cleanupOldSessionFiles() {
|
|
|
440086
440161
|
continue;
|
|
440087
440162
|
}
|
|
440088
440163
|
try {
|
|
440089
|
-
if (await unlinkIfOld(
|
|
440164
|
+
if (await unlinkIfOld(join152(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
440090
440165
|
result.messages++;
|
|
440091
440166
|
}
|
|
440092
440167
|
} catch {
|
|
440093
440168
|
result.errors++;
|
|
440094
440169
|
}
|
|
440095
440170
|
} else if (entry.isDirectory()) {
|
|
440096
|
-
const sessionDir =
|
|
440097
|
-
const toolResultsDir =
|
|
440171
|
+
const sessionDir = join152(projectDir, entry.name);
|
|
440172
|
+
const toolResultsDir = join152(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
440098
440173
|
let toolDirs;
|
|
440099
440174
|
try {
|
|
440100
440175
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -440105,14 +440180,14 @@ async function cleanupOldSessionFiles() {
|
|
|
440105
440180
|
for (const toolEntry of toolDirs) {
|
|
440106
440181
|
if (toolEntry.isFile()) {
|
|
440107
440182
|
try {
|
|
440108
|
-
if (await unlinkIfOld(
|
|
440183
|
+
if (await unlinkIfOld(join152(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
440109
440184
|
result.messages++;
|
|
440110
440185
|
}
|
|
440111
440186
|
} catch {
|
|
440112
440187
|
result.errors++;
|
|
440113
440188
|
}
|
|
440114
440189
|
} else if (toolEntry.isDirectory()) {
|
|
440115
|
-
const toolDirPath =
|
|
440190
|
+
const toolDirPath = join152(toolResultsDir, toolEntry.name);
|
|
440116
440191
|
let toolFiles;
|
|
440117
440192
|
try {
|
|
440118
440193
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -440123,7 +440198,7 @@ async function cleanupOldSessionFiles() {
|
|
|
440123
440198
|
if (!tf.isFile())
|
|
440124
440199
|
continue;
|
|
440125
440200
|
try {
|
|
440126
|
-
if (await unlinkIfOld(
|
|
440201
|
+
if (await unlinkIfOld(join152(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
440127
440202
|
result.messages++;
|
|
440128
440203
|
}
|
|
440129
440204
|
} catch {
|
|
@@ -440155,7 +440230,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
440155
440230
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
440156
440231
|
continue;
|
|
440157
440232
|
try {
|
|
440158
|
-
if (await unlinkIfOld(
|
|
440233
|
+
if (await unlinkIfOld(join152(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
440159
440234
|
result.messages++;
|
|
440160
440235
|
}
|
|
440161
440236
|
} catch {
|
|
@@ -440168,7 +440243,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
440168
440243
|
return result;
|
|
440169
440244
|
}
|
|
440170
440245
|
function cleanupOldPlanFiles() {
|
|
440171
|
-
const plansDir =
|
|
440246
|
+
const plansDir = join152(getTheusConfigHomeDir(), "plans");
|
|
440172
440247
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
440173
440248
|
}
|
|
440174
440249
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -440177,14 +440252,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
440177
440252
|
const fsImpl = getFsImplementation();
|
|
440178
440253
|
try {
|
|
440179
440254
|
const configDir = getTheusConfigHomeDir();
|
|
440180
|
-
const fileHistoryStorageDir =
|
|
440255
|
+
const fileHistoryStorageDir = join152(configDir, "file-history");
|
|
440181
440256
|
let dirents;
|
|
440182
440257
|
try {
|
|
440183
440258
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
440184
440259
|
} catch {
|
|
440185
440260
|
return result;
|
|
440186
440261
|
}
|
|
440187
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
440262
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join152(fileHistoryStorageDir, dirent.name));
|
|
440188
440263
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
440189
440264
|
try {
|
|
440190
440265
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -440211,14 +440286,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
440211
440286
|
const fsImpl = getFsImplementation();
|
|
440212
440287
|
try {
|
|
440213
440288
|
const configDir = getTheusConfigHomeDir();
|
|
440214
|
-
const sessionEnvBaseDir =
|
|
440289
|
+
const sessionEnvBaseDir = join152(configDir, "session-env");
|
|
440215
440290
|
let dirents;
|
|
440216
440291
|
try {
|
|
440217
440292
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
440218
440293
|
} catch {
|
|
440219
440294
|
return result;
|
|
440220
440295
|
}
|
|
440221
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
440296
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join152(sessionEnvBaseDir, dirent.name));
|
|
440222
440297
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
440223
440298
|
try {
|
|
440224
440299
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -440240,7 +440315,7 @@ async function cleanupOldDebugLogs() {
|
|
|
440240
440315
|
const cutoffDate = getCutoffDate();
|
|
440241
440316
|
const result = { messages: 0, errors: 0 };
|
|
440242
440317
|
const fsImpl = getFsImplementation();
|
|
440243
|
-
const debugDir =
|
|
440318
|
+
const debugDir = join152(getTheusConfigHomeDir(), "debug");
|
|
440244
440319
|
let dirents;
|
|
440245
440320
|
try {
|
|
440246
440321
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -440252,7 +440327,7 @@ async function cleanupOldDebugLogs() {
|
|
|
440252
440327
|
continue;
|
|
440253
440328
|
}
|
|
440254
440329
|
try {
|
|
440255
|
-
if (await unlinkIfOld(
|
|
440330
|
+
if (await unlinkIfOld(join152(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
440256
440331
|
result.messages++;
|
|
440257
440332
|
}
|
|
440258
440333
|
} catch {
|
|
@@ -440262,7 +440337,7 @@ async function cleanupOldDebugLogs() {
|
|
|
440262
440337
|
return result;
|
|
440263
440338
|
}
|
|
440264
440339
|
async function cleanupNpmCacheForTheusPackages() {
|
|
440265
|
-
const markerPath =
|
|
440340
|
+
const markerPath = join152(getTheusConfigHomeDir(), ".npm-cache-cleanup");
|
|
440266
440341
|
try {
|
|
440267
440342
|
const stat46 = await fs5.stat(markerPath);
|
|
440268
440343
|
if (Date.now() - stat46.mtimeMs < ONE_DAY_MS) {
|
|
@@ -440277,7 +440352,7 @@ async function cleanupNpmCacheForTheusPackages() {
|
|
|
440277
440352
|
return;
|
|
440278
440353
|
}
|
|
440279
440354
|
logForDebugging("npm cache cleanup: starting");
|
|
440280
|
-
const npmCachePath =
|
|
440355
|
+
const npmCachePath = join152(homedir42(), ".npm", "_cacache");
|
|
440281
440356
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
440282
440357
|
const startTime2 = Date.now();
|
|
440283
440358
|
try {
|
|
@@ -440332,7 +440407,7 @@ async function cleanupNpmCacheForTheusPackages() {
|
|
|
440332
440407
|
}
|
|
440333
440408
|
}
|
|
440334
440409
|
async function cleanupOldVersionsThrottled() {
|
|
440335
|
-
const markerPath =
|
|
440410
|
+
const markerPath = join152(getTheusConfigHomeDir(), ".version-cleanup");
|
|
440336
440411
|
try {
|
|
440337
440412
|
const stat46 = await fs5.stat(markerPath);
|
|
440338
440413
|
if (Date.now() - stat46.mtimeMs < ONE_DAY_MS) {
|
|
@@ -443563,7 +443638,7 @@ __export(exports_asciicast, {
|
|
|
443563
443638
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
443564
443639
|
});
|
|
443565
443640
|
import { appendFile as appendFile7, rename as rename10 } from "fs/promises";
|
|
443566
|
-
import { basename as basename56, dirname as dirname63, join as
|
|
443641
|
+
import { basename as basename56, dirname as dirname63, join as join154 } from "path";
|
|
443567
443642
|
function getRecordFilePath() {
|
|
443568
443643
|
if (recordingState.filePath !== null) {
|
|
443569
443644
|
return recordingState.filePath;
|
|
@@ -443574,10 +443649,10 @@ function getRecordFilePath() {
|
|
|
443574
443649
|
if (!isEnvTruthy(process.env.THEUS_CODE_TERMINAL_RECORDING)) {
|
|
443575
443650
|
return null;
|
|
443576
443651
|
}
|
|
443577
|
-
const projectsDir =
|
|
443578
|
-
const projectDir =
|
|
443652
|
+
const projectsDir = join154(getTheusConfigHomeDir(), "projects");
|
|
443653
|
+
const projectDir = join154(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
443579
443654
|
recordingState.timestamp = Date.now();
|
|
443580
|
-
recordingState.filePath =
|
|
443655
|
+
recordingState.filePath = join154(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
443581
443656
|
return recordingState.filePath;
|
|
443582
443657
|
}
|
|
443583
443658
|
function _resetRecordingStateForTesting() {
|
|
@@ -443586,13 +443661,13 @@ function _resetRecordingStateForTesting() {
|
|
|
443586
443661
|
}
|
|
443587
443662
|
function getSessionRecordingPaths() {
|
|
443588
443663
|
const sessionId = getSessionId();
|
|
443589
|
-
const projectsDir =
|
|
443590
|
-
const projectDir =
|
|
443664
|
+
const projectsDir = join154(getTheusConfigHomeDir(), "projects");
|
|
443665
|
+
const projectDir = join154(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
443591
443666
|
try {
|
|
443592
443667
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
443593
443668
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
443594
443669
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
443595
|
-
return files2.map((f) =>
|
|
443670
|
+
return files2.map((f) => join154(projectDir, f));
|
|
443596
443671
|
} catch {
|
|
443597
443672
|
return [];
|
|
443598
443673
|
}
|
|
@@ -443602,9 +443677,9 @@ async function renameRecordingForSession() {
|
|
|
443602
443677
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
443603
443678
|
return;
|
|
443604
443679
|
}
|
|
443605
|
-
const projectsDir =
|
|
443606
|
-
const projectDir =
|
|
443607
|
-
const newPath =
|
|
443680
|
+
const projectsDir = join154(getTheusConfigHomeDir(), "projects");
|
|
443681
|
+
const projectDir = join154(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
443682
|
+
const newPath = join154(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
443608
443683
|
if (oldPath === newPath) {
|
|
443609
443684
|
return;
|
|
443610
443685
|
}
|
|
@@ -445254,7 +445329,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
445254
445329
|
} catch {}
|
|
445255
445330
|
const data = {
|
|
445256
445331
|
trigger,
|
|
445257
|
-
version: { VERSION: "0.1.
|
|
445332
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
445258
445333
|
platform: process.platform,
|
|
445259
445334
|
transcript,
|
|
445260
445335
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -446481,7 +446556,7 @@ var init_useAwaySummary = __esm(() => {
|
|
|
446481
446556
|
|
|
446482
446557
|
// utils/theusInChrome/setupPortable.ts
|
|
446483
446558
|
import { readdir as readdir31 } from "fs/promises";
|
|
446484
|
-
import { join as
|
|
446559
|
+
import { join as join155 } from "path";
|
|
446485
446560
|
function getExtensionIds() {
|
|
446486
446561
|
return process.env.USER_TYPE === "ant" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
|
|
446487
446562
|
}
|
|
@@ -446508,7 +446583,7 @@ async function detectExtensionInstallationPortable(browserPaths, log2) {
|
|
|
446508
446583
|
}
|
|
446509
446584
|
for (const profile of profileDirs) {
|
|
446510
446585
|
for (const extensionId of extensionIds) {
|
|
446511
|
-
const extensionPath =
|
|
446586
|
+
const extensionPath = join155(browserBasePath, profile, "Extensions", extensionId);
|
|
446512
446587
|
try {
|
|
446513
446588
|
await readdir31(extensionPath);
|
|
446514
446589
|
log2?.(`[Theus in Chrome] Extension ${extensionId} found in ${browser} ${profile}`);
|
|
@@ -446531,8 +446606,8 @@ var init_setupPortable = __esm(() => {
|
|
|
446531
446606
|
|
|
446532
446607
|
// utils/theusInChrome/setup.ts
|
|
446533
446608
|
import { chmod as chmod11, mkdir as mkdir48, readFile as readFile53, writeFile as writeFile50 } from "fs/promises";
|
|
446534
|
-
import { homedir as
|
|
446535
|
-
import { join as
|
|
446609
|
+
import { homedir as homedir43 } from "os";
|
|
446610
|
+
import { join as join156 } from "path";
|
|
446536
446611
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
446537
446612
|
function shouldEnableTheusInChrome(chromeFlag) {
|
|
446538
446613
|
if (getIsNonInteractiveSession() && chromeFlag !== true) {
|
|
@@ -446589,8 +446664,8 @@ function setupTheusInChrome() {
|
|
|
446589
446664
|
};
|
|
446590
446665
|
} else {
|
|
446591
446666
|
const __filename3 = fileURLToPath7(import.meta.url);
|
|
446592
|
-
const __dirname3 =
|
|
446593
|
-
const cliPath =
|
|
446667
|
+
const __dirname3 = join156(__filename3, "..");
|
|
446668
|
+
const cliPath = join156(__dirname3, "cli.js");
|
|
446594
446669
|
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" }));
|
|
446595
446670
|
const mcpConfig = {
|
|
446596
446671
|
[THEUS_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -446611,9 +446686,9 @@ function setupTheusInChrome() {
|
|
|
446611
446686
|
function getNativeMessagingHostsDirs() {
|
|
446612
446687
|
const platform6 = getPlatform();
|
|
446613
446688
|
if (platform6 === "windows") {
|
|
446614
|
-
const home =
|
|
446615
|
-
const appData = process.env.APPDATA ||
|
|
446616
|
-
return [
|
|
446689
|
+
const home = homedir43();
|
|
446690
|
+
const appData = process.env.APPDATA || join156(home, "AppData", "Local");
|
|
446691
|
+
return [join156(appData, "Theus", "ChromeNativeHost")];
|
|
446617
446692
|
}
|
|
446618
446693
|
return getAllNativeMessagingHostsDirs().map(({ path: path21 }) => path21);
|
|
446619
446694
|
}
|
|
@@ -446638,7 +446713,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
446638
446713
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
446639
446714
|
let anyManifestUpdated = false;
|
|
446640
446715
|
for (const manifestDir of manifestDirs) {
|
|
446641
|
-
const manifestPath =
|
|
446716
|
+
const manifestPath = join156(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
446642
446717
|
const existingContent = await readFile53(manifestPath, "utf-8").catch(() => null);
|
|
446643
446718
|
if (existingContent === manifestContent) {
|
|
446644
446719
|
continue;
|
|
@@ -446653,7 +446728,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
446653
446728
|
}
|
|
446654
446729
|
}
|
|
446655
446730
|
if (getPlatform() === "windows") {
|
|
446656
|
-
const manifestPath =
|
|
446731
|
+
const manifestPath = join156(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
446657
446732
|
registerWindowsNativeHosts(manifestPath);
|
|
446658
446733
|
}
|
|
446659
446734
|
if (anyManifestUpdated) {
|
|
@@ -446691,8 +446766,8 @@ function registerWindowsNativeHosts(manifestPath) {
|
|
|
446691
446766
|
}
|
|
446692
446767
|
async function createWrapperScript(command7) {
|
|
446693
446768
|
const platform6 = getPlatform();
|
|
446694
|
-
const chromeDir =
|
|
446695
|
-
const wrapperPath = platform6 === "windows" ?
|
|
446769
|
+
const chromeDir = join156(getTheusConfigHomeDir(), "chrome");
|
|
446770
|
+
const wrapperPath = platform6 === "windows" ? join156(chromeDir, "chrome-native-host.bat") : join156(chromeDir, "chrome-native-host");
|
|
446696
446771
|
const scriptContent = platform6 === "windows" ? `@echo off
|
|
446697
446772
|
REM Chrome native host wrapper script
|
|
446698
446773
|
REM Generated by Theus - do not edit manually
|
|
@@ -446815,7 +446890,7 @@ var init_useChromeExtensionNotification = __esm(() => {
|
|
|
446815
446890
|
});
|
|
446816
446891
|
|
|
446817
446892
|
// utils/plugins/officialMarketplaceStartupCheck.ts
|
|
446818
|
-
import { join as
|
|
446893
|
+
import { join as join157 } from "path";
|
|
446819
446894
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
446820
446895
|
if (isEnvTruthy(process.env.THEUS_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)) {
|
|
446821
446896
|
return true;
|
|
@@ -446890,7 +446965,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
446890
446965
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
446891
446966
|
}
|
|
446892
446967
|
const cacheDir = getMarketplacesCacheDir();
|
|
446893
|
-
const installLocation =
|
|
446968
|
+
const installLocation = join157(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
446894
446969
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
446895
446970
|
if (gcsSha !== null) {
|
|
446896
446971
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -449869,7 +449944,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
449869
449944
|
});
|
|
449870
449945
|
|
|
449871
449946
|
// hooks/useLspPluginRecommendation.tsx
|
|
449872
|
-
import { extname as extname16, join as
|
|
449947
|
+
import { extname as extname16, join as join158 } from "path";
|
|
449873
449948
|
function useLspPluginRecommendation() {
|
|
449874
449949
|
const $2 = c3(12);
|
|
449875
449950
|
const trackedFiles = useAppState(_temp200);
|
|
@@ -449954,7 +450029,7 @@ function useLspPluginRecommendation() {
|
|
|
449954
450029
|
case "yes": {
|
|
449955
450030
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
449956
450031
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
449957
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
450032
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join158(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
449958
450033
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
449959
450034
|
const settings = getSettingsForSource("userSettings");
|
|
449960
450035
|
updateSettingsForSource("userSettings", {
|
|
@@ -452949,7 +453024,7 @@ var exports_REPL = {};
|
|
|
452949
453024
|
__export(exports_REPL, {
|
|
452950
453025
|
REPL: () => REPL
|
|
452951
453026
|
});
|
|
452952
|
-
import { dirname as dirname65, join as
|
|
453027
|
+
import { dirname as dirname65, join as join159 } from "path";
|
|
452953
453028
|
import { tmpdir as tmpdir11 } from "os";
|
|
452954
453029
|
import { writeFile as writeFile51 } from "fs/promises";
|
|
452955
453030
|
import { randomUUID as randomUUID50 } from "crypto";
|
|
@@ -455528,7 +455603,7 @@ Note: ctrl + z now suspends Theus, ctrl + _ undoes input.
|
|
|
455528
455603
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
455529
455604
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
455530
455605
|
const text2 = raw.replace(/[ \t]+$/gm, "");
|
|
455531
|
-
const path21 =
|
|
455606
|
+
const path21 = join159(tmpdir11(), `cc-transcript-${Date.now()}.txt`);
|
|
455532
455607
|
await writeFile51(path21, text2);
|
|
455533
455608
|
const opened = openFileInExternalEditor(path21);
|
|
455534
455609
|
setStatus(opened ? `opening ${path21}` : `wrote ${path21} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -458044,7 +458119,7 @@ function Onboarding({
|
|
|
458044
458119
|
flexDirection: "column",
|
|
458045
458120
|
children: [
|
|
458046
458121
|
/* @__PURE__ */ jsx_runtime457.jsx(TheusBanner, {
|
|
458047
|
-
version: { VERSION: "0.1.
|
|
458122
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
458048
458123
|
}),
|
|
458049
458124
|
/* @__PURE__ */ jsx_runtime457.jsxs(ThemedBox_default, {
|
|
458050
458125
|
flexDirection: "column",
|
|
@@ -458260,7 +458335,7 @@ var exports_TrustDialog = {};
|
|
|
458260
458335
|
__export(exports_TrustDialog, {
|
|
458261
458336
|
TrustDialog: () => TrustDialog
|
|
458262
458337
|
});
|
|
458263
|
-
import { homedir as
|
|
458338
|
+
import { homedir as homedir44 } from "os";
|
|
458264
458339
|
function TrustDialog(t0) {
|
|
458265
458340
|
const $2 = c3(33);
|
|
458266
458341
|
const {
|
|
@@ -458371,7 +458446,7 @@ function TrustDialog(t0) {
|
|
|
458371
458446
|
let t13;
|
|
458372
458447
|
if ($2[13] !== hasAnyBashExecution) {
|
|
458373
458448
|
t12 = () => {
|
|
458374
|
-
const isHomeDir =
|
|
458449
|
+
const isHomeDir = homedir44() === getCwd();
|
|
458375
458450
|
logEvent("tengu_trust_dialog_shown", {
|
|
458376
458451
|
isHomeDir,
|
|
458377
458452
|
hasMcpServers,
|
|
@@ -458400,7 +458475,7 @@ function TrustDialog(t0) {
|
|
|
458400
458475
|
gracefulShutdownSync(1);
|
|
458401
458476
|
return;
|
|
458402
458477
|
}
|
|
458403
|
-
const isHomeDir_0 =
|
|
458478
|
+
const isHomeDir_0 = homedir44() === getCwd();
|
|
458404
458479
|
logEvent("tengu_trust_dialog_accept", {
|
|
458405
458480
|
isHomeDir: isHomeDir_0,
|
|
458406
458481
|
hasMcpServers,
|
|
@@ -458915,7 +458990,7 @@ function completeOnboarding() {
|
|
|
458915
458990
|
saveGlobalConfig((current) => ({
|
|
458916
458991
|
...current,
|
|
458917
458992
|
hasCompletedOnboarding: true,
|
|
458918
|
-
lastOnboardingVersion: { VERSION: "0.1.
|
|
458993
|
+
lastOnboardingVersion: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
458919
458994
|
}));
|
|
458920
458995
|
}
|
|
458921
458996
|
function showDialog(root2, renderer) {
|
|
@@ -463588,12 +463663,12 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
463588
463663
|
});
|
|
463589
463664
|
|
|
463590
463665
|
// utils/errorLogSink.ts
|
|
463591
|
-
import { dirname as dirname67, join as
|
|
463666
|
+
import { dirname as dirname67, join as join160 } from "path";
|
|
463592
463667
|
function getErrorsPath() {
|
|
463593
|
-
return
|
|
463668
|
+
return join160(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
463594
463669
|
}
|
|
463595
463670
|
function getMCPLogsPath(serverName) {
|
|
463596
|
-
return
|
|
463671
|
+
return join160(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
463597
463672
|
}
|
|
463598
463673
|
function createJsonlWriter(options2) {
|
|
463599
463674
|
const writer = createBufferedWriter(options2);
|
|
@@ -463637,7 +463712,7 @@ function appendToLog(path21, message) {
|
|
|
463637
463712
|
cwd: getFsImplementation().cwd(),
|
|
463638
463713
|
userType: process.env.USER_TYPE,
|
|
463639
463714
|
sessionId: getSessionId(),
|
|
463640
|
-
version: { VERSION: "0.1.
|
|
463715
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
463641
463716
|
};
|
|
463642
463717
|
getLogWriter(path21).write(messageWithTimestamp);
|
|
463643
463718
|
}
|
|
@@ -463742,12 +463817,12 @@ __export(exports_setup, {
|
|
|
463742
463817
|
setupComputerUse: () => setupComputerUse,
|
|
463743
463818
|
COMPUTER_USE_SYSTEM_HINT: () => COMPUTER_USE_SYSTEM_HINT
|
|
463744
463819
|
});
|
|
463745
|
-
import { join as
|
|
463820
|
+
import { join as join161 } from "path";
|
|
463746
463821
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
463747
463822
|
function setupComputerUse() {
|
|
463748
463823
|
const allowedTools = COMPUTER_USE_TOOL_NAMES.map((name) => buildMcpToolName(COMPUTER_USE_SERVER_NAME, name));
|
|
463749
463824
|
const bundled = isInBundledMode();
|
|
463750
|
-
const command7 = bundled ? process.execPath :
|
|
463825
|
+
const command7 = bundled ? process.execPath : join161(fileURLToPath8(import.meta.url), "..", "..", "..", "bin", "theus");
|
|
463751
463826
|
const args = ["--theus-computer-use-mcp"];
|
|
463752
463827
|
return {
|
|
463753
463828
|
mcpConfig: {
|
|
@@ -463765,76 +463840,33 @@ function setupComputerUse() {
|
|
|
463765
463840
|
var COMPUTER_USE_SYSTEM_HINT;
|
|
463766
463841
|
var init_setup3 = __esm(() => {
|
|
463767
463842
|
init_mcpStringUtils();
|
|
463768
|
-
|
|
463843
|
+
init_common4();
|
|
463769
463844
|
COMPUTER_USE_SYSTEM_HINT = "Tienes control del escritorio (computer-use) v\xEDa las tools " + "`mcp__theus-computer-use__*`. Para operar la pantalla: toma primero un " + "`screenshot`, razona sobre lo que ves, y da las coordenadas de click/movimiento " + "en P\xCDXELES dentro de esa imagen. Tras cada acci\xF3n, vuelve a capturar para " + "verificar. Si una tool reporta falta de permisos macOS, dile al usuario que " + "otorgue Grabaci\xF3n de pantalla y Accesibilidad a su terminal.";
|
|
463770
463845
|
});
|
|
463771
463846
|
|
|
463772
|
-
// services/mcpNaupa/common.ts
|
|
463773
|
-
var exports_common2 = {};
|
|
463774
|
-
__export(exports_common2, {
|
|
463775
|
-
resolveNaupaBinary: () => resolveNaupaBinary,
|
|
463776
|
-
isNaupaEnabled: () => isNaupaEnabled,
|
|
463777
|
-
NAUPA_SERVER_NAME: () => NAUPA_SERVER_NAME,
|
|
463778
|
-
NAUPA_READONLY_TOOLS: () => NAUPA_READONLY_TOOLS
|
|
463779
|
-
});
|
|
463780
|
-
import { existsSync as existsSync17 } from "fs";
|
|
463781
|
-
import { homedir as homedir44 } from "os";
|
|
463782
|
-
import { join as join161 } from "path";
|
|
463783
|
-
function resolveNaupaBinary() {
|
|
463784
|
-
const fromEnv = (process.env.THEUS_NAUPA_BIN ?? "").trim();
|
|
463785
|
-
if (fromEnv) {
|
|
463786
|
-
return existsSync17(fromEnv) ? fromEnv : null;
|
|
463787
|
-
}
|
|
463788
|
-
const candidates = [
|
|
463789
|
-
join161(homedir44(), ".local", "bin", "naupa"),
|
|
463790
|
-
"/opt/homebrew/bin/naupa",
|
|
463791
|
-
"/usr/local/bin/naupa"
|
|
463792
|
-
];
|
|
463793
|
-
for (const candidate of candidates) {
|
|
463794
|
-
if (existsSync17(candidate))
|
|
463795
|
-
return candidate;
|
|
463796
|
-
}
|
|
463797
|
-
if (typeof Bun !== "undefined" && typeof Bun.which === "function") {
|
|
463798
|
-
const fromPath = Bun.which("naupa");
|
|
463799
|
-
if (fromPath)
|
|
463800
|
-
return fromPath;
|
|
463801
|
-
}
|
|
463802
|
-
return null;
|
|
463803
|
-
}
|
|
463804
|
-
function isNaupaEnabled() {
|
|
463805
|
-
if (process.env.THEUS_NO_NAUPA === "1")
|
|
463806
|
-
return false;
|
|
463807
|
-
return resolveNaupaBinary() !== null;
|
|
463808
|
-
}
|
|
463809
|
-
var NAUPA_SERVER_NAME = "theus-naupa", NAUPA_READONLY_TOOLS;
|
|
463810
|
-
var init_common4 = __esm(() => {
|
|
463811
|
-
NAUPA_READONLY_TOOLS = [
|
|
463812
|
-
"search_graph",
|
|
463813
|
-
"trace_path",
|
|
463814
|
-
"query_graph",
|
|
463815
|
-
"get_graph_schema",
|
|
463816
|
-
"get_architecture",
|
|
463817
|
-
"get_code_snippet",
|
|
463818
|
-
"search_code",
|
|
463819
|
-
"detect_changes",
|
|
463820
|
-
"index_status",
|
|
463821
|
-
"list_projects"
|
|
463822
|
-
];
|
|
463823
|
-
});
|
|
463824
|
-
|
|
463825
463847
|
// services/mcpNaupa/setup.ts
|
|
463826
463848
|
var exports_setup2 = {};
|
|
463827
463849
|
__export(exports_setup2, {
|
|
463828
463850
|
setupNaupa: () => setupNaupa,
|
|
463829
463851
|
NAUPA_SYSTEM_HINT: () => NAUPA_SYSTEM_HINT
|
|
463830
463852
|
});
|
|
463853
|
+
import { execFile as execFile6 } from "child_process";
|
|
463831
463854
|
import { homedir as homedir45 } from "os";
|
|
463832
463855
|
import { join as join162 } from "path";
|
|
463856
|
+
function ensureNaupaAutoIndex(command7, cacheDir) {
|
|
463857
|
+
try {
|
|
463858
|
+
const env6 = { ...process.env, CBM_CACHE_DIR: cacheDir };
|
|
463859
|
+
execFile6(command7, ["config", "set", "auto_index", "true"], { timeout: 3000, env: env6 }, () => {});
|
|
463860
|
+
execFile6(command7, ["--ui=true", "--version"], { timeout: 3000, env: env6 }, () => {});
|
|
463861
|
+
} catch {}
|
|
463862
|
+
}
|
|
463833
463863
|
function setupNaupa() {
|
|
463834
463864
|
const command7 = resolveNaupaBinary();
|
|
463835
463865
|
if (!command7) {
|
|
463836
463866
|
return { mcpConfig: {}, allowedTools: [], systemPrompt: "" };
|
|
463837
463867
|
}
|
|
463868
|
+
const cacheDir = join162(homedir45(), ".theus", "naupa");
|
|
463869
|
+
ensureNaupaAutoIndex(command7, cacheDir);
|
|
463838
463870
|
const allowedTools = NAUPA_READONLY_TOOLS.map((name) => buildMcpToolName(NAUPA_SERVER_NAME, name));
|
|
463839
463871
|
return {
|
|
463840
463872
|
mcpConfig: {
|
|
@@ -463844,7 +463876,7 @@ function setupNaupa() {
|
|
|
463844
463876
|
args: [],
|
|
463845
463877
|
scope: "dynamic",
|
|
463846
463878
|
env: {
|
|
463847
|
-
CBM_CACHE_DIR:
|
|
463879
|
+
CBM_CACHE_DIR: cacheDir
|
|
463848
463880
|
}
|
|
463849
463881
|
}
|
|
463850
463882
|
},
|
|
@@ -463855,8 +463887,8 @@ function setupNaupa() {
|
|
|
463855
463887
|
var NAUPA_SYSTEM_HINT;
|
|
463856
463888
|
var init_setup4 = __esm(() => {
|
|
463857
463889
|
init_mcpStringUtils();
|
|
463858
|
-
|
|
463859
|
-
NAUPA_SYSTEM_HINT = "Tienes acceso al grafo de c\xF3digo del proyecto (\xD1aupa) v\xEDa las tools " + "`mcp__theus-naupa__*`. Para preguntas ESTRUCTURALES \u2014 qui\xE9n llama a X, " + "c\xF3mo est\xE1 organizada la arquitectura, qu\xE9 impacto tiene cambiar algo \u2014 usa " + "primero `search_graph`, `trace_path` o `query_graph` ANTES de recurrir a " + "grep/read: el grafo responde en una consulta lo que costar\xEDa muchas " + "lecturas. `get_architecture` da la vista de m\xF3dulos, `get_code_snippet` " + "trae el c\xF3digo exacto de un nodo, y `detect_changes`/`index_status` dicen " + "si el \xEDndice est\xE1 al d\xEDa.
|
|
463890
|
+
init_common3();
|
|
463891
|
+
NAUPA_SYSTEM_HINT = "Tienes acceso al grafo de c\xF3digo del proyecto (\xD1aupa) v\xEDa las tools " + "`mcp__theus-naupa__*`. Para preguntas ESTRUCTURALES \u2014 qui\xE9n llama a X, " + "c\xF3mo est\xE1 organizada la arquitectura, qu\xE9 impacto tiene cambiar algo \u2014 usa " + "primero `search_graph`, `trace_path` o `query_graph` ANTES de recurrir a " + "grep/read: el grafo responde en una consulta lo que costar\xEDa muchas " + "lecturas. `get_architecture` da la vista de m\xF3dulos, `get_code_snippet` " + "trae el c\xF3digo exacto de un nodo, y `detect_changes`/`index_status` dicen " + "si el \xEDndice est\xE1 al d\xEDa. El proyecto se indexa SOLO al abrir la sesi\xF3n " + "(auto-index + watcher de cambios); si `index_status` reporta que a\xFAn no " + "hay \xEDndice (repo enorme o reci\xE9n abierto), usa `index_repository {repo_path}`.";
|
|
463860
463892
|
});
|
|
463861
463893
|
|
|
463862
463894
|
// services/SessionMemory/sessionMemory.ts
|
|
@@ -467846,8 +467878,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
467846
467878
|
}
|
|
467847
467879
|
async function checkEnvLessBridgeMinVersion() {
|
|
467848
467880
|
const cfg = await getEnvLessBridgeConfig();
|
|
467849
|
-
if (cfg.min_version && lt({ VERSION: "0.1.
|
|
467850
|
-
return `Your version of Theus (${{ VERSION: "0.1.
|
|
467881
|
+
if (cfg.min_version && lt({ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
467882
|
+
return `Your version of Theus (${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
467851
467883
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
467852
467884
|
}
|
|
467853
467885
|
return null;
|
|
@@ -468321,7 +468353,7 @@ async function initBridgeCore(params) {
|
|
|
468321
468353
|
const rawApi = createBridgeApiClient({
|
|
468322
468354
|
baseUrl,
|
|
468323
468355
|
getAccessToken,
|
|
468324
|
-
runnerVersion: { VERSION: "0.1.
|
|
468356
|
+
runnerVersion: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
468325
468357
|
onDebug: logForDebugging,
|
|
468326
468358
|
onAuth401,
|
|
468327
468359
|
getTrustedDeviceToken
|
|
@@ -473587,7 +473619,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
|
|
|
473587
473619
|
setCwd(cwd3);
|
|
473588
473620
|
const server = new Server({
|
|
473589
473621
|
name: "theus/tengu",
|
|
473590
|
-
version: { VERSION: "0.1.
|
|
473622
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
473591
473623
|
}, {
|
|
473592
473624
|
capabilities: {
|
|
473593
473625
|
tools: {}
|
|
@@ -475029,7 +475061,7 @@ async function setupTokenHandler(root2) {
|
|
|
475029
475061
|
gap: 1,
|
|
475030
475062
|
children: [
|
|
475031
475063
|
/* @__PURE__ */ jsx_runtime473.jsx(TheusBanner, {
|
|
475032
|
-
version: { VERSION: "0.1.
|
|
475064
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
475033
475065
|
}),
|
|
475034
475066
|
showAuthWarning && /* @__PURE__ */ jsx_runtime473.jsxs(ThemedBox_default, {
|
|
475035
475067
|
flexDirection: "column",
|
|
@@ -475960,7 +475992,7 @@ ${hint}` : hint;
|
|
|
475960
475992
|
try {
|
|
475961
475993
|
const {
|
|
475962
475994
|
isComputerUseEnabled: isComputerUseEnabled2
|
|
475963
|
-
} = await Promise.resolve().then(() => (
|
|
475995
|
+
} = await Promise.resolve().then(() => (init_common4(), exports_common2));
|
|
475964
475996
|
if (isComputerUseEnabled2()) {
|
|
475965
475997
|
const {
|
|
475966
475998
|
setupComputerUse: setupComputerUse2
|
|
@@ -475987,7 +476019,7 @@ ${cuHint}` : cuHint;
|
|
|
475987
476019
|
try {
|
|
475988
476020
|
const {
|
|
475989
476021
|
isNaupaEnabled: isNaupaEnabled2
|
|
475990
|
-
} = await Promise.resolve().then(() => (
|
|
476022
|
+
} = await Promise.resolve().then(() => (init_common3(), exports_common));
|
|
475991
476023
|
if (isNaupaEnabled2()) {
|
|
475992
476024
|
const {
|
|
475993
476025
|
setupNaupa: setupNaupa2
|
|
@@ -476434,7 +476466,7 @@ ${customInstructions}` : customInstructions;
|
|
|
476434
476466
|
}
|
|
476435
476467
|
}
|
|
476436
476468
|
logForDiagnosticsNoPII("info", "started", {
|
|
476437
|
-
version: { VERSION: "0.1.
|
|
476469
|
+
version: { VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
476438
476470
|
is_native_binary: isInBundledMode()
|
|
476439
476471
|
});
|
|
476440
476472
|
registerCleanup(async () => {
|
|
@@ -477218,7 +477250,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
477218
477250
|
pendingHookMessages
|
|
477219
477251
|
}, renderAndRun);
|
|
477220
477252
|
}
|
|
477221
|
-
}).version(`${{ VERSION: "0.1.
|
|
477253
|
+
}).version(`${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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");
|
|
477222
477254
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
477223
477255
|
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.");
|
|
477224
477256
|
if (canUserConfigureAdvisor()) {
|
|
@@ -477732,7 +477764,7 @@ if (false) {}
|
|
|
477732
477764
|
async function main2() {
|
|
477733
477765
|
const args = process.argv.slice(2);
|
|
477734
477766
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
477735
|
-
console.log(`${{ VERSION: "0.1.
|
|
477767
|
+
console.log(`${{ VERSION: "0.1.14", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)`);
|
|
477736
477768
|
return;
|
|
477737
477769
|
}
|
|
477738
477770
|
const {
|