theus-cli 0.1.10 → 0.1.11
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 +881 -799
- 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.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.ISSUES_EXPLAINER}`;
|
|
107184
107184
|
}
|
|
107185
107185
|
return "- When you cannot find an answer or the feature doesn't exist, direct the user to use /feedback to report a feature request or bug";
|
|
107186
107186
|
}
|
|
@@ -165877,7 +165877,7 @@ function getTelemetryAttributes() {
|
|
|
165877
165877
|
attributes["session.id"] = sessionId;
|
|
165878
165878
|
}
|
|
165879
165879
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
165880
|
-
attributes["app.version"] = { VERSION: "0.1.
|
|
165880
|
+
attributes["app.version"] = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
165881
165881
|
}
|
|
165882
165882
|
const oauthAccount = getOauthAccountInfo();
|
|
165883
165883
|
if (oauthAccount) {
|
|
@@ -201923,7 +201923,7 @@ function getInstallationEnv() {
|
|
|
201923
201923
|
return;
|
|
201924
201924
|
}
|
|
201925
201925
|
function getTheusCodeVersion() {
|
|
201926
|
-
return { VERSION: "0.1.
|
|
201926
|
+
return { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
201927
201927
|
}
|
|
201928
201928
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
201929
201929
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -203441,7 +203441,7 @@ async function getMcpHeadersFromHelper(serverName, config2) {
|
|
|
203441
203441
|
if ("scope" in config2 && isMcpServerFromProjectOrLocalSettings(config2) && !getIsNonInteractiveSession()) {
|
|
203442
203442
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
203443
203443
|
if (!hasTrust) {
|
|
203444
|
-
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.
|
|
203444
|
+
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.FEEDBACK_CHANNEL}.`);
|
|
203445
203445
|
logAntError("MCP headersHelper invoked before trust check", error40);
|
|
203446
203446
|
logEvent("tengu_mcp_headersHelper_missing_trust", {});
|
|
203447
203447
|
return null;
|
|
@@ -204651,7 +204651,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
204651
204651
|
const client2 = new Client({
|
|
204652
204652
|
name: "theus-code",
|
|
204653
204653
|
title: "Theus",
|
|
204654
|
-
version: { VERSION: "0.1.
|
|
204654
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
|
|
204655
204655
|
description: "Theus's agentic coding tool",
|
|
204656
204656
|
websiteUrl: PRODUCT_URL
|
|
204657
204657
|
}, {
|
|
@@ -205005,7 +205005,7 @@ var init_client5 = __esm(() => {
|
|
|
205005
205005
|
const client2 = new Client({
|
|
205006
205006
|
name: "theus-code",
|
|
205007
205007
|
title: "Theus",
|
|
205008
|
-
version: { VERSION: "0.1.
|
|
205008
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ?? "unknown",
|
|
205009
205009
|
description: "Theus's agentic coding tool",
|
|
205010
205010
|
websiteUrl: PRODUCT_URL
|
|
205011
205011
|
}, {
|
|
@@ -215564,7 +215564,7 @@ async function initializeBetaTracing(resource) {
|
|
|
215564
215564
|
});
|
|
215565
215565
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215566
215566
|
setLoggerProvider(loggerProvider);
|
|
215567
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215567
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215568
215568
|
setEventLogger(eventLogger);
|
|
215569
215569
|
process.on("beforeExit", async () => {
|
|
215570
215570
|
await loggerProvider?.forceFlush();
|
|
@@ -215604,7 +215604,7 @@ async function initializeTelemetry() {
|
|
|
215604
215604
|
const platform4 = getPlatform();
|
|
215605
215605
|
const baseAttributes = {
|
|
215606
215606
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
215607
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.
|
|
215607
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
215608
215608
|
};
|
|
215609
215609
|
if (platform4 === "wsl") {
|
|
215610
215610
|
const wslVersion = getWslVersion();
|
|
@@ -215649,7 +215649,7 @@ async function initializeTelemetry() {
|
|
|
215649
215649
|
} catch {}
|
|
215650
215650
|
};
|
|
215651
215651
|
registerCleanup(shutdownTelemetry2);
|
|
215652
|
-
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215652
|
+
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215653
215653
|
}
|
|
215654
215654
|
const meterProvider = new MeterProvider({
|
|
215655
215655
|
resource,
|
|
@@ -215669,7 +215669,7 @@ async function initializeTelemetry() {
|
|
|
215669
215669
|
});
|
|
215670
215670
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
215671
215671
|
setLoggerProvider(loggerProvider);
|
|
215672
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.
|
|
215672
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215673
215673
|
setEventLogger(eventLogger);
|
|
215674
215674
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
215675
215675
|
process.on("beforeExit", async () => {
|
|
@@ -215731,7 +215731,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
215731
215731
|
}
|
|
215732
215732
|
};
|
|
215733
215733
|
registerCleanup(shutdownTelemetry);
|
|
215734
|
-
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.
|
|
215734
|
+
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
215735
215735
|
}
|
|
215736
215736
|
async function flushTelemetry() {
|
|
215737
215737
|
const meterProvider = getMeterProvider();
|
|
@@ -216271,7 +216271,7 @@ async function installOrUpdateTheusPackage(channel2, specificVersion) {
|
|
|
216271
216271
|
return "install_failed";
|
|
216272
216272
|
}
|
|
216273
216273
|
const versionSpec = specificVersion ? specificVersion : channel2 === "stable" ? "stable" : "latest";
|
|
216274
|
-
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.
|
|
216274
|
+
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${versionSpec}`], { cwd: getLocalInstallDir(), maxBuffer: 1e6 });
|
|
216275
216275
|
if (result.code !== 0) {
|
|
216276
216276
|
const error40 = new Error(`Failed to install Theus CLI package: ${result.stderr}`);
|
|
216277
216277
|
logError2(error40);
|
|
@@ -216417,9 +216417,9 @@ async function assertMinVersion() {
|
|
|
216417
216417
|
if (false) {}
|
|
216418
216418
|
try {
|
|
216419
216419
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
216420
|
-
if (versionConfig.minVersion && lt({ VERSION: "0.1.
|
|
216420
|
+
if (versionConfig.minVersion && lt({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, versionConfig.minVersion)) {
|
|
216421
216421
|
console.error(`
|
|
216422
|
-
It looks like your version of Theus (${{ VERSION: "0.1.
|
|
216422
|
+
It looks like your version of Theus (${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}) needs an update.
|
|
216423
216423
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
216424
216424
|
|
|
216425
216425
|
To update, please run:
|
|
@@ -216560,7 +216560,7 @@ async function getInstallationPrefix() {
|
|
|
216560
216560
|
return prefixResult.stdout.trim();
|
|
216561
216561
|
}
|
|
216562
216562
|
function getGlobalInstallPackageManager() {
|
|
216563
|
-
if ({ VERSION: "0.1.
|
|
216563
|
+
if ({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL === "theus-cli") {
|
|
216564
216564
|
return "npm";
|
|
216565
216565
|
}
|
|
216566
216566
|
return env3.isRunningWithBun() ? "bun" : "npm";
|
|
@@ -216585,7 +216585,7 @@ async function checkGlobalInstallPermissions() {
|
|
|
216585
216585
|
}
|
|
216586
216586
|
async function getLatestVersion(channel2) {
|
|
216587
216587
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
216588
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.
|
|
216588
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
|
|
216589
216589
|
if (result.code !== 0) {
|
|
216590
216590
|
logForDebugging(`npm view failed with code ${result.code}`);
|
|
216591
216591
|
if (result.stderr) {
|
|
@@ -216601,7 +216601,7 @@ async function getLatestVersion(channel2) {
|
|
|
216601
216601
|
return result.stdout.trim();
|
|
216602
216602
|
}
|
|
216603
216603
|
async function getNpmDistTags() {
|
|
216604
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.
|
|
216604
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL, "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir18() });
|
|
216605
216605
|
if (result.code !== 0) {
|
|
216606
216606
|
logForDebugging(`npm view dist-tags failed with code ${result.code}`);
|
|
216607
216607
|
return { latest: null, stable: null };
|
|
@@ -216641,7 +216641,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216641
216641
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
216642
216642
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
216643
216643
|
pid: process.pid,
|
|
216644
|
-
currentVersion: { VERSION: "0.1.
|
|
216644
|
+
currentVersion: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
216645
216645
|
});
|
|
216646
216646
|
return "in_progress";
|
|
216647
216647
|
}
|
|
@@ -216650,7 +216650,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
216650
216650
|
if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
|
|
216651
216651
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
216652
216652
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
216653
|
-
currentVersion: { VERSION: "0.1.
|
|
216653
|
+
currentVersion: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
216654
216654
|
});
|
|
216655
216655
|
console.error(`
|
|
216656
216656
|
Error: Windows NPM detected in WSL
|
|
@@ -216669,7 +216669,7 @@ To fix this issue:
|
|
|
216669
216669
|
if (!hasPermissions) {
|
|
216670
216670
|
return "no_permissions";
|
|
216671
216671
|
}
|
|
216672
|
-
const packageSpec = specificVersion ? `${{ VERSION: "0.1.
|
|
216672
|
+
const packageSpec = specificVersion ? `${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL;
|
|
216673
216673
|
const packageManager = getGlobalInstallPackageManager();
|
|
216674
216674
|
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir18() });
|
|
216675
216675
|
if (installResult.code !== 0) {
|
|
@@ -216997,8 +216997,8 @@ async function detectMultipleInstallations() {
|
|
|
216997
216997
|
installations.push({ type: "npm-local", path: localPath });
|
|
216998
216998
|
}
|
|
216999
216999
|
const packagesToCheck = ["@theus-ai/theus-code"];
|
|
217000
|
-
if ({ VERSION: "0.1.
|
|
217001
|
-
packagesToCheck.push({ VERSION: "0.1.
|
|
217000
|
+
if ({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
|
|
217001
|
+
packagesToCheck.push({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
|
|
217002
217002
|
}
|
|
217003
217003
|
const npmResult = await execFileNoThrow("npm", [
|
|
217004
217004
|
"-g",
|
|
@@ -217181,7 +217181,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
217181
217181
|
}
|
|
217182
217182
|
async function getDoctorDiagnostic() {
|
|
217183
217183
|
const installationType = await getCurrentInstallationType();
|
|
217184
|
-
const version2 = { VERSION: "0.1.
|
|
217184
|
+
const version2 = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION : "unknown";
|
|
217185
217185
|
const installationPath = await getInstallationPath();
|
|
217186
217186
|
const invokedBinary = getInvokedBinary();
|
|
217187
217187
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -217193,8 +217193,8 @@ async function getDoctorDiagnostic() {
|
|
|
217193
217193
|
for (const install of npmInstalls) {
|
|
217194
217194
|
if (install.type === "npm-global") {
|
|
217195
217195
|
let uninstallCmd = "npm -g uninstall @theus-ai/theus-code";
|
|
217196
|
-
if ({ VERSION: "0.1.
|
|
217197
|
-
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.
|
|
217196
|
+
if ({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
|
|
217197
|
+
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}`;
|
|
217198
217198
|
}
|
|
217199
217199
|
warnings.push({
|
|
217200
217200
|
issue: `Leftover npm global installation at ${install.path}`,
|
|
@@ -217306,7 +217306,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217306
217306
|
const startTime2 = Date.now();
|
|
217307
217307
|
const { stdout, code, stderr } = await execFileNoThrowWithCwd("npm", [
|
|
217308
217308
|
"view",
|
|
217309
|
-
`${{ VERSION: "0.1.
|
|
217309
|
+
`${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2}`,
|
|
217310
217310
|
"version",
|
|
217311
217311
|
"--prefer-online",
|
|
217312
217312
|
"--registry",
|
|
@@ -217330,7 +217330,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217330
217330
|
latency_ms: latencyMs,
|
|
217331
217331
|
source_npm: true
|
|
217332
217332
|
});
|
|
217333
|
-
logForDebugging(`npm view ${{ VERSION: "0.1.
|
|
217333
|
+
logForDebugging(`npm view ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${tag2} version: ${stdout}`);
|
|
217334
217334
|
const latestVersion = stdout.trim();
|
|
217335
217335
|
return latestVersion;
|
|
217336
217336
|
}
|
|
@@ -217386,7 +217386,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217386
217386
|
const fs3 = getFsImplementation();
|
|
217387
217387
|
await fs3.rm(stagingPath, { recursive: true, force: true });
|
|
217388
217388
|
const platform4 = getPlatform2();
|
|
217389
|
-
const platformPackageName = `${{ VERSION: "0.1.
|
|
217389
|
+
const platformPackageName = `${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}-${platform4}`;
|
|
217390
217390
|
logForDebugging(`Fetching integrity hash for ${platformPackageName}@${version2}`);
|
|
217391
217391
|
const {
|
|
217392
217392
|
stdout: integrityOutput,
|
|
@@ -217415,7 +217415,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217415
217415
|
name: "theus-native-installer",
|
|
217416
217416
|
version: "0.0.1",
|
|
217417
217417
|
dependencies: {
|
|
217418
|
-
[{ VERSION: "0.1.
|
|
217418
|
+
[{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
|
|
217419
217419
|
}
|
|
217420
217420
|
};
|
|
217421
217421
|
const packageLock = {
|
|
@@ -217428,10 +217428,10 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217428
217428
|
name: "theus-native-installer",
|
|
217429
217429
|
version: "0.0.1",
|
|
217430
217430
|
dependencies: {
|
|
217431
|
-
[{ VERSION: "0.1.
|
|
217431
|
+
[{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL]: version2
|
|
217432
217432
|
}
|
|
217433
217433
|
},
|
|
217434
|
-
[`node_modules/${{ VERSION: "0.1.
|
|
217434
|
+
[`node_modules/${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}`]: {
|
|
217435
217435
|
version: version2,
|
|
217436
217436
|
optionalDependencies: {
|
|
217437
217437
|
[platformPackageName]: version2
|
|
@@ -217453,7 +217453,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
217453
217453
|
if (result.code !== 0) {
|
|
217454
217454
|
throw new Error(`npm ci failed with code ${result.code}: ${result.stderr}`);
|
|
217455
217455
|
}
|
|
217456
|
-
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.
|
|
217456
|
+
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.NATIVE_PACKAGE_URL}@${version2}`);
|
|
217457
217457
|
}
|
|
217458
217458
|
function getStallTimeoutMs() {
|
|
217459
217459
|
return Number(process.env.THEUS_CODE_STALL_TIMEOUT_MS_FOR_TESTING) || DEFAULT_STALL_TIMEOUT_MS;
|
|
@@ -218116,8 +218116,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218116
218116
|
const maxVersion = await getMaxVersion();
|
|
218117
218117
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
218118
218118
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
218119
|
-
if (gte({ VERSION: "0.1.
|
|
218120
|
-
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.
|
|
218119
|
+
if (gte({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION, maxVersion)) {
|
|
218120
|
+
logForDebugging(`Native installer: current version ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
218121
218121
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
218122
218122
|
latency_ms: Date.now() - startTime2,
|
|
218123
218123
|
max_version: maxVersion,
|
|
@@ -218128,7 +218128,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218128
218128
|
version2 = maxVersion;
|
|
218129
218129
|
}
|
|
218130
218130
|
}
|
|
218131
|
-
if (!forceReinstall && version2 === { VERSION: "0.1.
|
|
218131
|
+
if (!forceReinstall && version2 === { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION && await versionIsAvailable(version2) && await isPossibleTheusBinary(executablePath)) {
|
|
218132
218132
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
218133
218133
|
logEvent("tengu_native_update_complete", {
|
|
218134
218134
|
latency_ms: Date.now() - startTime2,
|
|
@@ -218870,8 +218870,8 @@ async function cleanupNpmInstallations() {
|
|
|
218870
218870
|
} else if (codePackageResult.error) {
|
|
218871
218871
|
errors4.push(codePackageResult.error);
|
|
218872
218872
|
}
|
|
218873
|
-
if ({ VERSION: "0.1.
|
|
218874
|
-
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.
|
|
218873
|
+
if ({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL !== "@theus-ai/theus-code") {
|
|
218874
|
+
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL);
|
|
218875
218875
|
if (macroPackageResult.success) {
|
|
218876
218876
|
removed++;
|
|
218877
218877
|
if (macroPackageResult.warning) {
|
|
@@ -240759,38 +240759,673 @@ var init_recall = __esm(() => {
|
|
|
240759
240759
|
scoringIndexCache = new WeakMap;
|
|
240760
240760
|
});
|
|
240761
240761
|
|
|
240762
|
+
// services/providers/adapters/theus.ts
|
|
240763
|
+
function createTheusAdapter(options2 = {}) {
|
|
240764
|
+
const id = options2.id ?? "theus";
|
|
240765
|
+
const defaultModel = options2.model ?? "theus-sonnet";
|
|
240766
|
+
const callModel = options2.deps?.callModel;
|
|
240767
|
+
return {
|
|
240768
|
+
id,
|
|
240769
|
+
label: "Theus (Theus)",
|
|
240770
|
+
capabilities: CAPS,
|
|
240771
|
+
enabled: options2.enabled ?? true,
|
|
240772
|
+
priority: options2.priority ?? 100,
|
|
240773
|
+
async invoke(request) {
|
|
240774
|
+
const start = Date.now();
|
|
240775
|
+
const model = request.params?.model ?? defaultModel;
|
|
240776
|
+
if (!callModel) {
|
|
240777
|
+
return {
|
|
240778
|
+
providerId: id,
|
|
240779
|
+
capability: request.capability,
|
|
240780
|
+
text: `[theus:inert] would ask ${model}: ${request.prompt}`,
|
|
240781
|
+
meta: { model, inert: true, latencyMs: Date.now() - start }
|
|
240782
|
+
};
|
|
240783
|
+
}
|
|
240784
|
+
try {
|
|
240785
|
+
const { text, costUsd } = await callModel({
|
|
240786
|
+
prompt: request.prompt,
|
|
240787
|
+
model,
|
|
240788
|
+
signal: request.signal
|
|
240789
|
+
});
|
|
240790
|
+
return {
|
|
240791
|
+
providerId: id,
|
|
240792
|
+
capability: request.capability,
|
|
240793
|
+
text,
|
|
240794
|
+
meta: { model, costUsd, latencyMs: Date.now() - start }
|
|
240795
|
+
};
|
|
240796
|
+
} catch (err2) {
|
|
240797
|
+
return {
|
|
240798
|
+
providerId: id,
|
|
240799
|
+
capability: request.capability,
|
|
240800
|
+
text: `[theus:error] ${err2.message}`,
|
|
240801
|
+
meta: { model, latencyMs: Date.now() - start }
|
|
240802
|
+
};
|
|
240803
|
+
}
|
|
240804
|
+
}
|
|
240805
|
+
};
|
|
240806
|
+
}
|
|
240807
|
+
var CAPS;
|
|
240808
|
+
var init_theus = __esm(() => {
|
|
240809
|
+
CAPS = ["text", "embedding"];
|
|
240810
|
+
});
|
|
240811
|
+
|
|
240812
|
+
// services/providers/adapters/chart.ts
|
|
240813
|
+
function coerceData(data) {
|
|
240814
|
+
if (!Array.isArray(data))
|
|
240815
|
+
return [];
|
|
240816
|
+
return data.map((d) => {
|
|
240817
|
+
if (d && typeof d === "object" && "label" in d && "value" in d && typeof d.value === "number") {
|
|
240818
|
+
return { label: String(d.label), value: d.value };
|
|
240819
|
+
}
|
|
240820
|
+
return null;
|
|
240821
|
+
}).filter((d) => d !== null);
|
|
240822
|
+
}
|
|
240823
|
+
function asciiChart(rows) {
|
|
240824
|
+
if (rows.length === 0)
|
|
240825
|
+
return "(no data)";
|
|
240826
|
+
const max2 = Math.max(...rows.map((r) => r.value), 0);
|
|
240827
|
+
const min = Math.min(...rows.map((r) => r.value), 0);
|
|
240828
|
+
const span = max2 - min || 1;
|
|
240829
|
+
const spark = rows.map((r) => BARS[Math.min(BARS.length - 1, Math.round((r.value - min) / span * (BARS.length - 1)))]).join("");
|
|
240830
|
+
const lines = rows.map((r) => {
|
|
240831
|
+
const filled = Math.round(r.value / (max2 || 1) * 20);
|
|
240832
|
+
return ` ${r.label.padEnd(10).slice(0, 10)} \u2502${"\u2588".repeat(filled)} ${r.value}`;
|
|
240833
|
+
});
|
|
240834
|
+
return `${spark}
|
|
240835
|
+
${lines.join(`
|
|
240836
|
+
`)}`;
|
|
240837
|
+
}
|
|
240838
|
+
function createChartAdapter(options2 = {}) {
|
|
240839
|
+
const id = options2.id ?? "chart";
|
|
240840
|
+
return {
|
|
240841
|
+
id,
|
|
240842
|
+
label: "Chart renderer",
|
|
240843
|
+
capabilities: CAPS2,
|
|
240844
|
+
enabled: options2.enabled ?? true,
|
|
240845
|
+
priority: options2.priority ?? 20,
|
|
240846
|
+
async invoke(request) {
|
|
240847
|
+
const start = Date.now();
|
|
240848
|
+
const rows = coerceData(request.data);
|
|
240849
|
+
const mark = request.params?.mark ?? "bar";
|
|
240850
|
+
const spec = {
|
|
240851
|
+
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
|
|
240852
|
+
description: request.prompt,
|
|
240853
|
+
data: { values: rows },
|
|
240854
|
+
mark,
|
|
240855
|
+
encoding: {
|
|
240856
|
+
x: { field: "label", type: "nominal" },
|
|
240857
|
+
y: { field: "value", type: "quantitative" }
|
|
240858
|
+
}
|
|
240859
|
+
};
|
|
240860
|
+
const artifact = {
|
|
240861
|
+
kind: "chart",
|
|
240862
|
+
label: `${mark} chart (${rows.length} points)`,
|
|
240863
|
+
payload: spec
|
|
240864
|
+
};
|
|
240865
|
+
const preview = asciiChart(rows);
|
|
240866
|
+
return {
|
|
240867
|
+
providerId: id,
|
|
240868
|
+
capability: "chart",
|
|
240869
|
+
text: `Chart for "${request.prompt}" (${mark}, ${rows.length} points):
|
|
240870
|
+
${preview}`,
|
|
240871
|
+
artifacts: [artifact],
|
|
240872
|
+
meta: { latencyMs: Date.now() - start, points: rows.length }
|
|
240873
|
+
};
|
|
240874
|
+
}
|
|
240875
|
+
};
|
|
240876
|
+
}
|
|
240877
|
+
var CAPS2, BARS = "\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";
|
|
240878
|
+
var init_chart = __esm(() => {
|
|
240879
|
+
CAPS2 = ["chart"];
|
|
240880
|
+
});
|
|
240881
|
+
|
|
240882
|
+
// services/providers/adapters/openai.ts
|
|
240883
|
+
function createOpenAIAdapter(options2 = {}) {
|
|
240884
|
+
const id = options2.id ?? "openai";
|
|
240885
|
+
const model = options2.model ?? "gpt-4o";
|
|
240886
|
+
const complete = options2.deps?.complete;
|
|
240887
|
+
const hasKey = Boolean(options2.apiKeyEnv && process.env[options2.apiKeyEnv]);
|
|
240888
|
+
return {
|
|
240889
|
+
id,
|
|
240890
|
+
label: "OpenAI",
|
|
240891
|
+
capabilities: CAPS3,
|
|
240892
|
+
enabled: options2.enabled ?? true,
|
|
240893
|
+
priority: options2.priority ?? 50,
|
|
240894
|
+
async invoke(request) {
|
|
240895
|
+
const start = Date.now();
|
|
240896
|
+
if (!complete) {
|
|
240897
|
+
return {
|
|
240898
|
+
providerId: id,
|
|
240899
|
+
capability: request.capability,
|
|
240900
|
+
text: `[openai:inert] adapter stub (no client wired${hasKey ? ", key present" : ""}) \u2014 would run ${model} for: ${request.prompt}`,
|
|
240901
|
+
meta: { model, inert: true, latencyMs: Date.now() - start }
|
|
240902
|
+
};
|
|
240903
|
+
}
|
|
240904
|
+
const { text, costUsd } = await complete({
|
|
240905
|
+
prompt: request.prompt,
|
|
240906
|
+
model,
|
|
240907
|
+
signal: request.signal
|
|
240908
|
+
});
|
|
240909
|
+
return {
|
|
240910
|
+
providerId: id,
|
|
240911
|
+
capability: request.capability,
|
|
240912
|
+
text,
|
|
240913
|
+
meta: { model, costUsd, latencyMs: Date.now() - start }
|
|
240914
|
+
};
|
|
240915
|
+
}
|
|
240916
|
+
};
|
|
240917
|
+
}
|
|
240918
|
+
var CAPS3;
|
|
240919
|
+
var init_openai = __esm(() => {
|
|
240920
|
+
CAPS3 = ["text", "image", "embedding"];
|
|
240921
|
+
});
|
|
240922
|
+
|
|
240923
|
+
// services/providers/adapters/openaiCompatible.ts
|
|
240924
|
+
function trimBaseURL(baseURL) {
|
|
240925
|
+
return baseURL.replace(/\/+$/, "");
|
|
240926
|
+
}
|
|
240927
|
+
function extractText(payload) {
|
|
240928
|
+
if (!payload || typeof payload !== "object")
|
|
240929
|
+
return "";
|
|
240930
|
+
const choices = payload.choices;
|
|
240931
|
+
if (!Array.isArray(choices))
|
|
240932
|
+
return "";
|
|
240933
|
+
const first = choices[0];
|
|
240934
|
+
const content = first?.message?.content ?? first?.text;
|
|
240935
|
+
return typeof content === "string" ? content : JSON.stringify(content ?? "");
|
|
240936
|
+
}
|
|
240937
|
+
function createOpenAICompatibleAdapter(options2 = {}) {
|
|
240938
|
+
const id = options2.id ?? "openai-compatible";
|
|
240939
|
+
const baseURL = options2.baseURL;
|
|
240940
|
+
const model = options2.model ?? "gpt-4o";
|
|
240941
|
+
const apiKey = options2.apiKey ?? (options2.apiKeyEnv ? process.env[options2.apiKeyEnv] : undefined);
|
|
240942
|
+
return {
|
|
240943
|
+
id,
|
|
240944
|
+
label: options2.label ?? "OpenAI-compatible",
|
|
240945
|
+
capabilities: CAPS4,
|
|
240946
|
+
enabled: options2.enabled ?? Boolean(baseURL),
|
|
240947
|
+
priority: options2.priority ?? 80,
|
|
240948
|
+
async invoke(request) {
|
|
240949
|
+
const start = Date.now();
|
|
240950
|
+
if (!baseURL) {
|
|
240951
|
+
return {
|
|
240952
|
+
providerId: id,
|
|
240953
|
+
capability: request.capability,
|
|
240954
|
+
text: `[${id}:inert] missing baseURL`,
|
|
240955
|
+
meta: { model, inert: true, latencyMs: Date.now() - start }
|
|
240956
|
+
};
|
|
240957
|
+
}
|
|
240958
|
+
try {
|
|
240959
|
+
const response = await fetch(`${trimBaseURL(baseURL)}/chat/completions`, {
|
|
240960
|
+
method: "POST",
|
|
240961
|
+
headers: {
|
|
240962
|
+
"content-type": "application/json",
|
|
240963
|
+
...apiKey ? { authorization: `Bearer ${apiKey}` } : {}
|
|
240964
|
+
},
|
|
240965
|
+
body: JSON.stringify({
|
|
240966
|
+
model: request.params?.model ?? model,
|
|
240967
|
+
messages: [{ role: "user", content: request.prompt }],
|
|
240968
|
+
stream: false
|
|
240969
|
+
}),
|
|
240970
|
+
signal: request.signal
|
|
240971
|
+
});
|
|
240972
|
+
if (!response.ok) {
|
|
240973
|
+
const detail = await response.text().catch(() => "");
|
|
240974
|
+
throw new Error(`${response.status} ${response.statusText}${detail ? `: ${detail.slice(0, 240)}` : ""}`);
|
|
240975
|
+
}
|
|
240976
|
+
const payload = await response.json();
|
|
240977
|
+
const text = extractText(payload);
|
|
240978
|
+
return {
|
|
240979
|
+
providerId: id,
|
|
240980
|
+
capability: request.capability,
|
|
240981
|
+
text: text || `[${id}:empty] Provider returned no text.`,
|
|
240982
|
+
meta: { model, latencyMs: Date.now() - start }
|
|
240983
|
+
};
|
|
240984
|
+
} catch (err2) {
|
|
240985
|
+
return {
|
|
240986
|
+
providerId: id,
|
|
240987
|
+
capability: request.capability,
|
|
240988
|
+
text: `[${id}:error] ${err2.message}`,
|
|
240989
|
+
meta: { model, latencyMs: Date.now() - start }
|
|
240990
|
+
};
|
|
240991
|
+
}
|
|
240992
|
+
}
|
|
240993
|
+
};
|
|
240994
|
+
}
|
|
240995
|
+
var CAPS4;
|
|
240996
|
+
var init_openaiCompatible = __esm(() => {
|
|
240997
|
+
CAPS4 = ["text"];
|
|
240998
|
+
});
|
|
240999
|
+
|
|
241000
|
+
// services/providers/adapters/report.ts
|
|
241001
|
+
function coerceSections(data) {
|
|
241002
|
+
if (!Array.isArray(data))
|
|
241003
|
+
return [];
|
|
241004
|
+
return data.filter((s) => !!s && typeof s === "object" && ("heading" in s) && ("body" in s)).map((s) => ({ heading: String(s.heading), body: String(s.body) }));
|
|
241005
|
+
}
|
|
241006
|
+
function createReportAdapter(options2 = {}) {
|
|
241007
|
+
const id = options2.id ?? "report";
|
|
241008
|
+
return {
|
|
241009
|
+
id,
|
|
241010
|
+
label: "Report generator",
|
|
241011
|
+
capabilities: CAPS5,
|
|
241012
|
+
enabled: options2.enabled ?? true,
|
|
241013
|
+
priority: options2.priority ?? 20,
|
|
241014
|
+
async invoke(request) {
|
|
241015
|
+
const start = Date.now();
|
|
241016
|
+
const sections = coerceSections(request.data);
|
|
241017
|
+
const title = request.params?.title ?? request.prompt;
|
|
241018
|
+
const md = `# ${title}
|
|
241019
|
+
|
|
241020
|
+
` + (sections.length ? sections.map((s) => `## ${s.heading}
|
|
241021
|
+
|
|
241022
|
+
${s.body}`).join(`
|
|
241023
|
+
|
|
241024
|
+
`) : `_No structured sections supplied for: ${request.prompt}_`);
|
|
241025
|
+
const artifact = {
|
|
241026
|
+
kind: "report",
|
|
241027
|
+
label: `${title} (${sections.length} sections)`,
|
|
241028
|
+
payload: md
|
|
241029
|
+
};
|
|
241030
|
+
return {
|
|
241031
|
+
providerId: id,
|
|
241032
|
+
capability: "report",
|
|
241033
|
+
text: `Generated report "${title}" with ${sections.length} section(s).`,
|
|
241034
|
+
artifacts: [artifact],
|
|
241035
|
+
meta: { latencyMs: Date.now() - start, sections: sections.length }
|
|
241036
|
+
};
|
|
241037
|
+
}
|
|
241038
|
+
};
|
|
241039
|
+
}
|
|
241040
|
+
var CAPS5;
|
|
241041
|
+
var init_report = __esm(() => {
|
|
241042
|
+
CAPS5 = ["report"];
|
|
241043
|
+
});
|
|
241044
|
+
|
|
241045
|
+
// services/providers/adapters/video.ts
|
|
241046
|
+
function createVideoAdapter(options2 = {}) {
|
|
241047
|
+
const id = options2.id ?? "video";
|
|
241048
|
+
const vendor = options2.vendor ?? "runway";
|
|
241049
|
+
const generate = options2.deps?.generate;
|
|
241050
|
+
return {
|
|
241051
|
+
id,
|
|
241052
|
+
label: `Video (${vendor})`,
|
|
241053
|
+
capabilities: CAPS6,
|
|
241054
|
+
enabled: options2.enabled ?? true,
|
|
241055
|
+
priority: options2.priority ?? 10,
|
|
241056
|
+
async invoke(request) {
|
|
241057
|
+
const start = Date.now();
|
|
241058
|
+
const durationSec = request.params?.durationSec ?? 5;
|
|
241059
|
+
if (!generate) {
|
|
241060
|
+
const artifact = {
|
|
241061
|
+
kind: "video",
|
|
241062
|
+
label: `${durationSec}s clip (stub)`,
|
|
241063
|
+
ref: `stub://video/${vendor}/${encodeURIComponent(request.prompt.slice(0, 40))}`
|
|
241064
|
+
};
|
|
241065
|
+
return {
|
|
241066
|
+
providerId: id,
|
|
241067
|
+
capability: "video",
|
|
241068
|
+
text: `[video:inert] would render a ${durationSec}s ${vendor} clip of: ${request.prompt}`,
|
|
241069
|
+
artifacts: [artifact],
|
|
241070
|
+
meta: { model: vendor, inert: true, latencyMs: Date.now() - start }
|
|
241071
|
+
};
|
|
241072
|
+
}
|
|
241073
|
+
const { url: url3, costUsd } = await generate({
|
|
241074
|
+
prompt: request.prompt,
|
|
241075
|
+
durationSec,
|
|
241076
|
+
signal: request.signal
|
|
241077
|
+
});
|
|
241078
|
+
return {
|
|
241079
|
+
providerId: id,
|
|
241080
|
+
capability: "video",
|
|
241081
|
+
text: `Rendered a ${durationSec}s clip.`,
|
|
241082
|
+
artifacts: [{ kind: "video", label: `${durationSec}s clip`, ref: url3 }],
|
|
241083
|
+
meta: { model: vendor, costUsd, latencyMs: Date.now() - start }
|
|
241084
|
+
};
|
|
241085
|
+
}
|
|
241086
|
+
};
|
|
241087
|
+
}
|
|
241088
|
+
var CAPS6;
|
|
241089
|
+
var init_video = __esm(() => {
|
|
241090
|
+
CAPS6 = ["video"];
|
|
241091
|
+
});
|
|
241092
|
+
|
|
241093
|
+
// services/providers/adapters/index.ts
|
|
241094
|
+
var ADAPTER_FACTORIES;
|
|
241095
|
+
var init_adapters2 = __esm(() => {
|
|
241096
|
+
init_theus();
|
|
241097
|
+
init_chart();
|
|
241098
|
+
init_openai();
|
|
241099
|
+
init_openaiCompatible();
|
|
241100
|
+
init_report();
|
|
241101
|
+
init_video();
|
|
241102
|
+
ADAPTER_FACTORIES = {
|
|
241103
|
+
theus: createTheusAdapter,
|
|
241104
|
+
openai: createOpenAIAdapter,
|
|
241105
|
+
"openai-compatible": createOpenAICompatibleAdapter,
|
|
241106
|
+
video: createVideoAdapter,
|
|
241107
|
+
chart: createChartAdapter,
|
|
241108
|
+
report: createReportAdapter
|
|
241109
|
+
};
|
|
241110
|
+
});
|
|
241111
|
+
|
|
241112
|
+
// services/providers/registry.ts
|
|
241113
|
+
import { existsSync as existsSync4, readFileSync as readFileSync11 } from "fs";
|
|
241114
|
+
import { homedir as homedir23 } from "os";
|
|
241115
|
+
import { join as join68 } from "path";
|
|
241116
|
+
function defaultProvidersConfigPath() {
|
|
241117
|
+
const override = process.env[`${ENV_PREFIX}PROVIDERS_CONFIG`];
|
|
241118
|
+
if (override)
|
|
241119
|
+
return override;
|
|
241120
|
+
const home = homedir23();
|
|
241121
|
+
const primary = join68(home, CONFIG_DIR_NAME, "providers.json");
|
|
241122
|
+
if (existsSync4(primary))
|
|
241123
|
+
return primary;
|
|
241124
|
+
for (const legacyDir of LEGACY_CONFIG_DIR_NAMES) {
|
|
241125
|
+
const legacy = join68(home, legacyDir, "providers.json");
|
|
241126
|
+
if (existsSync4(legacy))
|
|
241127
|
+
return legacy;
|
|
241128
|
+
}
|
|
241129
|
+
return primary;
|
|
241130
|
+
}
|
|
241131
|
+
|
|
241132
|
+
class ProviderRegistry {
|
|
241133
|
+
byId = new Map;
|
|
241134
|
+
policy = {};
|
|
241135
|
+
register(adapter2) {
|
|
241136
|
+
this.byId.set(adapter2.id, adapter2);
|
|
241137
|
+
return this;
|
|
241138
|
+
}
|
|
241139
|
+
unregister(id) {
|
|
241140
|
+
return this.byId.delete(id);
|
|
241141
|
+
}
|
|
241142
|
+
get(id) {
|
|
241143
|
+
return this.byId.get(id);
|
|
241144
|
+
}
|
|
241145
|
+
all() {
|
|
241146
|
+
return [...this.byId.values()];
|
|
241147
|
+
}
|
|
241148
|
+
forCapability(capability) {
|
|
241149
|
+
const policyOrder = this.policy?.[capability];
|
|
241150
|
+
const matches = this.all().filter((a2) => a2.enabled !== false && a2.capabilities.includes(capability));
|
|
241151
|
+
return matches.sort((a2, b) => {
|
|
241152
|
+
if (policyOrder) {
|
|
241153
|
+
const ai = policyOrder.indexOf(a2.id);
|
|
241154
|
+
const bi = policyOrder.indexOf(b.id);
|
|
241155
|
+
if (ai !== -1 || bi !== -1) {
|
|
241156
|
+
if (ai === -1)
|
|
241157
|
+
return 1;
|
|
241158
|
+
if (bi === -1)
|
|
241159
|
+
return -1;
|
|
241160
|
+
if (ai !== bi)
|
|
241161
|
+
return ai - bi;
|
|
241162
|
+
}
|
|
241163
|
+
}
|
|
241164
|
+
return (b.priority ?? 0) - (a2.priority ?? 0);
|
|
241165
|
+
});
|
|
241166
|
+
}
|
|
241167
|
+
supportedCapabilities() {
|
|
241168
|
+
const set3 = new Set;
|
|
241169
|
+
for (const a2 of this.all()) {
|
|
241170
|
+
if (a2.enabled === false)
|
|
241171
|
+
continue;
|
|
241172
|
+
for (const c5 of a2.capabilities)
|
|
241173
|
+
set3.add(c5);
|
|
241174
|
+
}
|
|
241175
|
+
return [...set3];
|
|
241176
|
+
}
|
|
241177
|
+
setPolicy(policy) {
|
|
241178
|
+
this.policy = policy ?? {};
|
|
241179
|
+
return this;
|
|
241180
|
+
}
|
|
241181
|
+
getPolicy() {
|
|
241182
|
+
return this.policy;
|
|
241183
|
+
}
|
|
241184
|
+
instantiate(entry) {
|
|
241185
|
+
const factory2 = ADAPTER_FACTORIES[entry.adapter];
|
|
241186
|
+
if (!factory2)
|
|
241187
|
+
return;
|
|
241188
|
+
return factory2({
|
|
241189
|
+
id: entry.id,
|
|
241190
|
+
enabled: entry.enabled,
|
|
241191
|
+
priority: entry.priority,
|
|
241192
|
+
...entry.options ?? {}
|
|
241193
|
+
});
|
|
241194
|
+
}
|
|
241195
|
+
loadConfig(config2) {
|
|
241196
|
+
for (const entry of config2.providers ?? []) {
|
|
241197
|
+
const adapter2 = this.instantiate(entry);
|
|
241198
|
+
if (adapter2)
|
|
241199
|
+
this.register(adapter2);
|
|
241200
|
+
}
|
|
241201
|
+
if (config2.policy)
|
|
241202
|
+
this.setPolicy(config2.policy);
|
|
241203
|
+
return this;
|
|
241204
|
+
}
|
|
241205
|
+
loadFromFile(path10 = defaultProvidersConfigPath()) {
|
|
241206
|
+
try {
|
|
241207
|
+
if (!existsSync4(path10))
|
|
241208
|
+
return this;
|
|
241209
|
+
const raw = readFileSync11(path10, "utf8");
|
|
241210
|
+
const config2 = JSON.parse(raw);
|
|
241211
|
+
return this.loadConfig(config2);
|
|
241212
|
+
} catch {
|
|
241213
|
+
return this;
|
|
241214
|
+
}
|
|
241215
|
+
}
|
|
241216
|
+
}
|
|
241217
|
+
var init_registry2 = __esm(() => {
|
|
241218
|
+
init_branding();
|
|
241219
|
+
init_adapters2();
|
|
241220
|
+
});
|
|
241221
|
+
|
|
241222
|
+
// services/router/secretStore.ts
|
|
241223
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
241224
|
+
function detectBackend() {
|
|
241225
|
+
if (_cachedBackend !== undefined)
|
|
241226
|
+
return _cachedBackend;
|
|
241227
|
+
_cachedBackend = computeBackend();
|
|
241228
|
+
return _cachedBackend;
|
|
241229
|
+
}
|
|
241230
|
+
function binExists(bin, probeArgs) {
|
|
241231
|
+
try {
|
|
241232
|
+
const r = spawnSync3(bin, probeArgs, { stdio: "ignore", timeout: 4000 });
|
|
241233
|
+
return !r.error;
|
|
241234
|
+
} catch {
|
|
241235
|
+
return false;
|
|
241236
|
+
}
|
|
241237
|
+
}
|
|
241238
|
+
function computeBackend() {
|
|
241239
|
+
if (process.env.THEUS_DISABLE_KEYCHAIN === "1")
|
|
241240
|
+
return null;
|
|
241241
|
+
if (process.platform === "darwin") {
|
|
241242
|
+
return binExists("security", ["help"]) ? "macos" : null;
|
|
241243
|
+
}
|
|
241244
|
+
if (process.platform === "linux") {
|
|
241245
|
+
return binExists("secret-tool", ["--version"]) ? "linux" : null;
|
|
241246
|
+
}
|
|
241247
|
+
return null;
|
|
241248
|
+
}
|
|
241249
|
+
function buildRef(account) {
|
|
241250
|
+
return `${REF_PREFIX}${KEYCHAIN_SERVICE}:${account}`;
|
|
241251
|
+
}
|
|
241252
|
+
function parseRef(ref) {
|
|
241253
|
+
if (!ref.startsWith(REF_PREFIX))
|
|
241254
|
+
return null;
|
|
241255
|
+
const rest = ref.slice(REF_PREFIX.length);
|
|
241256
|
+
const sep13 = rest.indexOf(":");
|
|
241257
|
+
if (sep13 <= 0)
|
|
241258
|
+
return null;
|
|
241259
|
+
return { service: rest.slice(0, sep13), account: rest.slice(sep13 + 1) };
|
|
241260
|
+
}
|
|
241261
|
+
function isKeychainRef(value) {
|
|
241262
|
+
return typeof value === "string" && value.startsWith(REF_PREFIX);
|
|
241263
|
+
}
|
|
241264
|
+
function macosStore(service, account, secret) {
|
|
241265
|
+
const r = spawnSync3("security", [
|
|
241266
|
+
"add-generic-password",
|
|
241267
|
+
"-U",
|
|
241268
|
+
"-a",
|
|
241269
|
+
account,
|
|
241270
|
+
"-s",
|
|
241271
|
+
service,
|
|
241272
|
+
"-w",
|
|
241273
|
+
secret
|
|
241274
|
+
], { stdio: "ignore", timeout: 8000 });
|
|
241275
|
+
return !r.error && r.status === 0;
|
|
241276
|
+
}
|
|
241277
|
+
function macosLookup(service, account) {
|
|
241278
|
+
const r = spawnSync3("security", ["find-generic-password", "-a", account, "-s", service, "-w"], { encoding: "utf8", timeout: 8000 });
|
|
241279
|
+
if (r.error || r.status !== 0)
|
|
241280
|
+
return;
|
|
241281
|
+
const out = (r.stdout ?? "").replace(/\n$/, "");
|
|
241282
|
+
return out || undefined;
|
|
241283
|
+
}
|
|
241284
|
+
function linuxStore(service, account, secret) {
|
|
241285
|
+
const r = spawnSync3("secret-tool", ["store", "--label=Theus provider key", "service", service, "account", account], { input: secret, stdio: ["pipe", "ignore", "ignore"], timeout: 8000 });
|
|
241286
|
+
return !r.error && r.status === 0;
|
|
241287
|
+
}
|
|
241288
|
+
function linuxLookup(service, account) {
|
|
241289
|
+
const r = spawnSync3("secret-tool", ["lookup", "service", service, "account", account], { encoding: "utf8", timeout: 8000 });
|
|
241290
|
+
if (r.error || r.status !== 0)
|
|
241291
|
+
return;
|
|
241292
|
+
const out = (r.stdout ?? "").replace(/\n$/, "");
|
|
241293
|
+
return out || undefined;
|
|
241294
|
+
}
|
|
241295
|
+
function storeApiKey(providerId, apiKey) {
|
|
241296
|
+
const trimmed = apiKey.trim();
|
|
241297
|
+
const backend = detectBackend();
|
|
241298
|
+
if (backend) {
|
|
241299
|
+
try {
|
|
241300
|
+
const ok = backend === "macos" ? macosStore(KEYCHAIN_SERVICE, providerId, trimmed) : linuxStore(KEYCHAIN_SERVICE, providerId, trimmed);
|
|
241301
|
+
if (ok)
|
|
241302
|
+
return { apiKeyRef: buildRef(providerId), storage: "keychain" };
|
|
241303
|
+
} catch {}
|
|
241304
|
+
}
|
|
241305
|
+
return { apiKey: trimmed, storage: "file" };
|
|
241306
|
+
}
|
|
241307
|
+
function resolveApiKeyRef(ref) {
|
|
241308
|
+
const parsed = parseRef(ref);
|
|
241309
|
+
if (!parsed)
|
|
241310
|
+
return;
|
|
241311
|
+
const backend = detectBackend();
|
|
241312
|
+
if (!backend)
|
|
241313
|
+
return;
|
|
241314
|
+
try {
|
|
241315
|
+
return backend === "macos" ? macosLookup(parsed.service, parsed.account) : linuxLookup(parsed.service, parsed.account);
|
|
241316
|
+
} catch {
|
|
241317
|
+
return;
|
|
241318
|
+
}
|
|
241319
|
+
}
|
|
241320
|
+
var KEYCHAIN_SERVICE = "theus-provider", REF_PREFIX = "keychain:", _cachedBackend;
|
|
241321
|
+
var init_secretStore = () => {};
|
|
241322
|
+
|
|
240762
241323
|
// services/knowledge/semantic.ts
|
|
240763
241324
|
import { createHash as createHash16 } from "crypto";
|
|
240764
|
-
import { mkdirSync as mkdirSync5 } from "fs";
|
|
241325
|
+
import { mkdirSync as mkdirSync5, readFileSync as readFileSync12, statSync as statSync6 } from "fs";
|
|
240765
241326
|
import { readFile as readFile18, writeFile as writeFile18 } from "fs/promises";
|
|
240766
|
-
import { join as
|
|
240767
|
-
function
|
|
240768
|
-
const
|
|
240769
|
-
|
|
241327
|
+
import { join as join69 } from "path";
|
|
241328
|
+
function providersJsonPath() {
|
|
241329
|
+
const fileOverride = process.env.THEUS_PROVIDERS_CONFIG?.trim();
|
|
241330
|
+
if (fileOverride)
|
|
241331
|
+
return fileOverride;
|
|
241332
|
+
if (process.env.THEUS_CONFIG_DIR?.trim()) {
|
|
241333
|
+
return join69(getTheusConfigHome(), "providers.json");
|
|
241334
|
+
}
|
|
241335
|
+
return defaultProvidersConfigPath();
|
|
240770
241336
|
}
|
|
240771
|
-
function
|
|
240772
|
-
|
|
241337
|
+
function fileMtimeMs(path10) {
|
|
241338
|
+
try {
|
|
241339
|
+
return statSync6(path10).mtimeMs;
|
|
241340
|
+
} catch {
|
|
241341
|
+
return 0;
|
|
241342
|
+
}
|
|
241343
|
+
}
|
|
241344
|
+
function resolveFromProviders() {
|
|
241345
|
+
const path10 = providersJsonPath();
|
|
241346
|
+
const mtimeMs = fileMtimeMs(path10);
|
|
241347
|
+
if (providerMemo && providerMemo.path === path10 && providerMemo.mtimeMs === mtimeMs) {
|
|
241348
|
+
return providerMemo.config;
|
|
241349
|
+
}
|
|
241350
|
+
let config2 = null;
|
|
241351
|
+
if (mtimeMs !== 0) {
|
|
241352
|
+
try {
|
|
241353
|
+
const raw = readFileSync12(path10, "utf-8");
|
|
241354
|
+
const parsed = JSON.parse(raw);
|
|
241355
|
+
const entry = Array.isArray(parsed?.providers) ? parsed.providers.find((p) => p?.id === OFFICIAL_PROVIDER_ID && p.enabled !== false) : undefined;
|
|
241356
|
+
const options2 = entry?.options ?? {};
|
|
241357
|
+
const baseURL = typeof options2.baseURL === "string" ? options2.baseURL.trim() : "";
|
|
241358
|
+
if (baseURL) {
|
|
241359
|
+
const key = typeof options2.apiKey === "string" && options2.apiKey.trim() ? options2.apiKey.trim() : typeof options2.apiKeyRef === "string" ? resolveApiKeyRef(options2.apiKeyRef) : typeof options2.apiKeyEnv === "string" ? process.env[options2.apiKeyEnv]?.trim() : undefined;
|
|
241360
|
+
config2 = {
|
|
241361
|
+
url: `${baseURL.replace(/\/+$/, "")}/embeddings`,
|
|
241362
|
+
...key ? { key } : {},
|
|
241363
|
+
model: OFFICIAL_EMBED_MODEL,
|
|
241364
|
+
source: "provider"
|
|
241365
|
+
};
|
|
241366
|
+
}
|
|
241367
|
+
} catch {
|
|
241368
|
+
config2 = null;
|
|
241369
|
+
}
|
|
241370
|
+
}
|
|
241371
|
+
providerMemo = { path: path10, mtimeMs, config: config2 };
|
|
241372
|
+
return config2;
|
|
241373
|
+
}
|
|
241374
|
+
function resolveEmbeddingsConfig() {
|
|
241375
|
+
if (isEnvTruthy(process.env[ENV_KILL]))
|
|
241376
|
+
return null;
|
|
241377
|
+
const envUrl = process.env[ENV_URL]?.trim();
|
|
241378
|
+
if (envUrl) {
|
|
241379
|
+
const key = process.env[ENV_KEY]?.trim();
|
|
241380
|
+
return {
|
|
241381
|
+
url: envUrl,
|
|
241382
|
+
...key ? { key } : {},
|
|
241383
|
+
model: process.env[ENV_MODEL]?.trim() || "text-embedding-3-small",
|
|
241384
|
+
source: "env"
|
|
241385
|
+
};
|
|
241386
|
+
}
|
|
241387
|
+
if (autoDisabled)
|
|
241388
|
+
return null;
|
|
241389
|
+
return resolveFromProviders();
|
|
241390
|
+
}
|
|
241391
|
+
function noteAutoFailure() {
|
|
241392
|
+
autoFailures += 1;
|
|
241393
|
+
if (autoFailures >= AUTO_FAILURES_MAX && !autoDisabled) {
|
|
241394
|
+
autoDisabled = true;
|
|
241395
|
+
if (!autoWarned) {
|
|
241396
|
+
autoWarned = true;
|
|
241397
|
+
process.stderr.write(`[theus-semantica] backend de embeddings no disponible \u2014 recall l\xE9xico solamente
|
|
241398
|
+
`);
|
|
241399
|
+
}
|
|
241400
|
+
}
|
|
241401
|
+
}
|
|
241402
|
+
function semanticAvailable() {
|
|
241403
|
+
return resolveEmbeddingsConfig() !== null;
|
|
240773
241404
|
}
|
|
240774
241405
|
async function embedTexts(texts) {
|
|
240775
|
-
const
|
|
240776
|
-
if (!
|
|
241406
|
+
const cfg = resolveEmbeddingsConfig();
|
|
241407
|
+
if (!cfg || texts.length === 0)
|
|
241408
|
+
return null;
|
|
241409
|
+
const fail = () => {
|
|
241410
|
+
if (cfg.source === "provider")
|
|
241411
|
+
noteAutoFailure();
|
|
240777
241412
|
return null;
|
|
241413
|
+
};
|
|
240778
241414
|
const controller = new AbortController;
|
|
240779
241415
|
const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
240780
241416
|
timer.unref?.();
|
|
240781
241417
|
try {
|
|
240782
241418
|
const headers = { "content-type": "application/json" };
|
|
240783
|
-
|
|
240784
|
-
|
|
240785
|
-
|
|
240786
|
-
const res = await fetch(url3, {
|
|
241419
|
+
if (cfg.key)
|
|
241420
|
+
headers.authorization = `Bearer ${cfg.key}`;
|
|
241421
|
+
const res = await fetch(cfg.url, {
|
|
240787
241422
|
method: "POST",
|
|
240788
241423
|
headers,
|
|
240789
|
-
body: JSON.stringify({ input: texts, model:
|
|
241424
|
+
body: JSON.stringify({ input: texts, model: cfg.model }),
|
|
240790
241425
|
signal: controller.signal
|
|
240791
241426
|
});
|
|
240792
241427
|
if (!res.ok)
|
|
240793
|
-
return
|
|
241428
|
+
return fail();
|
|
240794
241429
|
const body = await res.json();
|
|
240795
241430
|
if (!Array.isArray(body?.data) || body.data.length !== texts.length)
|
|
240796
241431
|
return null;
|
|
@@ -240808,18 +241443,20 @@ async function embedTexts(texts) {
|
|
|
240808
241443
|
for (const v of out)
|
|
240809
241444
|
if (!v)
|
|
240810
241445
|
return null;
|
|
241446
|
+
if (cfg.source === "provider")
|
|
241447
|
+
autoFailures = 0;
|
|
240811
241448
|
return out;
|
|
240812
241449
|
} catch {
|
|
240813
|
-
return
|
|
241450
|
+
return fail();
|
|
240814
241451
|
} finally {
|
|
240815
241452
|
clearTimeout(timer);
|
|
240816
241453
|
}
|
|
240817
241454
|
}
|
|
240818
241455
|
function cachePath(projectRoot) {
|
|
240819
|
-
return
|
|
241456
|
+
return join69(getKnowledgeDir(projectRoot), "semantic-cache.json");
|
|
240820
241457
|
}
|
|
240821
|
-
function textKey(text) {
|
|
240822
|
-
return createHash16("sha256").update(`${
|
|
241458
|
+
function textKey(model, text) {
|
|
241459
|
+
return createHash16("sha256").update(`${model}\x00${text}`).digest("hex");
|
|
240823
241460
|
}
|
|
240824
241461
|
function encodeVector(vec) {
|
|
240825
241462
|
return Buffer.from(vec.buffer, vec.byteOffset, vec.byteLength).toString("base64");
|
|
@@ -240900,7 +241537,8 @@ function cosine2(a2, b) {
|
|
|
240900
241537
|
return den > 0 ? dot / den : 0;
|
|
240901
241538
|
}
|
|
240902
241539
|
async function semanticRerank(query, candidates, topK, opts = {}) {
|
|
240903
|
-
|
|
241540
|
+
const cfg = resolveEmbeddingsConfig();
|
|
241541
|
+
if (!cfg || candidates.length === 0)
|
|
240904
241542
|
return null;
|
|
240905
241543
|
try {
|
|
240906
241544
|
const projectRoot = opts.projectRoot ?? process.cwd();
|
|
@@ -240909,10 +241547,12 @@ async function semanticRerank(query, candidates, topK, opts = {}) {
|
|
|
240909
241547
|
const now2 = Date.now();
|
|
240910
241548
|
const clip = (s) => s.slice(0, MAX_TEXT_CHARS);
|
|
240911
241549
|
const qText = clip(query);
|
|
240912
|
-
const wanted = [
|
|
241550
|
+
const wanted = [
|
|
241551
|
+
{ text: qText, key: textKey(cfg.model, qText) }
|
|
241552
|
+
];
|
|
240913
241553
|
const candTexts = candidates.map((c5) => clip(c5.text));
|
|
240914
241554
|
for (const t of candTexts)
|
|
240915
|
-
wanted.push({ text: t, key: textKey(t) });
|
|
241555
|
+
wanted.push({ text: t, key: textKey(cfg.model, t) });
|
|
240916
241556
|
const vectors = new Map;
|
|
240917
241557
|
const missing = [];
|
|
240918
241558
|
const seen = new Set;
|
|
@@ -240942,12 +241582,12 @@ async function semanticRerank(query, candidates, topK, opts = {}) {
|
|
|
240942
241582
|
} else if (wanted.some((w) => cache2.entries.has(w.key))) {
|
|
240943
241583
|
scheduleCacheWrite(projectRoot, cache2);
|
|
240944
241584
|
}
|
|
240945
|
-
const qVec = vectors.get(textKey(qText));
|
|
241585
|
+
const qVec = vectors.get(textKey(cfg.model, qText));
|
|
240946
241586
|
if (!qVec)
|
|
240947
241587
|
return null;
|
|
240948
241588
|
const sims = new Map;
|
|
240949
241589
|
for (let i3 = 0;i3 < candidates.length; i3++) {
|
|
240950
|
-
const vec = vectors.get(textKey(candTexts[i3]));
|
|
241590
|
+
const vec = vectors.get(textKey(cfg.model, candTexts[i3]));
|
|
240951
241591
|
if (!vec)
|
|
240952
241592
|
continue;
|
|
240953
241593
|
sims.set(candidates[i3].id, cosine2(qVec, vec));
|
|
@@ -240982,8 +241622,11 @@ async function semanticRerankHits(query, hits, keep, opts = {}) {
|
|
|
240982
241622
|
blended.sort((a2, b) => b.score - a2.score);
|
|
240983
241623
|
return blended.slice(0, keep);
|
|
240984
241624
|
}
|
|
240985
|
-
var ENV_URL = "THEUS_EMBEDDINGS_URL", ENV_KEY = "THEUS_EMBEDDINGS_KEY", ENV_MODEL = "THEUS_EMBEDDINGS_MODEL", REQUEST_TIMEOUT_MS = 3000, CACHE_MAX_ENTRIES = 5000, CACHE_WRITE_DEBOUNCE_MS = 500, MAX_TEXT_CHARS = 600, projectCaches;
|
|
241625
|
+
var ENV_URL = "THEUS_EMBEDDINGS_URL", ENV_KEY = "THEUS_EMBEDDINGS_KEY", ENV_MODEL = "THEUS_EMBEDDINGS_MODEL", ENV_KILL = "THEUS_NO_EMBEDDINGS", OFFICIAL_PROVIDER_ID = "theus-official", OFFICIAL_EMBED_MODEL = "theus-embed", AUTO_FAILURES_MAX = 2, REQUEST_TIMEOUT_MS = 3000, CACHE_MAX_ENTRIES = 5000, CACHE_WRITE_DEBOUNCE_MS = 500, MAX_TEXT_CHARS = 600, providerMemo = null, autoFailures = 0, autoDisabled = false, autoWarned = false, projectCaches;
|
|
240986
241626
|
var init_semantic = __esm(() => {
|
|
241627
|
+
init_envUtils();
|
|
241628
|
+
init_registry2();
|
|
241629
|
+
init_secretStore();
|
|
240987
241630
|
init_paths2();
|
|
240988
241631
|
projectCaches = new Map;
|
|
240989
241632
|
});
|
|
@@ -241226,9 +241869,9 @@ var init_file_index = __esm(() => {
|
|
|
241226
241869
|
});
|
|
241227
241870
|
|
|
241228
241871
|
// services/knowledge/indexer.ts
|
|
241229
|
-
import { existsSync as
|
|
241872
|
+
import { existsSync as existsSync5 } from "fs";
|
|
241230
241873
|
import { readFile as readFile19, readdir as readdir11, stat as stat21 } from "fs/promises";
|
|
241231
|
-
import { basename as basename18, dirname as dirname27, extname as extname8, join as
|
|
241874
|
+
import { basename as basename18, dirname as dirname27, extname as extname8, join as join70, relative as relative9, resolve as resolve21 } from "path";
|
|
241232
241875
|
async function collectSourceFiles(root2, opts = {}) {
|
|
241233
241876
|
const ignore2 = new Set([...IGNORE_DIRS, ...opts.ignoreDirs ?? []]);
|
|
241234
241877
|
const max2 = opts.maxFiles ?? 5000;
|
|
@@ -241269,7 +241912,7 @@ async function collectSourceFiles(root2, opts = {}) {
|
|
|
241269
241912
|
if (ent.isDirectory() && ignore2.has(ent.name))
|
|
241270
241913
|
continue;
|
|
241271
241914
|
}
|
|
241272
|
-
const full =
|
|
241915
|
+
const full = join70(dir, ent.name);
|
|
241273
241916
|
if (ent.isDirectory()) {
|
|
241274
241917
|
if (ignore2.has(ent.name))
|
|
241275
241918
|
continue;
|
|
@@ -241411,12 +242054,12 @@ function resolveSpecifier(fromFile, spec, known) {
|
|
|
241411
242054
|
`${base2}.tsx`,
|
|
241412
242055
|
`${base2}.js`,
|
|
241413
242056
|
`${base2}.jsx`,
|
|
241414
|
-
|
|
241415
|
-
|
|
241416
|
-
|
|
242057
|
+
join70(base2, "index.ts"),
|
|
242058
|
+
join70(base2, "index.tsx"),
|
|
242059
|
+
join70(base2, "index.js")
|
|
241417
242060
|
].filter(Boolean);
|
|
241418
242061
|
for (const c5 of candidates) {
|
|
241419
|
-
if (known ? known.has(c5) :
|
|
242062
|
+
if (known ? known.has(c5) : existsSync5(c5))
|
|
241420
242063
|
return c5;
|
|
241421
242064
|
}
|
|
241422
242065
|
return;
|
|
@@ -241867,7 +242510,7 @@ var init_introspect = () => {};
|
|
|
241867
242510
|
|
|
241868
242511
|
// services/projectIntelligence/dbSchema.ts
|
|
241869
242512
|
import { readFile as readFile20, readdir as readdir12 } from "fs/promises";
|
|
241870
|
-
import { basename as basename19, extname as extname9, join as
|
|
242513
|
+
import { basename as basename19, extname as extname9, join as join71, relative as relative10 } from "path";
|
|
241871
242514
|
async function discoverDatabaseSchema(projectRoot, maxFiles = 80) {
|
|
241872
242515
|
const candidates = await collectSchemaFiles(projectRoot, maxFiles);
|
|
241873
242516
|
const notes = [];
|
|
@@ -241964,7 +242607,7 @@ async function collectSchemaFiles(root2, maxFiles) {
|
|
|
241964
242607
|
return;
|
|
241965
242608
|
if (DB_SCAN_IGNORE.has(entry.name))
|
|
241966
242609
|
continue;
|
|
241967
|
-
const full =
|
|
242610
|
+
const full = join71(dir, entry.name);
|
|
241968
242611
|
if (entry.isDirectory()) {
|
|
241969
242612
|
await walk(full);
|
|
241970
242613
|
continue;
|
|
@@ -244077,7 +244720,7 @@ import { mkdir as mkdir17, writeFile as writeFile19 } from "fs/promises";
|
|
|
244077
244720
|
import {
|
|
244078
244721
|
createServer as createServer5
|
|
244079
244722
|
} from "http";
|
|
244080
|
-
import { dirname as dirname28, join as
|
|
244723
|
+
import { dirname as dirname28, join as join72, resolve as resolve23 } from "path";
|
|
244081
244724
|
import { spawn as spawn4 } from "child_process";
|
|
244082
244725
|
function getLiveStore(projectRoot) {
|
|
244083
244726
|
return liveStores.get(resolve23(projectRoot)) ?? null;
|
|
@@ -244122,7 +244765,7 @@ async function startFresh(projectRoot) {
|
|
|
244122
244765
|
await store.save();
|
|
244123
244766
|
const database = await discoverDatabaseSchema(projectRoot);
|
|
244124
244767
|
const knowledgeDir = getKnowledgeDir(projectRoot);
|
|
244125
|
-
const indexPath =
|
|
244768
|
+
const indexPath = join72(knowledgeDir, "project-index.json");
|
|
244126
244769
|
const graphPath = getGraphPath(projectRoot);
|
|
244127
244770
|
await mkdir17(dirname28(indexPath), { recursive: true });
|
|
244128
244771
|
const summary = summarizeIndex(index);
|
|
@@ -244410,7 +245053,7 @@ __export(exports_inject, {
|
|
|
244410
245053
|
buildKnowledgeInjection: () => buildKnowledgeInjection,
|
|
244411
245054
|
KNOWLEDGE_INJECT_KILL_SWITCH: () => KNOWLEDGE_INJECT_KILL_SWITCH
|
|
244412
245055
|
});
|
|
244413
|
-
import { statSync as
|
|
245056
|
+
import { statSync as statSync7 } from "fs";
|
|
244414
245057
|
function isTruthyEnv(value) {
|
|
244415
245058
|
if (!value)
|
|
244416
245059
|
return false;
|
|
@@ -244435,7 +245078,7 @@ async function resolveStore(projectRoot) {
|
|
|
244435
245078
|
}
|
|
244436
245079
|
function readGraphMtimeMs(projectRoot) {
|
|
244437
245080
|
try {
|
|
244438
|
-
return
|
|
245081
|
+
return statSync7(getGraphPath(projectRoot)).mtimeMs;
|
|
244439
245082
|
} catch {
|
|
244440
245083
|
return 0;
|
|
244441
245084
|
}
|
|
@@ -246228,7 +246871,7 @@ import {
|
|
|
246228
246871
|
stat as stat22,
|
|
246229
246872
|
unlink as unlink9
|
|
246230
246873
|
} from "fs/promises";
|
|
246231
|
-
import { dirname as dirname29, isAbsolute as isAbsolute13, join as
|
|
246874
|
+
import { dirname as dirname29, isAbsolute as isAbsolute13, join as join73, relative as relative11 } from "path";
|
|
246232
246875
|
import { inspect as inspect3 } from "util";
|
|
246233
246876
|
function fileHistoryEnabled() {
|
|
246234
246877
|
if (getIsNonInteractiveSession()) {
|
|
@@ -246647,7 +247290,7 @@ function getBackupFileName(filePath, version2) {
|
|
|
246647
247290
|
}
|
|
246648
247291
|
function resolveBackupPath(backupFileName, sessionId) {
|
|
246649
247292
|
const configDir = getTheusConfigHomeDir();
|
|
246650
|
-
return
|
|
247293
|
+
return join73(configDir, "file-history", sessionId || getSessionId(), backupFileName);
|
|
246651
247294
|
}
|
|
246652
247295
|
async function createBackup(filePath, version2) {
|
|
246653
247296
|
if (filePath === null) {
|
|
@@ -246729,7 +247372,7 @@ function maybeExpandFilePath(filePath) {
|
|
|
246729
247372
|
if (isAbsolute13(filePath)) {
|
|
246730
247373
|
return filePath;
|
|
246731
247374
|
}
|
|
246732
|
-
return
|
|
247375
|
+
return join73(getOriginalCwd(), filePath);
|
|
246733
247376
|
}
|
|
246734
247377
|
function fileHistoryRestoreStateFromLog(fileHistorySnapshots, onUpdateState) {
|
|
246735
247378
|
if (!fileHistoryEnabled()) {
|
|
@@ -246775,14 +247418,14 @@ async function copyFileHistoryForResume(log) {
|
|
|
246775
247418
|
return;
|
|
246776
247419
|
}
|
|
246777
247420
|
try {
|
|
246778
|
-
const newBackupDir =
|
|
247421
|
+
const newBackupDir = join73(getTheusConfigHomeDir(), "file-history", sessionId);
|
|
246779
247422
|
await mkdir18(newBackupDir, { recursive: true });
|
|
246780
247423
|
let failedSnapshots = 0;
|
|
246781
247424
|
await Promise.allSettled(fileHistorySnapshots.map(async (snapshot2) => {
|
|
246782
247425
|
const backupEntries = Object.values(snapshot2.trackedFileBackups).filter((backup) => backup.backupFileName !== null);
|
|
246783
247426
|
const results = await Promise.allSettled(backupEntries.map(async ({ backupFileName }) => {
|
|
246784
247427
|
const oldBackupPath = resolveBackupPath(backupFileName, previousSessionId);
|
|
246785
|
-
const newBackupPath =
|
|
247428
|
+
const newBackupPath = join73(newBackupDir, backupFileName);
|
|
246786
247429
|
try {
|
|
246787
247430
|
await link3(oldBackupPath, newBackupPath);
|
|
246788
247431
|
} catch (e) {
|
|
@@ -247661,7 +248304,7 @@ var init_words = __esm(() => {
|
|
|
247661
248304
|
// utils/plans.ts
|
|
247662
248305
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
247663
248306
|
import { copyFile as copyFile4, writeFile as writeFile20 } from "fs/promises";
|
|
247664
|
-
import { join as
|
|
248307
|
+
import { join as join74, resolve as resolve24, sep as sep14 } from "path";
|
|
247665
248308
|
function getPlanSlug(sessionId) {
|
|
247666
248309
|
const id = sessionId ?? getSessionId();
|
|
247667
248310
|
const cache2 = getPlanSlugCache();
|
|
@@ -247670,7 +248313,7 @@ function getPlanSlug(sessionId) {
|
|
|
247670
248313
|
const plansDir = getPlansDirectory();
|
|
247671
248314
|
for (let i3 = 0;i3 < MAX_SLUG_RETRIES; i3++) {
|
|
247672
248315
|
slug = generateWordSlug();
|
|
247673
|
-
const filePath =
|
|
248316
|
+
const filePath = join74(plansDir, `${slug}.md`);
|
|
247674
248317
|
if (!getFsImplementation().existsSync(filePath)) {
|
|
247675
248318
|
break;
|
|
247676
248319
|
}
|
|
@@ -247688,9 +248331,9 @@ function clearAllPlanSlugs() {
|
|
|
247688
248331
|
function getPlanFilePath(agentId) {
|
|
247689
248332
|
const planSlug = getPlanSlug(getSessionId());
|
|
247690
248333
|
if (!agentId) {
|
|
247691
|
-
return
|
|
248334
|
+
return join74(getPlansDirectory(), `${planSlug}.md`);
|
|
247692
248335
|
}
|
|
247693
|
-
return
|
|
248336
|
+
return join74(getPlansDirectory(), `${planSlug}-agent-${agentId}.md`);
|
|
247694
248337
|
}
|
|
247695
248338
|
function getPlan(agentId) {
|
|
247696
248339
|
const filePath = getPlanFilePath(agentId);
|
|
@@ -247713,7 +248356,7 @@ async function copyPlanForResume(log, targetSessionId) {
|
|
|
247713
248356
|
}
|
|
247714
248357
|
const sessionId = targetSessionId ?? getSessionId();
|
|
247715
248358
|
setPlanSlug(sessionId, slug);
|
|
247716
|
-
const planPath =
|
|
248359
|
+
const planPath = join74(getPlansDirectory(), `${slug}.md`);
|
|
247717
248360
|
try {
|
|
247718
248361
|
await getFsImplementation().readFile(planPath, { encoding: "utf-8" });
|
|
247719
248362
|
return true;
|
|
@@ -247756,9 +248399,9 @@ async function copyPlanForFork(log, targetSessionId) {
|
|
|
247756
248399
|
return false;
|
|
247757
248400
|
}
|
|
247758
248401
|
const plansDir = getPlansDirectory();
|
|
247759
|
-
const originalPlanPath =
|
|
248402
|
+
const originalPlanPath = join74(plansDir, `${originalSlug}.md`);
|
|
247760
248403
|
const newSlug = getPlanSlug(targetSessionId);
|
|
247761
|
-
const newPlanPath =
|
|
248404
|
+
const newPlanPath = join74(plansDir, `${newSlug}.md`);
|
|
247762
248405
|
try {
|
|
247763
248406
|
await copyFile4(originalPlanPath, newPlanPath);
|
|
247764
248407
|
return true;
|
|
@@ -247873,12 +248516,12 @@ var init_plans = __esm(() => {
|
|
|
247873
248516
|
const resolved = resolve24(cwd2, settingsDir);
|
|
247874
248517
|
if (!resolved.startsWith(cwd2 + sep14) && resolved !== cwd2) {
|
|
247875
248518
|
logError2(new Error(`plansDirectory must be within project root: ${settingsDir}`));
|
|
247876
|
-
plansPath =
|
|
248519
|
+
plansPath = join74(getTheusConfigHomeDir(), "plans");
|
|
247877
248520
|
} else {
|
|
247878
248521
|
plansPath = resolved;
|
|
247879
248522
|
}
|
|
247880
248523
|
} else {
|
|
247881
|
-
plansPath =
|
|
248524
|
+
plansPath = join74(getTheusConfigHomeDir(), "plans");
|
|
247882
248525
|
}
|
|
247883
248526
|
try {
|
|
247884
248527
|
getFsImplementation().mkdirSync(plansPath);
|
|
@@ -247891,21 +248534,21 @@ var init_plans = __esm(() => {
|
|
|
247891
248534
|
|
|
247892
248535
|
// utils/sessionEnvironment.ts
|
|
247893
248536
|
import { mkdir as mkdir19, readdir as readdir13, readFile as readFile22, writeFile as writeFile21 } from "fs/promises";
|
|
247894
|
-
import { join as
|
|
248537
|
+
import { join as join75 } from "path";
|
|
247895
248538
|
async function getSessionEnvDirPath() {
|
|
247896
|
-
const sessionEnvDir =
|
|
248539
|
+
const sessionEnvDir = join75(getTheusConfigHomeDir(), "session-env", getSessionId());
|
|
247897
248540
|
await mkdir19(sessionEnvDir, { recursive: true });
|
|
247898
248541
|
return sessionEnvDir;
|
|
247899
248542
|
}
|
|
247900
248543
|
async function getHookEnvFilePath(hookEvent, hookIndex) {
|
|
247901
248544
|
const prefix = hookEvent.toLowerCase();
|
|
247902
|
-
return
|
|
248545
|
+
return join75(await getSessionEnvDirPath(), `${prefix}-hook-${hookIndex}.sh`);
|
|
247903
248546
|
}
|
|
247904
248547
|
async function clearCwdEnvFiles() {
|
|
247905
248548
|
try {
|
|
247906
248549
|
const dir = await getSessionEnvDirPath();
|
|
247907
248550
|
const files = await readdir13(dir);
|
|
247908
|
-
await Promise.all(files.filter((f) => (f.startsWith("filechanged-hook-") || f.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f)).map((f) => writeFile21(
|
|
248551
|
+
await Promise.all(files.filter((f) => (f.startsWith("filechanged-hook-") || f.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f)).map((f) => writeFile21(join75(dir, f), "")));
|
|
247909
248552
|
} catch (e) {
|
|
247910
248553
|
const code = getErrnoCode(e);
|
|
247911
248554
|
if (code !== "ENOENT") {
|
|
@@ -247946,7 +248589,7 @@ async function getSessionEnvironmentScript() {
|
|
|
247946
248589
|
const files = await readdir13(sessionEnvDir);
|
|
247947
248590
|
const hookFiles = files.filter((f) => HOOK_ENV_REGEX.test(f)).sort(sortHookEnvFiles);
|
|
247948
248591
|
for (const file2 of hookFiles) {
|
|
247949
|
-
const filePath =
|
|
248592
|
+
const filePath = join75(sessionEnvDir, file2);
|
|
247950
248593
|
try {
|
|
247951
248594
|
const content = (await readFile22(filePath, "utf8")).trim();
|
|
247952
248595
|
if (content) {
|
|
@@ -248059,7 +248702,7 @@ var init_hooksConfigSnapshot = __esm(() => {
|
|
|
248059
248702
|
});
|
|
248060
248703
|
|
|
248061
248704
|
// utils/hooks/fileChangedWatcher.ts
|
|
248062
|
-
import { isAbsolute as isAbsolute14, join as
|
|
248705
|
+
import { isAbsolute as isAbsolute14, join as join76 } from "path";
|
|
248063
248706
|
function setEnvHookNotifier(cb) {
|
|
248064
248707
|
notifyCallback = cb;
|
|
248065
248708
|
}
|
|
@@ -248087,7 +248730,7 @@ function resolveWatchPaths(config2) {
|
|
|
248087
248730
|
for (const name of m.matcher.split("|").map((s) => s.trim())) {
|
|
248088
248731
|
if (!name)
|
|
248089
248732
|
continue;
|
|
248090
|
-
staticPaths.push(isAbsolute14(name) ? name :
|
|
248733
|
+
staticPaths.push(isAbsolute14(name) ? name : join76(currentCwd, name));
|
|
248091
248734
|
}
|
|
248092
248735
|
}
|
|
248093
248736
|
return [...new Set([...staticPaths, ...dynamicWatchPaths])];
|
|
@@ -249087,10 +249730,10 @@ var init_filesApi = __esm(() => {
|
|
|
249087
249730
|
// utils/tempfile.ts
|
|
249088
249731
|
import { createHash as createHash18, randomUUID as randomUUID15 } from "crypto";
|
|
249089
249732
|
import { tmpdir as tmpdir4 } from "os";
|
|
249090
|
-
import { join as
|
|
249733
|
+
import { join as join78 } from "path";
|
|
249091
249734
|
function generateTempFilePath(prefix = "theus-prompt", extension = ".md", options2) {
|
|
249092
249735
|
const id = options2?.contentHash ? createHash18("sha256").update(options2.contentHash).digest("hex").slice(0, 16) : randomUUID15();
|
|
249093
|
-
return
|
|
249736
|
+
return join78(tmpdir4(), `${prefix}-${id}${extension}`);
|
|
249094
249737
|
}
|
|
249095
249738
|
var init_tempfile = () => {};
|
|
249096
249739
|
|
|
@@ -251487,7 +252130,7 @@ var init_LSPDiagnosticRegistry = __esm(() => {
|
|
|
251487
252130
|
|
|
251488
252131
|
// utils/plugins/lspPluginIntegration.ts
|
|
251489
252132
|
import { readFile as readFile24 } from "fs/promises";
|
|
251490
|
-
import { join as
|
|
252133
|
+
import { join as join79, relative as relative13, resolve as resolve25 } from "path";
|
|
251491
252134
|
function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
251492
252135
|
const resolvedPluginPath = resolve25(pluginPath);
|
|
251493
252136
|
const resolvedFilePath = resolve25(pluginPath, relativePath);
|
|
@@ -251499,7 +252142,7 @@ function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
|
251499
252142
|
}
|
|
251500
252143
|
async function loadPluginLspServers(plugin, errors4 = []) {
|
|
251501
252144
|
const servers = {};
|
|
251502
|
-
const lspJsonPath =
|
|
252145
|
+
const lspJsonPath = join79(plugin.path, ".lsp.json");
|
|
251503
252146
|
try {
|
|
251504
252147
|
const content = await readFile24(lspJsonPath, "utf-8");
|
|
251505
252148
|
const parsed = jsonParse(content);
|
|
@@ -257047,7 +257690,7 @@ var init_bashPipeCommand = __esm(() => {
|
|
|
257047
257690
|
import { execFile as execFile4 } from "child_process";
|
|
257048
257691
|
import { mkdir as mkdir21, stat as stat24 } from "fs/promises";
|
|
257049
257692
|
import * as os4 from "os";
|
|
257050
|
-
import { join as
|
|
257693
|
+
import { join as join80 } from "path";
|
|
257051
257694
|
function createArgv0ShellFunction(funcName, argv0, binaryPath, prependArgs = []) {
|
|
257052
257695
|
const quotedPath = quote([binaryPath]);
|
|
257053
257696
|
const argSuffix = prependArgs.length > 0 ? `${prependArgs.join(" ")} "$@"` : '"$@"';
|
|
@@ -257103,7 +257746,7 @@ function createFindGrepShellIntegration() {
|
|
|
257103
257746
|
}
|
|
257104
257747
|
function getConfigFile(shellPath) {
|
|
257105
257748
|
const fileName = shellPath.includes("zsh") ? ".zshrc" : shellPath.includes("bash") ? ".bashrc" : ".profile";
|
|
257106
|
-
const configPath =
|
|
257749
|
+
const configPath = join80(os4.homedir(), fileName);
|
|
257107
257750
|
return configPath;
|
|
257108
257751
|
}
|
|
257109
257752
|
function getUserSnapshotContent(configFile) {
|
|
@@ -257257,9 +257900,9 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
257257
257900
|
}
|
|
257258
257901
|
const timestamp = Date.now();
|
|
257259
257902
|
const randomId = Math.random().toString(36).substring(2, 8);
|
|
257260
|
-
const snapshotsDir =
|
|
257903
|
+
const snapshotsDir = join80(getTheusConfigHomeDir(), "shell-snapshots");
|
|
257261
257904
|
logForDebugging(`Snapshots directory: ${snapshotsDir}`);
|
|
257262
|
-
const shellSnapshotPath =
|
|
257905
|
+
const shellSnapshotPath = join80(snapshotsDir, `snapshot-${shellType}-${timestamp}-${randomId}.sh`);
|
|
257263
257906
|
await mkdir21(snapshotsDir, { recursive: true });
|
|
257264
257907
|
const snapshotScript = await getSnapshotScript(binShell, shellSnapshotPath, configFileExists);
|
|
257265
257908
|
logForDebugging(`Creating snapshot at: ${shellSnapshotPath}`);
|
|
@@ -257814,7 +258457,7 @@ var init_powershellDetection = __esm(() => {
|
|
|
257814
258457
|
|
|
257815
258458
|
// utils/shell/powershellProvider.ts
|
|
257816
258459
|
import { tmpdir as tmpdir5 } from "os";
|
|
257817
|
-
import { join as
|
|
258460
|
+
import { join as join81 } from "path";
|
|
257818
258461
|
import { join as posixJoin2 } from "path/posix";
|
|
257819
258462
|
function buildPowerShellArgs(cmd) {
|
|
257820
258463
|
return ["-NoProfile", "-NonInteractive", "-Command", cmd];
|
|
@@ -257830,7 +258473,7 @@ function createPowerShellProvider(shellPath) {
|
|
|
257830
258473
|
detached: false,
|
|
257831
258474
|
async buildExecCommand(command, opts) {
|
|
257832
258475
|
currentSandboxTmpDir = opts.useSandbox ? opts.sandboxTmpDir : undefined;
|
|
257833
|
-
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `theus-pwd-ps-${opts.id}`) :
|
|
258476
|
+
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `theus-pwd-ps-${opts.id}`) : join81(tmpdir5(), `theus-pwd-ps-${opts.id}`);
|
|
257834
258477
|
const escapedCwdFilePath = cwdFilePath.replace(/'/g, "''");
|
|
257835
258478
|
const cwdTracking = `
|
|
257836
258479
|
; $_ec = if ($null -ne $LASTEXITCODE) { $LASTEXITCODE } elseif ($?) { 0 } else { 1 }
|
|
@@ -257868,7 +258511,7 @@ var init_powershellProvider = __esm(() => {
|
|
|
257868
258511
|
|
|
257869
258512
|
// utils/Shell.ts
|
|
257870
258513
|
import { execFileSync as execFileSync2, spawn as spawn6 } from "child_process";
|
|
257871
|
-
import { constants as fsConstants4, readFileSync as
|
|
258514
|
+
import { constants as fsConstants4, readFileSync as readFileSync13, unlinkSync as unlinkSync2 } from "fs";
|
|
257872
258515
|
import { mkdir as mkdir22, open as open9, realpath as realpath9 } from "fs/promises";
|
|
257873
258516
|
import { isAbsolute as isAbsolute15, resolve as resolve27 } from "path";
|
|
257874
258517
|
import { join as posixJoin3 } from "path/posix";
|
|
@@ -258029,7 +258672,7 @@ async function exec2(command, abortSignal, shellType, options2) {
|
|
|
258029
258672
|
}
|
|
258030
258673
|
if (result && !preventCwdChanges && !result.backgroundTaskId) {
|
|
258031
258674
|
try {
|
|
258032
|
-
let newCwd =
|
|
258675
|
+
let newCwd = readFileSync13(nativeCwdFilePath, {
|
|
258033
258676
|
encoding: "utf8"
|
|
258034
258677
|
}).trim();
|
|
258035
258678
|
if (getPlatform() === "windows") {
|
|
@@ -261260,7 +261903,7 @@ var init_modeValidation = __esm(() => {
|
|
|
261260
261903
|
});
|
|
261261
261904
|
|
|
261262
261905
|
// tools/PowerShellTool/pathValidation.ts
|
|
261263
|
-
import { homedir as
|
|
261906
|
+
import { homedir as homedir25 } from "os";
|
|
261264
261907
|
import { isAbsolute as isAbsolute16, resolve as resolve29 } from "path";
|
|
261265
261908
|
function matchesParam(paramLower, paramList) {
|
|
261266
261909
|
for (const p of paramList) {
|
|
@@ -261283,7 +261926,7 @@ function formatDirectoryList2(directories) {
|
|
|
261283
261926
|
}
|
|
261284
261927
|
function expandTilde2(filePath) {
|
|
261285
261928
|
if (filePath === "~" || filePath.startsWith("~/") || filePath.startsWith("~\\")) {
|
|
261286
|
-
return
|
|
261929
|
+
return homedir25() + filePath.slice(1);
|
|
261287
261930
|
}
|
|
261288
261931
|
return filePath;
|
|
261289
261932
|
}
|
|
@@ -265281,16 +265924,16 @@ import {
|
|
|
265281
265924
|
basename as basename23,
|
|
265282
265925
|
dirname as dirname31,
|
|
265283
265926
|
isAbsolute as isAbsolute17,
|
|
265284
|
-
join as
|
|
265927
|
+
join as join82,
|
|
265285
265928
|
sep as pathSep,
|
|
265286
265929
|
relative as relative14
|
|
265287
265930
|
} from "path";
|
|
265288
265931
|
function getSkillsPath(source, dir) {
|
|
265289
265932
|
switch (source) {
|
|
265290
265933
|
case "policySettings":
|
|
265291
|
-
return
|
|
265934
|
+
return join82(getManagedFilePath(), ".theus", dir);
|
|
265292
265935
|
case "userSettings":
|
|
265293
|
-
return
|
|
265936
|
+
return join82(getTheusConfigHomeDir(), dir);
|
|
265294
265937
|
case "projectSettings":
|
|
265295
265938
|
return `.theus/${dir}`;
|
|
265296
265939
|
case "plugin":
|
|
@@ -265460,8 +266103,8 @@ async function loadSkillsFromSkillsDir(basePath, source) {
|
|
|
265460
266103
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
265461
266104
|
return null;
|
|
265462
266105
|
}
|
|
265463
|
-
const skillDirPath =
|
|
265464
|
-
const skillFilePath =
|
|
266106
|
+
const skillDirPath = join82(basePath, entry.name);
|
|
266107
|
+
const skillFilePath = join82(skillDirPath, "SKILL.md");
|
|
265465
266108
|
let content;
|
|
265466
266109
|
try {
|
|
265467
266110
|
content = await fs4.readFile(skillFilePath, { encoding: "utf-8" });
|
|
@@ -265616,7 +266259,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd2) {
|
|
|
265616
266259
|
for (const filePath of filePaths) {
|
|
265617
266260
|
let currentDir = dirname31(filePath);
|
|
265618
266261
|
while (currentDir.startsWith(resolvedCwd + pathSep)) {
|
|
265619
|
-
const skillDir =
|
|
266262
|
+
const skillDir = join82(currentDir, ".theus", "skills");
|
|
265620
266263
|
if (!dynamicSkillDirs.has(skillDir)) {
|
|
265621
266264
|
dynamicSkillDirs.add(skillDir);
|
|
265622
266265
|
try {
|
|
@@ -265739,8 +266382,8 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
265739
266382
|
init_types3();
|
|
265740
266383
|
import_ignore2 = __toESM(require_ignore(), 1);
|
|
265741
266384
|
getSkillDirCommands = memoize_default(async (cwd2) => {
|
|
265742
|
-
const userSkillsDir =
|
|
265743
|
-
const managedSkillsDir =
|
|
266385
|
+
const userSkillsDir = join82(getTheusConfigHomeDir(), "skills");
|
|
266386
|
+
const managedSkillsDir = join82(getManagedFilePath(), ".theus", "skills");
|
|
265744
266387
|
const projectSkillsDirs = getProjectDirsUpToHome("skills", cwd2);
|
|
265745
266388
|
logForDebugging(`Loading skills from: managed=${managedSkillsDir}, user=${userSkillsDir}, project=[${projectSkillsDirs.join(", ")}]`);
|
|
265746
266389
|
const additionalDirs = getAdditionalDirectoriesForTheusMd();
|
|
@@ -265751,7 +266394,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
265751
266394
|
logForDebugging(`[bare] Skipping skill dir discovery (${additionalDirs.length === 0 ? "no --add-dir" : "projectSettings disabled or skillsLocked"})`);
|
|
265752
266395
|
return [];
|
|
265753
266396
|
}
|
|
265754
|
-
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
266397
|
+
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join82(dir, ".theus", "skills"), "projectSettings")));
|
|
265755
266398
|
return additionalSkillsNested2.flat().map((s) => s.skill);
|
|
265756
266399
|
}
|
|
265757
266400
|
const [
|
|
@@ -265764,7 +266407,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
265764
266407
|
isEnvTruthy(process.env.THEUS_CODE_DISABLE_POLICY_SKILLS) ? Promise.resolve([]) : loadSkillsFromSkillsDir(managedSkillsDir, "policySettings"),
|
|
265765
266408
|
isSettingSourceEnabled("userSettings") && !skillsLocked ? loadSkillsFromSkillsDir(userSkillsDir, "userSettings") : Promise.resolve([]),
|
|
265766
266409
|
projectSettingsEnabled ? Promise.all(projectSkillsDirs.map((dir) => loadSkillsFromSkillsDir(dir, "projectSettings"))) : Promise.resolve([]),
|
|
265767
|
-
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
266410
|
+
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join82(dir, ".theus", "skills"), "projectSettings"))) : Promise.resolve([]),
|
|
265768
266411
|
skillsLocked ? Promise.resolve([]) : loadSkillsFromCommandsDir(cwd2)
|
|
265769
266412
|
]);
|
|
265770
266413
|
const allSkillsWithPaths = [
|
|
@@ -266132,7 +266775,7 @@ var init_fileOperationAnalytics = __esm(() => {
|
|
|
266132
266775
|
|
|
266133
266776
|
// utils/gitDiff.ts
|
|
266134
266777
|
import { access as access5, readFile as readFile26 } from "fs/promises";
|
|
266135
|
-
import { dirname as dirname32, join as
|
|
266778
|
+
import { dirname as dirname32, join as join83, relative as relative15, sep as sep17 } from "path";
|
|
266136
266779
|
async function fetchGitDiff() {
|
|
266137
266780
|
const isGit = await getIsGit();
|
|
266138
266781
|
if (!isGit)
|
|
@@ -266283,7 +266926,7 @@ async function isInTransientGitState() {
|
|
|
266283
266926
|
"CHERRY_PICK_HEAD",
|
|
266284
266927
|
"REVERT_HEAD"
|
|
266285
266928
|
];
|
|
266286
|
-
const results = await Promise.all(transientFiles.map((file2) => access5(
|
|
266929
|
+
const results = await Promise.all(transientFiles.map((file2) => access5(join83(gitDir, file2)).then(() => true).catch(() => false)));
|
|
266287
266930
|
return results.some(Boolean);
|
|
266288
266931
|
}
|
|
266289
266932
|
async function fetchUntrackedFiles(maxFiles) {
|
|
@@ -269726,10 +270369,10 @@ var init_FileWriteTool = __esm(() => {
|
|
|
269726
270369
|
return { result: true };
|
|
269727
270370
|
}
|
|
269728
270371
|
const fs4 = getFsImplementation();
|
|
269729
|
-
let
|
|
270372
|
+
let fileMtimeMs2;
|
|
269730
270373
|
try {
|
|
269731
270374
|
const fileStat = await fs4.stat(fullFilePath);
|
|
269732
|
-
|
|
270375
|
+
fileMtimeMs2 = fileStat.mtimeMs;
|
|
269733
270376
|
} catch (e) {
|
|
269734
270377
|
if (isENOENT(e)) {
|
|
269735
270378
|
return { result: true };
|
|
@@ -269744,7 +270387,7 @@ var init_FileWriteTool = __esm(() => {
|
|
|
269744
270387
|
errorCode: 2
|
|
269745
270388
|
};
|
|
269746
270389
|
}
|
|
269747
|
-
const lastWriteTime = Math.floor(
|
|
270390
|
+
const lastWriteTime = Math.floor(fileMtimeMs2);
|
|
269748
270391
|
if (lastWriteTime > readTimestamp.timestamp) {
|
|
269749
270392
|
return {
|
|
269750
270393
|
result: false,
|
|
@@ -269898,9 +270541,9 @@ var init_FileWriteTool = __esm(() => {
|
|
|
269898
270541
|
});
|
|
269899
270542
|
|
|
269900
270543
|
// utils/plugins/orphanedPluginFilter.ts
|
|
269901
|
-
import { dirname as dirname35, isAbsolute as isAbsolute20, join as
|
|
270544
|
+
import { dirname as dirname35, isAbsolute as isAbsolute20, join as join84, normalize as normalize10, relative as relative18, sep as sep20 } from "path";
|
|
269902
270545
|
async function getGlobExclusionsForPluginCache(searchPath) {
|
|
269903
|
-
const cachePath2 = normalize10(
|
|
270546
|
+
const cachePath2 = normalize10(join84(getPluginsDirectory(), "cache"));
|
|
269904
270547
|
if (searchPath && !pathsOverlap(searchPath, cachePath2)) {
|
|
269905
270548
|
return [];
|
|
269906
270549
|
}
|
|
@@ -269948,7 +270591,7 @@ var init_orphanedPluginFilter = __esm(() => {
|
|
|
269948
270591
|
});
|
|
269949
270592
|
|
|
269950
270593
|
// utils/glob.ts
|
|
269951
|
-
import { basename as basename24, dirname as dirname36, isAbsolute as isAbsolute21, join as
|
|
270594
|
+
import { basename as basename24, dirname as dirname36, isAbsolute as isAbsolute21, join as join85, sep as sep21 } from "path";
|
|
269952
270595
|
function extractGlobBaseDirectory(pattern) {
|
|
269953
270596
|
const globChars = /[*?[{]/;
|
|
269954
270597
|
const match = pattern.match(globChars);
|
|
@@ -270000,7 +270643,7 @@ async function glob(filePattern, cwd2, { limit, offset }, abortSignal, toolPermi
|
|
|
270000
270643
|
args.push("--glob", exclusion);
|
|
270001
270644
|
}
|
|
270002
270645
|
const allPaths = await ripGrep(args, searchDir, abortSignal);
|
|
270003
|
-
const absolutePaths = allPaths.map((p) => isAbsolute21(p) ? p :
|
|
270646
|
+
const absolutePaths = allPaths.map((p) => isAbsolute21(p) ? p : join85(searchDir, p));
|
|
270004
270647
|
const truncated = absolutePaths.length > offset + limit;
|
|
270005
270648
|
const files = absolutePaths.slice(offset, offset + limit);
|
|
270006
270649
|
return { files, truncated };
|
|
@@ -272404,7 +273047,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
272404
273047
|
|
|
272405
273048
|
// utils/listSessionsImpl.ts
|
|
272406
273049
|
import { readdir as readdir14, stat as stat27 } from "fs/promises";
|
|
272407
|
-
import { basename as basename25, join as
|
|
273050
|
+
import { basename as basename25, join as join86 } from "path";
|
|
272408
273051
|
async function listCandidates(projectDir, doStat, projectPath) {
|
|
272409
273052
|
let names;
|
|
272410
273053
|
try {
|
|
@@ -272418,7 +273061,7 @@ async function listCandidates(projectDir, doStat, projectPath) {
|
|
|
272418
273061
|
const sessionId = validateUuid(name.slice(0, -6));
|
|
272419
273062
|
if (!sessionId)
|
|
272420
273063
|
return null;
|
|
272421
|
-
const filePath =
|
|
273064
|
+
const filePath = join86(projectDir, name);
|
|
272422
273065
|
if (!doStat)
|
|
272423
273066
|
return { sessionId, filePath, mtime: 0, projectPath };
|
|
272424
273067
|
try {
|
|
@@ -272437,9 +273080,9 @@ var init_listSessionsImpl = __esm(() => {
|
|
|
272437
273080
|
|
|
272438
273081
|
// services/autoDream/consolidationLock.ts
|
|
272439
273082
|
import { mkdir as mkdir23, readFile as readFile27, stat as stat28, unlink as unlink12, utimes, writeFile as writeFile23 } from "fs/promises";
|
|
272440
|
-
import { join as
|
|
273083
|
+
import { join as join87 } from "path";
|
|
272441
273084
|
function lockPath() {
|
|
272442
|
-
return
|
|
273085
|
+
return join87(getAutoMemPath(), LOCK_FILE);
|
|
272443
273086
|
}
|
|
272444
273087
|
async function readLastConsolidatedAt() {
|
|
272445
273088
|
try {
|
|
@@ -273164,466 +273807,6 @@ var init_BriefTool = __esm(() => {
|
|
|
273164
273807
|
});
|
|
273165
273808
|
});
|
|
273166
273809
|
|
|
273167
|
-
// services/providers/adapters/theus.ts
|
|
273168
|
-
function createTheusAdapter(options2 = {}) {
|
|
273169
|
-
const id = options2.id ?? "theus";
|
|
273170
|
-
const defaultModel = options2.model ?? "theus-sonnet";
|
|
273171
|
-
const callModel = options2.deps?.callModel;
|
|
273172
|
-
return {
|
|
273173
|
-
id,
|
|
273174
|
-
label: "Theus (Theus)",
|
|
273175
|
-
capabilities: CAPS,
|
|
273176
|
-
enabled: options2.enabled ?? true,
|
|
273177
|
-
priority: options2.priority ?? 100,
|
|
273178
|
-
async invoke(request) {
|
|
273179
|
-
const start = Date.now();
|
|
273180
|
-
const model = request.params?.model ?? defaultModel;
|
|
273181
|
-
if (!callModel) {
|
|
273182
|
-
return {
|
|
273183
|
-
providerId: id,
|
|
273184
|
-
capability: request.capability,
|
|
273185
|
-
text: `[theus:inert] would ask ${model}: ${request.prompt}`,
|
|
273186
|
-
meta: { model, inert: true, latencyMs: Date.now() - start }
|
|
273187
|
-
};
|
|
273188
|
-
}
|
|
273189
|
-
try {
|
|
273190
|
-
const { text, costUsd } = await callModel({
|
|
273191
|
-
prompt: request.prompt,
|
|
273192
|
-
model,
|
|
273193
|
-
signal: request.signal
|
|
273194
|
-
});
|
|
273195
|
-
return {
|
|
273196
|
-
providerId: id,
|
|
273197
|
-
capability: request.capability,
|
|
273198
|
-
text,
|
|
273199
|
-
meta: { model, costUsd, latencyMs: Date.now() - start }
|
|
273200
|
-
};
|
|
273201
|
-
} catch (err2) {
|
|
273202
|
-
return {
|
|
273203
|
-
providerId: id,
|
|
273204
|
-
capability: request.capability,
|
|
273205
|
-
text: `[theus:error] ${err2.message}`,
|
|
273206
|
-
meta: { model, latencyMs: Date.now() - start }
|
|
273207
|
-
};
|
|
273208
|
-
}
|
|
273209
|
-
}
|
|
273210
|
-
};
|
|
273211
|
-
}
|
|
273212
|
-
var CAPS;
|
|
273213
|
-
var init_theus = __esm(() => {
|
|
273214
|
-
CAPS = ["text", "embedding"];
|
|
273215
|
-
});
|
|
273216
|
-
|
|
273217
|
-
// services/providers/adapters/chart.ts
|
|
273218
|
-
function coerceData(data) {
|
|
273219
|
-
if (!Array.isArray(data))
|
|
273220
|
-
return [];
|
|
273221
|
-
return data.map((d) => {
|
|
273222
|
-
if (d && typeof d === "object" && "label" in d && "value" in d && typeof d.value === "number") {
|
|
273223
|
-
return { label: String(d.label), value: d.value };
|
|
273224
|
-
}
|
|
273225
|
-
return null;
|
|
273226
|
-
}).filter((d) => d !== null);
|
|
273227
|
-
}
|
|
273228
|
-
function asciiChart(rows) {
|
|
273229
|
-
if (rows.length === 0)
|
|
273230
|
-
return "(no data)";
|
|
273231
|
-
const max2 = Math.max(...rows.map((r) => r.value), 0);
|
|
273232
|
-
const min = Math.min(...rows.map((r) => r.value), 0);
|
|
273233
|
-
const span = max2 - min || 1;
|
|
273234
|
-
const spark = rows.map((r) => BARS[Math.min(BARS.length - 1, Math.round((r.value - min) / span * (BARS.length - 1)))]).join("");
|
|
273235
|
-
const lines = rows.map((r) => {
|
|
273236
|
-
const filled = Math.round(r.value / (max2 || 1) * 20);
|
|
273237
|
-
return ` ${r.label.padEnd(10).slice(0, 10)} \u2502${"\u2588".repeat(filled)} ${r.value}`;
|
|
273238
|
-
});
|
|
273239
|
-
return `${spark}
|
|
273240
|
-
${lines.join(`
|
|
273241
|
-
`)}`;
|
|
273242
|
-
}
|
|
273243
|
-
function createChartAdapter(options2 = {}) {
|
|
273244
|
-
const id = options2.id ?? "chart";
|
|
273245
|
-
return {
|
|
273246
|
-
id,
|
|
273247
|
-
label: "Chart renderer",
|
|
273248
|
-
capabilities: CAPS2,
|
|
273249
|
-
enabled: options2.enabled ?? true,
|
|
273250
|
-
priority: options2.priority ?? 20,
|
|
273251
|
-
async invoke(request) {
|
|
273252
|
-
const start = Date.now();
|
|
273253
|
-
const rows = coerceData(request.data);
|
|
273254
|
-
const mark = request.params?.mark ?? "bar";
|
|
273255
|
-
const spec = {
|
|
273256
|
-
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
|
|
273257
|
-
description: request.prompt,
|
|
273258
|
-
data: { values: rows },
|
|
273259
|
-
mark,
|
|
273260
|
-
encoding: {
|
|
273261
|
-
x: { field: "label", type: "nominal" },
|
|
273262
|
-
y: { field: "value", type: "quantitative" }
|
|
273263
|
-
}
|
|
273264
|
-
};
|
|
273265
|
-
const artifact = {
|
|
273266
|
-
kind: "chart",
|
|
273267
|
-
label: `${mark} chart (${rows.length} points)`,
|
|
273268
|
-
payload: spec
|
|
273269
|
-
};
|
|
273270
|
-
const preview = asciiChart(rows);
|
|
273271
|
-
return {
|
|
273272
|
-
providerId: id,
|
|
273273
|
-
capability: "chart",
|
|
273274
|
-
text: `Chart for "${request.prompt}" (${mark}, ${rows.length} points):
|
|
273275
|
-
${preview}`,
|
|
273276
|
-
artifacts: [artifact],
|
|
273277
|
-
meta: { latencyMs: Date.now() - start, points: rows.length }
|
|
273278
|
-
};
|
|
273279
|
-
}
|
|
273280
|
-
};
|
|
273281
|
-
}
|
|
273282
|
-
var CAPS2, BARS = "\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";
|
|
273283
|
-
var init_chart = __esm(() => {
|
|
273284
|
-
CAPS2 = ["chart"];
|
|
273285
|
-
});
|
|
273286
|
-
|
|
273287
|
-
// services/providers/adapters/openai.ts
|
|
273288
|
-
function createOpenAIAdapter(options2 = {}) {
|
|
273289
|
-
const id = options2.id ?? "openai";
|
|
273290
|
-
const model = options2.model ?? "gpt-4o";
|
|
273291
|
-
const complete = options2.deps?.complete;
|
|
273292
|
-
const hasKey = Boolean(options2.apiKeyEnv && process.env[options2.apiKeyEnv]);
|
|
273293
|
-
return {
|
|
273294
|
-
id,
|
|
273295
|
-
label: "OpenAI",
|
|
273296
|
-
capabilities: CAPS3,
|
|
273297
|
-
enabled: options2.enabled ?? true,
|
|
273298
|
-
priority: options2.priority ?? 50,
|
|
273299
|
-
async invoke(request) {
|
|
273300
|
-
const start = Date.now();
|
|
273301
|
-
if (!complete) {
|
|
273302
|
-
return {
|
|
273303
|
-
providerId: id,
|
|
273304
|
-
capability: request.capability,
|
|
273305
|
-
text: `[openai:inert] adapter stub (no client wired${hasKey ? ", key present" : ""}) \u2014 would run ${model} for: ${request.prompt}`,
|
|
273306
|
-
meta: { model, inert: true, latencyMs: Date.now() - start }
|
|
273307
|
-
};
|
|
273308
|
-
}
|
|
273309
|
-
const { text, costUsd } = await complete({
|
|
273310
|
-
prompt: request.prompt,
|
|
273311
|
-
model,
|
|
273312
|
-
signal: request.signal
|
|
273313
|
-
});
|
|
273314
|
-
return {
|
|
273315
|
-
providerId: id,
|
|
273316
|
-
capability: request.capability,
|
|
273317
|
-
text,
|
|
273318
|
-
meta: { model, costUsd, latencyMs: Date.now() - start }
|
|
273319
|
-
};
|
|
273320
|
-
}
|
|
273321
|
-
};
|
|
273322
|
-
}
|
|
273323
|
-
var CAPS3;
|
|
273324
|
-
var init_openai = __esm(() => {
|
|
273325
|
-
CAPS3 = ["text", "image", "embedding"];
|
|
273326
|
-
});
|
|
273327
|
-
|
|
273328
|
-
// services/providers/adapters/openaiCompatible.ts
|
|
273329
|
-
function trimBaseURL(baseURL) {
|
|
273330
|
-
return baseURL.replace(/\/+$/, "");
|
|
273331
|
-
}
|
|
273332
|
-
function extractText(payload) {
|
|
273333
|
-
if (!payload || typeof payload !== "object")
|
|
273334
|
-
return "";
|
|
273335
|
-
const choices = payload.choices;
|
|
273336
|
-
if (!Array.isArray(choices))
|
|
273337
|
-
return "";
|
|
273338
|
-
const first = choices[0];
|
|
273339
|
-
const content = first?.message?.content ?? first?.text;
|
|
273340
|
-
return typeof content === "string" ? content : JSON.stringify(content ?? "");
|
|
273341
|
-
}
|
|
273342
|
-
function createOpenAICompatibleAdapter(options2 = {}) {
|
|
273343
|
-
const id = options2.id ?? "openai-compatible";
|
|
273344
|
-
const baseURL = options2.baseURL;
|
|
273345
|
-
const model = options2.model ?? "gpt-4o";
|
|
273346
|
-
const apiKey = options2.apiKey ?? (options2.apiKeyEnv ? process.env[options2.apiKeyEnv] : undefined);
|
|
273347
|
-
return {
|
|
273348
|
-
id,
|
|
273349
|
-
label: options2.label ?? "OpenAI-compatible",
|
|
273350
|
-
capabilities: CAPS4,
|
|
273351
|
-
enabled: options2.enabled ?? Boolean(baseURL),
|
|
273352
|
-
priority: options2.priority ?? 80,
|
|
273353
|
-
async invoke(request) {
|
|
273354
|
-
const start = Date.now();
|
|
273355
|
-
if (!baseURL) {
|
|
273356
|
-
return {
|
|
273357
|
-
providerId: id,
|
|
273358
|
-
capability: request.capability,
|
|
273359
|
-
text: `[${id}:inert] missing baseURL`,
|
|
273360
|
-
meta: { model, inert: true, latencyMs: Date.now() - start }
|
|
273361
|
-
};
|
|
273362
|
-
}
|
|
273363
|
-
try {
|
|
273364
|
-
const response = await fetch(`${trimBaseURL(baseURL)}/chat/completions`, {
|
|
273365
|
-
method: "POST",
|
|
273366
|
-
headers: {
|
|
273367
|
-
"content-type": "application/json",
|
|
273368
|
-
...apiKey ? { authorization: `Bearer ${apiKey}` } : {}
|
|
273369
|
-
},
|
|
273370
|
-
body: JSON.stringify({
|
|
273371
|
-
model: request.params?.model ?? model,
|
|
273372
|
-
messages: [{ role: "user", content: request.prompt }],
|
|
273373
|
-
stream: false
|
|
273374
|
-
}),
|
|
273375
|
-
signal: request.signal
|
|
273376
|
-
});
|
|
273377
|
-
if (!response.ok) {
|
|
273378
|
-
const detail = await response.text().catch(() => "");
|
|
273379
|
-
throw new Error(`${response.status} ${response.statusText}${detail ? `: ${detail.slice(0, 240)}` : ""}`);
|
|
273380
|
-
}
|
|
273381
|
-
const payload = await response.json();
|
|
273382
|
-
const text = extractText(payload);
|
|
273383
|
-
return {
|
|
273384
|
-
providerId: id,
|
|
273385
|
-
capability: request.capability,
|
|
273386
|
-
text: text || `[${id}:empty] Provider returned no text.`,
|
|
273387
|
-
meta: { model, latencyMs: Date.now() - start }
|
|
273388
|
-
};
|
|
273389
|
-
} catch (err2) {
|
|
273390
|
-
return {
|
|
273391
|
-
providerId: id,
|
|
273392
|
-
capability: request.capability,
|
|
273393
|
-
text: `[${id}:error] ${err2.message}`,
|
|
273394
|
-
meta: { model, latencyMs: Date.now() - start }
|
|
273395
|
-
};
|
|
273396
|
-
}
|
|
273397
|
-
}
|
|
273398
|
-
};
|
|
273399
|
-
}
|
|
273400
|
-
var CAPS4;
|
|
273401
|
-
var init_openaiCompatible = __esm(() => {
|
|
273402
|
-
CAPS4 = ["text"];
|
|
273403
|
-
});
|
|
273404
|
-
|
|
273405
|
-
// services/providers/adapters/report.ts
|
|
273406
|
-
function coerceSections(data) {
|
|
273407
|
-
if (!Array.isArray(data))
|
|
273408
|
-
return [];
|
|
273409
|
-
return data.filter((s) => !!s && typeof s === "object" && ("heading" in s) && ("body" in s)).map((s) => ({ heading: String(s.heading), body: String(s.body) }));
|
|
273410
|
-
}
|
|
273411
|
-
function createReportAdapter(options2 = {}) {
|
|
273412
|
-
const id = options2.id ?? "report";
|
|
273413
|
-
return {
|
|
273414
|
-
id,
|
|
273415
|
-
label: "Report generator",
|
|
273416
|
-
capabilities: CAPS5,
|
|
273417
|
-
enabled: options2.enabled ?? true,
|
|
273418
|
-
priority: options2.priority ?? 20,
|
|
273419
|
-
async invoke(request) {
|
|
273420
|
-
const start = Date.now();
|
|
273421
|
-
const sections = coerceSections(request.data);
|
|
273422
|
-
const title = request.params?.title ?? request.prompt;
|
|
273423
|
-
const md = `# ${title}
|
|
273424
|
-
|
|
273425
|
-
` + (sections.length ? sections.map((s) => `## ${s.heading}
|
|
273426
|
-
|
|
273427
|
-
${s.body}`).join(`
|
|
273428
|
-
|
|
273429
|
-
`) : `_No structured sections supplied for: ${request.prompt}_`);
|
|
273430
|
-
const artifact = {
|
|
273431
|
-
kind: "report",
|
|
273432
|
-
label: `${title} (${sections.length} sections)`,
|
|
273433
|
-
payload: md
|
|
273434
|
-
};
|
|
273435
|
-
return {
|
|
273436
|
-
providerId: id,
|
|
273437
|
-
capability: "report",
|
|
273438
|
-
text: `Generated report "${title}" with ${sections.length} section(s).`,
|
|
273439
|
-
artifacts: [artifact],
|
|
273440
|
-
meta: { latencyMs: Date.now() - start, sections: sections.length }
|
|
273441
|
-
};
|
|
273442
|
-
}
|
|
273443
|
-
};
|
|
273444
|
-
}
|
|
273445
|
-
var CAPS5;
|
|
273446
|
-
var init_report = __esm(() => {
|
|
273447
|
-
CAPS5 = ["report"];
|
|
273448
|
-
});
|
|
273449
|
-
|
|
273450
|
-
// services/providers/adapters/video.ts
|
|
273451
|
-
function createVideoAdapter(options2 = {}) {
|
|
273452
|
-
const id = options2.id ?? "video";
|
|
273453
|
-
const vendor = options2.vendor ?? "runway";
|
|
273454
|
-
const generate = options2.deps?.generate;
|
|
273455
|
-
return {
|
|
273456
|
-
id,
|
|
273457
|
-
label: `Video (${vendor})`,
|
|
273458
|
-
capabilities: CAPS6,
|
|
273459
|
-
enabled: options2.enabled ?? true,
|
|
273460
|
-
priority: options2.priority ?? 10,
|
|
273461
|
-
async invoke(request) {
|
|
273462
|
-
const start = Date.now();
|
|
273463
|
-
const durationSec = request.params?.durationSec ?? 5;
|
|
273464
|
-
if (!generate) {
|
|
273465
|
-
const artifact = {
|
|
273466
|
-
kind: "video",
|
|
273467
|
-
label: `${durationSec}s clip (stub)`,
|
|
273468
|
-
ref: `stub://video/${vendor}/${encodeURIComponent(request.prompt.slice(0, 40))}`
|
|
273469
|
-
};
|
|
273470
|
-
return {
|
|
273471
|
-
providerId: id,
|
|
273472
|
-
capability: "video",
|
|
273473
|
-
text: `[video:inert] would render a ${durationSec}s ${vendor} clip of: ${request.prompt}`,
|
|
273474
|
-
artifacts: [artifact],
|
|
273475
|
-
meta: { model: vendor, inert: true, latencyMs: Date.now() - start }
|
|
273476
|
-
};
|
|
273477
|
-
}
|
|
273478
|
-
const { url: url3, costUsd } = await generate({
|
|
273479
|
-
prompt: request.prompt,
|
|
273480
|
-
durationSec,
|
|
273481
|
-
signal: request.signal
|
|
273482
|
-
});
|
|
273483
|
-
return {
|
|
273484
|
-
providerId: id,
|
|
273485
|
-
capability: "video",
|
|
273486
|
-
text: `Rendered a ${durationSec}s clip.`,
|
|
273487
|
-
artifacts: [{ kind: "video", label: `${durationSec}s clip`, ref: url3 }],
|
|
273488
|
-
meta: { model: vendor, costUsd, latencyMs: Date.now() - start }
|
|
273489
|
-
};
|
|
273490
|
-
}
|
|
273491
|
-
};
|
|
273492
|
-
}
|
|
273493
|
-
var CAPS6;
|
|
273494
|
-
var init_video = __esm(() => {
|
|
273495
|
-
CAPS6 = ["video"];
|
|
273496
|
-
});
|
|
273497
|
-
|
|
273498
|
-
// services/providers/adapters/index.ts
|
|
273499
|
-
var ADAPTER_FACTORIES;
|
|
273500
|
-
var init_adapters2 = __esm(() => {
|
|
273501
|
-
init_theus();
|
|
273502
|
-
init_chart();
|
|
273503
|
-
init_openai();
|
|
273504
|
-
init_openaiCompatible();
|
|
273505
|
-
init_report();
|
|
273506
|
-
init_video();
|
|
273507
|
-
ADAPTER_FACTORIES = {
|
|
273508
|
-
theus: createTheusAdapter,
|
|
273509
|
-
openai: createOpenAIAdapter,
|
|
273510
|
-
"openai-compatible": createOpenAICompatibleAdapter,
|
|
273511
|
-
video: createVideoAdapter,
|
|
273512
|
-
chart: createChartAdapter,
|
|
273513
|
-
report: createReportAdapter
|
|
273514
|
-
};
|
|
273515
|
-
});
|
|
273516
|
-
|
|
273517
|
-
// services/providers/registry.ts
|
|
273518
|
-
import { existsSync as existsSync5, readFileSync as readFileSync12 } from "fs";
|
|
273519
|
-
import { homedir as homedir25 } from "os";
|
|
273520
|
-
import { join as join87 } from "path";
|
|
273521
|
-
function defaultProvidersConfigPath() {
|
|
273522
|
-
const override = process.env[`${ENV_PREFIX}PROVIDERS_CONFIG`];
|
|
273523
|
-
if (override)
|
|
273524
|
-
return override;
|
|
273525
|
-
const home = homedir25();
|
|
273526
|
-
const primary = join87(home, CONFIG_DIR_NAME, "providers.json");
|
|
273527
|
-
if (existsSync5(primary))
|
|
273528
|
-
return primary;
|
|
273529
|
-
for (const legacyDir of LEGACY_CONFIG_DIR_NAMES) {
|
|
273530
|
-
const legacy = join87(home, legacyDir, "providers.json");
|
|
273531
|
-
if (existsSync5(legacy))
|
|
273532
|
-
return legacy;
|
|
273533
|
-
}
|
|
273534
|
-
return primary;
|
|
273535
|
-
}
|
|
273536
|
-
|
|
273537
|
-
class ProviderRegistry {
|
|
273538
|
-
byId = new Map;
|
|
273539
|
-
policy = {};
|
|
273540
|
-
register(adapter2) {
|
|
273541
|
-
this.byId.set(adapter2.id, adapter2);
|
|
273542
|
-
return this;
|
|
273543
|
-
}
|
|
273544
|
-
unregister(id) {
|
|
273545
|
-
return this.byId.delete(id);
|
|
273546
|
-
}
|
|
273547
|
-
get(id) {
|
|
273548
|
-
return this.byId.get(id);
|
|
273549
|
-
}
|
|
273550
|
-
all() {
|
|
273551
|
-
return [...this.byId.values()];
|
|
273552
|
-
}
|
|
273553
|
-
forCapability(capability) {
|
|
273554
|
-
const policyOrder = this.policy?.[capability];
|
|
273555
|
-
const matches = this.all().filter((a2) => a2.enabled !== false && a2.capabilities.includes(capability));
|
|
273556
|
-
return matches.sort((a2, b) => {
|
|
273557
|
-
if (policyOrder) {
|
|
273558
|
-
const ai = policyOrder.indexOf(a2.id);
|
|
273559
|
-
const bi = policyOrder.indexOf(b.id);
|
|
273560
|
-
if (ai !== -1 || bi !== -1) {
|
|
273561
|
-
if (ai === -1)
|
|
273562
|
-
return 1;
|
|
273563
|
-
if (bi === -1)
|
|
273564
|
-
return -1;
|
|
273565
|
-
if (ai !== bi)
|
|
273566
|
-
return ai - bi;
|
|
273567
|
-
}
|
|
273568
|
-
}
|
|
273569
|
-
return (b.priority ?? 0) - (a2.priority ?? 0);
|
|
273570
|
-
});
|
|
273571
|
-
}
|
|
273572
|
-
supportedCapabilities() {
|
|
273573
|
-
const set3 = new Set;
|
|
273574
|
-
for (const a2 of this.all()) {
|
|
273575
|
-
if (a2.enabled === false)
|
|
273576
|
-
continue;
|
|
273577
|
-
for (const c5 of a2.capabilities)
|
|
273578
|
-
set3.add(c5);
|
|
273579
|
-
}
|
|
273580
|
-
return [...set3];
|
|
273581
|
-
}
|
|
273582
|
-
setPolicy(policy) {
|
|
273583
|
-
this.policy = policy ?? {};
|
|
273584
|
-
return this;
|
|
273585
|
-
}
|
|
273586
|
-
getPolicy() {
|
|
273587
|
-
return this.policy;
|
|
273588
|
-
}
|
|
273589
|
-
instantiate(entry) {
|
|
273590
|
-
const factory2 = ADAPTER_FACTORIES[entry.adapter];
|
|
273591
|
-
if (!factory2)
|
|
273592
|
-
return;
|
|
273593
|
-
return factory2({
|
|
273594
|
-
id: entry.id,
|
|
273595
|
-
enabled: entry.enabled,
|
|
273596
|
-
priority: entry.priority,
|
|
273597
|
-
...entry.options ?? {}
|
|
273598
|
-
});
|
|
273599
|
-
}
|
|
273600
|
-
loadConfig(config2) {
|
|
273601
|
-
for (const entry of config2.providers ?? []) {
|
|
273602
|
-
const adapter2 = this.instantiate(entry);
|
|
273603
|
-
if (adapter2)
|
|
273604
|
-
this.register(adapter2);
|
|
273605
|
-
}
|
|
273606
|
-
if (config2.policy)
|
|
273607
|
-
this.setPolicy(config2.policy);
|
|
273608
|
-
return this;
|
|
273609
|
-
}
|
|
273610
|
-
loadFromFile(path13 = defaultProvidersConfigPath()) {
|
|
273611
|
-
try {
|
|
273612
|
-
if (!existsSync5(path13))
|
|
273613
|
-
return this;
|
|
273614
|
-
const raw = readFileSync12(path13, "utf8");
|
|
273615
|
-
const config2 = JSON.parse(raw);
|
|
273616
|
-
return this.loadConfig(config2);
|
|
273617
|
-
} catch {
|
|
273618
|
-
return this;
|
|
273619
|
-
}
|
|
273620
|
-
}
|
|
273621
|
-
}
|
|
273622
|
-
var init_registry2 = __esm(() => {
|
|
273623
|
-
init_branding();
|
|
273624
|
-
init_adapters2();
|
|
273625
|
-
});
|
|
273626
|
-
|
|
273627
273810
|
// services/providers/defaults.ts
|
|
273628
273811
|
function createDefaultRegistry(configPath) {
|
|
273629
273812
|
const registry2 = new ProviderRegistry().register(createOpenAICompatibleAdapter({ enabled: false })).register(createTheusAdapter({ enabled: false })).register(createOpenAIAdapter({ enabled: false, apiKeyEnv: "OPENAI_API_KEY" })).register(createVideoAdapter()).register(createChartAdapter()).register(createReportAdapter());
|
|
@@ -275154,7 +275337,7 @@ var init_directSearch = __esm(() => {
|
|
|
275154
275337
|
});
|
|
275155
275338
|
|
|
275156
275339
|
// tools/WebSearchTool/providerSupport.ts
|
|
275157
|
-
import { existsSync as existsSync6, readFileSync as
|
|
275340
|
+
import { existsSync as existsSync6, readFileSync as readFileSync14 } from "fs";
|
|
275158
275341
|
function env4(name) {
|
|
275159
275342
|
const value = process.env[name];
|
|
275160
275343
|
return value && value.trim() ? value.trim() : undefined;
|
|
@@ -275164,7 +275347,7 @@ function loadProvidersConfig() {
|
|
|
275164
275347
|
if (!existsSync6(path13))
|
|
275165
275348
|
return null;
|
|
275166
275349
|
try {
|
|
275167
|
-
return JSON.parse(
|
|
275350
|
+
return JSON.parse(readFileSync14(path13, "utf8"));
|
|
275168
275351
|
} catch {
|
|
275169
275352
|
return null;
|
|
275170
275353
|
}
|
|
@@ -280702,7 +280885,7 @@ var init_UI25 = __esm(() => {
|
|
|
280702
280885
|
import {
|
|
280703
280886
|
existsSync as existsSync7,
|
|
280704
280887
|
mkdirSync as mkdirSync6,
|
|
280705
|
-
readFileSync as
|
|
280888
|
+
readFileSync as readFileSync15,
|
|
280706
280889
|
rmSync as rmSync3,
|
|
280707
280890
|
writeFileSync as writeFileSync4
|
|
280708
280891
|
} from "fs";
|
|
@@ -280751,7 +280934,7 @@ function acquireLock2(home) {
|
|
|
280751
280934
|
function readProjects(home = homedir26()) {
|
|
280752
280935
|
let raw;
|
|
280753
280936
|
try {
|
|
280754
|
-
raw =
|
|
280937
|
+
raw = readFileSync15(projectsPath(home), "utf8");
|
|
280755
280938
|
} catch {
|
|
280756
280939
|
return { projects: [] };
|
|
280757
280940
|
}
|
|
@@ -292772,107 +292955,6 @@ var init_tokenBudget2 = __esm(() => {
|
|
|
292772
292955
|
init_tokenBudget();
|
|
292773
292956
|
});
|
|
292774
292957
|
|
|
292775
|
-
// services/router/secretStore.ts
|
|
292776
|
-
import { spawnSync as spawnSync3 } from "child_process";
|
|
292777
|
-
function detectBackend() {
|
|
292778
|
-
if (_cachedBackend !== undefined)
|
|
292779
|
-
return _cachedBackend;
|
|
292780
|
-
_cachedBackend = computeBackend();
|
|
292781
|
-
return _cachedBackend;
|
|
292782
|
-
}
|
|
292783
|
-
function binExists(bin, probeArgs) {
|
|
292784
|
-
try {
|
|
292785
|
-
const r = spawnSync3(bin, probeArgs, { stdio: "ignore", timeout: 4000 });
|
|
292786
|
-
return !r.error;
|
|
292787
|
-
} catch {
|
|
292788
|
-
return false;
|
|
292789
|
-
}
|
|
292790
|
-
}
|
|
292791
|
-
function computeBackend() {
|
|
292792
|
-
if (process.env.THEUS_DISABLE_KEYCHAIN === "1")
|
|
292793
|
-
return null;
|
|
292794
|
-
if (process.platform === "darwin") {
|
|
292795
|
-
return binExists("security", ["help"]) ? "macos" : null;
|
|
292796
|
-
}
|
|
292797
|
-
if (process.platform === "linux") {
|
|
292798
|
-
return binExists("secret-tool", ["--version"]) ? "linux" : null;
|
|
292799
|
-
}
|
|
292800
|
-
return null;
|
|
292801
|
-
}
|
|
292802
|
-
function buildRef(account) {
|
|
292803
|
-
return `${REF_PREFIX}${KEYCHAIN_SERVICE}:${account}`;
|
|
292804
|
-
}
|
|
292805
|
-
function parseRef(ref) {
|
|
292806
|
-
if (!ref.startsWith(REF_PREFIX))
|
|
292807
|
-
return null;
|
|
292808
|
-
const rest = ref.slice(REF_PREFIX.length);
|
|
292809
|
-
const sep22 = rest.indexOf(":");
|
|
292810
|
-
if (sep22 <= 0)
|
|
292811
|
-
return null;
|
|
292812
|
-
return { service: rest.slice(0, sep22), account: rest.slice(sep22 + 1) };
|
|
292813
|
-
}
|
|
292814
|
-
function isKeychainRef(value) {
|
|
292815
|
-
return typeof value === "string" && value.startsWith(REF_PREFIX);
|
|
292816
|
-
}
|
|
292817
|
-
function macosStore(service, account, secret) {
|
|
292818
|
-
const r = spawnSync3("security", [
|
|
292819
|
-
"add-generic-password",
|
|
292820
|
-
"-U",
|
|
292821
|
-
"-a",
|
|
292822
|
-
account,
|
|
292823
|
-
"-s",
|
|
292824
|
-
service,
|
|
292825
|
-
"-w",
|
|
292826
|
-
secret
|
|
292827
|
-
], { stdio: "ignore", timeout: 8000 });
|
|
292828
|
-
return !r.error && r.status === 0;
|
|
292829
|
-
}
|
|
292830
|
-
function macosLookup(service, account) {
|
|
292831
|
-
const r = spawnSync3("security", ["find-generic-password", "-a", account, "-s", service, "-w"], { encoding: "utf8", timeout: 8000 });
|
|
292832
|
-
if (r.error || r.status !== 0)
|
|
292833
|
-
return;
|
|
292834
|
-
const out = (r.stdout ?? "").replace(/\n$/, "");
|
|
292835
|
-
return out || undefined;
|
|
292836
|
-
}
|
|
292837
|
-
function linuxStore(service, account, secret) {
|
|
292838
|
-
const r = spawnSync3("secret-tool", ["store", "--label=Theus provider key", "service", service, "account", account], { input: secret, stdio: ["pipe", "ignore", "ignore"], timeout: 8000 });
|
|
292839
|
-
return !r.error && r.status === 0;
|
|
292840
|
-
}
|
|
292841
|
-
function linuxLookup(service, account) {
|
|
292842
|
-
const r = spawnSync3("secret-tool", ["lookup", "service", service, "account", account], { encoding: "utf8", timeout: 8000 });
|
|
292843
|
-
if (r.error || r.status !== 0)
|
|
292844
|
-
return;
|
|
292845
|
-
const out = (r.stdout ?? "").replace(/\n$/, "");
|
|
292846
|
-
return out || undefined;
|
|
292847
|
-
}
|
|
292848
|
-
function storeApiKey(providerId, apiKey) {
|
|
292849
|
-
const trimmed = apiKey.trim();
|
|
292850
|
-
const backend = detectBackend();
|
|
292851
|
-
if (backend) {
|
|
292852
|
-
try {
|
|
292853
|
-
const ok = backend === "macos" ? macosStore(KEYCHAIN_SERVICE, providerId, trimmed) : linuxStore(KEYCHAIN_SERVICE, providerId, trimmed);
|
|
292854
|
-
if (ok)
|
|
292855
|
-
return { apiKeyRef: buildRef(providerId), storage: "keychain" };
|
|
292856
|
-
} catch {}
|
|
292857
|
-
}
|
|
292858
|
-
return { apiKey: trimmed, storage: "file" };
|
|
292859
|
-
}
|
|
292860
|
-
function resolveApiKeyRef(ref) {
|
|
292861
|
-
const parsed = parseRef(ref);
|
|
292862
|
-
if (!parsed)
|
|
292863
|
-
return;
|
|
292864
|
-
const backend = detectBackend();
|
|
292865
|
-
if (!backend)
|
|
292866
|
-
return;
|
|
292867
|
-
try {
|
|
292868
|
-
return backend === "macos" ? macosLookup(parsed.service, parsed.account) : linuxLookup(parsed.service, parsed.account);
|
|
292869
|
-
} catch {
|
|
292870
|
-
return;
|
|
292871
|
-
}
|
|
292872
|
-
}
|
|
292873
|
-
var KEYCHAIN_SERVICE = "theus-provider", REF_PREFIX = "keychain:", _cachedBackend;
|
|
292874
|
-
var init_secretStore = () => {};
|
|
292875
|
-
|
|
292876
292958
|
// services/router/knownModels.ts
|
|
292877
292959
|
function knownModelsFor(family) {
|
|
292878
292960
|
return (KNOWN_MODELS[family] ?? []).map((card) => ({
|
|
@@ -293092,7 +293174,7 @@ var init_knownModels = __esm(() => {
|
|
|
293092
293174
|
});
|
|
293093
293175
|
|
|
293094
293176
|
// services/router/registry.ts
|
|
293095
|
-
import { existsSync as existsSync8, readFileSync as
|
|
293177
|
+
import { existsSync as existsSync8, readFileSync as readFileSync16 } from "fs";
|
|
293096
293178
|
function readEntryOptions(entry) {
|
|
293097
293179
|
return entry.options ?? {};
|
|
293098
293180
|
}
|
|
@@ -293188,7 +293270,7 @@ function loadConfig(path14) {
|
|
|
293188
293270
|
try {
|
|
293189
293271
|
if (!existsSync8(path14))
|
|
293190
293272
|
return { providers: [] };
|
|
293191
|
-
return JSON.parse(
|
|
293273
|
+
return JSON.parse(readFileSync16(path14, "utf8"));
|
|
293192
293274
|
} catch {
|
|
293193
293275
|
return { providers: [] };
|
|
293194
293276
|
}
|
|
@@ -293255,7 +293337,7 @@ var init_registry3 = __esm(() => {
|
|
|
293255
293337
|
});
|
|
293256
293338
|
|
|
293257
293339
|
// services/router/userRules.ts
|
|
293258
|
-
import { existsSync as existsSync9, readFileSync as
|
|
293340
|
+
import { existsSync as existsSync9, readFileSync as readFileSync17 } from "fs";
|
|
293259
293341
|
function defaultUserRoutingRules() {
|
|
293260
293342
|
return { optimizeFor: "balanced", pin: [], deny: [] };
|
|
293261
293343
|
}
|
|
@@ -293318,7 +293400,7 @@ function loadUserRoutingRules(configPath = defaultProvidersConfigPath()) {
|
|
|
293318
293400
|
try {
|
|
293319
293401
|
if (!existsSync9(configPath))
|
|
293320
293402
|
return defaultUserRoutingRules();
|
|
293321
|
-
const parsed = JSON.parse(
|
|
293403
|
+
const parsed = JSON.parse(readFileSync17(configPath, "utf8"));
|
|
293322
293404
|
return parseUserRoutingRules(parsed);
|
|
293323
293405
|
} catch {
|
|
293324
293406
|
return defaultUserRoutingRules();
|
|
@@ -293977,9 +294059,9 @@ import {
|
|
|
293977
294059
|
appendFileSync as appendFileSync4,
|
|
293978
294060
|
existsSync as existsSync10,
|
|
293979
294061
|
mkdirSync as mkdirSync7,
|
|
293980
|
-
readFileSync as
|
|
294062
|
+
readFileSync as readFileSync18,
|
|
293981
294063
|
renameSync as renameSync2,
|
|
293982
|
-
statSync as
|
|
294064
|
+
statSync as statSync8
|
|
293983
294065
|
} from "fs";
|
|
293984
294066
|
import { dirname as dirname37, join as join92 } from "path";
|
|
293985
294067
|
function defaultTelemetryPath() {
|
|
@@ -293997,7 +294079,7 @@ function rotateIfNeeded(filePath, maxBytes) {
|
|
|
293997
294079
|
try {
|
|
293998
294080
|
if (!existsSync10(filePath))
|
|
293999
294081
|
return;
|
|
294000
|
-
if (
|
|
294082
|
+
if (statSync8(filePath).size < maxBytes)
|
|
294001
294083
|
return;
|
|
294002
294084
|
renameSync2(filePath, `${filePath}.1`);
|
|
294003
294085
|
} catch {}
|
|
@@ -295154,9 +295236,9 @@ function getTheusEnvMetadata() {
|
|
|
295154
295236
|
};
|
|
295155
295237
|
}
|
|
295156
295238
|
function getBuildAgeMinutes() {
|
|
295157
|
-
if (!{ VERSION: "0.1.
|
|
295239
|
+
if (!{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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)
|
|
295158
295240
|
return;
|
|
295159
|
-
const buildTime = new Date({ VERSION: "0.1.
|
|
295241
|
+
const buildTime = new Date({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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();
|
|
295160
295242
|
if (isNaN(buildTime))
|
|
295161
295243
|
return;
|
|
295162
295244
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -311386,7 +311468,7 @@ function getAssistantMessageFromError(error40, model, options2) {
|
|
|
311386
311468
|
if (process.env.USER_TYPE === "ant") {
|
|
311387
311469
|
const baseMessage = `API Error: 400 ${error40.message}
|
|
311388
311470
|
|
|
311389
|
-
Run /share and post the JSON file to ${{ VERSION: "0.1.
|
|
311471
|
+
Run /share and post the JSON file to ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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}.`;
|
|
311390
311472
|
const rewindInstruction = getIsNonInteractiveSession() ? "" : " Then, use /rewind to recover the conversation.";
|
|
311391
311473
|
return createAssistantAPIErrorMessage({
|
|
311392
311474
|
content: baseMessage + rewindInstruction,
|
|
@@ -311422,7 +311504,7 @@ Run /share and post the JSON file to ${{ VERSION: "0.1.10", BUILD_TIME: "1970-01
|
|
|
311422
311504
|
if (process.env.USER_TYPE === "ant" && !process.env.THEUS_MODEL && error40 instanceof Error && error40.message.toLowerCase().includes("invalid model name")) {
|
|
311423
311505
|
const orgId = getOauthAccountInfo()?.organizationUuid;
|
|
311424
311506
|
const baseMsg = `[THEUS-INTERNAL] Your org isn't gated into the \`${model}\` model. Either run \`theus\` with \`THEUS_MODEL=${getDefaultMainLoopModelSetting()}\``;
|
|
311425
|
-
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.
|
|
311507
|
+
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.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.`;
|
|
311426
311508
|
return createAssistantAPIErrorMessage({
|
|
311427
311509
|
content: msg,
|
|
311428
311510
|
error: "invalid_request"
|
|
@@ -318812,7 +318894,7 @@ var init_issue = __esm(() => {
|
|
|
318812
318894
|
});
|
|
318813
318895
|
|
|
318814
318896
|
// hooks/fileSuggestions.ts
|
|
318815
|
-
import { statSync as
|
|
318897
|
+
import { statSync as statSync9 } from "fs";
|
|
318816
318898
|
import * as path15 from "path";
|
|
318817
318899
|
function getFileIndex() {
|
|
318818
318900
|
if (!fileIndex) {
|
|
@@ -318860,7 +318942,7 @@ function getGitIndexMtime() {
|
|
|
318860
318942
|
if (!repoRoot)
|
|
318861
318943
|
return null;
|
|
318862
318944
|
try {
|
|
318863
|
-
return
|
|
318945
|
+
return statSync9(path15.join(repoRoot, ".git", "index")).mtimeMs;
|
|
318864
318946
|
} catch {
|
|
318865
318947
|
return null;
|
|
318866
318948
|
}
|
|
@@ -321500,7 +321582,7 @@ function buildPrimarySection() {
|
|
|
321500
321582
|
});
|
|
321501
321583
|
return [{
|
|
321502
321584
|
label: "Version",
|
|
321503
|
-
value: { VERSION: "0.1.
|
|
321585
|
+
value: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
321504
321586
|
}, {
|
|
321505
321587
|
label: "Session name",
|
|
321506
321588
|
value: nameValue
|
|
@@ -325251,7 +325333,7 @@ function Config({
|
|
|
325251
325333
|
}
|
|
325252
325334
|
})
|
|
325253
325335
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime180.jsx(ChannelDowngradeDialog, {
|
|
325254
|
-
currentVersion: { VERSION: "0.1.
|
|
325336
|
+
currentVersion: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
325255
325337
|
onChoice: (choice) => {
|
|
325256
325338
|
setShowSubmenu(null);
|
|
325257
325339
|
setTabsHidden(false);
|
|
@@ -325263,7 +325345,7 @@ function Config({
|
|
|
325263
325345
|
autoUpdatesChannel: "stable"
|
|
325264
325346
|
};
|
|
325265
325347
|
if (choice === "stay") {
|
|
325266
|
-
newSettings.minimumVersion = { VERSION: "0.1.
|
|
325348
|
+
newSettings.minimumVersion = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
325267
325349
|
}
|
|
325268
325350
|
updateSettingsForSource("userSettings", newSettings);
|
|
325269
325351
|
setSettingsData((prev_27) => ({
|
|
@@ -333297,7 +333379,7 @@ function HelpV2(t0) {
|
|
|
333297
333379
|
let t6;
|
|
333298
333380
|
if ($2[31] !== tabs) {
|
|
333299
333381
|
t6 = /* @__PURE__ */ jsx_runtime207.jsx(Tabs, {
|
|
333300
|
-
title: `Theus v${{ VERSION: "0.1.
|
|
333382
|
+
title: `Theus v${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
|
|
333301
333383
|
color: "professionalBlue",
|
|
333302
333384
|
defaultTab: "general",
|
|
333303
333385
|
children: tabs
|
|
@@ -334743,7 +334825,7 @@ import {
|
|
|
334743
334825
|
chmodSync as chmodSync3,
|
|
334744
334826
|
existsSync as existsSync11,
|
|
334745
334827
|
mkdirSync as mkdirSync8,
|
|
334746
|
-
readFileSync as
|
|
334828
|
+
readFileSync as readFileSync19,
|
|
334747
334829
|
writeFileSync as writeFileSync5
|
|
334748
334830
|
} from "fs";
|
|
334749
334831
|
import { homedir as homedir31 } from "os";
|
|
@@ -334788,7 +334870,7 @@ function loadProvidersConfig2() {
|
|
|
334788
334870
|
try {
|
|
334789
334871
|
if (!existsSync11(path17))
|
|
334790
334872
|
return baseConfig();
|
|
334791
|
-
const parsed = JSON.parse(
|
|
334873
|
+
const parsed = JSON.parse(readFileSync19(path17, "utf8"));
|
|
334792
334874
|
if (!parsed || !Array.isArray(parsed.providers))
|
|
334793
334875
|
return baseConfig();
|
|
334794
334876
|
return parsed;
|
|
@@ -350728,9 +350810,9 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
350728
350810
|
return [];
|
|
350729
350811
|
}
|
|
350730
350812
|
}
|
|
350731
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.
|
|
350813
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
350732
350814
|
if (process.env.USER_TYPE === "ant") {
|
|
350733
|
-
const changelog = { VERSION: "0.1.
|
|
350815
|
+
const changelog = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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;
|
|
350734
350816
|
if (changelog) {
|
|
350735
350817
|
const commits = changelog.trim().split(`
|
|
350736
350818
|
`).filter(Boolean);
|
|
@@ -354924,7 +355006,7 @@ var init_Messages = __esm(() => {
|
|
|
354924
355006
|
let t1;
|
|
354925
355007
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
354926
355008
|
t1 = /* @__PURE__ */ jsx_runtime245.jsx(TheusBanner, {
|
|
354927
|
-
version: { VERSION: "0.1.
|
|
355009
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
354928
355010
|
});
|
|
354929
355011
|
$2[0] = t1;
|
|
354930
355012
|
} else {
|
|
@@ -382464,7 +382546,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
382464
382546
|
smapsRollup,
|
|
382465
382547
|
platform: process.platform,
|
|
382466
382548
|
nodeVersion: process.version,
|
|
382467
|
-
ccVersion: { VERSION: "0.1.
|
|
382549
|
+
ccVersion: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
382468
382550
|
};
|
|
382469
382551
|
}
|
|
382470
382552
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -383050,7 +383132,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
383050
383132
|
var call54 = async () => {
|
|
383051
383133
|
return {
|
|
383052
383134
|
type: "text",
|
|
383053
|
-
value: { VERSION: "0.1.
|
|
383135
|
+
value: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
383054
383136
|
};
|
|
383055
383137
|
}, version2, version_default;
|
|
383056
383138
|
var init_version = __esm(() => {
|
|
@@ -385220,13 +385302,13 @@ var init_export2 = __esm(() => {
|
|
|
385220
385302
|
});
|
|
385221
385303
|
|
|
385222
385304
|
// services/providers/sessionCatalog.ts
|
|
385223
|
-
import { existsSync as existsSync12, readFileSync as
|
|
385305
|
+
import { existsSync as existsSync12, readFileSync as readFileSync20 } from "fs";
|
|
385224
385306
|
function loadConfig2() {
|
|
385225
385307
|
const path19 = defaultProvidersConfigPath();
|
|
385226
385308
|
if (!existsSync12(path19))
|
|
385227
385309
|
return null;
|
|
385228
385310
|
try {
|
|
385229
|
-
const parsed = JSON.parse(
|
|
385311
|
+
const parsed = JSON.parse(readFileSync20(path19, "utf8"));
|
|
385230
385312
|
if (!parsed || !Array.isArray(parsed.providers))
|
|
385231
385313
|
return null;
|
|
385232
385314
|
return parsed;
|
|
@@ -386785,7 +386867,7 @@ __export(exports_update, {
|
|
|
386785
386867
|
});
|
|
386786
386868
|
async function update() {
|
|
386787
386869
|
logEvent("tengu_update_check", {});
|
|
386788
|
-
writeToStdout(`Current version: ${{ VERSION: "0.1.
|
|
386870
|
+
writeToStdout(`Current version: ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
386789
386871
|
`);
|
|
386790
386872
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
386791
386873
|
writeToStdout(`Checking for updates to ${channel2} version...
|
|
@@ -386860,8 +386942,8 @@ async function update() {
|
|
|
386860
386942
|
writeToStdout(`Theus is managed by Homebrew.
|
|
386861
386943
|
`);
|
|
386862
386944
|
const latest = await getLatestVersion(channel2);
|
|
386863
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
386864
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
386945
|
+
if (latest && !gte({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
386946
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
386865
386947
|
`);
|
|
386866
386948
|
writeToStdout(`
|
|
386867
386949
|
`);
|
|
@@ -386877,8 +386959,8 @@ async function update() {
|
|
|
386877
386959
|
writeToStdout(`Theus is managed by winget.
|
|
386878
386960
|
`);
|
|
386879
386961
|
const latest = await getLatestVersion(channel2);
|
|
386880
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
386881
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
386962
|
+
if (latest && !gte({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
386963
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
386882
386964
|
`);
|
|
386883
386965
|
writeToStdout(`
|
|
386884
386966
|
`);
|
|
@@ -386894,8 +386976,8 @@ async function update() {
|
|
|
386894
386976
|
writeToStdout(`Theus is managed by apk.
|
|
386895
386977
|
`);
|
|
386896
386978
|
const latest = await getLatestVersion(channel2);
|
|
386897
|
-
if (latest && !gte({ VERSION: "0.1.
|
|
386898
|
-
writeToStdout(`Update available: ${{ VERSION: "0.1.
|
|
386979
|
+
if (latest && !gte({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
386980
|
+
writeToStdout(`Update available: ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
386899
386981
|
`);
|
|
386900
386982
|
writeToStdout(`
|
|
386901
386983
|
`);
|
|
@@ -386960,11 +387042,11 @@ async function update() {
|
|
|
386960
387042
|
`);
|
|
386961
387043
|
await gracefulShutdown(1);
|
|
386962
387044
|
}
|
|
386963
|
-
if (result.latestVersion === { VERSION: "0.1.
|
|
386964
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
387045
|
+
if (result.latestVersion === { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
387046
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
386965
387047
|
`);
|
|
386966
387048
|
} else {
|
|
386967
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
387049
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
386968
387050
|
`);
|
|
386969
387051
|
await regenerateCompletionCache();
|
|
386970
387052
|
}
|
|
@@ -386983,9 +387065,9 @@ async function update() {
|
|
|
386983
387065
|
await removeInstalledSymlink();
|
|
386984
387066
|
}
|
|
386985
387067
|
logForDebugging("update: Checking npm registry for latest version");
|
|
386986
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.
|
|
387068
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
386987
387069
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
386988
|
-
const npmCommand = `npm view ${{ VERSION: "0.1.
|
|
387070
|
+
const npmCommand = `npm view ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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`;
|
|
386989
387071
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
386990
387072
|
const latestVersion = await getLatestVersion(channel2);
|
|
386991
387073
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -387005,7 +387087,7 @@ async function update() {
|
|
|
387005
387087
|
`);
|
|
387006
387088
|
process.stderr.write(` \u2022 Corporate proxy/firewall blocking npm
|
|
387007
387089
|
`);
|
|
387008
|
-
if ({ VERSION: "0.1.
|
|
387090
|
+
if ({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.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")) {
|
|
387009
387091
|
process.stderr.write(` \u2022 Internal/development build not published to npm
|
|
387010
387092
|
`);
|
|
387011
387093
|
}
|
|
@@ -387017,19 +387099,19 @@ async function update() {
|
|
|
387017
387099
|
`);
|
|
387018
387100
|
process.stderr.write(` \u2022 Run with --debug flag for more details
|
|
387019
387101
|
`);
|
|
387020
|
-
const packageName = { VERSION: "0.1.
|
|
387102
|
+
const packageName = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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");
|
|
387021
387103
|
process.stderr.write(` \u2022 Manually check: npm view ${packageName} version
|
|
387022
387104
|
`);
|
|
387023
387105
|
process.stderr.write(` \u2022 Check if you need to login: npm whoami
|
|
387024
387106
|
`);
|
|
387025
387107
|
await gracefulShutdown(1);
|
|
387026
387108
|
}
|
|
387027
|
-
if (gte({ VERSION: "0.1.
|
|
387028
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.
|
|
387109
|
+
if (gte({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
387110
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
387029
387111
|
`);
|
|
387030
387112
|
await gracefulShutdown(0);
|
|
387031
387113
|
}
|
|
387032
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.
|
|
387114
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
387033
387115
|
`);
|
|
387034
387116
|
writeToStdout(`Installing update...
|
|
387035
387117
|
`);
|
|
@@ -387074,7 +387156,7 @@ async function update() {
|
|
|
387074
387156
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
387075
387157
|
switch (status2) {
|
|
387076
387158
|
case "success":
|
|
387077
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.
|
|
387159
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
387078
387160
|
`);
|
|
387079
387161
|
await regenerateCompletionCache();
|
|
387080
387162
|
break;
|
|
@@ -387084,7 +387166,7 @@ async function update() {
|
|
|
387084
387166
|
if (useLocalUpdate) {
|
|
387085
387167
|
process.stderr.write(`Try manually updating with:
|
|
387086
387168
|
`);
|
|
387087
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
387169
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387088
387170
|
`);
|
|
387089
387171
|
} else {
|
|
387090
387172
|
process.stderr.write(`Try running with sudo or fix npm permissions
|
|
@@ -387100,7 +387182,7 @@ async function update() {
|
|
|
387100
387182
|
if (useLocalUpdate) {
|
|
387101
387183
|
process.stderr.write(`Try manually updating with:
|
|
387102
387184
|
`);
|
|
387103
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
387185
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
387104
387186
|
`);
|
|
387105
387187
|
} else {
|
|
387106
387188
|
process.stderr.write(`Or consider using native installation with: theus install
|
|
@@ -393995,7 +394077,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
393995
394077
|
init_settings2();
|
|
393996
394078
|
init_slowOperations();
|
|
393997
394079
|
init_uuid();
|
|
393998
|
-
VERSION4 = { VERSION: "0.1.
|
|
394080
|
+
VERSION4 = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
393999
394081
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
394000
394082
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
394001
394083
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -395200,7 +395282,7 @@ var init_filesystem = __esm(() => {
|
|
|
395200
395282
|
});
|
|
395201
395283
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
395202
395284
|
const nonce = randomBytes20(16).toString("hex");
|
|
395203
|
-
return join140(getTheusTempDir(), "bundled-skills", { VERSION: "0.1.
|
|
395285
|
+
return join140(getTheusTempDir(), "bundled-skills", { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
395204
395286
|
});
|
|
395205
395287
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
395206
395288
|
});
|
|
@@ -400375,7 +400457,7 @@ function getSimpleDoingTasksSection() {
|
|
|
400375
400457
|
];
|
|
400376
400458
|
const userHelpSubitems = [
|
|
400377
400459
|
`/help: Get help with using Theus`,
|
|
400378
|
-
`To give feedback, users should ${{ VERSION: "0.1.
|
|
400460
|
+
`To give feedback, users should ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
400379
400461
|
];
|
|
400380
400462
|
const items = [
|
|
400381
400463
|
`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.`,
|
|
@@ -401198,7 +401280,7 @@ function computeFingerprint(messageText, version3) {
|
|
|
401198
401280
|
}
|
|
401199
401281
|
function computeFingerprintFromMessages(messages) {
|
|
401200
401282
|
const firstMessageText = extractFirstMessageText(messages);
|
|
401201
|
-
return computeFingerprint(firstMessageText, { VERSION: "0.1.
|
|
401283
|
+
return computeFingerprint(firstMessageText, { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
401202
401284
|
}
|
|
401203
401285
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
401204
401286
|
var init_fingerprint = () => {};
|
|
@@ -402998,7 +403080,7 @@ var init_theusEngine = __esm(() => {
|
|
|
402998
403080
|
});
|
|
402999
403081
|
|
|
403000
403082
|
// services/api/theus.ts
|
|
403001
|
-
import { existsSync as existsSync13, readFileSync as
|
|
403083
|
+
import { existsSync as existsSync13, readFileSync as readFileSync21 } from "fs";
|
|
403002
403084
|
import { randomUUID as randomUUID33 } from "crypto";
|
|
403003
403085
|
function env5(name) {
|
|
403004
403086
|
const value = process.env[name];
|
|
@@ -403012,7 +403094,7 @@ function loadProvidersConfig3() {
|
|
|
403012
403094
|
if (!existsSync13(path19))
|
|
403013
403095
|
return null;
|
|
403014
403096
|
try {
|
|
403015
|
-
return JSON.parse(
|
|
403097
|
+
return JSON.parse(readFileSync21(path19, "utf8"));
|
|
403016
403098
|
} catch {
|
|
403017
403099
|
return null;
|
|
403018
403100
|
}
|
|
@@ -403632,7 +403714,7 @@ async function sideQuery(opts) {
|
|
|
403632
403714
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
403633
403715
|
}
|
|
403634
403716
|
const messageText = extractFirstUserMessageText(messages);
|
|
403635
|
-
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.
|
|
403717
|
+
const fingerprint = computeFingerprint(messageText, { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
403636
403718
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
403637
403719
|
const systemBlocks = [
|
|
403638
403720
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -404935,7 +405017,7 @@ async function handleMemories(state) {
|
|
|
404935
405017
|
async function runProjectContextMcpServer() {
|
|
404936
405018
|
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
404937
405019
|
const state = new ProjectContextState(projectRoot);
|
|
404938
|
-
const server = new Server({ name: SERVER_NAME, version: { VERSION: "0.1.
|
|
405020
|
+
const server = new Server({ name: SERVER_NAME, version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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: {} } });
|
|
404939
405021
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
404940
405022
|
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
404941
405023
|
name: t.name,
|
|
@@ -405468,7 +405550,7 @@ __export(exports_workerRegistry, {
|
|
|
405468
405550
|
});
|
|
405469
405551
|
import { spawn as spawn9 } from "child_process";
|
|
405470
405552
|
import { randomUUID as randomUUID34 } from "crypto";
|
|
405471
|
-
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync9, readFileSync as
|
|
405553
|
+
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync9, readFileSync as readFileSync22, writeFileSync as writeFileSync7 } from "fs";
|
|
405472
405554
|
import { homedir as homedir35 } from "os";
|
|
405473
405555
|
import { dirname as dirname61, join as join145 } from "path";
|
|
405474
405556
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
@@ -405478,7 +405560,7 @@ function projectsConfigPath() {
|
|
|
405478
405560
|
function readEnabledProjects() {
|
|
405479
405561
|
let raw;
|
|
405480
405562
|
try {
|
|
405481
|
-
raw =
|
|
405563
|
+
raw = readFileSync22(projectsConfigPath(), "utf8");
|
|
405482
405564
|
} catch {
|
|
405483
405565
|
return [];
|
|
405484
405566
|
}
|
|
@@ -405682,7 +405764,7 @@ __export(exports_main, {
|
|
|
405682
405764
|
import {
|
|
405683
405765
|
existsSync as existsSync14,
|
|
405684
405766
|
mkdirSync as mkdirSync10,
|
|
405685
|
-
readFileSync as
|
|
405767
|
+
readFileSync as readFileSync23,
|
|
405686
405768
|
rmSync as rmSync4,
|
|
405687
405769
|
writeFileSync as writeFileSync8
|
|
405688
405770
|
} from "fs";
|
|
@@ -405702,7 +405784,7 @@ function ensureDaemonDir() {
|
|
|
405702
405784
|
}
|
|
405703
405785
|
function readPid() {
|
|
405704
405786
|
try {
|
|
405705
|
-
const raw =
|
|
405787
|
+
const raw = readFileSync23(pidFilePath(), "utf8").trim();
|
|
405706
405788
|
const pid = Number.parseInt(raw, 10);
|
|
405707
405789
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
405708
405790
|
} catch {
|
|
@@ -405775,7 +405857,7 @@ function doLogs() {
|
|
|
405775
405857
|
}
|
|
405776
405858
|
let content;
|
|
405777
405859
|
try {
|
|
405778
|
-
content =
|
|
405860
|
+
content = readFileSync23(path19, "utf8");
|
|
405779
405861
|
} catch (e) {
|
|
405780
405862
|
console.error(`No se pudo leer el registro: ${e?.message}`);
|
|
405781
405863
|
return;
|
|
@@ -409930,7 +410012,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
409930
410012
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
409931
410013
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
409932
410014
|
betas: getSdkBetas(),
|
|
409933
|
-
theus_code_version: { VERSION: "0.1.
|
|
410015
|
+
theus_code_version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
409934
410016
|
output_style: outputStyle2,
|
|
409935
410017
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
409936
410018
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -424564,7 +424646,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
424564
424646
|
function getSemverPart(version3) {
|
|
424565
424647
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
424566
424648
|
}
|
|
424567
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.
|
|
424649
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
424568
424650
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react215.useState(() => getSemverPart(initialVersion));
|
|
424569
424651
|
if (!updatedVersion) {
|
|
424570
424652
|
return null;
|
|
@@ -424604,7 +424686,7 @@ function AutoUpdater({
|
|
|
424604
424686
|
return;
|
|
424605
424687
|
}
|
|
424606
424688
|
if (false) {}
|
|
424607
|
-
const currentVersion = { VERSION: "0.1.
|
|
424689
|
+
const currentVersion = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
424608
424690
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
424609
424691
|
let latestVersion = await getLatestVersion(channel2);
|
|
424610
424692
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -424740,7 +424822,7 @@ function AutoUpdater({
|
|
|
424740
424822
|
" ",
|
|
424741
424823
|
/* @__PURE__ */ jsx_runtime383.jsx(ThemedText, {
|
|
424742
424824
|
bold: true,
|
|
424743
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.
|
|
424825
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.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.11", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
424744
424826
|
})
|
|
424745
424827
|
]
|
|
424746
424828
|
})
|
|
@@ -424817,12 +424899,12 @@ function NativeAutoUpdater({
|
|
|
424817
424899
|
logEvent("tengu_native_auto_updater_start", {});
|
|
424818
424900
|
try {
|
|
424819
424901
|
const maxVersion = await getMaxVersion();
|
|
424820
|
-
if (maxVersion && gt({ VERSION: "0.1.
|
|
424902
|
+
if (maxVersion && gt({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
424821
424903
|
const msg = await getMaxVersionMessage();
|
|
424822
424904
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
424823
424905
|
}
|
|
424824
424906
|
const result = await installLatest(channel2);
|
|
424825
|
-
const currentVersion = { VERSION: "0.1.
|
|
424907
|
+
const currentVersion = { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
424826
424908
|
const latencyMs = Date.now() - startTime2;
|
|
424827
424909
|
if (result.lockFailed) {
|
|
424828
424910
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -424959,17 +425041,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
424959
425041
|
const maxVersion = await getMaxVersion();
|
|
424960
425042
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
424961
425043
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
424962
|
-
if (gte({ VERSION: "0.1.
|
|
424963
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.
|
|
425044
|
+
if (gte({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
425045
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
424964
425046
|
setUpdateAvailable(false);
|
|
424965
425047
|
return;
|
|
424966
425048
|
}
|
|
424967
425049
|
latest = maxVersion;
|
|
424968
425050
|
}
|
|
424969
|
-
const hasUpdate = latest && !gte({ VERSION: "0.1.
|
|
425051
|
+
const hasUpdate = latest && !gte({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
424970
425052
|
setUpdateAvailable(!!hasUpdate);
|
|
424971
425053
|
if (hasUpdate) {
|
|
424972
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.
|
|
425054
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`);
|
|
424973
425055
|
}
|
|
424974
425056
|
};
|
|
424975
425057
|
$2[0] = t1;
|
|
@@ -425003,7 +425085,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
425003
425085
|
wrap: "truncate",
|
|
425004
425086
|
children: [
|
|
425005
425087
|
"currentVersion: ",
|
|
425006
|
-
{ VERSION: "0.1.
|
|
425088
|
+
{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
425007
425089
|
]
|
|
425008
425090
|
});
|
|
425009
425091
|
$2[3] = verbose;
|
|
@@ -432876,7 +432958,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
432876
432958
|
project_dir: getOriginalCwd(),
|
|
432877
432959
|
added_dirs: addedDirs
|
|
432878
432960
|
},
|
|
432879
|
-
version: { VERSION: "0.1.
|
|
432961
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
432880
432962
|
output_style: {
|
|
432881
432963
|
name: outputStyleName
|
|
432882
432964
|
},
|
|
@@ -444439,7 +444521,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
444439
444521
|
} catch {}
|
|
444440
444522
|
const data = {
|
|
444441
444523
|
trigger,
|
|
444442
|
-
version: { VERSION: "0.1.
|
|
444524
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
444443
444525
|
platform: process.platform,
|
|
444444
444526
|
transcript,
|
|
444445
444527
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -457229,7 +457311,7 @@ function Onboarding({
|
|
|
457229
457311
|
flexDirection: "column",
|
|
457230
457312
|
children: [
|
|
457231
457313
|
/* @__PURE__ */ jsx_runtime457.jsx(TheusBanner, {
|
|
457232
|
-
version: { VERSION: "0.1.
|
|
457314
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
457233
457315
|
}),
|
|
457234
457316
|
/* @__PURE__ */ jsx_runtime457.jsxs(ThemedBox_default, {
|
|
457235
457317
|
flexDirection: "column",
|
|
@@ -458100,7 +458182,7 @@ function completeOnboarding() {
|
|
|
458100
458182
|
saveGlobalConfig((current) => ({
|
|
458101
458183
|
...current,
|
|
458102
458184
|
hasCompletedOnboarding: true,
|
|
458103
|
-
lastOnboardingVersion: { VERSION: "0.1.
|
|
458185
|
+
lastOnboardingVersion: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
458104
458186
|
}));
|
|
458105
458187
|
}
|
|
458106
458188
|
function showDialog(root2, renderer) {
|
|
@@ -462822,7 +462904,7 @@ function appendToLog(path21, message) {
|
|
|
462822
462904
|
cwd: getFsImplementation().cwd(),
|
|
462823
462905
|
userType: process.env.USER_TYPE,
|
|
462824
462906
|
sessionId: getSessionId(),
|
|
462825
|
-
version: { VERSION: "0.1.
|
|
462907
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
462826
462908
|
};
|
|
462827
462909
|
getLogWriter(path21).write(messageWithTimestamp);
|
|
462828
462910
|
}
|
|
@@ -466908,8 +466990,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
466908
466990
|
}
|
|
466909
466991
|
async function checkEnvLessBridgeMinVersion() {
|
|
466910
466992
|
const cfg = await getEnvLessBridgeConfig();
|
|
466911
|
-
if (cfg.min_version && lt({ VERSION: "0.1.
|
|
466912
|
-
return `Your version of Theus (${{ VERSION: "0.1.
|
|
466993
|
+
if (cfg.min_version && lt({ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
466994
|
+
return `Your version of Theus (${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
466913
466995
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
466914
466996
|
}
|
|
466915
466997
|
return null;
|
|
@@ -467383,7 +467465,7 @@ async function initBridgeCore(params) {
|
|
|
467383
467465
|
const rawApi = createBridgeApiClient({
|
|
467384
467466
|
baseUrl,
|
|
467385
467467
|
getAccessToken,
|
|
467386
|
-
runnerVersion: { VERSION: "0.1.
|
|
467468
|
+
runnerVersion: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
467387
467469
|
onDebug: logForDebugging,
|
|
467388
467470
|
onAuth401,
|
|
467389
467471
|
getTrustedDeviceToken
|
|
@@ -472649,7 +472731,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
|
|
|
472649
472731
|
setCwd(cwd3);
|
|
472650
472732
|
const server = new Server({
|
|
472651
472733
|
name: "theus/tengu",
|
|
472652
|
-
version: { VERSION: "0.1.
|
|
472734
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
472653
472735
|
}, {
|
|
472654
472736
|
capabilities: {
|
|
472655
472737
|
tools: {}
|
|
@@ -474091,7 +474173,7 @@ async function setupTokenHandler(root2) {
|
|
|
474091
474173
|
gap: 1,
|
|
474092
474174
|
children: [
|
|
474093
474175
|
/* @__PURE__ */ jsx_runtime473.jsx(TheusBanner, {
|
|
474094
|
-
version: { VERSION: "0.1.
|
|
474176
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
474095
474177
|
}),
|
|
474096
474178
|
showAuthWarning && /* @__PURE__ */ jsx_runtime473.jsxs(ThemedBox_default, {
|
|
474097
474179
|
flexDirection: "column",
|
|
@@ -474261,7 +474343,7 @@ __export(exports_main2, {
|
|
|
474261
474343
|
startDeferredPrefetches: () => startDeferredPrefetches,
|
|
474262
474344
|
main: () => main
|
|
474263
474345
|
});
|
|
474264
|
-
import { readFileSync as
|
|
474346
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
474265
474347
|
import { resolve as resolve46 } from "path";
|
|
474266
474348
|
function logManagedSettings() {
|
|
474267
474349
|
try {
|
|
@@ -474417,7 +474499,7 @@ function loadSettingsFromFlag(settingsFile) {
|
|
|
474417
474499
|
resolvedPath: resolvedSettingsPath
|
|
474418
474500
|
} = safeResolvePath(getFsImplementation(), settingsFile);
|
|
474419
474501
|
try {
|
|
474420
|
-
|
|
474502
|
+
readFileSync24(resolvedSettingsPath, "utf8");
|
|
474421
474503
|
} catch (e) {
|
|
474422
474504
|
if (isENOENT(e)) {
|
|
474423
474505
|
process.stderr.write(source_default.red(`Error: Settings file not found: ${resolvedSettingsPath}
|
|
@@ -474822,7 +474904,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
474822
474904
|
}
|
|
474823
474905
|
try {
|
|
474824
474906
|
const filePath = resolve46(options2.systemPromptFile);
|
|
474825
|
-
systemPrompt =
|
|
474907
|
+
systemPrompt = readFileSync24(filePath, "utf8");
|
|
474826
474908
|
} catch (error40) {
|
|
474827
474909
|
const code = getErrnoCode(error40);
|
|
474828
474910
|
if (code === "ENOENT") {
|
|
@@ -474844,7 +474926,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
474844
474926
|
}
|
|
474845
474927
|
try {
|
|
474846
474928
|
const filePath = resolve46(options2.appendSystemPromptFile);
|
|
474847
|
-
appendSystemPrompt =
|
|
474929
|
+
appendSystemPrompt = readFileSync24(filePath, "utf8");
|
|
474848
474930
|
} catch (error40) {
|
|
474849
474931
|
const code = getErrnoCode(error40);
|
|
474850
474932
|
if (code === "ENOENT") {
|
|
@@ -475440,7 +475522,7 @@ ${customInstructions}` : customInstructions;
|
|
|
475440
475522
|
}
|
|
475441
475523
|
}
|
|
475442
475524
|
logForDiagnosticsNoPII("info", "started", {
|
|
475443
|
-
version: { VERSION: "0.1.
|
|
475525
|
+
version: { VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
475444
475526
|
is_native_binary: isInBundledMode()
|
|
475445
475527
|
});
|
|
475446
475528
|
registerCleanup(async () => {
|
|
@@ -476224,7 +476306,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
476224
476306
|
pendingHookMessages
|
|
476225
476307
|
}, renderAndRun);
|
|
476226
476308
|
}
|
|
476227
|
-
}).version(`${{ VERSION: "0.1.
|
|
476309
|
+
}).version(`${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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");
|
|
476228
476310
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
476229
476311
|
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.");
|
|
476230
476312
|
if (canUserConfigureAdvisor()) {
|
|
@@ -476738,7 +476820,7 @@ if (false) {}
|
|
|
476738
476820
|
async function main2() {
|
|
476739
476821
|
const args = process.argv.slice(2);
|
|
476740
476822
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
476741
|
-
console.log(`${{ VERSION: "0.1.
|
|
476823
|
+
console.log(`${{ VERSION: "0.1.11", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)`);
|
|
476742
476824
|
return;
|
|
476743
476825
|
}
|
|
476744
476826
|
const {
|