theus-cli 0.1.7 → 0.1.8
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 +999 -617
- 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.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.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
|
}
|
|
@@ -165796,7 +165796,7 @@ function getTelemetryAttributes() {
|
|
|
165796
165796
|
attributes["session.id"] = sessionId;
|
|
165797
165797
|
}
|
|
165798
165798
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
165799
|
-
attributes["app.version"] = { VERSION: "0.1.
|
|
165799
|
+
attributes["app.version"] = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
165800
165800
|
}
|
|
165801
165801
|
const oauthAccount = getOauthAccountInfo();
|
|
165802
165802
|
if (oauthAccount) {
|
|
@@ -201855,7 +201855,7 @@ function getInstallationEnv() {
|
|
|
201855
201855
|
return;
|
|
201856
201856
|
}
|
|
201857
201857
|
function getTheusCodeVersion() {
|
|
201858
|
-
return { VERSION: "0.1.
|
|
201858
|
+
return { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
201859
201859
|
}
|
|
201860
201860
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
201861
201861
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -203373,7 +203373,7 @@ async function getMcpHeadersFromHelper(serverName, config2) {
|
|
|
203373
203373
|
if ("scope" in config2 && isMcpServerFromProjectOrLocalSettings(config2) && !getIsNonInteractiveSession()) {
|
|
203374
203374
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
203375
203375
|
if (!hasTrust) {
|
|
203376
|
-
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.
|
|
203376
|
+
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.8", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
203377
203377
|
logAntError("MCP headersHelper invoked before trust check", error40);
|
|
203378
203378
|
logEvent("tengu_mcp_headersHelper_missing_trust", {});
|
|
203379
203379
|
return null;
|
|
@@ -204583,7 +204583,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
204583
204583
|
const client2 = new Client({
|
|
204584
204584
|
name: "theus-code",
|
|
204585
204585
|
title: "Theus",
|
|
204586
|
-
version: { VERSION: "0.1.
|
|
204586
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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",
|
|
204587
204587
|
description: "Theus's agentic coding tool",
|
|
204588
204588
|
websiteUrl: PRODUCT_URL
|
|
204589
204589
|
}, {
|
|
@@ -204937,7 +204937,7 @@ var init_client5 = __esm(() => {
|
|
|
204937
204937
|
const client2 = new Client({
|
|
204938
204938
|
name: "theus-code",
|
|
204939
204939
|
title: "Theus",
|
|
204940
|
-
version: { VERSION: "0.1.
|
|
204940
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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",
|
|
204941
204941
|
description: "Theus's agentic coding tool",
|
|
204942
204942
|
websiteUrl: PRODUCT_URL
|
|
204943
204943
|
}, {
|
|
@@ -215496,7 +215496,7 @@ async function initializeBetaTracing(resource) {
|
|
|
215496
215496
|
});
|
|
215497
215497
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215498
215498
|
setLoggerProvider(loggerProvider);
|
|
215499
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215499
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215500
215500
|
setEventLogger(eventLogger);
|
|
215501
215501
|
process.on("beforeExit", async () => {
|
|
215502
215502
|
await loggerProvider?.forceFlush();
|
|
@@ -215536,7 +215536,7 @@ async function initializeTelemetry() {
|
|
|
215536
215536
|
const platform4 = getPlatform();
|
|
215537
215537
|
const baseAttributes = {
|
|
215538
215538
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
215539
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.
|
|
215539
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
215540
215540
|
};
|
|
215541
215541
|
if (platform4 === "wsl") {
|
|
215542
215542
|
const wslVersion = getWslVersion();
|
|
@@ -215581,7 +215581,7 @@ async function initializeTelemetry() {
|
|
|
215581
215581
|
} catch {}
|
|
215582
215582
|
};
|
|
215583
215583
|
registerCleanup(shutdownTelemetry2);
|
|
215584
|
-
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215584
|
+
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215585
215585
|
}
|
|
215586
215586
|
const meterProvider = new MeterProvider({
|
|
215587
215587
|
resource,
|
|
@@ -215601,7 +215601,7 @@ async function initializeTelemetry() {
|
|
|
215601
215601
|
});
|
|
215602
215602
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215603
215603
|
setLoggerProvider(loggerProvider);
|
|
215604
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215604
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215605
215605
|
setEventLogger(eventLogger);
|
|
215606
215606
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
215607
215607
|
process.on("beforeExit", async () => {
|
|
@@ -215663,7 +215663,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
215663
215663
|
}
|
|
215664
215664
|
};
|
|
215665
215665
|
registerCleanup(shutdownTelemetry);
|
|
215666
|
-
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215666
|
+
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215667
215667
|
}
|
|
215668
215668
|
async function flushTelemetry() {
|
|
215669
215669
|
const meterProvider = getMeterProvider();
|
|
@@ -216203,7 +216203,7 @@ async function installOrUpdateTheusPackage(channel2, specificVersion) {
|
|
|
216203
216203
|
return "install_failed";
|
|
216204
216204
|
}
|
|
216205
216205
|
const versionSpec = specificVersion ? specificVersion : channel2 === "stable" ? "stable" : "latest";
|
|
216206
|
-
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.
|
|
216206
|
+
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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 });
|
|
216207
216207
|
if (result.code !== 0) {
|
|
216208
216208
|
const error40 = new Error(`Failed to install Theus CLI package: ${result.stderr}`);
|
|
216209
216209
|
logError2(error40);
|
|
@@ -216349,9 +216349,9 @@ async function assertMinVersion() {
|
|
|
216349
216349
|
if (false) {}
|
|
216350
216350
|
try {
|
|
216351
216351
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
216352
|
-
if (versionConfig.minVersion && lt({ VERSION: "0.1.
|
|
216352
|
+
if (versionConfig.minVersion && lt({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
216353
216353
|
console.error(`
|
|
216354
|
-
It looks like your version of Theus (${{ VERSION: "0.1.
|
|
216354
|
+
It looks like your version of Theus (${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
216355
216355
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
216356
216356
|
|
|
216357
216357
|
To update, please run:
|
|
@@ -216492,7 +216492,7 @@ async function getInstallationPrefix() {
|
|
|
216492
216492
|
return prefixResult.stdout.trim();
|
|
216493
216493
|
}
|
|
216494
216494
|
function getGlobalInstallPackageManager() {
|
|
216495
|
-
if ({ VERSION: "0.1.
|
|
216495
|
+
if ({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
216496
216496
|
return "npm";
|
|
216497
216497
|
}
|
|
216498
216498
|
return env3.isRunningWithBun() ? "bun" : "npm";
|
|
@@ -216517,7 +216517,7 @@ async function checkGlobalInstallPermissions() {
|
|
|
216517
216517
|
}
|
|
216518
216518
|
async function getLatestVersion(channel2) {
|
|
216519
216519
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
216520
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.
|
|
216520
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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() });
|
|
216521
216521
|
if (result.code !== 0) {
|
|
216522
216522
|
logForDebugging(`npm view failed with code ${result.code}`);
|
|
216523
216523
|
if (result.stderr) {
|
|
@@ -216533,7 +216533,7 @@ async function getLatestVersion(channel2) {
|
|
|
216533
216533
|
return result.stdout.trim();
|
|
216534
216534
|
}
|
|
216535
216535
|
async function getNpmDistTags() {
|
|
216536
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.
|
|
216536
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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() });
|
|
216537
216537
|
if (result.code !== 0) {
|
|
216538
216538
|
logForDebugging(`npm view dist-tags failed with code ${result.code}`);
|
|
216539
216539
|
return { latest: null, stable: null };
|
|
@@ -216573,7 +216573,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216573
216573
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
216574
216574
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
216575
216575
|
pid: process.pid,
|
|
216576
|
-
currentVersion: { VERSION: "0.1.
|
|
216576
|
+
currentVersion: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
216577
216577
|
});
|
|
216578
216578
|
return "in_progress";
|
|
216579
216579
|
}
|
|
@@ -216582,7 +216582,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216582
216582
|
if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
|
|
216583
216583
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
216584
216584
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
216585
|
-
currentVersion: { VERSION: "0.1.
|
|
216585
|
+
currentVersion: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
216586
216586
|
});
|
|
216587
216587
|
console.error(`
|
|
216588
216588
|
Error: Windows NPM detected in WSL
|
|
@@ -216601,7 +216601,7 @@ To fix this issue:
|
|
|
216601
216601
|
if (!hasPermissions) {
|
|
216602
216602
|
return "no_permissions";
|
|
216603
216603
|
}
|
|
216604
|
-
const packageSpec = specificVersion ? `${{ VERSION: "0.1.
|
|
216604
|
+
const packageSpec = specificVersion ? `${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
216605
216605
|
const packageManager = getGlobalInstallPackageManager();
|
|
216606
216606
|
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir18() });
|
|
216607
216607
|
if (installResult.code !== 0) {
|
|
@@ -216929,8 +216929,8 @@ async function detectMultipleInstallations() {
|
|
|
216929
216929
|
installations.push({ type: "npm-local", path: localPath });
|
|
216930
216930
|
}
|
|
216931
216931
|
const packagesToCheck = ["@theus-ai/theus-code"];
|
|
216932
|
-
if ({ VERSION: "0.1.
|
|
216933
|
-
packagesToCheck.push({ VERSION: "0.1.
|
|
216932
|
+
if ({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
216933
|
+
packagesToCheck.push({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
216934
216934
|
}
|
|
216935
216935
|
const npmResult = await execFileNoThrow("npm", [
|
|
216936
216936
|
"-g",
|
|
@@ -217113,7 +217113,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
217113
217113
|
}
|
|
217114
217114
|
async function getDoctorDiagnostic() {
|
|
217115
217115
|
const installationType = await getCurrentInstallationType();
|
|
217116
|
-
const version2 = { VERSION: "0.1.
|
|
217116
|
+
const version2 = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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";
|
|
217117
217117
|
const installationPath = await getInstallationPath();
|
|
217118
217118
|
const invokedBinary = getInvokedBinary();
|
|
217119
217119
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -217125,8 +217125,8 @@ async function getDoctorDiagnostic() {
|
|
|
217125
217125
|
for (const install of npmInstalls) {
|
|
217126
217126
|
if (install.type === "npm-global") {
|
|
217127
217127
|
let uninstallCmd = "npm -g uninstall @theus-ai/theus-code";
|
|
217128
|
-
if ({ VERSION: "0.1.
|
|
217129
|
-
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.
|
|
217128
|
+
if ({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
217129
|
+
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
217130
217130
|
}
|
|
217131
217131
|
warnings.push({
|
|
217132
217132
|
issue: `Leftover npm global installation at ${install.path}`,
|
|
@@ -217238,7 +217238,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217238
217238
|
const startTime2 = Date.now();
|
|
217239
217239
|
const { stdout, code, stderr } = await execFileNoThrowWithCwd("npm", [
|
|
217240
217240
|
"view",
|
|
217241
|
-
`${{ VERSION: "0.1.
|
|
217241
|
+
`${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`,
|
|
217242
217242
|
"version",
|
|
217243
217243
|
"--prefer-online",
|
|
217244
217244
|
"--registry",
|
|
@@ -217262,7 +217262,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217262
217262
|
latency_ms: latencyMs,
|
|
217263
217263
|
source_npm: true
|
|
217264
217264
|
});
|
|
217265
|
-
logForDebugging(`npm view ${{ VERSION: "0.1.
|
|
217265
|
+
logForDebugging(`npm view ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
217266
217266
|
const latestVersion = stdout.trim();
|
|
217267
217267
|
return latestVersion;
|
|
217268
217268
|
}
|
|
@@ -217318,7 +217318,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217318
217318
|
const fs3 = getFsImplementation();
|
|
217319
217319
|
await fs3.rm(stagingPath, { recursive: true, force: true });
|
|
217320
217320
|
const platform4 = getPlatform2();
|
|
217321
|
-
const platformPackageName = `${{ VERSION: "0.1.
|
|
217321
|
+
const platformPackageName = `${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
217322
217322
|
logForDebugging(`Fetching integrity hash for ${platformPackageName}@${version2}`);
|
|
217323
217323
|
const {
|
|
217324
217324
|
stdout: integrityOutput,
|
|
@@ -217347,7 +217347,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217347
217347
|
name: "theus-native-installer",
|
|
217348
217348
|
version: "0.0.1",
|
|
217349
217349
|
dependencies: {
|
|
217350
|
-
[{ VERSION: "0.1.
|
|
217350
|
+
[{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
217351
217351
|
}
|
|
217352
217352
|
};
|
|
217353
217353
|
const packageLock = {
|
|
@@ -217360,10 +217360,10 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217360
217360
|
name: "theus-native-installer",
|
|
217361
217361
|
version: "0.0.1",
|
|
217362
217362
|
dependencies: {
|
|
217363
|
-
[{ VERSION: "0.1.
|
|
217363
|
+
[{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
217364
217364
|
}
|
|
217365
217365
|
},
|
|
217366
|
-
[`node_modules/${{ VERSION: "0.1.
|
|
217366
|
+
[`node_modules/${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`]: {
|
|
217367
217367
|
version: version2,
|
|
217368
217368
|
optionalDependencies: {
|
|
217369
217369
|
[platformPackageName]: version2
|
|
@@ -217385,7 +217385,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217385
217385
|
if (result.code !== 0) {
|
|
217386
217386
|
throw new Error(`npm ci failed with code ${result.code}: ${result.stderr}`);
|
|
217387
217387
|
}
|
|
217388
|
-
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.
|
|
217388
|
+
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
217389
217389
|
}
|
|
217390
217390
|
function getStallTimeoutMs() {
|
|
217391
217391
|
return Number(process.env.THEUS_CODE_STALL_TIMEOUT_MS_FOR_TESTING) || DEFAULT_STALL_TIMEOUT_MS;
|
|
@@ -218048,8 +218048,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218048
218048
|
const maxVersion = await getMaxVersion();
|
|
218049
218049
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
218050
218050
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
218051
|
-
if (gte({ VERSION: "0.1.
|
|
218052
|
-
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.
|
|
218051
|
+
if (gte({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
218052
|
+
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
218053
218053
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
218054
218054
|
latency_ms: Date.now() - startTime2,
|
|
218055
218055
|
max_version: maxVersion,
|
|
@@ -218060,7 +218060,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218060
218060
|
version2 = maxVersion;
|
|
218061
218061
|
}
|
|
218062
218062
|
}
|
|
218063
|
-
if (!forceReinstall && version2 === { VERSION: "0.1.
|
|
218063
|
+
if (!forceReinstall && version2 === { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
218064
218064
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
218065
218065
|
logEvent("tengu_native_update_complete", {
|
|
218066
218066
|
latency_ms: Date.now() - startTime2,
|
|
@@ -218802,8 +218802,8 @@ async function cleanupNpmInstallations() {
|
|
|
218802
218802
|
} else if (codePackageResult.error) {
|
|
218803
218803
|
errors4.push(codePackageResult.error);
|
|
218804
218804
|
}
|
|
218805
|
-
if ({ VERSION: "0.1.
|
|
218806
|
-
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.
|
|
218805
|
+
if ({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
218806
|
+
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
218807
218807
|
if (macroPackageResult.success) {
|
|
218808
218808
|
removed++;
|
|
218809
218809
|
if (macroPackageResult.warning) {
|
|
@@ -294213,9 +294213,9 @@ function getTheusEnvMetadata() {
|
|
|
294213
294213
|
};
|
|
294214
294214
|
}
|
|
294215
294215
|
function getBuildAgeMinutes() {
|
|
294216
|
-
if (!{ VERSION: "0.1.
|
|
294216
|
+
if (!{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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)
|
|
294217
294217
|
return;
|
|
294218
|
-
const buildTime = new Date({ VERSION: "0.1.
|
|
294218
|
+
const buildTime = new Date({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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();
|
|
294219
294219
|
if (isNaN(buildTime))
|
|
294220
294220
|
return;
|
|
294221
294221
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -310376,7 +310376,7 @@ function getAssistantMessageFromError(error40, model, options2) {
|
|
|
310376
310376
|
if (process.env.USER_TYPE === "ant") {
|
|
310377
310377
|
const baseMessage = `API Error: 400 ${error40.message}
|
|
310378
310378
|
|
|
310379
|
-
Run /share and post the JSON file to ${{ VERSION: "0.1.
|
|
310379
|
+
Run /share and post the JSON file to ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}.`;
|
|
310380
310380
|
const rewindInstruction = getIsNonInteractiveSession() ? "" : " Then, use /rewind to recover the conversation.";
|
|
310381
310381
|
return createAssistantAPIErrorMessage({
|
|
310382
310382
|
content: baseMessage + rewindInstruction,
|
|
@@ -310412,7 +310412,7 @@ Run /share and post the JSON file to ${{ VERSION: "0.1.7", BUILD_TIME: "1970-01-
|
|
|
310412
310412
|
if (process.env.USER_TYPE === "ant" && !process.env.THEUS_MODEL && error40 instanceof Error && error40.message.toLowerCase().includes("invalid model name")) {
|
|
310413
310413
|
const orgId = getOauthAccountInfo()?.organizationUuid;
|
|
310414
310414
|
const baseMsg = `[THEUS-INTERNAL] Your org isn't gated into the \`${model}\` model. Either run \`theus\` with \`THEUS_MODEL=${getDefaultMainLoopModelSetting()}\``;
|
|
310415
|
-
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.
|
|
310415
|
+
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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.`;
|
|
310416
310416
|
return createAssistantAPIErrorMessage({
|
|
310417
310417
|
content: msg,
|
|
310418
310418
|
error: "invalid_request"
|
|
@@ -320490,7 +320490,7 @@ function buildPrimarySection() {
|
|
|
320490
320490
|
});
|
|
320491
320491
|
return [{
|
|
320492
320492
|
label: "Version",
|
|
320493
|
-
value: { VERSION: "0.1.
|
|
320493
|
+
value: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
320494
320494
|
}, {
|
|
320495
320495
|
label: "Session name",
|
|
320496
320496
|
value: nameValue
|
|
@@ -324241,7 +324241,7 @@ function Config({
|
|
|
324241
324241
|
}
|
|
324242
324242
|
})
|
|
324243
324243
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime180.jsx(ChannelDowngradeDialog, {
|
|
324244
|
-
currentVersion: { VERSION: "0.1.
|
|
324244
|
+
currentVersion: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
324245
324245
|
onChoice: (choice) => {
|
|
324246
324246
|
setShowSubmenu(null);
|
|
324247
324247
|
setTabsHidden(false);
|
|
@@ -324253,7 +324253,7 @@ function Config({
|
|
|
324253
324253
|
autoUpdatesChannel: "stable"
|
|
324254
324254
|
};
|
|
324255
324255
|
if (choice === "stay") {
|
|
324256
|
-
newSettings.minimumVersion = { VERSION: "0.1.
|
|
324256
|
+
newSettings.minimumVersion = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
324257
324257
|
}
|
|
324258
324258
|
updateSettingsForSource("userSettings", newSettings);
|
|
324259
324259
|
setSettingsData((prev_27) => ({
|
|
@@ -332287,7 +332287,7 @@ function HelpV2(t0) {
|
|
|
332287
332287
|
let t6;
|
|
332288
332288
|
if ($2[31] !== tabs) {
|
|
332289
332289
|
t6 = /* @__PURE__ */ jsx_runtime207.jsx(Tabs, {
|
|
332290
|
-
title: `Theus v${{ VERSION: "0.1.
|
|
332290
|
+
title: `Theus v${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
|
|
332291
332291
|
color: "professionalBlue",
|
|
332292
332292
|
defaultTab: "general",
|
|
332293
332293
|
children: tabs
|
|
@@ -349718,9 +349718,9 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
349718
349718
|
return [];
|
|
349719
349719
|
}
|
|
349720
349720
|
}
|
|
349721
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.
|
|
349721
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
349722
349722
|
if (process.env.USER_TYPE === "ant") {
|
|
349723
|
-
const changelog = { VERSION: "0.1.
|
|
349723
|
+
const changelog = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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;
|
|
349724
349724
|
if (changelog) {
|
|
349725
349725
|
const commits = changelog.trim().split(`
|
|
349726
349726
|
`).filter(Boolean);
|
|
@@ -353914,7 +353914,7 @@ var init_Messages = __esm(() => {
|
|
|
353914
353914
|
let t1;
|
|
353915
353915
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
353916
353916
|
t1 = /* @__PURE__ */ jsx_runtime245.jsx(TheusBanner, {
|
|
353917
|
-
version: { VERSION: "0.1.
|
|
353917
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
353918
353918
|
});
|
|
353919
353919
|
$2[0] = t1;
|
|
353920
353920
|
} else {
|
|
@@ -381454,7 +381454,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
381454
381454
|
smapsRollup,
|
|
381455
381455
|
platform: process.platform,
|
|
381456
381456
|
nodeVersion: process.version,
|
|
381457
|
-
ccVersion: { VERSION: "0.1.
|
|
381457
|
+
ccVersion: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
381458
381458
|
};
|
|
381459
381459
|
}
|
|
381460
381460
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -382040,7 +382040,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
382040
382040
|
var call54 = async () => {
|
|
382041
382041
|
return {
|
|
382042
382042
|
type: "text",
|
|
382043
|
-
value: { VERSION: "0.1.
|
|
382043
|
+
value: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
382044
382044
|
};
|
|
382045
382045
|
}, version2, version_default;
|
|
382046
382046
|
var init_version = __esm(() => {
|
|
@@ -385775,7 +385775,7 @@ __export(exports_update, {
|
|
|
385775
385775
|
});
|
|
385776
385776
|
async function update() {
|
|
385777
385777
|
logEvent("tengu_update_check", {});
|
|
385778
|
-
writeToStdout(`Current version: ${{ VERSION: "0.1.
|
|
385778
|
+
writeToStdout(`Current version: ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
385779
385779
|
`);
|
|
385780
385780
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
385781
385781
|
writeToStdout(`Checking for updates to ${channel2} version...
|
|
@@ -385850,8 +385850,8 @@ async function update() {
|
|
|
385850
385850
|
writeToStdout(`Theus is managed by Homebrew.
|
|
385851
385851
|
`);
|
|
385852
385852
|
const latest = await getLatestVersion(channel2);
|
|
385853
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
385854
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
385853
|
+
if (latest && !gte({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
385854
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
385855
385855
|
`);
|
|
385856
385856
|
writeToStdout(`
|
|
385857
385857
|
`);
|
|
@@ -385867,8 +385867,8 @@ async function update() {
|
|
|
385867
385867
|
writeToStdout(`Theus is managed by winget.
|
|
385868
385868
|
`);
|
|
385869
385869
|
const latest = await getLatestVersion(channel2);
|
|
385870
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
385871
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
385870
|
+
if (latest && !gte({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
385871
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
385872
385872
|
`);
|
|
385873
385873
|
writeToStdout(`
|
|
385874
385874
|
`);
|
|
@@ -385884,8 +385884,8 @@ async function update() {
|
|
|
385884
385884
|
writeToStdout(`Theus is managed by apk.
|
|
385885
385885
|
`);
|
|
385886
385886
|
const latest = await getLatestVersion(channel2);
|
|
385887
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
385888
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
385887
|
+
if (latest && !gte({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
385888
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
385889
385889
|
`);
|
|
385890
385890
|
writeToStdout(`
|
|
385891
385891
|
`);
|
|
@@ -385950,11 +385950,11 @@ async function update() {
|
|
|
385950
385950
|
`);
|
|
385951
385951
|
await gracefulShutdown(1);
|
|
385952
385952
|
}
|
|
385953
|
-
if (result.latestVersion === { VERSION: "0.1.
|
|
385954
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
385953
|
+
if (result.latestVersion === { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
385954
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
385955
385955
|
`);
|
|
385956
385956
|
} else {
|
|
385957
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
385957
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
385958
385958
|
`);
|
|
385959
385959
|
await regenerateCompletionCache();
|
|
385960
385960
|
}
|
|
@@ -385973,9 +385973,9 @@ async function update() {
|
|
|
385973
385973
|
await removeInstalledSymlink();
|
|
385974
385974
|
}
|
|
385975
385975
|
logForDebugging("update: Checking npm registry for latest version");
|
|
385976
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.
|
|
385976
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
385977
385977
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
385978
|
-
const npmCommand = `npm view ${{ VERSION: "0.1.
|
|
385978
|
+
const npmCommand = `npm view ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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`;
|
|
385979
385979
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
385980
385980
|
const latestVersion = await getLatestVersion(channel2);
|
|
385981
385981
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -385995,7 +385995,7 @@ async function update() {
|
|
|
385995
385995
|
`);
|
|
385996
385996
|
process.stderr.write(` \u2022 Corporate proxy/firewall blocking npm
|
|
385997
385997
|
`);
|
|
385998
|
-
if ({ VERSION: "0.1.
|
|
385998
|
+
if ({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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")) {
|
|
385999
385999
|
process.stderr.write(` \u2022 Internal/development build not published to npm
|
|
386000
386000
|
`);
|
|
386001
386001
|
}
|
|
@@ -386007,19 +386007,19 @@ async function update() {
|
|
|
386007
386007
|
`);
|
|
386008
386008
|
process.stderr.write(` \u2022 Run with --debug flag for more details
|
|
386009
386009
|
`);
|
|
386010
|
-
const packageName = { VERSION: "0.1.
|
|
386010
|
+
const packageName = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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");
|
|
386011
386011
|
process.stderr.write(` \u2022 Manually check: npm view ${packageName} version
|
|
386012
386012
|
`);
|
|
386013
386013
|
process.stderr.write(` \u2022 Check if you need to login: npm whoami
|
|
386014
386014
|
`);
|
|
386015
386015
|
await gracefulShutdown(1);
|
|
386016
386016
|
}
|
|
386017
|
-
if (gte({ VERSION: "0.1.
|
|
386018
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
386017
|
+
if (gte({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
386018
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
386019
386019
|
`);
|
|
386020
386020
|
await gracefulShutdown(0);
|
|
386021
386021
|
}
|
|
386022
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.
|
|
386022
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
386023
386023
|
`);
|
|
386024
386024
|
writeToStdout(`Installing update...
|
|
386025
386025
|
`);
|
|
@@ -386064,7 +386064,7 @@ async function update() {
|
|
|
386064
386064
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
386065
386065
|
switch (status2) {
|
|
386066
386066
|
case "success":
|
|
386067
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
386067
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
386068
386068
|
`);
|
|
386069
386069
|
await regenerateCompletionCache();
|
|
386070
386070
|
break;
|
|
@@ -386074,7 +386074,7 @@ async function update() {
|
|
|
386074
386074
|
if (useLocalUpdate) {
|
|
386075
386075
|
process.stderr.write(`Try manually updating with:
|
|
386076
386076
|
`);
|
|
386077
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
386077
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
386078
386078
|
`);
|
|
386079
386079
|
} else {
|
|
386080
386080
|
process.stderr.write(`Try running with sudo or fix npm permissions
|
|
@@ -386090,7 +386090,7 @@ async function update() {
|
|
|
386090
386090
|
if (useLocalUpdate) {
|
|
386091
386091
|
process.stderr.write(`Try manually updating with:
|
|
386092
386092
|
`);
|
|
386093
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
386093
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
386094
386094
|
`);
|
|
386095
386095
|
} else {
|
|
386096
386096
|
process.stderr.write(`Or consider using native installation with: theus install
|
|
@@ -392985,7 +392985,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
392985
392985
|
init_settings2();
|
|
392986
392986
|
init_slowOperations();
|
|
392987
392987
|
init_uuid();
|
|
392988
|
-
VERSION4 = { VERSION: "0.1.
|
|
392988
|
+
VERSION4 = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
392989
392989
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
392990
392990
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
392991
392991
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -394190,7 +394190,7 @@ var init_filesystem = __esm(() => {
|
|
|
394190
394190
|
});
|
|
394191
394191
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
394192
394192
|
const nonce = randomBytes20(16).toString("hex");
|
|
394193
|
-
return join137(getTheusTempDir(), "bundled-skills", { VERSION: "0.1.
|
|
394193
|
+
return join137(getTheusTempDir(), "bundled-skills", { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
394194
394194
|
});
|
|
394195
394195
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
394196
394196
|
});
|
|
@@ -399365,7 +399365,7 @@ function getSimpleDoingTasksSection() {
|
|
|
399365
399365
|
];
|
|
399366
399366
|
const userHelpSubitems = [
|
|
399367
399367
|
`/help: Get help with using Theus`,
|
|
399368
|
-
`To give feedback, users should ${{ VERSION: "0.1.
|
|
399368
|
+
`To give feedback, users should ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
399369
399369
|
];
|
|
399370
399370
|
const items = [
|
|
399371
399371
|
`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.`,
|
|
@@ -400187,7 +400187,7 @@ function computeFingerprint(messageText, version3) {
|
|
|
400187
400187
|
}
|
|
400188
400188
|
function computeFingerprintFromMessages(messages) {
|
|
400189
400189
|
const firstMessageText = extractFirstMessageText(messages);
|
|
400190
|
-
return computeFingerprint(firstMessageText, { VERSION: "0.1.
|
|
400190
|
+
return computeFingerprint(firstMessageText, { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
400191
400191
|
}
|
|
400192
400192
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
400193
400193
|
var init_fingerprint = () => {};
|
|
@@ -402621,7 +402621,7 @@ async function sideQuery(opts) {
|
|
|
402621
402621
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
402622
402622
|
}
|
|
402623
402623
|
const messageText = extractFirstUserMessageText(messages);
|
|
402624
|
-
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.
|
|
402624
|
+
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
402625
402625
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
402626
402626
|
const systemBlocks = [
|
|
402627
402627
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -403251,6 +403251,803 @@ var init_chromeNativeHost = __esm(() => {
|
|
|
403251
403251
|
}).passthrough());
|
|
403252
403252
|
});
|
|
403253
403253
|
|
|
403254
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
403255
|
+
class ExperimentalServerTasks {
|
|
403256
|
+
constructor(_server) {
|
|
403257
|
+
this._server = _server;
|
|
403258
|
+
}
|
|
403259
|
+
requestStream(request, resultSchema, options2) {
|
|
403260
|
+
return this._server.requestStream(request, resultSchema, options2);
|
|
403261
|
+
}
|
|
403262
|
+
createMessageStream(params, options2) {
|
|
403263
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
403264
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
403265
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
403266
|
+
}
|
|
403267
|
+
if (params.messages.length > 0) {
|
|
403268
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
403269
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
403270
|
+
const hasToolResults = lastContent.some((c5) => c5.type === "tool_result");
|
|
403271
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
403272
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
403273
|
+
const hasPreviousToolUse = previousContent.some((c5) => c5.type === "tool_use");
|
|
403274
|
+
if (hasToolResults) {
|
|
403275
|
+
if (lastContent.some((c5) => c5.type !== "tool_result")) {
|
|
403276
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
403277
|
+
}
|
|
403278
|
+
if (!hasPreviousToolUse) {
|
|
403279
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
403280
|
+
}
|
|
403281
|
+
}
|
|
403282
|
+
if (hasPreviousToolUse) {
|
|
403283
|
+
const toolUseIds = new Set(previousContent.filter((c5) => c5.type === "tool_use").map((c5) => c5.id));
|
|
403284
|
+
const toolResultIds = new Set(lastContent.filter((c5) => c5.type === "tool_result").map((c5) => c5.toolUseId));
|
|
403285
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
403286
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
403287
|
+
}
|
|
403288
|
+
}
|
|
403289
|
+
}
|
|
403290
|
+
return this.requestStream({
|
|
403291
|
+
method: "sampling/createMessage",
|
|
403292
|
+
params
|
|
403293
|
+
}, CreateMessageResultSchema, options2);
|
|
403294
|
+
}
|
|
403295
|
+
elicitInputStream(params, options2) {
|
|
403296
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
403297
|
+
const mode = params.mode ?? "form";
|
|
403298
|
+
switch (mode) {
|
|
403299
|
+
case "url": {
|
|
403300
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
403301
|
+
throw new Error("Client does not support url elicitation.");
|
|
403302
|
+
}
|
|
403303
|
+
break;
|
|
403304
|
+
}
|
|
403305
|
+
case "form": {
|
|
403306
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
403307
|
+
throw new Error("Client does not support form elicitation.");
|
|
403308
|
+
}
|
|
403309
|
+
break;
|
|
403310
|
+
}
|
|
403311
|
+
}
|
|
403312
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
403313
|
+
return this.requestStream({
|
|
403314
|
+
method: "elicitation/create",
|
|
403315
|
+
params: normalizedParams
|
|
403316
|
+
}, ElicitResultSchema, options2);
|
|
403317
|
+
}
|
|
403318
|
+
async getTask(taskId, options2) {
|
|
403319
|
+
return this._server.getTask({ taskId }, options2);
|
|
403320
|
+
}
|
|
403321
|
+
async getTaskResult(taskId, resultSchema, options2) {
|
|
403322
|
+
return this._server.getTaskResult({ taskId }, resultSchema, options2);
|
|
403323
|
+
}
|
|
403324
|
+
async listTasks(cursor, options2) {
|
|
403325
|
+
return this._server.listTasks(cursor ? { cursor } : undefined, options2);
|
|
403326
|
+
}
|
|
403327
|
+
async cancelTask(taskId, options2) {
|
|
403328
|
+
return this._server.cancelTask({ taskId }, options2);
|
|
403329
|
+
}
|
|
403330
|
+
}
|
|
403331
|
+
var init_server2 = __esm(() => {
|
|
403332
|
+
init_types();
|
|
403333
|
+
});
|
|
403334
|
+
|
|
403335
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
403336
|
+
var Server;
|
|
403337
|
+
var init_server3 = __esm(() => {
|
|
403338
|
+
init_protocol();
|
|
403339
|
+
init_types();
|
|
403340
|
+
init_ajv_provider();
|
|
403341
|
+
init_zod_compat();
|
|
403342
|
+
init_server2();
|
|
403343
|
+
Server = class Server extends Protocol {
|
|
403344
|
+
constructor(_serverInfo, options2) {
|
|
403345
|
+
super(options2);
|
|
403346
|
+
this._serverInfo = _serverInfo;
|
|
403347
|
+
this._loggingLevels = new Map;
|
|
403348
|
+
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
|
|
403349
|
+
this.isMessageIgnored = (level, sessionId) => {
|
|
403350
|
+
const currentLevel = this._loggingLevels.get(sessionId);
|
|
403351
|
+
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
403352
|
+
};
|
|
403353
|
+
this._capabilities = options2?.capabilities ?? {};
|
|
403354
|
+
this._instructions = options2?.instructions;
|
|
403355
|
+
this._jsonSchemaValidator = options2?.jsonSchemaValidator ?? new AjvJsonSchemaValidator;
|
|
403356
|
+
this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request));
|
|
403357
|
+
this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.());
|
|
403358
|
+
if (this._capabilities.logging) {
|
|
403359
|
+
this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
|
|
403360
|
+
const transportSessionId = extra.sessionId || extra.requestInfo?.headers["mcp-session-id"] || undefined;
|
|
403361
|
+
const { level } = request.params;
|
|
403362
|
+
const parseResult = LoggingLevelSchema.safeParse(level);
|
|
403363
|
+
if (parseResult.success) {
|
|
403364
|
+
this._loggingLevels.set(transportSessionId, parseResult.data);
|
|
403365
|
+
}
|
|
403366
|
+
return {};
|
|
403367
|
+
});
|
|
403368
|
+
}
|
|
403369
|
+
}
|
|
403370
|
+
get experimental() {
|
|
403371
|
+
if (!this._experimental) {
|
|
403372
|
+
this._experimental = {
|
|
403373
|
+
tasks: new ExperimentalServerTasks(this)
|
|
403374
|
+
};
|
|
403375
|
+
}
|
|
403376
|
+
return this._experimental;
|
|
403377
|
+
}
|
|
403378
|
+
registerCapabilities(capabilities) {
|
|
403379
|
+
if (this.transport) {
|
|
403380
|
+
throw new Error("Cannot register capabilities after connecting to transport");
|
|
403381
|
+
}
|
|
403382
|
+
this._capabilities = mergeCapabilities(this._capabilities, capabilities);
|
|
403383
|
+
}
|
|
403384
|
+
setRequestHandler(requestSchema, handler) {
|
|
403385
|
+
const shape = getObjectShape(requestSchema);
|
|
403386
|
+
const methodSchema = shape?.method;
|
|
403387
|
+
if (!methodSchema) {
|
|
403388
|
+
throw new Error("Schema is missing a method literal");
|
|
403389
|
+
}
|
|
403390
|
+
let methodValue;
|
|
403391
|
+
if (isZ4Schema(methodSchema)) {
|
|
403392
|
+
const v4Schema = methodSchema;
|
|
403393
|
+
const v4Def = v4Schema._zod?.def;
|
|
403394
|
+
methodValue = v4Def?.value ?? v4Schema.value;
|
|
403395
|
+
} else {
|
|
403396
|
+
const v3Schema = methodSchema;
|
|
403397
|
+
const legacyDef = v3Schema._def;
|
|
403398
|
+
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
403399
|
+
}
|
|
403400
|
+
if (typeof methodValue !== "string") {
|
|
403401
|
+
throw new Error("Schema method literal must be a string");
|
|
403402
|
+
}
|
|
403403
|
+
const method = methodValue;
|
|
403404
|
+
if (method === "tools/call") {
|
|
403405
|
+
const wrappedHandler = async (request, extra) => {
|
|
403406
|
+
const validatedRequest = safeParse3(CallToolRequestSchema, request);
|
|
403407
|
+
if (!validatedRequest.success) {
|
|
403408
|
+
const errorMessage2 = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
|
|
403409
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage2}`);
|
|
403410
|
+
}
|
|
403411
|
+
const { params } = validatedRequest.data;
|
|
403412
|
+
const result = await Promise.resolve(handler(request, extra));
|
|
403413
|
+
if (params.task) {
|
|
403414
|
+
const taskValidationResult = safeParse3(CreateTaskResultSchema, result);
|
|
403415
|
+
if (!taskValidationResult.success) {
|
|
403416
|
+
const errorMessage2 = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
|
|
403417
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage2}`);
|
|
403418
|
+
}
|
|
403419
|
+
return taskValidationResult.data;
|
|
403420
|
+
}
|
|
403421
|
+
const validationResult = safeParse3(CallToolResultSchema, result);
|
|
403422
|
+
if (!validationResult.success) {
|
|
403423
|
+
const errorMessage2 = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
|
|
403424
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage2}`);
|
|
403425
|
+
}
|
|
403426
|
+
return validationResult.data;
|
|
403427
|
+
};
|
|
403428
|
+
return super.setRequestHandler(requestSchema, wrappedHandler);
|
|
403429
|
+
}
|
|
403430
|
+
return super.setRequestHandler(requestSchema, handler);
|
|
403431
|
+
}
|
|
403432
|
+
assertCapabilityForMethod(method) {
|
|
403433
|
+
switch (method) {
|
|
403434
|
+
case "sampling/createMessage":
|
|
403435
|
+
if (!this._clientCapabilities?.sampling) {
|
|
403436
|
+
throw new Error(`Client does not support sampling (required for ${method})`);
|
|
403437
|
+
}
|
|
403438
|
+
break;
|
|
403439
|
+
case "elicitation/create":
|
|
403440
|
+
if (!this._clientCapabilities?.elicitation) {
|
|
403441
|
+
throw new Error(`Client does not support elicitation (required for ${method})`);
|
|
403442
|
+
}
|
|
403443
|
+
break;
|
|
403444
|
+
case "roots/list":
|
|
403445
|
+
if (!this._clientCapabilities?.roots) {
|
|
403446
|
+
throw new Error(`Client does not support listing roots (required for ${method})`);
|
|
403447
|
+
}
|
|
403448
|
+
break;
|
|
403449
|
+
case "ping":
|
|
403450
|
+
break;
|
|
403451
|
+
}
|
|
403452
|
+
}
|
|
403453
|
+
assertNotificationCapability(method) {
|
|
403454
|
+
switch (method) {
|
|
403455
|
+
case "notifications/message":
|
|
403456
|
+
if (!this._capabilities.logging) {
|
|
403457
|
+
throw new Error(`Server does not support logging (required for ${method})`);
|
|
403458
|
+
}
|
|
403459
|
+
break;
|
|
403460
|
+
case "notifications/resources/updated":
|
|
403461
|
+
case "notifications/resources/list_changed":
|
|
403462
|
+
if (!this._capabilities.resources) {
|
|
403463
|
+
throw new Error(`Server does not support notifying about resources (required for ${method})`);
|
|
403464
|
+
}
|
|
403465
|
+
break;
|
|
403466
|
+
case "notifications/tools/list_changed":
|
|
403467
|
+
if (!this._capabilities.tools) {
|
|
403468
|
+
throw new Error(`Server does not support notifying of tool list changes (required for ${method})`);
|
|
403469
|
+
}
|
|
403470
|
+
break;
|
|
403471
|
+
case "notifications/prompts/list_changed":
|
|
403472
|
+
if (!this._capabilities.prompts) {
|
|
403473
|
+
throw new Error(`Server does not support notifying of prompt list changes (required for ${method})`);
|
|
403474
|
+
}
|
|
403475
|
+
break;
|
|
403476
|
+
case "notifications/elicitation/complete":
|
|
403477
|
+
if (!this._clientCapabilities?.elicitation?.url) {
|
|
403478
|
+
throw new Error(`Client does not support URL elicitation (required for ${method})`);
|
|
403479
|
+
}
|
|
403480
|
+
break;
|
|
403481
|
+
case "notifications/cancelled":
|
|
403482
|
+
break;
|
|
403483
|
+
case "notifications/progress":
|
|
403484
|
+
break;
|
|
403485
|
+
}
|
|
403486
|
+
}
|
|
403487
|
+
assertRequestHandlerCapability(method) {
|
|
403488
|
+
if (!this._capabilities) {
|
|
403489
|
+
return;
|
|
403490
|
+
}
|
|
403491
|
+
switch (method) {
|
|
403492
|
+
case "completion/complete":
|
|
403493
|
+
if (!this._capabilities.completions) {
|
|
403494
|
+
throw new Error(`Server does not support completions (required for ${method})`);
|
|
403495
|
+
}
|
|
403496
|
+
break;
|
|
403497
|
+
case "logging/setLevel":
|
|
403498
|
+
if (!this._capabilities.logging) {
|
|
403499
|
+
throw new Error(`Server does not support logging (required for ${method})`);
|
|
403500
|
+
}
|
|
403501
|
+
break;
|
|
403502
|
+
case "prompts/get":
|
|
403503
|
+
case "prompts/list":
|
|
403504
|
+
if (!this._capabilities.prompts) {
|
|
403505
|
+
throw new Error(`Server does not support prompts (required for ${method})`);
|
|
403506
|
+
}
|
|
403507
|
+
break;
|
|
403508
|
+
case "resources/list":
|
|
403509
|
+
case "resources/templates/list":
|
|
403510
|
+
case "resources/read":
|
|
403511
|
+
if (!this._capabilities.resources) {
|
|
403512
|
+
throw new Error(`Server does not support resources (required for ${method})`);
|
|
403513
|
+
}
|
|
403514
|
+
break;
|
|
403515
|
+
case "tools/call":
|
|
403516
|
+
case "tools/list":
|
|
403517
|
+
if (!this._capabilities.tools) {
|
|
403518
|
+
throw new Error(`Server does not support tools (required for ${method})`);
|
|
403519
|
+
}
|
|
403520
|
+
break;
|
|
403521
|
+
case "tasks/get":
|
|
403522
|
+
case "tasks/list":
|
|
403523
|
+
case "tasks/result":
|
|
403524
|
+
case "tasks/cancel":
|
|
403525
|
+
if (!this._capabilities.tasks) {
|
|
403526
|
+
throw new Error(`Server does not support tasks capability (required for ${method})`);
|
|
403527
|
+
}
|
|
403528
|
+
break;
|
|
403529
|
+
case "ping":
|
|
403530
|
+
case "initialize":
|
|
403531
|
+
break;
|
|
403532
|
+
}
|
|
403533
|
+
}
|
|
403534
|
+
assertTaskCapability(method) {
|
|
403535
|
+
assertClientRequestTaskCapability(this._clientCapabilities?.tasks?.requests, method, "Client");
|
|
403536
|
+
}
|
|
403537
|
+
assertTaskHandlerCapability(method) {
|
|
403538
|
+
if (!this._capabilities) {
|
|
403539
|
+
return;
|
|
403540
|
+
}
|
|
403541
|
+
assertToolsCallTaskCapability(this._capabilities.tasks?.requests, method, "Server");
|
|
403542
|
+
}
|
|
403543
|
+
async _oninitialize(request) {
|
|
403544
|
+
const requestedVersion = request.params.protocolVersion;
|
|
403545
|
+
this._clientCapabilities = request.params.capabilities;
|
|
403546
|
+
this._clientVersion = request.params.clientInfo;
|
|
403547
|
+
const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION;
|
|
403548
|
+
return {
|
|
403549
|
+
protocolVersion,
|
|
403550
|
+
capabilities: this.getCapabilities(),
|
|
403551
|
+
serverInfo: this._serverInfo,
|
|
403552
|
+
...this._instructions && { instructions: this._instructions }
|
|
403553
|
+
};
|
|
403554
|
+
}
|
|
403555
|
+
getClientCapabilities() {
|
|
403556
|
+
return this._clientCapabilities;
|
|
403557
|
+
}
|
|
403558
|
+
getClientVersion() {
|
|
403559
|
+
return this._clientVersion;
|
|
403560
|
+
}
|
|
403561
|
+
getCapabilities() {
|
|
403562
|
+
return this._capabilities;
|
|
403563
|
+
}
|
|
403564
|
+
async ping() {
|
|
403565
|
+
return this.request({ method: "ping" }, EmptyResultSchema);
|
|
403566
|
+
}
|
|
403567
|
+
async createMessage(params, options2) {
|
|
403568
|
+
if (params.tools || params.toolChoice) {
|
|
403569
|
+
if (!this._clientCapabilities?.sampling?.tools) {
|
|
403570
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
403571
|
+
}
|
|
403572
|
+
}
|
|
403573
|
+
if (params.messages.length > 0) {
|
|
403574
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
403575
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
403576
|
+
const hasToolResults = lastContent.some((c5) => c5.type === "tool_result");
|
|
403577
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
403578
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
403579
|
+
const hasPreviousToolUse = previousContent.some((c5) => c5.type === "tool_use");
|
|
403580
|
+
if (hasToolResults) {
|
|
403581
|
+
if (lastContent.some((c5) => c5.type !== "tool_result")) {
|
|
403582
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
403583
|
+
}
|
|
403584
|
+
if (!hasPreviousToolUse) {
|
|
403585
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
403586
|
+
}
|
|
403587
|
+
}
|
|
403588
|
+
if (hasPreviousToolUse) {
|
|
403589
|
+
const toolUseIds = new Set(previousContent.filter((c5) => c5.type === "tool_use").map((c5) => c5.id));
|
|
403590
|
+
const toolResultIds = new Set(lastContent.filter((c5) => c5.type === "tool_result").map((c5) => c5.toolUseId));
|
|
403591
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
403592
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
403593
|
+
}
|
|
403594
|
+
}
|
|
403595
|
+
}
|
|
403596
|
+
if (params.tools) {
|
|
403597
|
+
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultWithToolsSchema, options2);
|
|
403598
|
+
}
|
|
403599
|
+
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultSchema, options2);
|
|
403600
|
+
}
|
|
403601
|
+
async elicitInput(params, options2) {
|
|
403602
|
+
const mode = params.mode ?? "form";
|
|
403603
|
+
switch (mode) {
|
|
403604
|
+
case "url": {
|
|
403605
|
+
if (!this._clientCapabilities?.elicitation?.url) {
|
|
403606
|
+
throw new Error("Client does not support url elicitation.");
|
|
403607
|
+
}
|
|
403608
|
+
const urlParams = params;
|
|
403609
|
+
return this.request({ method: "elicitation/create", params: urlParams }, ElicitResultSchema, options2);
|
|
403610
|
+
}
|
|
403611
|
+
case "form": {
|
|
403612
|
+
if (!this._clientCapabilities?.elicitation?.form) {
|
|
403613
|
+
throw new Error("Client does not support form elicitation.");
|
|
403614
|
+
}
|
|
403615
|
+
const formParams = params.mode === "form" ? params : { ...params, mode: "form" };
|
|
403616
|
+
const result = await this.request({ method: "elicitation/create", params: formParams }, ElicitResultSchema, options2);
|
|
403617
|
+
if (result.action === "accept" && result.content && formParams.requestedSchema) {
|
|
403618
|
+
try {
|
|
403619
|
+
const validator = this._jsonSchemaValidator.getValidator(formParams.requestedSchema);
|
|
403620
|
+
const validationResult = validator(result.content);
|
|
403621
|
+
if (!validationResult.valid) {
|
|
403622
|
+
throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`);
|
|
403623
|
+
}
|
|
403624
|
+
} catch (error40) {
|
|
403625
|
+
if (error40 instanceof McpError) {
|
|
403626
|
+
throw error40;
|
|
403627
|
+
}
|
|
403628
|
+
throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error40 instanceof Error ? error40.message : String(error40)}`);
|
|
403629
|
+
}
|
|
403630
|
+
}
|
|
403631
|
+
return result;
|
|
403632
|
+
}
|
|
403633
|
+
}
|
|
403634
|
+
}
|
|
403635
|
+
createElicitationCompletionNotifier(elicitationId, options2) {
|
|
403636
|
+
if (!this._clientCapabilities?.elicitation?.url) {
|
|
403637
|
+
throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");
|
|
403638
|
+
}
|
|
403639
|
+
return () => this.notification({
|
|
403640
|
+
method: "notifications/elicitation/complete",
|
|
403641
|
+
params: {
|
|
403642
|
+
elicitationId
|
|
403643
|
+
}
|
|
403644
|
+
}, options2);
|
|
403645
|
+
}
|
|
403646
|
+
async listRoots(params, options2) {
|
|
403647
|
+
return this.request({ method: "roots/list", params }, ListRootsResultSchema, options2);
|
|
403648
|
+
}
|
|
403649
|
+
async sendLoggingMessage(params, sessionId) {
|
|
403650
|
+
if (this._capabilities.logging) {
|
|
403651
|
+
if (!this.isMessageIgnored(params.level, sessionId)) {
|
|
403652
|
+
return this.notification({ method: "notifications/message", params });
|
|
403653
|
+
}
|
|
403654
|
+
}
|
|
403655
|
+
}
|
|
403656
|
+
async sendResourceUpdated(params) {
|
|
403657
|
+
return this.notification({
|
|
403658
|
+
method: "notifications/resources/updated",
|
|
403659
|
+
params
|
|
403660
|
+
});
|
|
403661
|
+
}
|
|
403662
|
+
async sendResourceListChanged() {
|
|
403663
|
+
return this.notification({
|
|
403664
|
+
method: "notifications/resources/list_changed"
|
|
403665
|
+
});
|
|
403666
|
+
}
|
|
403667
|
+
async sendToolListChanged() {
|
|
403668
|
+
return this.notification({ method: "notifications/tools/list_changed" });
|
|
403669
|
+
}
|
|
403670
|
+
async sendPromptListChanged() {
|
|
403671
|
+
return this.notification({ method: "notifications/prompts/list_changed" });
|
|
403672
|
+
}
|
|
403673
|
+
};
|
|
403674
|
+
});
|
|
403675
|
+
|
|
403676
|
+
// services/mcpProjectContext/server.ts
|
|
403677
|
+
var exports_server = {};
|
|
403678
|
+
__export(exports_server, {
|
|
403679
|
+
runProjectContextMcpServer: () => runProjectContextMcpServer
|
|
403680
|
+
});
|
|
403681
|
+
import { resolve as resolve43 } from "path";
|
|
403682
|
+
function logToStderr(message) {
|
|
403683
|
+
process.stderr.write(`[${SERVER_NAME}] ${message}
|
|
403684
|
+
`);
|
|
403685
|
+
}
|
|
403686
|
+
function readIntEnv2(name, fallback) {
|
|
403687
|
+
const raw = process.env[name];
|
|
403688
|
+
if (!raw)
|
|
403689
|
+
return fallback;
|
|
403690
|
+
const parsed = Number.parseInt(raw, 10);
|
|
403691
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
403692
|
+
}
|
|
403693
|
+
|
|
403694
|
+
class ProjectContextState {
|
|
403695
|
+
projectRoot;
|
|
403696
|
+
storePromise = null;
|
|
403697
|
+
dbPromise = null;
|
|
403698
|
+
constructor(projectRoot) {
|
|
403699
|
+
this.projectRoot = resolve43(projectRoot);
|
|
403700
|
+
}
|
|
403701
|
+
getStore() {
|
|
403702
|
+
const live = getLiveStore(this.projectRoot);
|
|
403703
|
+
if (live)
|
|
403704
|
+
return Promise.resolve(live);
|
|
403705
|
+
if (!this.storePromise) {
|
|
403706
|
+
this.storePromise = this.loadOrIndex().catch((err2) => {
|
|
403707
|
+
this.storePromise = null;
|
|
403708
|
+
throw err2;
|
|
403709
|
+
});
|
|
403710
|
+
}
|
|
403711
|
+
return this.storePromise;
|
|
403712
|
+
}
|
|
403713
|
+
async loadOrIndex() {
|
|
403714
|
+
const loaded = await KnowledgeStore.load(this.projectRoot);
|
|
403715
|
+
if (loaded.graph.nodesOfType("file").length > 0) {
|
|
403716
|
+
logToStderr(`\xEDndice persistido cargado (${loaded.graph.nodeCount} nodos, ${loaded.graph.edgeCount} aristas)`);
|
|
403717
|
+
return loaded;
|
|
403718
|
+
}
|
|
403719
|
+
logToStderr(`sin \xEDndice previo \u2014 indexando ${this.projectRoot}\u2026`);
|
|
403720
|
+
const maxFiles = readIntEnv2("INDEX_MAX_FILES", 2500);
|
|
403721
|
+
const maxFileBytes = readIntEnv2("INDEX_MAX_FILE_BYTES", 1024 * 1024);
|
|
403722
|
+
const index = await indexDirectory(this.projectRoot, this.projectRoot, {
|
|
403723
|
+
maxFiles,
|
|
403724
|
+
maxFileBytes,
|
|
403725
|
+
ignoreDirs: [".theus"]
|
|
403726
|
+
});
|
|
403727
|
+
for (const mem of loaded.graph.nodesOfType("memory"))
|
|
403728
|
+
index.graph.addNode(mem);
|
|
403729
|
+
for (const edge of loaded.graph.allEdges()) {
|
|
403730
|
+
if (loaded.graph.getNode(edge.from)?.type === "memory")
|
|
403731
|
+
index.graph.addEdge(edge);
|
|
403732
|
+
}
|
|
403733
|
+
const store = new KnowledgeStore(this.projectRoot, index.graph);
|
|
403734
|
+
store.embedAll();
|
|
403735
|
+
await store.save();
|
|
403736
|
+
logToStderr(`indexado: ${index.filesIndexed} archivos, ${index.symbolsFound} s\xEDmbolos (${index.graph.nodeCount} nodos)`);
|
|
403737
|
+
return store;
|
|
403738
|
+
}
|
|
403739
|
+
getDatabase() {
|
|
403740
|
+
if (!this.dbPromise) {
|
|
403741
|
+
this.dbPromise = discoverDatabaseSchema(this.projectRoot).catch((err2) => {
|
|
403742
|
+
this.dbPromise = null;
|
|
403743
|
+
throw err2;
|
|
403744
|
+
});
|
|
403745
|
+
}
|
|
403746
|
+
return this.dbPromise;
|
|
403747
|
+
}
|
|
403748
|
+
}
|
|
403749
|
+
function locationOf2(node) {
|
|
403750
|
+
const path19 = node.meta?.file ?? node.meta?.path;
|
|
403751
|
+
const line = node.meta?.line;
|
|
403752
|
+
if (path19 && line)
|
|
403753
|
+
return `${path19}:${line}`;
|
|
403754
|
+
return path19 ?? "";
|
|
403755
|
+
}
|
|
403756
|
+
function textResult(text) {
|
|
403757
|
+
return { content: [{ type: "text", text }] };
|
|
403758
|
+
}
|
|
403759
|
+
async function handleRecall(state, args) {
|
|
403760
|
+
const query2 = typeof args.query === "string" ? args.query.trim() : "";
|
|
403761
|
+
if (!query2)
|
|
403762
|
+
return { content: [{ type: "text", text: 'Falta el par\xE1metro "query".' }], isError: true };
|
|
403763
|
+
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) && args.limit > 0 ? Math.min(Math.floor(args.limit), 50) : 8;
|
|
403764
|
+
const store = await state.getStore();
|
|
403765
|
+
const result = recall(store, query2, { seeds: limit });
|
|
403766
|
+
const lines = [`Recall para: "${query2}"`, ""];
|
|
403767
|
+
if (result.hits.length === 0) {
|
|
403768
|
+
lines.push("(sin resultados relevantes en el \xEDndice del proyecto)");
|
|
403769
|
+
} else {
|
|
403770
|
+
lines.push("Nodos m\xE1s relevantes:");
|
|
403771
|
+
for (const h2 of result.hits) {
|
|
403772
|
+
const loc = locationOf2(h2.node);
|
|
403773
|
+
lines.push(`- [${h2.node.type}] ${h2.node.label}${loc ? ` (${loc})` : ""} \u2014 score ${h2.score.toFixed(3)} (kw ${h2.keywordScore.toFixed(2)} / vec ${h2.vectorScore.toFixed(2)}) \u2014 id: ${h2.node.id}`);
|
|
403774
|
+
}
|
|
403775
|
+
const related = result.subgraph.nodes.filter((n3) => !result.hits.some((h2) => h2.node.id === n3.id) && !n3.meta?.placeholder);
|
|
403776
|
+
if (related.length > 0) {
|
|
403777
|
+
lines.push("", `Contexto conectado (subgrafo, ${related.length} nodos):`);
|
|
403778
|
+
for (const n3 of related.slice(0, 20)) {
|
|
403779
|
+
const loc = locationOf2(n3);
|
|
403780
|
+
lines.push(`- [${n3.type}] ${n3.label}${loc ? ` (${loc})` : ""}`);
|
|
403781
|
+
}
|
|
403782
|
+
if (related.length > 20)
|
|
403783
|
+
lines.push(`\u2026 y ${related.length - 20} m\xE1s`);
|
|
403784
|
+
}
|
|
403785
|
+
if (result.subgraph.edges.length > 0) {
|
|
403786
|
+
lines.push("", "Relaciones (muestra):");
|
|
403787
|
+
for (const e of result.subgraph.edges.slice(0, 20)) {
|
|
403788
|
+
lines.push(`- ${e.from} --${e.type}--> ${e.to}`);
|
|
403789
|
+
}
|
|
403790
|
+
}
|
|
403791
|
+
}
|
|
403792
|
+
const data = {
|
|
403793
|
+
query: query2,
|
|
403794
|
+
hits: result.hits.map((h2) => ({
|
|
403795
|
+
id: h2.node.id,
|
|
403796
|
+
type: h2.node.type,
|
|
403797
|
+
label: h2.node.label,
|
|
403798
|
+
location: locationOf2(h2.node) || undefined,
|
|
403799
|
+
score: Number(h2.score.toFixed(4))
|
|
403800
|
+
})),
|
|
403801
|
+
subgraph: {
|
|
403802
|
+
nodes: result.subgraph.nodes.length,
|
|
403803
|
+
edges: result.subgraph.edges.length
|
|
403804
|
+
}
|
|
403805
|
+
};
|
|
403806
|
+
lines.push("", "```json", JSON.stringify(data, null, 2), "```");
|
|
403807
|
+
return textResult(lines.join(`
|
|
403808
|
+
`));
|
|
403809
|
+
}
|
|
403810
|
+
async function handleSymbols(state, args) {
|
|
403811
|
+
const fileFilter = typeof args.file === "string" && args.file.trim() ? args.file.trim() : undefined;
|
|
403812
|
+
const store = await state.getStore();
|
|
403813
|
+
let symbols = store.graph.nodesOfType("symbol");
|
|
403814
|
+
if (fileFilter) {
|
|
403815
|
+
symbols = symbols.filter((s) => String(s.meta?.file ?? "").includes(fileFilter));
|
|
403816
|
+
}
|
|
403817
|
+
symbols.sort((a2, b) => {
|
|
403818
|
+
const fa = String(a2.meta?.file ?? "");
|
|
403819
|
+
const fb = String(b.meta?.file ?? "");
|
|
403820
|
+
return fa === fb ? Number(a2.meta?.line ?? 0) - Number(b.meta?.line ?? 0) : fa.localeCompare(fb);
|
|
403821
|
+
});
|
|
403822
|
+
const MAX = 300;
|
|
403823
|
+
const lines = [
|
|
403824
|
+
fileFilter ? `S\xEDmbolos que coinciden con "${fileFilter}" (${symbols.length}):` : `S\xEDmbolos del proyecto (${symbols.length}):`
|
|
403825
|
+
];
|
|
403826
|
+
if (symbols.length === 0) {
|
|
403827
|
+
lines.push(fileFilter ? "(ning\xFAn s\xEDmbolo coincide con ese filtro de archivo)" : "(el \xEDndice no contiene s\xEDmbolos)");
|
|
403828
|
+
}
|
|
403829
|
+
let lastFile = "";
|
|
403830
|
+
for (const s of symbols.slice(0, MAX)) {
|
|
403831
|
+
const file2 = String(s.meta?.file ?? "?");
|
|
403832
|
+
if (file2 !== lastFile) {
|
|
403833
|
+
lines.push("", `${file2}:`);
|
|
403834
|
+
lastFile = file2;
|
|
403835
|
+
}
|
|
403836
|
+
lines.push(` - ${s.label} [${String(s.meta?.kind ?? "symbol")}] l\xEDnea ${String(s.meta?.line ?? "?")}`);
|
|
403837
|
+
}
|
|
403838
|
+
if (symbols.length > MAX) {
|
|
403839
|
+
lines.push("", `\u2026 ${symbols.length - MAX} s\xEDmbolos m\xE1s \u2014 usa el filtro "file" para acotar.`);
|
|
403840
|
+
}
|
|
403841
|
+
return textResult(lines.join(`
|
|
403842
|
+
`));
|
|
403843
|
+
}
|
|
403844
|
+
async function handleProjectMap(state) {
|
|
403845
|
+
const store = await state.getStore();
|
|
403846
|
+
const files2 = store.graph.nodesOfType("file");
|
|
403847
|
+
const symbols = store.graph.nodesOfType("symbol");
|
|
403848
|
+
const entities = store.graph.nodesOfType("entity");
|
|
403849
|
+
const memories = store.graph.nodesOfType("memory");
|
|
403850
|
+
const byKind = new Map;
|
|
403851
|
+
for (const s of symbols) {
|
|
403852
|
+
const kind = String(s.meta?.kind ?? "symbol");
|
|
403853
|
+
byKind.set(kind, (byKind.get(kind) ?? 0) + 1);
|
|
403854
|
+
}
|
|
403855
|
+
const lines = [
|
|
403856
|
+
`Mapa del proyecto: ${state.projectRoot}`,
|
|
403857
|
+
"",
|
|
403858
|
+
`Archivos indexados: ${files2.length}`,
|
|
403859
|
+
`S\xEDmbolos: ${symbols.length}`
|
|
403860
|
+
];
|
|
403861
|
+
for (const [kind, count4] of [...byKind].sort((a2, b) => b[1] - a2[1])) {
|
|
403862
|
+
lines.push(` - ${kind}: ${count4}`);
|
|
403863
|
+
}
|
|
403864
|
+
lines.push(`Entidades de dominio: ${entities.length}`);
|
|
403865
|
+
if (entities.length > 0) {
|
|
403866
|
+
const sample2 = entities.slice(0, 25).map((e) => e.label).join(", ");
|
|
403867
|
+
lines.push(` Principales: ${sample2}${entities.length > 25 ? ", \u2026" : ""}`);
|
|
403868
|
+
}
|
|
403869
|
+
lines.push(`Memorias persistentes: ${memories.length}`);
|
|
403870
|
+
lines.push(`Grafo: ${store.graph.nodeCount} nodos, ${store.graph.edgeCount} aristas`);
|
|
403871
|
+
try {
|
|
403872
|
+
const db = await state.getDatabase();
|
|
403873
|
+
if (db.schema.tables.length > 0) {
|
|
403874
|
+
lines.push("", `Base de datos (${db.sources.join(", ") || "detectada"}): ${db.schema.tables.length} tablas, ${db.schema.relations.length} relaciones`);
|
|
403875
|
+
for (const table of db.schema.tables.slice(0, 30)) {
|
|
403876
|
+
lines.push(` - ${table.name} (${table.columns.length} columnas)`);
|
|
403877
|
+
}
|
|
403878
|
+
if (db.schema.tables.length > 30) {
|
|
403879
|
+
lines.push(` \u2026 y ${db.schema.tables.length - 30} tablas m\xE1s`);
|
|
403880
|
+
}
|
|
403881
|
+
} else {
|
|
403882
|
+
lines.push("", "Base de datos: no se detect\xF3 esquema (Prisma/SQL).");
|
|
403883
|
+
}
|
|
403884
|
+
} catch (err2) {
|
|
403885
|
+
lines.push("", `Base de datos: error al descubrir el esquema (${String(err2)})`);
|
|
403886
|
+
}
|
|
403887
|
+
return textResult(lines.join(`
|
|
403888
|
+
`));
|
|
403889
|
+
}
|
|
403890
|
+
async function handleRemember(state, args) {
|
|
403891
|
+
const title = typeof args.title === "string" ? args.title.trim() : "";
|
|
403892
|
+
const text = typeof args.text === "string" ? args.text.trim() : "";
|
|
403893
|
+
if (!title || !text) {
|
|
403894
|
+
return {
|
|
403895
|
+
content: [{ type: "text", text: 'Faltan par\xE1metros: "title" y "text" son obligatorios.' }],
|
|
403896
|
+
isError: true
|
|
403897
|
+
};
|
|
403898
|
+
}
|
|
403899
|
+
const store = await state.getStore();
|
|
403900
|
+
const node = addMemory(store, { title, text });
|
|
403901
|
+
await store.save();
|
|
403902
|
+
return textResult(`Memoria guardada.
|
|
403903
|
+
- id: ${node.id}
|
|
403904
|
+
- t\xEDtulo: ${title}
|
|
403905
|
+
|
|
403906
|
+
Qued\xF3 persistida en el grafo del proyecto y ser\xE1 recuperable v\xEDa recall/memories.`);
|
|
403907
|
+
}
|
|
403908
|
+
async function handleMemories(state) {
|
|
403909
|
+
const store = await state.getStore();
|
|
403910
|
+
const memories = store.graph.nodesOfType("memory");
|
|
403911
|
+
if (memories.length === 0) {
|
|
403912
|
+
return textResult('No hay memorias persistentes para este proyecto todav\xEDa. Usa la tool "remember" para crear una.');
|
|
403913
|
+
}
|
|
403914
|
+
const lines = [`Memorias persistentes del proyecto (${memories.length}):`, ""];
|
|
403915
|
+
for (const m of memories) {
|
|
403916
|
+
const createdAt = m.meta?.createdAt ? ` \u2014 ${String(m.meta.createdAt)}` : "";
|
|
403917
|
+
lines.push(`- ${m.label}${createdAt}`);
|
|
403918
|
+
lines.push(` id: ${m.id}`);
|
|
403919
|
+
lines.push(` texto: ${m.text}`);
|
|
403920
|
+
}
|
|
403921
|
+
return textResult(lines.join(`
|
|
403922
|
+
`));
|
|
403923
|
+
}
|
|
403924
|
+
async function runProjectContextMcpServer() {
|
|
403925
|
+
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
403926
|
+
const state = new ProjectContextState(projectRoot);
|
|
403927
|
+
const server = new Server({ name: SERVER_NAME, version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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: {} } });
|
|
403928
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
403929
|
+
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
403930
|
+
name: t.name,
|
|
403931
|
+
description: t.description,
|
|
403932
|
+
inputSchema: t.inputSchema
|
|
403933
|
+
}))
|
|
403934
|
+
}));
|
|
403935
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
403936
|
+
const name = request.params.name;
|
|
403937
|
+
const args = request.params.arguments ?? {};
|
|
403938
|
+
try {
|
|
403939
|
+
switch (name) {
|
|
403940
|
+
case "recall":
|
|
403941
|
+
return await handleRecall(state, args);
|
|
403942
|
+
case "symbols":
|
|
403943
|
+
return await handleSymbols(state, args);
|
|
403944
|
+
case "project_map":
|
|
403945
|
+
return await handleProjectMap(state);
|
|
403946
|
+
case "remember":
|
|
403947
|
+
return await handleRemember(state, args);
|
|
403948
|
+
case "memories":
|
|
403949
|
+
return await handleMemories(state);
|
|
403950
|
+
default:
|
|
403951
|
+
return {
|
|
403952
|
+
content: [{ type: "text", text: `Tool desconocida: ${name}` }],
|
|
403953
|
+
isError: true
|
|
403954
|
+
};
|
|
403955
|
+
}
|
|
403956
|
+
} catch (err2) {
|
|
403957
|
+
logToStderr(`error en tool ${name}: ${String(err2)}`);
|
|
403958
|
+
return {
|
|
403959
|
+
content: [
|
|
403960
|
+
{
|
|
403961
|
+
type: "text",
|
|
403962
|
+
text: `Error ejecutando "${name}": ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
403963
|
+
}
|
|
403964
|
+
],
|
|
403965
|
+
isError: true
|
|
403966
|
+
};
|
|
403967
|
+
}
|
|
403968
|
+
});
|
|
403969
|
+
const transport = new StdioServerTransport;
|
|
403970
|
+
let exiting = false;
|
|
403971
|
+
const shutdownAndExit = () => {
|
|
403972
|
+
if (exiting)
|
|
403973
|
+
return;
|
|
403974
|
+
exiting = true;
|
|
403975
|
+
process.exit(0);
|
|
403976
|
+
};
|
|
403977
|
+
process.stdin.on("end", shutdownAndExit);
|
|
403978
|
+
process.stdin.on("error", shutdownAndExit);
|
|
403979
|
+
logToStderr(`arrancando servidor MCP (root: ${state.projectRoot})`);
|
|
403980
|
+
await server.connect(transport);
|
|
403981
|
+
logToStderr("servidor MCP listo");
|
|
403982
|
+
}
|
|
403983
|
+
var SERVER_NAME = "theus-project-context", TOOL_DEFINITIONS;
|
|
403984
|
+
var init_server4 = __esm(() => {
|
|
403985
|
+
init_server3();
|
|
403986
|
+
init_stdio2();
|
|
403987
|
+
init_types();
|
|
403988
|
+
init_indexer();
|
|
403989
|
+
init_memory();
|
|
403990
|
+
init_recall();
|
|
403991
|
+
init_store();
|
|
403992
|
+
init_dbSchema();
|
|
403993
|
+
init_projectIntelligence();
|
|
403994
|
+
TOOL_DEFINITIONS = [
|
|
403995
|
+
{
|
|
403996
|
+
name: "recall",
|
|
403997
|
+
description: "Recuperaci\xF3n h\xEDbrida (keywords + embeddings + traversal del grafo) sobre el \xEDndice del proyecto. Devuelve los nodos m\xE1s relevantes para la consulta (archivos, s\xEDmbolos, entidades y memorias) con archivo:l\xEDnea y score, m\xE1s un resumen del subgrafo conectado.",
|
|
403998
|
+
inputSchema: {
|
|
403999
|
+
type: "object",
|
|
404000
|
+
properties: {
|
|
404001
|
+
query: {
|
|
404002
|
+
type: "string",
|
|
404003
|
+
description: "Consulta en lenguaje natural o nombres de s\xEDmbolos."
|
|
404004
|
+
},
|
|
404005
|
+
limit: {
|
|
404006
|
+
type: "number",
|
|
404007
|
+
description: "M\xE1ximo de nodos semilla a devolver (por defecto 8)."
|
|
404008
|
+
}
|
|
404009
|
+
},
|
|
404010
|
+
required: ["query"]
|
|
404011
|
+
}
|
|
404012
|
+
},
|
|
404013
|
+
{
|
|
404014
|
+
name: "symbols",
|
|
404015
|
+
description: "Lista los s\xEDmbolos indexados del proyecto (funciones, clases, tipos, interfaces, enums, consts) con su archivo:l\xEDnea. Opcionalmente filtra por archivo (subcadena de la ruta relativa).",
|
|
404016
|
+
inputSchema: {
|
|
404017
|
+
type: "object",
|
|
404018
|
+
properties: {
|
|
404019
|
+
file: {
|
|
404020
|
+
type: "string",
|
|
404021
|
+
description: 'Filtro opcional: subcadena de la ruta relativa del archivo (p.ej. "services/api").'
|
|
404022
|
+
}
|
|
404023
|
+
}
|
|
404024
|
+
}
|
|
404025
|
+
},
|
|
404026
|
+
{
|
|
404027
|
+
name: "project_map",
|
|
404028
|
+
description: "Resumen estructural del proyecto: archivos indexados, conteo de s\xEDmbolos por tipo, entidades de dominio principales y esquema de base de datos si se detecta (Prisma/SQL).",
|
|
404029
|
+
inputSchema: { type: "object", properties: {} }
|
|
404030
|
+
},
|
|
404031
|
+
{
|
|
404032
|
+
name: "remember",
|
|
404033
|
+
description: "Guarda una memoria persistente en el grafo de conocimiento del proyecto (sobrevive a la sesi\xF3n; recuperable luego v\xEDa recall o memories). Devuelve el id del nodo creado.",
|
|
404034
|
+
inputSchema: {
|
|
404035
|
+
type: "object",
|
|
404036
|
+
properties: {
|
|
404037
|
+
title: { type: "string", description: "T\xEDtulo corto de la memoria." },
|
|
404038
|
+
text: { type: "string", description: "Contenido de la memoria." }
|
|
404039
|
+
},
|
|
404040
|
+
required: ["title", "text"]
|
|
404041
|
+
}
|
|
404042
|
+
},
|
|
404043
|
+
{
|
|
404044
|
+
name: "memories",
|
|
404045
|
+
description: "Lista todas las memorias persistentes guardadas para este proyecto (t\xEDtulo + texto).",
|
|
404046
|
+
inputSchema: { type: "object", properties: {} }
|
|
404047
|
+
}
|
|
404048
|
+
];
|
|
404049
|
+
});
|
|
404050
|
+
|
|
403254
404051
|
// utils/cronTasksLock.ts
|
|
403255
404052
|
import { mkdir as mkdir44, readFile as readFile48, unlink as unlink23, writeFile as writeFile44 } from "fs/promises";
|
|
403256
404053
|
import { dirname as dirname60, join as join141 } from "path";
|
|
@@ -403841,7 +404638,7 @@ async function runDaemonWorker(kind) {
|
|
|
403841
404638
|
if (schedulers.length === 0) {
|
|
403842
404639
|
console.log("[daemon:cron] sin proyectos habilitados en projects.json \u2014 keep-alive en espera");
|
|
403843
404640
|
}
|
|
403844
|
-
await new Promise((
|
|
404641
|
+
await new Promise((resolve44) => {
|
|
403845
404642
|
const keepAlive = setInterval(() => {}, 60000);
|
|
403846
404643
|
let shuttingDown = false;
|
|
403847
404644
|
const shutdown = () => {
|
|
@@ -403855,7 +404652,7 @@ async function runDaemonWorker(kind) {
|
|
|
403855
404652
|
} catch {}
|
|
403856
404653
|
}
|
|
403857
404654
|
clearInterval(keepAlive);
|
|
403858
|
-
|
|
404655
|
+
resolve44();
|
|
403859
404656
|
};
|
|
403860
404657
|
process.on("SIGTERM", shutdown);
|
|
403861
404658
|
process.on("SIGINT", shutdown);
|
|
@@ -406336,7 +407133,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
|
|
|
406336
407133
|
cleanupConn(states.get(sock));
|
|
406337
407134
|
});
|
|
406338
407135
|
});
|
|
406339
|
-
return new Promise((
|
|
407136
|
+
return new Promise((resolve44, reject2) => {
|
|
406340
407137
|
server.once("error", reject2);
|
|
406341
407138
|
server.listen(0, "127.0.0.1", () => {
|
|
406342
407139
|
const addr = server.address();
|
|
@@ -406344,7 +407141,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
|
|
|
406344
407141
|
reject2(new Error("upstreamproxy: server has no TCP address"));
|
|
406345
407142
|
return;
|
|
406346
407143
|
}
|
|
406347
|
-
|
|
407144
|
+
resolve44({
|
|
406348
407145
|
port: addr.port,
|
|
406349
407146
|
stop: () => server.close()
|
|
406350
407147
|
});
|
|
@@ -406800,7 +407597,7 @@ async function showInvalidConfigDialog({
|
|
|
406800
407597
|
...getBaseRenderOptions(false),
|
|
406801
407598
|
theme: SAFE_ERROR_THEME_NAME
|
|
406802
407599
|
};
|
|
406803
|
-
await new Promise(async (
|
|
407600
|
+
await new Promise(async (resolve44) => {
|
|
406804
407601
|
const {
|
|
406805
407602
|
unmount
|
|
406806
407603
|
} = await render(/* @__PURE__ */ jsx_runtime339.jsx(AppStateProvider, {
|
|
@@ -406810,7 +407607,7 @@ async function showInvalidConfigDialog({
|
|
|
406810
407607
|
errorDescription: error40.message,
|
|
406811
407608
|
onExit: () => {
|
|
406812
407609
|
unmount();
|
|
406813
|
-
|
|
407610
|
+
resolve44();
|
|
406814
407611
|
process.exit(1);
|
|
406815
407612
|
},
|
|
406816
407613
|
onReset: () => {
|
|
@@ -406819,7 +407616,7 @@ async function showInvalidConfigDialog({
|
|
|
406819
407616
|
encoding: "utf8"
|
|
406820
407617
|
});
|
|
406821
407618
|
unmount();
|
|
406822
|
-
|
|
407619
|
+
resolve44();
|
|
406823
407620
|
process.exit(0);
|
|
406824
407621
|
}
|
|
406825
407622
|
})
|
|
@@ -408122,7 +408919,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
408122
408919
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
408123
408920
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
408124
408921
|
betas: getSdkBetas(),
|
|
408125
|
-
theus_code_version: { VERSION: "0.1.
|
|
408922
|
+
theus_code_version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
408126
408923
|
output_style: outputStyle2,
|
|
408127
408924
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
408128
408925
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -422756,7 +423553,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
422756
423553
|
function getSemverPart(version3) {
|
|
422757
423554
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
422758
423555
|
}
|
|
422759
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.
|
|
423556
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
422760
423557
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react215.useState(() => getSemverPart(initialVersion));
|
|
422761
423558
|
if (!updatedVersion) {
|
|
422762
423559
|
return null;
|
|
@@ -422796,7 +423593,7 @@ function AutoUpdater({
|
|
|
422796
423593
|
return;
|
|
422797
423594
|
}
|
|
422798
423595
|
if (false) {}
|
|
422799
|
-
const currentVersion = { VERSION: "0.1.
|
|
423596
|
+
const currentVersion = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
422800
423597
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
422801
423598
|
let latestVersion = await getLatestVersion(channel2);
|
|
422802
423599
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -422932,7 +423729,7 @@ function AutoUpdater({
|
|
|
422932
423729
|
" ",
|
|
422933
423730
|
/* @__PURE__ */ jsx_runtime383.jsx(ThemedText, {
|
|
422934
423731
|
bold: true,
|
|
422935
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
423732
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.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.8", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
422936
423733
|
})
|
|
422937
423734
|
]
|
|
422938
423735
|
})
|
|
@@ -423009,12 +423806,12 @@ function NativeAutoUpdater({
|
|
|
423009
423806
|
logEvent("tengu_native_auto_updater_start", {});
|
|
423010
423807
|
try {
|
|
423011
423808
|
const maxVersion = await getMaxVersion();
|
|
423012
|
-
if (maxVersion && gt({ VERSION: "0.1.
|
|
423809
|
+
if (maxVersion && gt({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
423013
423810
|
const msg = await getMaxVersionMessage();
|
|
423014
423811
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
423015
423812
|
}
|
|
423016
423813
|
const result = await installLatest(channel2);
|
|
423017
|
-
const currentVersion = { VERSION: "0.1.
|
|
423814
|
+
const currentVersion = { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
423018
423815
|
const latencyMs = Date.now() - startTime2;
|
|
423019
423816
|
if (result.lockFailed) {
|
|
423020
423817
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -423151,17 +423948,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
423151
423948
|
const maxVersion = await getMaxVersion();
|
|
423152
423949
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
423153
423950
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
423154
|
-
if (gte({ VERSION: "0.1.
|
|
423155
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.
|
|
423951
|
+
if (gte({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
423952
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
423156
423953
|
setUpdateAvailable(false);
|
|
423157
423954
|
return;
|
|
423158
423955
|
}
|
|
423159
423956
|
latest = maxVersion;
|
|
423160
423957
|
}
|
|
423161
|
-
const hasUpdate = latest && !gte({ VERSION: "0.1.
|
|
423958
|
+
const hasUpdate = latest && !gte({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
423162
423959
|
setUpdateAvailable(!!hasUpdate);
|
|
423163
423960
|
if (hasUpdate) {
|
|
423164
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.
|
|
423961
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`);
|
|
423165
423962
|
}
|
|
423166
423963
|
};
|
|
423167
423964
|
$2[0] = t1;
|
|
@@ -423195,7 +423992,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
423195
423992
|
wrap: "truncate",
|
|
423196
423993
|
children: [
|
|
423197
423994
|
"currentVersion: ",
|
|
423198
|
-
{ VERSION: "0.1.
|
|
423995
|
+
{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
423199
423996
|
]
|
|
423200
423997
|
});
|
|
423201
423998
|
$2[3] = verbose;
|
|
@@ -431068,7 +431865,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
431068
431865
|
project_dir: getOriginalCwd(),
|
|
431069
431866
|
added_dirs: addedDirs
|
|
431070
431867
|
},
|
|
431071
|
-
version: { VERSION: "0.1.
|
|
431868
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
431072
431869
|
output_style: {
|
|
431073
431870
|
name: outputStyleName
|
|
431074
431871
|
},
|
|
@@ -438738,7 +439535,7 @@ var init_coordinatorHandler = __esm(() => {
|
|
|
438738
439535
|
});
|
|
438739
439536
|
|
|
438740
439537
|
// hooks/toolPermission/PermissionContext.ts
|
|
438741
|
-
function createResolveOnce(
|
|
439538
|
+
function createResolveOnce(resolve44) {
|
|
438742
439539
|
let claimed = false;
|
|
438743
439540
|
let delivered = false;
|
|
438744
439541
|
return {
|
|
@@ -438747,7 +439544,7 @@ function createResolveOnce(resolve43) {
|
|
|
438747
439544
|
return;
|
|
438748
439545
|
delivered = true;
|
|
438749
439546
|
claimed = true;
|
|
438750
|
-
|
|
439547
|
+
resolve44(value);
|
|
438751
439548
|
},
|
|
438752
439549
|
isResolved() {
|
|
438753
439550
|
return claimed;
|
|
@@ -438792,11 +439589,11 @@ function createPermissionContext(tool, input, toolUseContext, assistantMessage,
|
|
|
438792
439589
|
setToolPermissionContext(applyPermissionUpdates(appState.toolPermissionContext, updates));
|
|
438793
439590
|
return updates.some((update3) => supportsPersistence(update3.destination));
|
|
438794
439591
|
},
|
|
438795
|
-
resolveIfAborted(
|
|
439592
|
+
resolveIfAborted(resolve44) {
|
|
438796
439593
|
if (!toolUseContext.abortController.signal.aborted)
|
|
438797
439594
|
return false;
|
|
438798
439595
|
this.logCancelled();
|
|
438799
|
-
|
|
439596
|
+
resolve44(this.cancelAndAbort(undefined, true));
|
|
438800
439597
|
return true;
|
|
438801
439598
|
},
|
|
438802
439599
|
cancelAndAbort(feedback, isAbort, contentBlocks) {
|
|
@@ -438912,7 +439709,7 @@ var init_PermissionContext = __esm(() => {
|
|
|
438912
439709
|
|
|
438913
439710
|
// hooks/toolPermission/handlers/interactiveHandler.ts
|
|
438914
439711
|
import { randomUUID as randomUUID43 } from "crypto";
|
|
438915
|
-
function handleInteractivePermission(params,
|
|
439712
|
+
function handleInteractivePermission(params, resolve44) {
|
|
438916
439713
|
const {
|
|
438917
439714
|
ctx,
|
|
438918
439715
|
description,
|
|
@@ -438921,7 +439718,7 @@ function handleInteractivePermission(params, resolve43) {
|
|
|
438921
439718
|
bridgeCallbacks,
|
|
438922
439719
|
channelCallbacks
|
|
438923
439720
|
} = params;
|
|
438924
|
-
const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(
|
|
439721
|
+
const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(resolve44);
|
|
438925
439722
|
let userInteracted = false;
|
|
438926
439723
|
let checkmarkTransitionTimer;
|
|
438927
439724
|
let checkmarkAbortHandler;
|
|
@@ -439108,8 +439905,8 @@ async function handleSwarmWorkerPermission(params) {
|
|
|
439108
439905
|
...prev,
|
|
439109
439906
|
pendingWorkerRequest: null
|
|
439110
439907
|
}));
|
|
439111
|
-
const decision = await new Promise((
|
|
439112
|
-
const { resolve: resolveOnce, claim } = createResolveOnce(
|
|
439908
|
+
const decision = await new Promise((resolve44) => {
|
|
439909
|
+
const { resolve: resolveOnce, claim } = createResolveOnce(resolve44);
|
|
439113
439910
|
const request = createPermissionRequest({
|
|
439114
439911
|
toolName: ctx.tool.name,
|
|
439115
439912
|
toolUseId: ctx.toolUseID,
|
|
@@ -439175,15 +439972,15 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439175
439972
|
const $2 = c3(3);
|
|
439176
439973
|
let t0;
|
|
439177
439974
|
if ($2[0] !== setToolPermissionContext || $2[1] !== setToolUseConfirmQueue) {
|
|
439178
|
-
t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((
|
|
439975
|
+
t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((resolve44) => {
|
|
439179
439976
|
const ctx = createPermissionContext(tool, input, toolUseContext, assistantMessage, toolUseID, setToolPermissionContext, createPermissionQueueOps(setToolUseConfirmQueue));
|
|
439180
|
-
if (ctx.resolveIfAborted(
|
|
439977
|
+
if (ctx.resolveIfAborted(resolve44)) {
|
|
439181
439978
|
return;
|
|
439182
439979
|
}
|
|
439183
439980
|
const decisionPromise = forceDecision !== undefined ? Promise.resolve(forceDecision) : hasPermissionsToUseTool(tool, input, toolUseContext, assistantMessage, toolUseID);
|
|
439184
439981
|
return decisionPromise.then(async (result) => {
|
|
439185
439982
|
if (result.behavior === "allow") {
|
|
439186
|
-
if (ctx.resolveIfAborted(
|
|
439983
|
+
if (ctx.resolveIfAborted(resolve44)) {
|
|
439187
439984
|
return;
|
|
439188
439985
|
}
|
|
439189
439986
|
if (false) {}
|
|
@@ -439191,7 +439988,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439191
439988
|
decision: "accept",
|
|
439192
439989
|
source: "config"
|
|
439193
439990
|
});
|
|
439194
|
-
|
|
439991
|
+
resolve44(ctx.buildAllow(result.updatedInput ?? input, {
|
|
439195
439992
|
decisionReason: result.decisionReason
|
|
439196
439993
|
}));
|
|
439197
439994
|
return;
|
|
@@ -439202,7 +439999,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439202
439999
|
toolPermissionContext: appState.toolPermissionContext,
|
|
439203
440000
|
tools: toolUseContext.options.tools
|
|
439204
440001
|
});
|
|
439205
|
-
if (ctx.resolveIfAborted(
|
|
440002
|
+
if (ctx.resolveIfAborted(resolve44)) {
|
|
439206
440003
|
return;
|
|
439207
440004
|
}
|
|
439208
440005
|
switch (result.behavior) {
|
|
@@ -439218,7 +440015,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439218
440015
|
source: "config"
|
|
439219
440016
|
});
|
|
439220
440017
|
if (false) {}
|
|
439221
|
-
|
|
440018
|
+
resolve44(result);
|
|
439222
440019
|
return;
|
|
439223
440020
|
}
|
|
439224
440021
|
case "ask": {
|
|
@@ -439231,11 +440028,11 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439231
440028
|
permissionMode: appState.toolPermissionContext.mode
|
|
439232
440029
|
});
|
|
439233
440030
|
if (coordinatorDecision) {
|
|
439234
|
-
|
|
440031
|
+
resolve44(coordinatorDecision);
|
|
439235
440032
|
return;
|
|
439236
440033
|
}
|
|
439237
440034
|
}
|
|
439238
|
-
if (ctx.resolveIfAborted(
|
|
440035
|
+
if (ctx.resolveIfAborted(resolve44)) {
|
|
439239
440036
|
return;
|
|
439240
440037
|
}
|
|
439241
440038
|
const swarmDecision = await handleSwarmWorkerPermission({
|
|
@@ -439246,7 +440043,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439246
440043
|
suggestions: result.suggestions
|
|
439247
440044
|
});
|
|
439248
440045
|
if (swarmDecision) {
|
|
439249
|
-
|
|
440046
|
+
resolve44(swarmDecision);
|
|
439250
440047
|
return;
|
|
439251
440048
|
}
|
|
439252
440049
|
if (false) {}
|
|
@@ -439257,7 +440054,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439257
440054
|
awaitAutomatedChecksBeforeDialog: appState.toolPermissionContext.awaitAutomatedChecksBeforeDialog,
|
|
439258
440055
|
bridgeCallbacks: undefined,
|
|
439259
440056
|
channelCallbacks: undefined
|
|
439260
|
-
},
|
|
440057
|
+
}, resolve44);
|
|
439261
440058
|
return;
|
|
439262
440059
|
}
|
|
439263
440060
|
}
|
|
@@ -439265,10 +440062,10 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
439265
440062
|
if (error40 instanceof AbortError || error40 instanceof import_sdk13.APIUserAbortError) {
|
|
439266
440063
|
logForDebugging(`Permission check threw ${error40.constructor.name} for tool=${tool.name}: ${error40.message}`);
|
|
439267
440064
|
ctx.logCancelled();
|
|
439268
|
-
|
|
440065
|
+
resolve44(ctx.cancelAndAbort(undefined, true));
|
|
439269
440066
|
} else {
|
|
439270
440067
|
logError2(error40);
|
|
439271
|
-
|
|
440068
|
+
resolve44(ctx.cancelAndAbort(undefined, true));
|
|
439272
440069
|
}
|
|
439273
440070
|
}).finally(() => {
|
|
439274
440071
|
clearClassifierChecking(toolUseID);
|
|
@@ -442631,7 +443428,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
442631
443428
|
} catch {}
|
|
442632
443429
|
const data = {
|
|
442633
443430
|
trigger,
|
|
442634
|
-
version: { VERSION: "0.1.
|
|
443431
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
442635
443432
|
platform: process.platform,
|
|
442636
443433
|
transcript,
|
|
442637
443434
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -446017,7 +446814,7 @@ class StructuredIO {
|
|
|
446017
446814
|
});
|
|
446018
446815
|
}
|
|
446019
446816
|
try {
|
|
446020
|
-
return await new Promise((
|
|
446817
|
+
return await new Promise((resolve45, reject2) => {
|
|
446021
446818
|
this.pendingRequests.set(requestId, {
|
|
446022
446819
|
request: {
|
|
446023
446820
|
type: "control_request",
|
|
@@ -446025,7 +446822,7 @@ class StructuredIO {
|
|
|
446025
446822
|
request
|
|
446026
446823
|
},
|
|
446027
446824
|
resolve: (result) => {
|
|
446028
|
-
|
|
446825
|
+
resolve45(result);
|
|
446029
446826
|
},
|
|
446030
446827
|
reject: reject2,
|
|
446031
446828
|
schema
|
|
@@ -447148,7 +447945,7 @@ function usePluginRecommendationBase() {
|
|
|
447148
447945
|
const isCheckingRef = React143.useRef(false);
|
|
447149
447946
|
let t0;
|
|
447150
447947
|
if ($2[0] !== recommendation) {
|
|
447151
|
-
t0 = (
|
|
447948
|
+
t0 = (resolve45) => {
|
|
447152
447949
|
if (getIsRemoteMode()) {
|
|
447153
447950
|
return;
|
|
447154
447951
|
}
|
|
@@ -447159,7 +447956,7 @@ function usePluginRecommendationBase() {
|
|
|
447159
447956
|
return;
|
|
447160
447957
|
}
|
|
447161
447958
|
isCheckingRef.current = true;
|
|
447162
|
-
|
|
447959
|
+
resolve45().then((rec) => {
|
|
447163
447960
|
if (rec) {
|
|
447164
447961
|
setRecommendation(rec);
|
|
447165
447962
|
}
|
|
@@ -448035,7 +448832,7 @@ var init_usePluginAutoupdateNotification = __esm(() => {
|
|
|
448035
448832
|
});
|
|
448036
448833
|
|
|
448037
448834
|
// utils/plugins/reconciler.ts
|
|
448038
|
-
import { isAbsolute as isAbsolute25, resolve as
|
|
448835
|
+
import { isAbsolute as isAbsolute25, resolve as resolve45 } from "path";
|
|
448039
448836
|
function diffMarketplaces(declared, materialized, opts) {
|
|
448040
448837
|
const missing = [];
|
|
448041
448838
|
const sourceChanged = [];
|
|
@@ -448148,7 +448945,7 @@ function normalizeSource(source, projectRoot) {
|
|
|
448148
448945
|
const canonicalRoot = findCanonicalGitRoot(base2);
|
|
448149
448946
|
return {
|
|
448150
448947
|
...source,
|
|
448151
|
-
path:
|
|
448948
|
+
path: resolve45(canonicalRoot ?? base2, source.path)
|
|
448152
448949
|
};
|
|
448153
448950
|
}
|
|
448154
448951
|
return source;
|
|
@@ -451592,12 +452389,12 @@ Error: sandbox required but unavailable: ${reason}
|
|
|
451592
452389
|
return () => unregisterLeaderSetToolPermissionContext();
|
|
451593
452390
|
}, [setToolPermissionContext]);
|
|
451594
452391
|
const canUseTool = useCanUseTool_default(setToolUseConfirmQueue, setToolPermissionContext);
|
|
451595
|
-
const requestPrompt = import_react308.useCallback((title, toolInputSummary) => (request) => new Promise((
|
|
452392
|
+
const requestPrompt = import_react308.useCallback((title, toolInputSummary) => (request) => new Promise((resolve46, reject2) => {
|
|
451596
452393
|
setPromptQueue((prev) => [...prev, {
|
|
451597
452394
|
request,
|
|
451598
452395
|
title,
|
|
451599
452396
|
toolInputSummary,
|
|
451600
|
-
resolve:
|
|
452397
|
+
resolve: resolve46,
|
|
451601
452398
|
reject: reject2
|
|
451602
452399
|
}]);
|
|
451603
452400
|
}), []);
|
|
@@ -454474,8 +455271,8 @@ async function handleMcpjsonServerApprovals(root2) {
|
|
|
454474
455271
|
if (pendingServers.length === 0) {
|
|
454475
455272
|
return;
|
|
454476
455273
|
}
|
|
454477
|
-
await new Promise((
|
|
454478
|
-
const done = () => void
|
|
455274
|
+
await new Promise((resolve46) => {
|
|
455275
|
+
const done = () => void resolve46();
|
|
454479
455276
|
if (pendingServers.length === 1 && pendingServers[0] !== undefined) {
|
|
454480
455277
|
const serverName = pendingServers[0];
|
|
454481
455278
|
root2.render(/* @__PURE__ */ jsx_runtime452.jsx(AppStateProvider, {
|
|
@@ -455421,7 +456218,7 @@ function Onboarding({
|
|
|
455421
456218
|
flexDirection: "column",
|
|
455422
456219
|
children: [
|
|
455423
456220
|
/* @__PURE__ */ jsx_runtime457.jsx(TheusBanner, {
|
|
455424
|
-
version: { VERSION: "0.1.
|
|
456221
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
455425
456222
|
}),
|
|
455426
456223
|
/* @__PURE__ */ jsx_runtime457.jsxs(ThemedBox_default, {
|
|
455427
456224
|
flexDirection: "column",
|
|
@@ -456292,12 +457089,12 @@ function completeOnboarding() {
|
|
|
456292
457089
|
saveGlobalConfig((current) => ({
|
|
456293
457090
|
...current,
|
|
456294
457091
|
hasCompletedOnboarding: true,
|
|
456295
|
-
lastOnboardingVersion: { VERSION: "0.1.
|
|
457092
|
+
lastOnboardingVersion: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
456296
457093
|
}));
|
|
456297
457094
|
}
|
|
456298
457095
|
function showDialog(root2, renderer) {
|
|
456299
|
-
return new Promise((
|
|
456300
|
-
const done = (result) => void
|
|
457096
|
+
return new Promise((resolve46) => {
|
|
457097
|
+
const done = (result) => void resolve46(result);
|
|
456301
457098
|
root2.render(renderer(done));
|
|
456302
457099
|
});
|
|
456303
457100
|
}
|
|
@@ -461014,7 +461811,7 @@ function appendToLog(path21, message) {
|
|
|
461014
461811
|
cwd: getFsImplementation().cwd(),
|
|
461015
461812
|
userType: process.env.USER_TYPE,
|
|
461016
461813
|
sessionId: getSessionId(),
|
|
461017
|
-
version: { VERSION: "0.1.
|
|
461814
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
461018
461815
|
};
|
|
461019
461816
|
getLogWriter(path21).write(messageWithTimestamp);
|
|
461020
461817
|
}
|
|
@@ -461826,8 +462623,8 @@ class SerialBatchEventUploader {
|
|
|
461826
462623
|
if (items.length === 0)
|
|
461827
462624
|
return;
|
|
461828
462625
|
while (this.pending.length + items.length > this.config.maxQueueSize && !this.closed) {
|
|
461829
|
-
await new Promise((
|
|
461830
|
-
this.backpressureResolvers.push(
|
|
462626
|
+
await new Promise((resolve46) => {
|
|
462627
|
+
this.backpressureResolvers.push(resolve46);
|
|
461831
462628
|
});
|
|
461832
462629
|
}
|
|
461833
462630
|
if (this.closed)
|
|
@@ -461840,8 +462637,8 @@ class SerialBatchEventUploader {
|
|
|
461840
462637
|
return Promise.resolve();
|
|
461841
462638
|
}
|
|
461842
462639
|
this.drain();
|
|
461843
|
-
return new Promise((
|
|
461844
|
-
this.flushResolvers.push(
|
|
462640
|
+
return new Promise((resolve46) => {
|
|
462641
|
+
this.flushResolvers.push(resolve46);
|
|
461845
462642
|
});
|
|
461846
462643
|
}
|
|
461847
462644
|
close() {
|
|
@@ -461852,11 +462649,11 @@ class SerialBatchEventUploader {
|
|
|
461852
462649
|
this.pending = [];
|
|
461853
462650
|
this.sleepResolve?.();
|
|
461854
462651
|
this.sleepResolve = null;
|
|
461855
|
-
for (const
|
|
461856
|
-
|
|
462652
|
+
for (const resolve46 of this.backpressureResolvers)
|
|
462653
|
+
resolve46();
|
|
461857
462654
|
this.backpressureResolvers = [];
|
|
461858
|
-
for (const
|
|
461859
|
-
|
|
462655
|
+
for (const resolve46 of this.flushResolvers)
|
|
462656
|
+
resolve46();
|
|
461860
462657
|
this.flushResolvers = [];
|
|
461861
462658
|
}
|
|
461862
462659
|
async drain() {
|
|
@@ -461891,8 +462688,8 @@ class SerialBatchEventUploader {
|
|
|
461891
462688
|
} finally {
|
|
461892
462689
|
this.draining = false;
|
|
461893
462690
|
if (this.pending.length === 0) {
|
|
461894
|
-
for (const
|
|
461895
|
-
|
|
462691
|
+
for (const resolve46 of this.flushResolvers)
|
|
462692
|
+
resolve46();
|
|
461896
462693
|
this.flushResolvers = [];
|
|
461897
462694
|
}
|
|
461898
462695
|
}
|
|
@@ -461931,16 +462728,16 @@ class SerialBatchEventUploader {
|
|
|
461931
462728
|
releaseBackpressure() {
|
|
461932
462729
|
const resolvers2 = this.backpressureResolvers;
|
|
461933
462730
|
this.backpressureResolvers = [];
|
|
461934
|
-
for (const
|
|
461935
|
-
|
|
462731
|
+
for (const resolve46 of resolvers2)
|
|
462732
|
+
resolve46();
|
|
461936
462733
|
}
|
|
461937
462734
|
sleep(ms) {
|
|
461938
|
-
return new Promise((
|
|
461939
|
-
this.sleepResolve =
|
|
461940
|
-
setTimeout((self2,
|
|
462735
|
+
return new Promise((resolve46) => {
|
|
462736
|
+
this.sleepResolve = resolve46;
|
|
462737
|
+
setTimeout((self2, resolve47) => {
|
|
461941
462738
|
self2.sleepResolve = null;
|
|
461942
|
-
|
|
461943
|
-
}, ms, this,
|
|
462739
|
+
resolve47();
|
|
462740
|
+
}, ms, this, resolve46);
|
|
461944
462741
|
});
|
|
461945
462742
|
}
|
|
461946
462743
|
}
|
|
@@ -463885,8 +464682,8 @@ async function buildKnowledgeInjection(projectRoot, userText, opts = {}) {
|
|
|
463885
464682
|
try {
|
|
463886
464683
|
return await Promise.race([
|
|
463887
464684
|
work.catch(() => null),
|
|
463888
|
-
new Promise((
|
|
463889
|
-
const t = setTimeout(() =>
|
|
464685
|
+
new Promise((resolve46) => {
|
|
464686
|
+
const t = setTimeout(() => resolve46(null), timeBudgetMs);
|
|
463890
464687
|
t.unref?.();
|
|
463891
464688
|
})
|
|
463892
464689
|
]);
|
|
@@ -464610,12 +465407,12 @@ class QueryEngine {
|
|
|
464610
465407
|
};
|
|
464611
465408
|
return;
|
|
464612
465409
|
}
|
|
464613
|
-
let
|
|
465410
|
+
let textResult2 = "";
|
|
464614
465411
|
let isApiError = false;
|
|
464615
465412
|
if (result.type === "assistant") {
|
|
464616
465413
|
const lastContent = last_default(result.message.content);
|
|
464617
465414
|
if (lastContent?.type === "text" && !SYNTHETIC_MESSAGES.has(lastContent.text)) {
|
|
464618
|
-
|
|
465415
|
+
textResult2 = lastContent.text;
|
|
464619
465416
|
}
|
|
464620
465417
|
isApiError = Boolean(result.isApiErrorMessage);
|
|
464621
465418
|
}
|
|
@@ -464626,7 +465423,7 @@ class QueryEngine {
|
|
|
464626
465423
|
duration_ms: Date.now() - startTime2,
|
|
464627
465424
|
duration_api_ms: getTotalAPIDuration(),
|
|
464628
465425
|
num_turns: turnCount,
|
|
464629
|
-
result:
|
|
465426
|
+
result: textResult2,
|
|
464630
465427
|
stop_reason: lastStopReason,
|
|
464631
465428
|
session_id: getSessionId(),
|
|
464632
465429
|
total_cost_usd: getTotalCostUSD(),
|
|
@@ -465174,8 +465971,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
465174
465971
|
}
|
|
465175
465972
|
async function checkEnvLessBridgeMinVersion() {
|
|
465176
465973
|
const cfg = await getEnvLessBridgeConfig();
|
|
465177
|
-
if (cfg.min_version && lt({ VERSION: "0.1.
|
|
465178
|
-
return `Your version of Theus (${{ VERSION: "0.1.
|
|
465974
|
+
if (cfg.min_version && lt({ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
465975
|
+
return `Your version of Theus (${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
465179
465976
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
465180
465977
|
}
|
|
465181
465978
|
return null;
|
|
@@ -465649,7 +466446,7 @@ async function initBridgeCore(params) {
|
|
|
465649
466446
|
const rawApi = createBridgeApiClient({
|
|
465650
466447
|
baseUrl,
|
|
465651
466448
|
getAccessToken,
|
|
465652
|
-
runnerVersion: { VERSION: "0.1.
|
|
466449
|
+
runnerVersion: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
465653
466450
|
onDebug: logForDebugging,
|
|
465654
466451
|
onAuth401,
|
|
465655
466452
|
getTrustedDeviceToken
|
|
@@ -469075,8 +469872,8 @@ ${m.text}
|
|
|
469075
469872
|
const controller = new AbortController;
|
|
469076
469873
|
activeOAuthFlows.set(serverName, controller);
|
|
469077
469874
|
let resolveAuthUrl;
|
|
469078
|
-
const authUrlPromise = new Promise((
|
|
469079
|
-
resolveAuthUrl =
|
|
469875
|
+
const authUrlPromise = new Promise((resolve46) => {
|
|
469876
|
+
resolveAuthUrl = resolve46;
|
|
469080
469877
|
});
|
|
469081
469878
|
const oauthPromise = performMCPOAuthFlow(serverName, config3, (url3) => resolveAuthUrl(url3), controller.signal, {
|
|
469082
469879
|
skipBrowserOpen: true,
|
|
@@ -469189,8 +469986,8 @@ ${m.text}
|
|
|
469189
469986
|
});
|
|
469190
469987
|
const service = new OAuthService;
|
|
469191
469988
|
let urlResolver;
|
|
469192
|
-
const urlPromise = new Promise((
|
|
469193
|
-
urlResolver =
|
|
469989
|
+
const urlPromise = new Promise((resolve46) => {
|
|
469990
|
+
urlResolver = resolve46;
|
|
469194
469991
|
});
|
|
469195
469992
|
const flow = service.startOAuthFlow(async (manualUrl, automaticUrl) => {
|
|
469196
469993
|
urlResolver({ manualUrl, automaticUrl });
|
|
@@ -469577,8 +470374,8 @@ function createCanUseToolWithPermissionPrompt(permissionPromptTool) {
|
|
|
469577
470374
|
}
|
|
469578
470375
|
};
|
|
469579
470376
|
}
|
|
469580
|
-
const abortPromise = new Promise((
|
|
469581
|
-
combinedSignal.addEventListener("abort", () =>
|
|
470377
|
+
const abortPromise = new Promise((resolve46) => {
|
|
470378
|
+
combinedSignal.addEventListener("abort", () => resolve46("aborted"), {
|
|
469582
470379
|
once: true
|
|
469583
470380
|
});
|
|
469584
470381
|
});
|
|
@@ -470904,428 +471701,6 @@ var init_MCPServerDesktopImportDialog = __esm(() => {
|
|
|
470904
471701
|
jsx_runtime470 = __toESM(require_jsx_runtime(), 1);
|
|
470905
471702
|
});
|
|
470906
471703
|
|
|
470907
|
-
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
470908
|
-
class ExperimentalServerTasks {
|
|
470909
|
-
constructor(_server) {
|
|
470910
|
-
this._server = _server;
|
|
470911
|
-
}
|
|
470912
|
-
requestStream(request, resultSchema, options2) {
|
|
470913
|
-
return this._server.requestStream(request, resultSchema, options2);
|
|
470914
|
-
}
|
|
470915
|
-
createMessageStream(params, options2) {
|
|
470916
|
-
const clientCapabilities = this._server.getClientCapabilities();
|
|
470917
|
-
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
470918
|
-
throw new Error("Client does not support sampling tools capability.");
|
|
470919
|
-
}
|
|
470920
|
-
if (params.messages.length > 0) {
|
|
470921
|
-
const lastMessage = params.messages[params.messages.length - 1];
|
|
470922
|
-
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
470923
|
-
const hasToolResults = lastContent.some((c5) => c5.type === "tool_result");
|
|
470924
|
-
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
470925
|
-
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
470926
|
-
const hasPreviousToolUse = previousContent.some((c5) => c5.type === "tool_use");
|
|
470927
|
-
if (hasToolResults) {
|
|
470928
|
-
if (lastContent.some((c5) => c5.type !== "tool_result")) {
|
|
470929
|
-
throw new Error("The last message must contain only tool_result content if any is present");
|
|
470930
|
-
}
|
|
470931
|
-
if (!hasPreviousToolUse) {
|
|
470932
|
-
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
470933
|
-
}
|
|
470934
|
-
}
|
|
470935
|
-
if (hasPreviousToolUse) {
|
|
470936
|
-
const toolUseIds = new Set(previousContent.filter((c5) => c5.type === "tool_use").map((c5) => c5.id));
|
|
470937
|
-
const toolResultIds = new Set(lastContent.filter((c5) => c5.type === "tool_result").map((c5) => c5.toolUseId));
|
|
470938
|
-
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
470939
|
-
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
470940
|
-
}
|
|
470941
|
-
}
|
|
470942
|
-
}
|
|
470943
|
-
return this.requestStream({
|
|
470944
|
-
method: "sampling/createMessage",
|
|
470945
|
-
params
|
|
470946
|
-
}, CreateMessageResultSchema, options2);
|
|
470947
|
-
}
|
|
470948
|
-
elicitInputStream(params, options2) {
|
|
470949
|
-
const clientCapabilities = this._server.getClientCapabilities();
|
|
470950
|
-
const mode = params.mode ?? "form";
|
|
470951
|
-
switch (mode) {
|
|
470952
|
-
case "url": {
|
|
470953
|
-
if (!clientCapabilities?.elicitation?.url) {
|
|
470954
|
-
throw new Error("Client does not support url elicitation.");
|
|
470955
|
-
}
|
|
470956
|
-
break;
|
|
470957
|
-
}
|
|
470958
|
-
case "form": {
|
|
470959
|
-
if (!clientCapabilities?.elicitation?.form) {
|
|
470960
|
-
throw new Error("Client does not support form elicitation.");
|
|
470961
|
-
}
|
|
470962
|
-
break;
|
|
470963
|
-
}
|
|
470964
|
-
}
|
|
470965
|
-
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
470966
|
-
return this.requestStream({
|
|
470967
|
-
method: "elicitation/create",
|
|
470968
|
-
params: normalizedParams
|
|
470969
|
-
}, ElicitResultSchema, options2);
|
|
470970
|
-
}
|
|
470971
|
-
async getTask(taskId, options2) {
|
|
470972
|
-
return this._server.getTask({ taskId }, options2);
|
|
470973
|
-
}
|
|
470974
|
-
async getTaskResult(taskId, resultSchema, options2) {
|
|
470975
|
-
return this._server.getTaskResult({ taskId }, resultSchema, options2);
|
|
470976
|
-
}
|
|
470977
|
-
async listTasks(cursor, options2) {
|
|
470978
|
-
return this._server.listTasks(cursor ? { cursor } : undefined, options2);
|
|
470979
|
-
}
|
|
470980
|
-
async cancelTask(taskId, options2) {
|
|
470981
|
-
return this._server.cancelTask({ taskId }, options2);
|
|
470982
|
-
}
|
|
470983
|
-
}
|
|
470984
|
-
var init_server2 = __esm(() => {
|
|
470985
|
-
init_types();
|
|
470986
|
-
});
|
|
470987
|
-
|
|
470988
|
-
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
470989
|
-
var Server;
|
|
470990
|
-
var init_server3 = __esm(() => {
|
|
470991
|
-
init_protocol();
|
|
470992
|
-
init_types();
|
|
470993
|
-
init_ajv_provider();
|
|
470994
|
-
init_zod_compat();
|
|
470995
|
-
init_server2();
|
|
470996
|
-
Server = class Server extends Protocol {
|
|
470997
|
-
constructor(_serverInfo, options2) {
|
|
470998
|
-
super(options2);
|
|
470999
|
-
this._serverInfo = _serverInfo;
|
|
471000
|
-
this._loggingLevels = new Map;
|
|
471001
|
-
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
|
|
471002
|
-
this.isMessageIgnored = (level, sessionId) => {
|
|
471003
|
-
const currentLevel = this._loggingLevels.get(sessionId);
|
|
471004
|
-
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
471005
|
-
};
|
|
471006
|
-
this._capabilities = options2?.capabilities ?? {};
|
|
471007
|
-
this._instructions = options2?.instructions;
|
|
471008
|
-
this._jsonSchemaValidator = options2?.jsonSchemaValidator ?? new AjvJsonSchemaValidator;
|
|
471009
|
-
this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request));
|
|
471010
|
-
this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.());
|
|
471011
|
-
if (this._capabilities.logging) {
|
|
471012
|
-
this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
|
|
471013
|
-
const transportSessionId = extra.sessionId || extra.requestInfo?.headers["mcp-session-id"] || undefined;
|
|
471014
|
-
const { level } = request.params;
|
|
471015
|
-
const parseResult = LoggingLevelSchema.safeParse(level);
|
|
471016
|
-
if (parseResult.success) {
|
|
471017
|
-
this._loggingLevels.set(transportSessionId, parseResult.data);
|
|
471018
|
-
}
|
|
471019
|
-
return {};
|
|
471020
|
-
});
|
|
471021
|
-
}
|
|
471022
|
-
}
|
|
471023
|
-
get experimental() {
|
|
471024
|
-
if (!this._experimental) {
|
|
471025
|
-
this._experimental = {
|
|
471026
|
-
tasks: new ExperimentalServerTasks(this)
|
|
471027
|
-
};
|
|
471028
|
-
}
|
|
471029
|
-
return this._experimental;
|
|
471030
|
-
}
|
|
471031
|
-
registerCapabilities(capabilities) {
|
|
471032
|
-
if (this.transport) {
|
|
471033
|
-
throw new Error("Cannot register capabilities after connecting to transport");
|
|
471034
|
-
}
|
|
471035
|
-
this._capabilities = mergeCapabilities(this._capabilities, capabilities);
|
|
471036
|
-
}
|
|
471037
|
-
setRequestHandler(requestSchema, handler) {
|
|
471038
|
-
const shape = getObjectShape(requestSchema);
|
|
471039
|
-
const methodSchema = shape?.method;
|
|
471040
|
-
if (!methodSchema) {
|
|
471041
|
-
throw new Error("Schema is missing a method literal");
|
|
471042
|
-
}
|
|
471043
|
-
let methodValue;
|
|
471044
|
-
if (isZ4Schema(methodSchema)) {
|
|
471045
|
-
const v4Schema = methodSchema;
|
|
471046
|
-
const v4Def = v4Schema._zod?.def;
|
|
471047
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
471048
|
-
} else {
|
|
471049
|
-
const v3Schema = methodSchema;
|
|
471050
|
-
const legacyDef = v3Schema._def;
|
|
471051
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
471052
|
-
}
|
|
471053
|
-
if (typeof methodValue !== "string") {
|
|
471054
|
-
throw new Error("Schema method literal must be a string");
|
|
471055
|
-
}
|
|
471056
|
-
const method = methodValue;
|
|
471057
|
-
if (method === "tools/call") {
|
|
471058
|
-
const wrappedHandler = async (request, extra) => {
|
|
471059
|
-
const validatedRequest = safeParse3(CallToolRequestSchema, request);
|
|
471060
|
-
if (!validatedRequest.success) {
|
|
471061
|
-
const errorMessage4 = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
|
|
471062
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage4}`);
|
|
471063
|
-
}
|
|
471064
|
-
const { params } = validatedRequest.data;
|
|
471065
|
-
const result = await Promise.resolve(handler(request, extra));
|
|
471066
|
-
if (params.task) {
|
|
471067
|
-
const taskValidationResult = safeParse3(CreateTaskResultSchema, result);
|
|
471068
|
-
if (!taskValidationResult.success) {
|
|
471069
|
-
const errorMessage4 = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
|
|
471070
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage4}`);
|
|
471071
|
-
}
|
|
471072
|
-
return taskValidationResult.data;
|
|
471073
|
-
}
|
|
471074
|
-
const validationResult = safeParse3(CallToolResultSchema, result);
|
|
471075
|
-
if (!validationResult.success) {
|
|
471076
|
-
const errorMessage4 = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
|
|
471077
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage4}`);
|
|
471078
|
-
}
|
|
471079
|
-
return validationResult.data;
|
|
471080
|
-
};
|
|
471081
|
-
return super.setRequestHandler(requestSchema, wrappedHandler);
|
|
471082
|
-
}
|
|
471083
|
-
return super.setRequestHandler(requestSchema, handler);
|
|
471084
|
-
}
|
|
471085
|
-
assertCapabilityForMethod(method) {
|
|
471086
|
-
switch (method) {
|
|
471087
|
-
case "sampling/createMessage":
|
|
471088
|
-
if (!this._clientCapabilities?.sampling) {
|
|
471089
|
-
throw new Error(`Client does not support sampling (required for ${method})`);
|
|
471090
|
-
}
|
|
471091
|
-
break;
|
|
471092
|
-
case "elicitation/create":
|
|
471093
|
-
if (!this._clientCapabilities?.elicitation) {
|
|
471094
|
-
throw new Error(`Client does not support elicitation (required for ${method})`);
|
|
471095
|
-
}
|
|
471096
|
-
break;
|
|
471097
|
-
case "roots/list":
|
|
471098
|
-
if (!this._clientCapabilities?.roots) {
|
|
471099
|
-
throw new Error(`Client does not support listing roots (required for ${method})`);
|
|
471100
|
-
}
|
|
471101
|
-
break;
|
|
471102
|
-
case "ping":
|
|
471103
|
-
break;
|
|
471104
|
-
}
|
|
471105
|
-
}
|
|
471106
|
-
assertNotificationCapability(method) {
|
|
471107
|
-
switch (method) {
|
|
471108
|
-
case "notifications/message":
|
|
471109
|
-
if (!this._capabilities.logging) {
|
|
471110
|
-
throw new Error(`Server does not support logging (required for ${method})`);
|
|
471111
|
-
}
|
|
471112
|
-
break;
|
|
471113
|
-
case "notifications/resources/updated":
|
|
471114
|
-
case "notifications/resources/list_changed":
|
|
471115
|
-
if (!this._capabilities.resources) {
|
|
471116
|
-
throw new Error(`Server does not support notifying about resources (required for ${method})`);
|
|
471117
|
-
}
|
|
471118
|
-
break;
|
|
471119
|
-
case "notifications/tools/list_changed":
|
|
471120
|
-
if (!this._capabilities.tools) {
|
|
471121
|
-
throw new Error(`Server does not support notifying of tool list changes (required for ${method})`);
|
|
471122
|
-
}
|
|
471123
|
-
break;
|
|
471124
|
-
case "notifications/prompts/list_changed":
|
|
471125
|
-
if (!this._capabilities.prompts) {
|
|
471126
|
-
throw new Error(`Server does not support notifying of prompt list changes (required for ${method})`);
|
|
471127
|
-
}
|
|
471128
|
-
break;
|
|
471129
|
-
case "notifications/elicitation/complete":
|
|
471130
|
-
if (!this._clientCapabilities?.elicitation?.url) {
|
|
471131
|
-
throw new Error(`Client does not support URL elicitation (required for ${method})`);
|
|
471132
|
-
}
|
|
471133
|
-
break;
|
|
471134
|
-
case "notifications/cancelled":
|
|
471135
|
-
break;
|
|
471136
|
-
case "notifications/progress":
|
|
471137
|
-
break;
|
|
471138
|
-
}
|
|
471139
|
-
}
|
|
471140
|
-
assertRequestHandlerCapability(method) {
|
|
471141
|
-
if (!this._capabilities) {
|
|
471142
|
-
return;
|
|
471143
|
-
}
|
|
471144
|
-
switch (method) {
|
|
471145
|
-
case "completion/complete":
|
|
471146
|
-
if (!this._capabilities.completions) {
|
|
471147
|
-
throw new Error(`Server does not support completions (required for ${method})`);
|
|
471148
|
-
}
|
|
471149
|
-
break;
|
|
471150
|
-
case "logging/setLevel":
|
|
471151
|
-
if (!this._capabilities.logging) {
|
|
471152
|
-
throw new Error(`Server does not support logging (required for ${method})`);
|
|
471153
|
-
}
|
|
471154
|
-
break;
|
|
471155
|
-
case "prompts/get":
|
|
471156
|
-
case "prompts/list":
|
|
471157
|
-
if (!this._capabilities.prompts) {
|
|
471158
|
-
throw new Error(`Server does not support prompts (required for ${method})`);
|
|
471159
|
-
}
|
|
471160
|
-
break;
|
|
471161
|
-
case "resources/list":
|
|
471162
|
-
case "resources/templates/list":
|
|
471163
|
-
case "resources/read":
|
|
471164
|
-
if (!this._capabilities.resources) {
|
|
471165
|
-
throw new Error(`Server does not support resources (required for ${method})`);
|
|
471166
|
-
}
|
|
471167
|
-
break;
|
|
471168
|
-
case "tools/call":
|
|
471169
|
-
case "tools/list":
|
|
471170
|
-
if (!this._capabilities.tools) {
|
|
471171
|
-
throw new Error(`Server does not support tools (required for ${method})`);
|
|
471172
|
-
}
|
|
471173
|
-
break;
|
|
471174
|
-
case "tasks/get":
|
|
471175
|
-
case "tasks/list":
|
|
471176
|
-
case "tasks/result":
|
|
471177
|
-
case "tasks/cancel":
|
|
471178
|
-
if (!this._capabilities.tasks) {
|
|
471179
|
-
throw new Error(`Server does not support tasks capability (required for ${method})`);
|
|
471180
|
-
}
|
|
471181
|
-
break;
|
|
471182
|
-
case "ping":
|
|
471183
|
-
case "initialize":
|
|
471184
|
-
break;
|
|
471185
|
-
}
|
|
471186
|
-
}
|
|
471187
|
-
assertTaskCapability(method) {
|
|
471188
|
-
assertClientRequestTaskCapability(this._clientCapabilities?.tasks?.requests, method, "Client");
|
|
471189
|
-
}
|
|
471190
|
-
assertTaskHandlerCapability(method) {
|
|
471191
|
-
if (!this._capabilities) {
|
|
471192
|
-
return;
|
|
471193
|
-
}
|
|
471194
|
-
assertToolsCallTaskCapability(this._capabilities.tasks?.requests, method, "Server");
|
|
471195
|
-
}
|
|
471196
|
-
async _oninitialize(request) {
|
|
471197
|
-
const requestedVersion = request.params.protocolVersion;
|
|
471198
|
-
this._clientCapabilities = request.params.capabilities;
|
|
471199
|
-
this._clientVersion = request.params.clientInfo;
|
|
471200
|
-
const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION;
|
|
471201
|
-
return {
|
|
471202
|
-
protocolVersion,
|
|
471203
|
-
capabilities: this.getCapabilities(),
|
|
471204
|
-
serverInfo: this._serverInfo,
|
|
471205
|
-
...this._instructions && { instructions: this._instructions }
|
|
471206
|
-
};
|
|
471207
|
-
}
|
|
471208
|
-
getClientCapabilities() {
|
|
471209
|
-
return this._clientCapabilities;
|
|
471210
|
-
}
|
|
471211
|
-
getClientVersion() {
|
|
471212
|
-
return this._clientVersion;
|
|
471213
|
-
}
|
|
471214
|
-
getCapabilities() {
|
|
471215
|
-
return this._capabilities;
|
|
471216
|
-
}
|
|
471217
|
-
async ping() {
|
|
471218
|
-
return this.request({ method: "ping" }, EmptyResultSchema);
|
|
471219
|
-
}
|
|
471220
|
-
async createMessage(params, options2) {
|
|
471221
|
-
if (params.tools || params.toolChoice) {
|
|
471222
|
-
if (!this._clientCapabilities?.sampling?.tools) {
|
|
471223
|
-
throw new Error("Client does not support sampling tools capability.");
|
|
471224
|
-
}
|
|
471225
|
-
}
|
|
471226
|
-
if (params.messages.length > 0) {
|
|
471227
|
-
const lastMessage = params.messages[params.messages.length - 1];
|
|
471228
|
-
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
471229
|
-
const hasToolResults = lastContent.some((c5) => c5.type === "tool_result");
|
|
471230
|
-
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
471231
|
-
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
471232
|
-
const hasPreviousToolUse = previousContent.some((c5) => c5.type === "tool_use");
|
|
471233
|
-
if (hasToolResults) {
|
|
471234
|
-
if (lastContent.some((c5) => c5.type !== "tool_result")) {
|
|
471235
|
-
throw new Error("The last message must contain only tool_result content if any is present");
|
|
471236
|
-
}
|
|
471237
|
-
if (!hasPreviousToolUse) {
|
|
471238
|
-
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
471239
|
-
}
|
|
471240
|
-
}
|
|
471241
|
-
if (hasPreviousToolUse) {
|
|
471242
|
-
const toolUseIds = new Set(previousContent.filter((c5) => c5.type === "tool_use").map((c5) => c5.id));
|
|
471243
|
-
const toolResultIds = new Set(lastContent.filter((c5) => c5.type === "tool_result").map((c5) => c5.toolUseId));
|
|
471244
|
-
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
471245
|
-
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
471246
|
-
}
|
|
471247
|
-
}
|
|
471248
|
-
}
|
|
471249
|
-
if (params.tools) {
|
|
471250
|
-
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultWithToolsSchema, options2);
|
|
471251
|
-
}
|
|
471252
|
-
return this.request({ method: "sampling/createMessage", params }, CreateMessageResultSchema, options2);
|
|
471253
|
-
}
|
|
471254
|
-
async elicitInput(params, options2) {
|
|
471255
|
-
const mode = params.mode ?? "form";
|
|
471256
|
-
switch (mode) {
|
|
471257
|
-
case "url": {
|
|
471258
|
-
if (!this._clientCapabilities?.elicitation?.url) {
|
|
471259
|
-
throw new Error("Client does not support url elicitation.");
|
|
471260
|
-
}
|
|
471261
|
-
const urlParams = params;
|
|
471262
|
-
return this.request({ method: "elicitation/create", params: urlParams }, ElicitResultSchema, options2);
|
|
471263
|
-
}
|
|
471264
|
-
case "form": {
|
|
471265
|
-
if (!this._clientCapabilities?.elicitation?.form) {
|
|
471266
|
-
throw new Error("Client does not support form elicitation.");
|
|
471267
|
-
}
|
|
471268
|
-
const formParams = params.mode === "form" ? params : { ...params, mode: "form" };
|
|
471269
|
-
const result = await this.request({ method: "elicitation/create", params: formParams }, ElicitResultSchema, options2);
|
|
471270
|
-
if (result.action === "accept" && result.content && formParams.requestedSchema) {
|
|
471271
|
-
try {
|
|
471272
|
-
const validator = this._jsonSchemaValidator.getValidator(formParams.requestedSchema);
|
|
471273
|
-
const validationResult = validator(result.content);
|
|
471274
|
-
if (!validationResult.valid) {
|
|
471275
|
-
throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`);
|
|
471276
|
-
}
|
|
471277
|
-
} catch (error40) {
|
|
471278
|
-
if (error40 instanceof McpError) {
|
|
471279
|
-
throw error40;
|
|
471280
|
-
}
|
|
471281
|
-
throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error40 instanceof Error ? error40.message : String(error40)}`);
|
|
471282
|
-
}
|
|
471283
|
-
}
|
|
471284
|
-
return result;
|
|
471285
|
-
}
|
|
471286
|
-
}
|
|
471287
|
-
}
|
|
471288
|
-
createElicitationCompletionNotifier(elicitationId, options2) {
|
|
471289
|
-
if (!this._clientCapabilities?.elicitation?.url) {
|
|
471290
|
-
throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");
|
|
471291
|
-
}
|
|
471292
|
-
return () => this.notification({
|
|
471293
|
-
method: "notifications/elicitation/complete",
|
|
471294
|
-
params: {
|
|
471295
|
-
elicitationId
|
|
471296
|
-
}
|
|
471297
|
-
}, options2);
|
|
471298
|
-
}
|
|
471299
|
-
async listRoots(params, options2) {
|
|
471300
|
-
return this.request({ method: "roots/list", params }, ListRootsResultSchema, options2);
|
|
471301
|
-
}
|
|
471302
|
-
async sendLoggingMessage(params, sessionId) {
|
|
471303
|
-
if (this._capabilities.logging) {
|
|
471304
|
-
if (!this.isMessageIgnored(params.level, sessionId)) {
|
|
471305
|
-
return this.notification({ method: "notifications/message", params });
|
|
471306
|
-
}
|
|
471307
|
-
}
|
|
471308
|
-
}
|
|
471309
|
-
async sendResourceUpdated(params) {
|
|
471310
|
-
return this.notification({
|
|
471311
|
-
method: "notifications/resources/updated",
|
|
471312
|
-
params
|
|
471313
|
-
});
|
|
471314
|
-
}
|
|
471315
|
-
async sendResourceListChanged() {
|
|
471316
|
-
return this.notification({
|
|
471317
|
-
method: "notifications/resources/list_changed"
|
|
471318
|
-
});
|
|
471319
|
-
}
|
|
471320
|
-
async sendToolListChanged() {
|
|
471321
|
-
return this.notification({ method: "notifications/tools/list_changed" });
|
|
471322
|
-
}
|
|
471323
|
-
async sendPromptListChanged() {
|
|
471324
|
-
return this.notification({ method: "notifications/prompts/list_changed" });
|
|
471325
|
-
}
|
|
471326
|
-
};
|
|
471327
|
-
});
|
|
471328
|
-
|
|
471329
471704
|
// entrypoints/mcp.ts
|
|
471330
471705
|
var exports_mcp2 = {};
|
|
471331
471706
|
__export(exports_mcp2, {
|
|
@@ -471337,7 +471712,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
|
|
|
471337
471712
|
setCwd(cwd3);
|
|
471338
471713
|
const server = new Server({
|
|
471339
471714
|
name: "theus/tengu",
|
|
471340
|
-
version: { VERSION: "0.1.
|
|
471715
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
471341
471716
|
}, {
|
|
471342
471717
|
capabilities: {
|
|
471343
471718
|
tools: {}
|
|
@@ -472770,7 +473145,7 @@ async function setupTokenHandler(root2) {
|
|
|
472770
473145
|
const {
|
|
472771
473146
|
ConsoleOAuthFlow: ConsoleOAuthFlow2
|
|
472772
473147
|
} = await Promise.resolve().then(() => (init_ConsoleOAuthFlow(), exports_ConsoleOAuthFlow));
|
|
472773
|
-
await new Promise((
|
|
473148
|
+
await new Promise((resolve46) => {
|
|
472774
473149
|
root2.render(/* @__PURE__ */ jsx_runtime473.jsx(AppStateProvider, {
|
|
472775
473150
|
onChangeAppState,
|
|
472776
473151
|
children: /* @__PURE__ */ jsx_runtime473.jsx(KeybindingSetup, {
|
|
@@ -472779,7 +473154,7 @@ async function setupTokenHandler(root2) {
|
|
|
472779
473154
|
gap: 1,
|
|
472780
473155
|
children: [
|
|
472781
473156
|
/* @__PURE__ */ jsx_runtime473.jsx(TheusBanner, {
|
|
472782
|
-
version: { VERSION: "0.1.
|
|
473157
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
472783
473158
|
}),
|
|
472784
473159
|
showAuthWarning && /* @__PURE__ */ jsx_runtime473.jsxs(ThemedBox_default, {
|
|
472785
473160
|
flexDirection: "column",
|
|
@@ -472796,7 +473171,7 @@ async function setupTokenHandler(root2) {
|
|
|
472796
473171
|
}),
|
|
472797
473172
|
/* @__PURE__ */ jsx_runtime473.jsx(ConsoleOAuthFlow2, {
|
|
472798
473173
|
onDone: () => {
|
|
472799
|
-
|
|
473174
|
+
resolve46();
|
|
472800
473175
|
},
|
|
472801
473176
|
mode: "setup-token",
|
|
472802
473177
|
startingMessage: "This will guide you through long-lived (1-year) auth token setup for your Theus account."
|
|
@@ -472832,7 +473207,7 @@ function DoctorWithPlugins(t0) {
|
|
|
472832
473207
|
}
|
|
472833
473208
|
async function doctorHandler(root2) {
|
|
472834
473209
|
logEvent("tengu_doctor_command", {});
|
|
472835
|
-
await new Promise((
|
|
473210
|
+
await new Promise((resolve46) => {
|
|
472836
473211
|
root2.render(/* @__PURE__ */ jsx_runtime473.jsx(AppStateProvider, {
|
|
472837
473212
|
children: /* @__PURE__ */ jsx_runtime473.jsx(KeybindingSetup, {
|
|
472838
473213
|
children: /* @__PURE__ */ jsx_runtime473.jsx(MCPConnectionManager, {
|
|
@@ -472840,7 +473215,7 @@ async function doctorHandler(root2) {
|
|
|
472840
473215
|
isStrictMcpConfig: false,
|
|
472841
473216
|
children: /* @__PURE__ */ jsx_runtime473.jsx(DoctorWithPlugins, {
|
|
472842
473217
|
onDone: () => {
|
|
472843
|
-
|
|
473218
|
+
resolve46();
|
|
472844
473219
|
}
|
|
472845
473220
|
})
|
|
472846
473221
|
})
|
|
@@ -472858,14 +473233,14 @@ async function installHandler(target, options2) {
|
|
|
472858
473233
|
const {
|
|
472859
473234
|
install: install2
|
|
472860
473235
|
} = await Promise.resolve().then(() => (init_install(), exports_install));
|
|
472861
|
-
await new Promise((
|
|
473236
|
+
await new Promise((resolve46) => {
|
|
472862
473237
|
const args = [];
|
|
472863
473238
|
if (target)
|
|
472864
473239
|
args.push(target);
|
|
472865
473240
|
if (options2.force)
|
|
472866
473241
|
args.push("--force");
|
|
472867
473242
|
install2.call((result) => {
|
|
472868
|
-
|
|
473243
|
+
resolve46();
|
|
472869
473244
|
process.exit(result.includes("failed") ? 1 : 0);
|
|
472870
473245
|
}, {}, args);
|
|
472871
473246
|
});
|
|
@@ -472950,7 +473325,7 @@ __export(exports_main2, {
|
|
|
472950
473325
|
main: () => main
|
|
472951
473326
|
});
|
|
472952
473327
|
import { readFileSync as readFileSync23 } from "fs";
|
|
472953
|
-
import { resolve as
|
|
473328
|
+
import { resolve as resolve46 } from "path";
|
|
472954
473329
|
function logManagedSettings() {
|
|
472955
473330
|
try {
|
|
472956
473331
|
const policySettings = getSettingsForSource("policySettings");
|
|
@@ -473509,12 +473884,12 @@ ${getTmuxInstallInstructions2()}
|
|
|
473509
473884
|
process.exit(1);
|
|
473510
473885
|
}
|
|
473511
473886
|
try {
|
|
473512
|
-
const filePath =
|
|
473887
|
+
const filePath = resolve46(options2.systemPromptFile);
|
|
473513
473888
|
systemPrompt = readFileSync23(filePath, "utf8");
|
|
473514
473889
|
} catch (error40) {
|
|
473515
473890
|
const code = getErrnoCode(error40);
|
|
473516
473891
|
if (code === "ENOENT") {
|
|
473517
|
-
process.stderr.write(source_default.red(`Error: System prompt file not found: ${
|
|
473892
|
+
process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve46(options2.systemPromptFile)}
|
|
473518
473893
|
`));
|
|
473519
473894
|
process.exit(1);
|
|
473520
473895
|
}
|
|
@@ -473531,12 +473906,12 @@ ${getTmuxInstallInstructions2()}
|
|
|
473531
473906
|
process.exit(1);
|
|
473532
473907
|
}
|
|
473533
473908
|
try {
|
|
473534
|
-
const filePath =
|
|
473909
|
+
const filePath = resolve46(options2.appendSystemPromptFile);
|
|
473535
473910
|
appendSystemPrompt = readFileSync23(filePath, "utf8");
|
|
473536
473911
|
} catch (error40) {
|
|
473537
473912
|
const code = getErrnoCode(error40);
|
|
473538
473913
|
if (code === "ENOENT") {
|
|
473539
|
-
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${
|
|
473914
|
+
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve46(options2.appendSystemPromptFile)}
|
|
473540
473915
|
`));
|
|
473541
473916
|
process.exit(1);
|
|
473542
473917
|
}
|
|
@@ -473582,7 +473957,7 @@ ${addendum}` : addendum;
|
|
|
473582
473957
|
errors4 = result.errors;
|
|
473583
473958
|
}
|
|
473584
473959
|
} else {
|
|
473585
|
-
const configPath2 =
|
|
473960
|
+
const configPath2 = resolve46(configItem);
|
|
473586
473961
|
const result = parseMcpConfigFromFilePath({
|
|
473587
473962
|
filePath: configPath2,
|
|
473588
473963
|
expandVars: true,
|
|
@@ -474128,7 +474503,7 @@ ${customInstructions}` : customInstructions;
|
|
|
474128
474503
|
}
|
|
474129
474504
|
}
|
|
474130
474505
|
logForDiagnosticsNoPII("info", "started", {
|
|
474131
|
-
version: { VERSION: "0.1.
|
|
474506
|
+
version: { VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
474132
474507
|
is_native_binary: isInBundledMode()
|
|
474133
474508
|
});
|
|
474134
474509
|
registerCleanup(async () => {
|
|
@@ -474333,8 +474708,8 @@ ${customInstructions}` : customInstructions;
|
|
|
474333
474708
|
return connectMcpBatch(dedupedTheusAi, "theusai");
|
|
474334
474709
|
});
|
|
474335
474710
|
let theusaiTimer;
|
|
474336
|
-
const theusaiTimedOut = await Promise.race([theusaiConnect.then(() => false), new Promise((
|
|
474337
|
-
theusaiTimer = setTimeout((r) => r(true), THEUS_AI_MCP_TIMEOUT_MS,
|
|
474711
|
+
const theusaiTimedOut = await Promise.race([theusaiConnect.then(() => false), new Promise((resolve47) => {
|
|
474712
|
+
theusaiTimer = setTimeout((r) => r(true), THEUS_AI_MCP_TIMEOUT_MS, resolve47);
|
|
474338
474713
|
})]);
|
|
474339
474714
|
if (theusaiTimer)
|
|
474340
474715
|
clearTimeout(theusaiTimer);
|
|
@@ -474912,7 +475287,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
474912
475287
|
pendingHookMessages
|
|
474913
475288
|
}, renderAndRun);
|
|
474914
475289
|
}
|
|
474915
|
-
}).version(`${{ VERSION: "0.1.
|
|
475290
|
+
}).version(`${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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");
|
|
474916
475291
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
474917
475292
|
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.");
|
|
474918
475293
|
if (canUserConfigureAdvisor()) {
|
|
@@ -475426,7 +475801,7 @@ if (false) {}
|
|
|
475426
475801
|
async function main2() {
|
|
475427
475802
|
const args = process.argv.slice(2);
|
|
475428
475803
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
475429
|
-
console.log(`${{ VERSION: "0.1.
|
|
475804
|
+
console.log(`${{ VERSION: "0.1.8", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)`);
|
|
475430
475805
|
return;
|
|
475431
475806
|
}
|
|
475432
475807
|
const {
|
|
@@ -475448,7 +475823,14 @@ async function main2() {
|
|
|
475448
475823
|
} = await Promise.resolve().then(() => (init_chromeNativeHost(), exports_chromeNativeHost));
|
|
475449
475824
|
await runChromeNativeHost2();
|
|
475450
475825
|
return;
|
|
475451
|
-
} else if (false) {}
|
|
475826
|
+
} else if (false) {} else if (process.argv[2] === "--project-context-mcp") {
|
|
475827
|
+
profileCheckpoint2("cli_project_context_mcp_path");
|
|
475828
|
+
const {
|
|
475829
|
+
runProjectContextMcpServer: runProjectContextMcpServer2
|
|
475830
|
+
} = await Promise.resolve().then(() => (init_server4(), exports_server));
|
|
475831
|
+
await runProjectContextMcpServer2();
|
|
475832
|
+
return;
|
|
475833
|
+
}
|
|
475452
475834
|
if (args[0] === "--daemon-worker" || args[0] === "daemon") {
|
|
475453
475835
|
const {
|
|
475454
475836
|
isEnvTruthy: isDaemonForced
|