theus-cli 0.2.30 → 0.2.31
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 +494 -284
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -58324,7 +58324,7 @@ async function _executeApiKeyHelper(isNonInteractiveSession) {
|
|
|
58324
58324
|
if (isApiKeyHelperFromProjectOrLocalSettings()) {
|
|
58325
58325
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58326
58326
|
if (!hasTrust && !isNonInteractiveSession) {
|
|
58327
|
-
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
58327
|
+
const error40 = new Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58328
58328
|
logAntError("apiKeyHelper invoked before trust check", error40);
|
|
58329
58329
|
logEvent("tengu_apiKeyHelper_missing_trust11", {});
|
|
58330
58330
|
return null;
|
|
@@ -58368,7 +58368,7 @@ async function runAwsAuthRefresh() {
|
|
|
58368
58368
|
if (isAwsAuthRefreshFromProjectSettings()) {
|
|
58369
58369
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58370
58370
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58371
|
-
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
58371
|
+
const error40 = new Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58372
58372
|
logAntError("awsAuthRefresh invoked before trust check", error40);
|
|
58373
58373
|
logEvent("tengu_awsAuthRefresh_missing_trust", {});
|
|
58374
58374
|
return false;
|
|
@@ -58428,7 +58428,7 @@ async function getAwsCredsFromCredentialExport() {
|
|
|
58428
58428
|
if (isAwsCredentialExportFromProjectSettings()) {
|
|
58429
58429
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58430
58430
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58431
|
-
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
58431
|
+
const error40 = new Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58432
58432
|
logAntError("awsCredentialExport invoked before trust check", error40);
|
|
58433
58433
|
logEvent("tengu_awsCredentialExport_missing_trust", {});
|
|
58434
58434
|
return null;
|
|
@@ -58513,7 +58513,7 @@ async function runGcpAuthRefresh() {
|
|
|
58513
58513
|
if (isGcpAuthRefreshFromProjectSettings()) {
|
|
58514
58514
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
58515
58515
|
if (!hasTrust && !getIsNonInteractiveSession()) {
|
|
58516
|
-
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
58516
|
+
const error40 = new Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
58517
58517
|
logAntError("gcpAuthRefresh invoked before trust check", error40);
|
|
58518
58518
|
logEvent("tengu_gcpAuthRefresh_missing_trust", {});
|
|
58519
58519
|
return false;
|
|
@@ -59208,7 +59208,7 @@ var init_auth = __esm(() => {
|
|
|
59208
59208
|
|
|
59209
59209
|
// utils/userAgent.ts
|
|
59210
59210
|
function getTheusCodeUserAgent() {
|
|
59211
|
-
return `theus-code/${{ VERSION: "0.2.
|
|
59211
|
+
return `theus-code/${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`;
|
|
59212
59212
|
}
|
|
59213
59213
|
|
|
59214
59214
|
// utils/workloadContext.ts
|
|
@@ -59230,7 +59230,7 @@ function getUserAgent() {
|
|
|
59230
59230
|
const clientApp = process.env.THEUS_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}` : "";
|
|
59231
59231
|
const workload = getWorkload();
|
|
59232
59232
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
59233
|
-
return `theus-cli/${{ VERSION: "0.2.
|
|
59233
|
+
return `theus-cli/${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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})`;
|
|
59234
59234
|
}
|
|
59235
59235
|
function getMCPUserAgent() {
|
|
59236
59236
|
const parts = [];
|
|
@@ -59244,7 +59244,7 @@ function getMCPUserAgent() {
|
|
|
59244
59244
|
parts.push(`client-app/${process.env.THEUS_AGENT_SDK_CLIENT_APP}`);
|
|
59245
59245
|
}
|
|
59246
59246
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
59247
|
-
return `theus-code/${{ VERSION: "0.2.
|
|
59247
|
+
return `theus-code/${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`;
|
|
59248
59248
|
}
|
|
59249
59249
|
function getWebFetchUserAgent() {
|
|
59250
59250
|
return `Theus-User (${getTheusCodeUserAgent()}; +https://support.theus.pe/)`;
|
|
@@ -59382,7 +59382,7 @@ var init_user = __esm(() => {
|
|
|
59382
59382
|
deviceId,
|
|
59383
59383
|
sessionId: getSessionId(),
|
|
59384
59384
|
email: getEmail(),
|
|
59385
|
-
appVersion: { VERSION: "0.2.
|
|
59385
|
+
appVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
59386
59386
|
platform: getHostPlatformForAnalytics(),
|
|
59387
59387
|
organizationUuid,
|
|
59388
59388
|
accountUuid,
|
|
@@ -61097,7 +61097,7 @@ var init_metadata = __esm(() => {
|
|
|
61097
61097
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
61098
61098
|
WHITESPACE_REGEX = /\s+/;
|
|
61099
61099
|
getVersionBase = memoize_default(() => {
|
|
61100
|
-
const match = { VERSION: "0.2.
|
|
61100
|
+
const match = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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]+)?/);
|
|
61101
61101
|
return match ? match[0] : undefined;
|
|
61102
61102
|
});
|
|
61103
61103
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -61137,9 +61137,9 @@ var init_metadata = __esm(() => {
|
|
|
61137
61137
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
61138
61138
|
isTheusCodeAction: isEnvTruthy(process.env.THEUS_CODE_ACTION),
|
|
61139
61139
|
isTheusAiAuth: isTheusAISubscriber(),
|
|
61140
|
-
version: { VERSION: "0.2.
|
|
61140
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
61141
61141
|
versionBase: getVersionBase(),
|
|
61142
|
-
buildTime: { VERSION: "0.2.
|
|
61142
|
+
buildTime: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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,
|
|
61143
61143
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
61144
61144
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
61145
61145
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -61805,7 +61805,7 @@ function initialize1PEventLogging() {
|
|
|
61805
61805
|
const platform2 = getPlatform();
|
|
61806
61806
|
const attributes = {
|
|
61807
61807
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
61808
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.
|
|
61808
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
61809
61809
|
};
|
|
61810
61810
|
if (platform2 === "wsl") {
|
|
61811
61811
|
const wslVersion = getWslVersion();
|
|
@@ -61832,7 +61832,7 @@ function initialize1PEventLogging() {
|
|
|
61832
61832
|
})
|
|
61833
61833
|
]
|
|
61834
61834
|
});
|
|
61835
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.2.
|
|
61835
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.theus.theus_code.events", { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
61836
61836
|
}
|
|
61837
61837
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
61838
61838
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -63703,7 +63703,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
63703
63703
|
if (!isAttributionHeaderEnabled()) {
|
|
63704
63704
|
return "";
|
|
63705
63705
|
}
|
|
63706
|
-
const version2 = `${{ VERSION: "0.2.
|
|
63706
|
+
const version2 = `${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`;
|
|
63707
63707
|
const entrypoint = process.env.THEUS_CODE_ENTRYPOINT ?? "unknown";
|
|
63708
63708
|
const cch = "";
|
|
63709
63709
|
const workload = getWorkload();
|
|
@@ -107813,7 +107813,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
107813
107813
|
}
|
|
107814
107814
|
function getFeedbackGuideline() {
|
|
107815
107815
|
if (isUsing3PServices()) {
|
|
107816
|
-
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.2.
|
|
107816
|
+
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
107817
107817
|
}
|
|
107818
107818
|
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";
|
|
107819
107819
|
}
|
|
@@ -166522,7 +166522,7 @@ function getTelemetryAttributes() {
|
|
|
166522
166522
|
attributes["session.id"] = sessionId;
|
|
166523
166523
|
}
|
|
166524
166524
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
166525
|
-
attributes["app.version"] = { VERSION: "0.2.
|
|
166525
|
+
attributes["app.version"] = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
166526
166526
|
}
|
|
166527
166527
|
const oauthAccount = getOauthAccountInfo();
|
|
166528
166528
|
if (oauthAccount) {
|
|
@@ -202535,7 +202535,7 @@ function getInstallationEnv() {
|
|
|
202535
202535
|
return;
|
|
202536
202536
|
}
|
|
202537
202537
|
function getTheusCodeVersion() {
|
|
202538
|
-
return { VERSION: "0.2.
|
|
202538
|
+
return { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
202539
202539
|
}
|
|
202540
202540
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
202541
202541
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -204053,7 +204053,7 @@ async function getMcpHeadersFromHelper(serverName, config2) {
|
|
|
204053
204053
|
if ("scope" in config2 && isMcpServerFromProjectOrLocalSettings(config2) && !getIsNonInteractiveSession()) {
|
|
204054
204054
|
const hasTrust = checkHasTrustDialogAccepted();
|
|
204055
204055
|
if (!hasTrust) {
|
|
204056
|
-
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.
|
|
204056
|
+
const error40 = new Error(`Security: headersHelper for MCP server '${serverName}' executed before workspace trust is confirmed. If you see this message, post in ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}.`);
|
|
204057
204057
|
logAntError("MCP headersHelper invoked before trust check", error40);
|
|
204058
204058
|
logEvent("tengu_mcp_headersHelper_missing_trust", {});
|
|
204059
204059
|
return null;
|
|
@@ -205263,7 +205263,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
205263
205263
|
const client2 = new Client({
|
|
205264
205264
|
name: "theus-code",
|
|
205265
205265
|
title: "Theus",
|
|
205266
|
-
version: { VERSION: "0.2.
|
|
205266
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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",
|
|
205267
205267
|
description: "Theus's agentic coding tool",
|
|
205268
205268
|
websiteUrl: PRODUCT_URL
|
|
205269
205269
|
}, {
|
|
@@ -205617,7 +205617,7 @@ var init_client5 = __esm(() => {
|
|
|
205617
205617
|
const client2 = new Client({
|
|
205618
205618
|
name: "theus-code",
|
|
205619
205619
|
title: "Theus",
|
|
205620
|
-
version: { VERSION: "0.2.
|
|
205620
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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",
|
|
205621
205621
|
description: "Theus's agentic coding tool",
|
|
205622
205622
|
websiteUrl: PRODUCT_URL
|
|
205623
205623
|
}, {
|
|
@@ -216195,7 +216195,7 @@ async function initializeBetaTracing(resource) {
|
|
|
216195
216195
|
});
|
|
216196
216196
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
216197
216197
|
setLoggerProvider(loggerProvider);
|
|
216198
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.
|
|
216198
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
216199
216199
|
setEventLogger(eventLogger);
|
|
216200
216200
|
process.on("beforeExit", async () => {
|
|
216201
216201
|
await loggerProvider?.forceFlush();
|
|
@@ -216235,7 +216235,7 @@ async function initializeTelemetry() {
|
|
|
216235
216235
|
const platform4 = getPlatform();
|
|
216236
216236
|
const baseAttributes = {
|
|
216237
216237
|
[ATTR_SERVICE_NAME]: "theus-code",
|
|
216238
|
-
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.
|
|
216238
|
+
[ATTR_SERVICE_VERSION]: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
216239
216239
|
};
|
|
216240
216240
|
if (platform4 === "wsl") {
|
|
216241
216241
|
const wslVersion = getWslVersion();
|
|
@@ -216280,7 +216280,7 @@ async function initializeTelemetry() {
|
|
|
216280
216280
|
} catch {}
|
|
216281
216281
|
};
|
|
216282
216282
|
registerCleanup(shutdownTelemetry2);
|
|
216283
|
-
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.2.
|
|
216283
|
+
return meterProvider2.getMeter("com.theus.theus_code", { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
216284
216284
|
}
|
|
216285
216285
|
const meterProvider = new MeterProvider({
|
|
216286
216286
|
resource,
|
|
@@ -216300,7 +216300,7 @@ async function initializeTelemetry() {
|
|
|
216300
216300
|
});
|
|
216301
216301
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
216302
216302
|
setLoggerProvider(loggerProvider);
|
|
216303
|
-
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.
|
|
216303
|
+
const eventLogger = logs.getLogger("com.theus.theus_code.events", { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
216304
216304
|
setEventLogger(eventLogger);
|
|
216305
216305
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
216306
216306
|
process.on("beforeExit", async () => {
|
|
@@ -216362,7 +216362,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
216362
216362
|
}
|
|
216363
216363
|
};
|
|
216364
216364
|
registerCleanup(shutdownTelemetry);
|
|
216365
|
-
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.2.
|
|
216365
|
+
return meterProvider.getMeter("com.theus.theus_code", { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
216366
216366
|
}
|
|
216367
216367
|
async function flushTelemetry() {
|
|
216368
216368
|
const meterProvider = getMeterProvider();
|
|
@@ -216902,7 +216902,7 @@ async function installOrUpdateTheusPackage(channel2, specificVersion) {
|
|
|
216902
216902
|
return "install_failed";
|
|
216903
216903
|
}
|
|
216904
216904
|
const versionSpec = specificVersion ? specificVersion : channel2 === "stable" ? "stable" : "latest";
|
|
216905
|
-
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.2.
|
|
216905
|
+
const result = await execFileNoThrowWithCwd("npm", ["install", `${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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 });
|
|
216906
216906
|
if (result.code !== 0) {
|
|
216907
216907
|
const error40 = new Error(`Failed to install Theus CLI package: ${result.stderr}`);
|
|
216908
216908
|
logError2(error40);
|
|
@@ -217048,9 +217048,9 @@ async function assertMinVersion() {
|
|
|
217048
217048
|
if (false) {}
|
|
217049
217049
|
try {
|
|
217050
217050
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
217051
|
-
if (versionConfig.minVersion && lt({ VERSION: "0.2.
|
|
217051
|
+
if (versionConfig.minVersion && lt({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
217052
217052
|
console.error(`
|
|
217053
|
-
It looks like your version of Theus (${{ VERSION: "0.2.
|
|
217053
|
+
It looks like your version of Theus (${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
217054
217054
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
217055
217055
|
|
|
217056
217056
|
To update, please run:
|
|
@@ -217191,7 +217191,7 @@ async function getInstallationPrefix() {
|
|
|
217191
217191
|
return prefixResult.stdout.trim();
|
|
217192
217192
|
}
|
|
217193
217193
|
function getGlobalInstallPackageManager() {
|
|
217194
|
-
if ({ VERSION: "0.2.
|
|
217194
|
+
if ({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
217195
217195
|
return "npm";
|
|
217196
217196
|
}
|
|
217197
217197
|
return env3.isRunningWithBun() ? "bun" : "npm";
|
|
@@ -217216,7 +217216,7 @@ async function checkGlobalInstallPermissions() {
|
|
|
217216
217216
|
}
|
|
217217
217217
|
async function getLatestVersion(channel2) {
|
|
217218
217218
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
217219
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.2.
|
|
217219
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", `${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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() });
|
|
217220
217220
|
if (result.code !== 0) {
|
|
217221
217221
|
logForDebugging(`npm view failed with code ${result.code}`);
|
|
217222
217222
|
if (result.stderr) {
|
|
@@ -217232,7 +217232,7 @@ async function getLatestVersion(channel2) {
|
|
|
217232
217232
|
return result.stdout.trim();
|
|
217233
217233
|
}
|
|
217234
217234
|
async function getNpmDistTags() {
|
|
217235
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.2.
|
|
217235
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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() });
|
|
217236
217236
|
if (result.code !== 0) {
|
|
217237
217237
|
logForDebugging(`npm view dist-tags failed with code ${result.code}`);
|
|
217238
217238
|
return { latest: null, stable: null };
|
|
@@ -217272,7 +217272,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
217272
217272
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
217273
217273
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
217274
217274
|
pid: process.pid,
|
|
217275
|
-
currentVersion: { VERSION: "0.2.
|
|
217275
|
+
currentVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
217276
217276
|
});
|
|
217277
217277
|
return "in_progress";
|
|
217278
217278
|
}
|
|
@@ -217281,7 +217281,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
217281
217281
|
if (!env3.isRunningWithBun() && env3.isNpmFromWindowsPath()) {
|
|
217282
217282
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
217283
217283
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
217284
|
-
currentVersion: { VERSION: "0.2.
|
|
217284
|
+
currentVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
217285
217285
|
});
|
|
217286
217286
|
console.error(`
|
|
217287
217287
|
Error: Windows NPM detected in WSL
|
|
@@ -217300,7 +217300,7 @@ To fix this issue:
|
|
|
217300
217300
|
if (!hasPermissions) {
|
|
217301
217301
|
return "no_permissions";
|
|
217302
217302
|
}
|
|
217303
|
-
const packageSpec = specificVersion ? `${{ VERSION: "0.2.
|
|
217303
|
+
const packageSpec = specificVersion ? `${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}@${specificVersion}` : { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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;
|
|
217304
217304
|
const packageManager = getGlobalInstallPackageManager();
|
|
217305
217305
|
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir18() });
|
|
217306
217306
|
if (installResult.code !== 0) {
|
|
@@ -217628,8 +217628,8 @@ async function detectMultipleInstallations() {
|
|
|
217628
217628
|
installations.push({ type: "npm-local", path: localPath });
|
|
217629
217629
|
}
|
|
217630
217630
|
const packagesToCheck = ["@theus-ai/theus-code"];
|
|
217631
|
-
if ({ VERSION: "0.2.
|
|
217632
|
-
packagesToCheck.push({ VERSION: "0.2.
|
|
217631
|
+
if ({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
217632
|
+
packagesToCheck.push({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
217633
217633
|
}
|
|
217634
217634
|
const npmResult = await execFileNoThrow("npm", [
|
|
217635
217635
|
"-g",
|
|
@@ -217812,7 +217812,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
217812
217812
|
}
|
|
217813
217813
|
async function getDoctorDiagnostic() {
|
|
217814
217814
|
const installationType = await getCurrentInstallationType();
|
|
217815
|
-
const version2 = { VERSION: "0.2.
|
|
217815
|
+
const version2 = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION ? { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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";
|
|
217816
217816
|
const installationPath = await getInstallationPath();
|
|
217817
217817
|
const invokedBinary = getInvokedBinary();
|
|
217818
217818
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -217824,8 +217824,8 @@ async function getDoctorDiagnostic() {
|
|
|
217824
217824
|
for (const install of npmInstalls) {
|
|
217825
217825
|
if (install.type === "npm-global") {
|
|
217826
217826
|
let uninstallCmd = "npm -g uninstall @theus-ai/theus-code";
|
|
217827
|
-
if ({ VERSION: "0.2.
|
|
217828
|
-
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.2.
|
|
217827
|
+
if ({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
217828
|
+
uninstallCmd += ` && npm -g uninstall ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
217829
217829
|
}
|
|
217830
217830
|
warnings.push({
|
|
217831
217831
|
issue: `Leftover npm global installation at ${install.path}`,
|
|
@@ -217937,7 +217937,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217937
217937
|
const startTime2 = Date.now();
|
|
217938
217938
|
const { stdout, code, stderr } = await execFileNoThrowWithCwd("npm", [
|
|
217939
217939
|
"view",
|
|
217940
|
-
`${{ VERSION: "0.2.
|
|
217940
|
+
`${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`,
|
|
217941
217941
|
"version",
|
|
217942
217942
|
"--prefer-online",
|
|
217943
217943
|
"--registry",
|
|
@@ -217961,7 +217961,7 @@ async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
|
217961
217961
|
latency_ms: latencyMs,
|
|
217962
217962
|
source_npm: true
|
|
217963
217963
|
});
|
|
217964
|
-
logForDebugging(`npm view ${{ VERSION: "0.2.
|
|
217964
|
+
logForDebugging(`npm view ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
217965
217965
|
const latestVersion = stdout.trim();
|
|
217966
217966
|
return latestVersion;
|
|
217967
217967
|
}
|
|
@@ -218017,7 +218017,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
218017
218017
|
const fs3 = getFsImplementation();
|
|
218018
218018
|
await fs3.rm(stagingPath, { recursive: true, force: true });
|
|
218019
218019
|
const platform4 = getPlatform2();
|
|
218020
|
-
const platformPackageName = `${{ VERSION: "0.2.
|
|
218020
|
+
const platformPackageName = `${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`;
|
|
218021
218021
|
logForDebugging(`Fetching integrity hash for ${platformPackageName}@${version2}`);
|
|
218022
218022
|
const {
|
|
218023
218023
|
stdout: integrityOutput,
|
|
@@ -218046,7 +218046,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
218046
218046
|
name: "theus-native-installer",
|
|
218047
218047
|
version: "0.0.1",
|
|
218048
218048
|
dependencies: {
|
|
218049
|
-
[{ VERSION: "0.2.
|
|
218049
|
+
[{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
218050
218050
|
}
|
|
218051
218051
|
};
|
|
218052
218052
|
const packageLock = {
|
|
@@ -218059,10 +218059,10 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
218059
218059
|
name: "theus-native-installer",
|
|
218060
218060
|
version: "0.0.1",
|
|
218061
218061
|
dependencies: {
|
|
218062
|
-
[{ VERSION: "0.2.
|
|
218062
|
+
[{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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
|
|
218063
218063
|
}
|
|
218064
218064
|
},
|
|
218065
|
-
[`node_modules/${{ VERSION: "0.2.
|
|
218065
|
+
[`node_modules/${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`]: {
|
|
218066
218066
|
version: version2,
|
|
218067
218067
|
optionalDependencies: {
|
|
218068
218068
|
[platformPackageName]: version2
|
|
@@ -218084,7 +218084,7 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
218084
218084
|
if (result.code !== 0) {
|
|
218085
218085
|
throw new Error(`npm ci failed with code ${result.code}: ${result.stderr}`);
|
|
218086
218086
|
}
|
|
218087
|
-
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.2.
|
|
218087
|
+
logForDebugging(`Successfully downloaded and verified ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
218088
218088
|
}
|
|
218089
218089
|
function getStallTimeoutMs() {
|
|
218090
218090
|
return Number(process.env.THEUS_CODE_STALL_TIMEOUT_MS_FOR_TESTING) || DEFAULT_STALL_TIMEOUT_MS;
|
|
@@ -218747,8 +218747,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218747
218747
|
const maxVersion = await getMaxVersion();
|
|
218748
218748
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
218749
218749
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
218750
|
-
if (gte({ VERSION: "0.2.
|
|
218751
|
-
logForDebugging(`Native installer: current version ${{ VERSION: "0.2.
|
|
218750
|
+
if (gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
218751
|
+
logForDebugging(`Native installer: current version ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
218752
218752
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
218753
218753
|
latency_ms: Date.now() - startTime2,
|
|
218754
218754
|
max_version: maxVersion,
|
|
@@ -218759,7 +218759,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
218759
218759
|
version2 = maxVersion;
|
|
218760
218760
|
}
|
|
218761
218761
|
}
|
|
218762
|
-
if (!forceReinstall && version2 === { VERSION: "0.2.
|
|
218762
|
+
if (!forceReinstall && version2 === { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
218763
218763
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
218764
218764
|
logEvent("tengu_native_update_complete", {
|
|
218765
218765
|
latency_ms: Date.now() - startTime2,
|
|
@@ -219509,8 +219509,8 @@ async function cleanupNpmInstallations() {
|
|
|
219509
219509
|
} else if (codePackageResult.error) {
|
|
219510
219510
|
errors4.push(codePackageResult.error);
|
|
219511
219511
|
}
|
|
219512
|
-
if ({ VERSION: "0.2.
|
|
219513
|
-
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.2.
|
|
219512
|
+
if ({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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") {
|
|
219513
|
+
const macroPackageResult = await attemptNpmUninstall({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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);
|
|
219514
219514
|
if (macroPackageResult.success) {
|
|
219515
219515
|
removed++;
|
|
219516
219516
|
if (macroPackageResult.warning) {
|
|
@@ -275166,9 +275166,9 @@ var init_DreamTask = __esm(() => {
|
|
|
275166
275166
|
});
|
|
275167
275167
|
|
|
275168
275168
|
// tools/WorkflowTool/runtime.js
|
|
275169
|
-
import { randomUUID as randomUUID19 } from "crypto";
|
|
275169
|
+
import { createHash as createHash20, randomUUID as randomUUID19 } from "crypto";
|
|
275170
275170
|
import { existsSync as existsSync9 } from "fs";
|
|
275171
|
-
import { mkdir as mkdir25, writeFile as writeFile25 } from "fs/promises";
|
|
275171
|
+
import { mkdir as mkdir25, readFile as readFile28, writeFile as writeFile25 } from "fs/promises";
|
|
275172
275172
|
import { homedir as homedir27 } from "os";
|
|
275173
275173
|
import { basename as basename27, extname as extname14, isAbsolute as isAbsolute24, relative as relative21, resolve as resolve33 } from "path";
|
|
275174
275174
|
import { pathToFileURL as pathToFileURL6 } from "url";
|
|
@@ -275364,6 +275364,81 @@ function normalizeAgentSpec(spec) {
|
|
|
275364
275364
|
raw: spec
|
|
275365
275365
|
};
|
|
275366
275366
|
}
|
|
275367
|
+
function hashAgentCall(tipo, prompt) {
|
|
275368
|
+
const h2 = createHash20("sha1");
|
|
275369
|
+
h2.update(String(tipo ?? ""));
|
|
275370
|
+
h2.update("\x00");
|
|
275371
|
+
h2.update(String(prompt ?? ""));
|
|
275372
|
+
return h2.digest("hex").slice(0, 16);
|
|
275373
|
+
}
|
|
275374
|
+
function agentCallKey(ordinal) {
|
|
275375
|
+
return `a${ordinal}`;
|
|
275376
|
+
}
|
|
275377
|
+
function ordinalFromKey(key) {
|
|
275378
|
+
if (typeof key === "number" && Number.isFinite(key))
|
|
275379
|
+
return key;
|
|
275380
|
+
const m = /^a?(\d+)$/.exec(String(key ?? ""));
|
|
275381
|
+
return m ? Number(m[1]) : undefined;
|
|
275382
|
+
}
|
|
275383
|
+
function normalizeInvalidated(input) {
|
|
275384
|
+
if (input === true || input === "all" || input === "*") {
|
|
275385
|
+
return { all: true, set: new Set };
|
|
275386
|
+
}
|
|
275387
|
+
const set3 = new Set;
|
|
275388
|
+
if (input && typeof input[Symbol.iterator] === "function") {
|
|
275389
|
+
for (const v of input) {
|
|
275390
|
+
if (v === true || v === "all" || v === "*")
|
|
275391
|
+
return { all: true, set: new Set };
|
|
275392
|
+
const ord = ordinalFromKey(v);
|
|
275393
|
+
if (Number.isFinite(ord))
|
|
275394
|
+
set3.add(ord);
|
|
275395
|
+
}
|
|
275396
|
+
}
|
|
275397
|
+
return { all: false, set: set3 };
|
|
275398
|
+
}
|
|
275399
|
+
function toJournalMap(journal) {
|
|
275400
|
+
const map3 = new Map;
|
|
275401
|
+
if (!journal)
|
|
275402
|
+
return map3;
|
|
275403
|
+
let pairs;
|
|
275404
|
+
if (journal instanceof Map) {
|
|
275405
|
+
pairs = journal.entries();
|
|
275406
|
+
} else if (journal.keys && typeof journal.keys === "object" && !Array.isArray(journal.keys)) {
|
|
275407
|
+
pairs = Object.entries(journal.keys);
|
|
275408
|
+
} else {
|
|
275409
|
+
pairs = Object.entries(journal);
|
|
275410
|
+
}
|
|
275411
|
+
for (const [k2, v] of pairs) {
|
|
275412
|
+
if (!v || typeof v !== "object")
|
|
275413
|
+
continue;
|
|
275414
|
+
const ord = v.ordinal != null && Number.isFinite(Number(v.ordinal)) ? Number(v.ordinal) : ordinalFromKey(k2);
|
|
275415
|
+
if (Number.isFinite(ord))
|
|
275416
|
+
map3.set(ord, v);
|
|
275417
|
+
}
|
|
275418
|
+
return map3;
|
|
275419
|
+
}
|
|
275420
|
+
function serializeJournal(map3) {
|
|
275421
|
+
const keys2 = {};
|
|
275422
|
+
let maxOrdinal = 0;
|
|
275423
|
+
if (map3) {
|
|
275424
|
+
for (const [ord, entry] of map3) {
|
|
275425
|
+
keys2[agentCallKey(ord)] = entry;
|
|
275426
|
+
if (ord > maxOrdinal)
|
|
275427
|
+
maxOrdinal = ord;
|
|
275428
|
+
}
|
|
275429
|
+
}
|
|
275430
|
+
return { version: 1, maxOrdinal, keys: keys2 };
|
|
275431
|
+
}
|
|
275432
|
+
async function loadRunJournal(runId, cwd2 = process.cwd()) {
|
|
275433
|
+
try {
|
|
275434
|
+
const file2 = resolve33(cwd2, ".theus", WORKFLOWS_DIR_NAME, WORKFLOW_RUNS_DIR_NAME, `${runId}.json`);
|
|
275435
|
+
const raw = await readFile28(file2, "utf8");
|
|
275436
|
+
const data = JSON.parse(raw);
|
|
275437
|
+
return data && data.journal ? data.journal : undefined;
|
|
275438
|
+
} catch {
|
|
275439
|
+
return;
|
|
275440
|
+
}
|
|
275441
|
+
}
|
|
275367
275442
|
function generateRunId() {
|
|
275368
275443
|
return `${WORKFLOW_RUN_ID_PREFIX}_${randomUUID19().slice(0, 12)}`;
|
|
275369
275444
|
}
|
|
@@ -275407,6 +275482,11 @@ function createWorkflowRuntime(options2 = {}) {
|
|
|
275407
275482
|
const signal = options2.signal;
|
|
275408
275483
|
const runId = options2.runId ?? generateRunId();
|
|
275409
275484
|
const onLog = typeof options2.onLog === "function" ? options2.onLog : undefined;
|
|
275485
|
+
const onReplay = typeof options2.onReplay === "function" ? options2.onReplay : undefined;
|
|
275486
|
+
const journalIn = toJournalMap(options2.journal);
|
|
275487
|
+
const { all: invalidateAll, set: invalidated } = normalizeInvalidated(options2.invalidatedKeys ?? (options2.invalidateAll ? "all" : undefined));
|
|
275488
|
+
const journalOut = new Map;
|
|
275489
|
+
let prefixBroken = false;
|
|
275410
275490
|
const logs2 = [];
|
|
275411
275491
|
const agentResults = [];
|
|
275412
275492
|
let agentSeq = 0;
|
|
@@ -275424,12 +275504,63 @@ function createWorkflowRuntime(options2 = {}) {
|
|
|
275424
275504
|
}
|
|
275425
275505
|
async function agent(spec) {
|
|
275426
275506
|
throwIfAborted(signal);
|
|
275507
|
+
const ordinal = ++agentSeq;
|
|
275508
|
+
const key = agentCallKey(ordinal);
|
|
275427
275509
|
const fase = currentPhase;
|
|
275428
275510
|
const norm = normalizeAgentSpec(spec);
|
|
275511
|
+
const hash = hashAgentCall(norm.tipo, norm.prompt);
|
|
275512
|
+
const prev = journalIn.get(ordinal);
|
|
275513
|
+
const isInvalidated = invalidateAll || invalidated.has(ordinal);
|
|
275514
|
+
const canReplay = !prefixBroken && !isInvalidated && prev && prev.hash === hash && prev.result && prev.result.ok === true;
|
|
275515
|
+
if (canReplay) {
|
|
275516
|
+
const result2 = serializableClone(prev.result) || {};
|
|
275517
|
+
if (result2 && typeof result2 === "object") {
|
|
275518
|
+
if (fase !== undefined)
|
|
275519
|
+
result2.fase = fase;
|
|
275520
|
+
result2.replay = true;
|
|
275521
|
+
}
|
|
275522
|
+
journalOut.set(ordinal, {
|
|
275523
|
+
...prev,
|
|
275524
|
+
ordinal,
|
|
275525
|
+
key,
|
|
275526
|
+
hash,
|
|
275527
|
+
...fase !== undefined ? { fase } : {},
|
|
275528
|
+
replay: true
|
|
275529
|
+
});
|
|
275530
|
+
agentResults.push(result2);
|
|
275531
|
+
log(`agent(${norm.tipo}) \u27F2 replay (clave ${key})`);
|
|
275532
|
+
if (onReplay) {
|
|
275533
|
+
try {
|
|
275534
|
+
onReplay({
|
|
275535
|
+
ordinal,
|
|
275536
|
+
key,
|
|
275537
|
+
fase,
|
|
275538
|
+
hash,
|
|
275539
|
+
tipo: norm.tipo,
|
|
275540
|
+
descripcion: norm.descripcion,
|
|
275541
|
+
prompt: norm.prompt,
|
|
275542
|
+
result: result2
|
|
275543
|
+
}, { signal, index: ordinal, fase });
|
|
275544
|
+
} catch {}
|
|
275545
|
+
}
|
|
275546
|
+
return result2;
|
|
275547
|
+
}
|
|
275548
|
+
prefixBroken = true;
|
|
275429
275549
|
log(`agent(${norm.tipo}) \u2192 ${norm.descripcion ? norm.descripcion + " \u2014 " : ""}${truncate3(norm.prompt)}`);
|
|
275430
|
-
const result = await spawn7(norm, { signal, index:
|
|
275550
|
+
const result = await spawn7(norm, { signal, index: ordinal, fase });
|
|
275431
275551
|
agentResults.push(result);
|
|
275432
|
-
|
|
275552
|
+
const ok = !(result && result.ok === false);
|
|
275553
|
+
journalOut.set(ordinal, {
|
|
275554
|
+
ordinal,
|
|
275555
|
+
key,
|
|
275556
|
+
hash,
|
|
275557
|
+
tipo: norm.tipo,
|
|
275558
|
+
descripcion: norm.descripcion,
|
|
275559
|
+
...fase !== undefined ? { fase } : {},
|
|
275560
|
+
status: ok ? "completed" : "failed",
|
|
275561
|
+
result: serializableClone(result)
|
|
275562
|
+
});
|
|
275563
|
+
if (!ok) {
|
|
275433
275564
|
log(`agent(${norm.tipo}) \u2717 ${result.error ? result.error.message : "fall\xF3"}`);
|
|
275434
275565
|
} else {
|
|
275435
275566
|
log(`agent(${norm.tipo}) \u2713 (${result?.durationMs ?? 0}ms)`);
|
|
@@ -275531,7 +275662,7 @@ function createWorkflowRuntime(options2 = {}) {
|
|
|
275531
275662
|
runId,
|
|
275532
275663
|
signal
|
|
275533
275664
|
};
|
|
275534
|
-
return { ctx, logs: logs2, agentResults, runId };
|
|
275665
|
+
return { ctx, logs: logs2, agentResults, runId, journal: journalOut };
|
|
275535
275666
|
}
|
|
275536
275667
|
function lazyRunAgent() {
|
|
275537
275668
|
if (!_runAgentCached) {
|
|
@@ -275783,8 +275914,13 @@ async function persistWorkflowRun(record3, options2 = {}) {
|
|
|
275783
275914
|
}
|
|
275784
275915
|
async function executeWorkflow(opts = {}) {
|
|
275785
275916
|
const startedAt = Date.now();
|
|
275786
|
-
const runId = opts.runId ?? generateRunId();
|
|
275917
|
+
const runId = opts.resumeRunId ?? opts.runId ?? generateRunId();
|
|
275787
275918
|
const cwd2 = opts.cwd ?? process.cwd();
|
|
275919
|
+
let journalIn = opts.journal;
|
|
275920
|
+
if (!journalIn && opts.resumeRunId) {
|
|
275921
|
+
journalIn = await loadRunJournal(opts.resumeRunId, cwd2);
|
|
275922
|
+
}
|
|
275923
|
+
const resumed = !!(journalIn || opts.resumeRunId || opts.invalidateAll || opts.invalidatedKeys && typeof opts.invalidatedKeys[Symbol.iterator] === "function");
|
|
275788
275924
|
const finish = async (record3) => {
|
|
275789
275925
|
const persistedPath = await persistWorkflowRun(record3, { cwd: cwd2 });
|
|
275790
275926
|
return persistedPath ? { ...record3, persistedPath } : record3;
|
|
@@ -275798,6 +275934,8 @@ async function executeWorkflow(opts = {}) {
|
|
|
275798
275934
|
result: undefined,
|
|
275799
275935
|
logs: logs2,
|
|
275800
275936
|
agents,
|
|
275937
|
+
journal: serializeJournal(null),
|
|
275938
|
+
resumed,
|
|
275801
275939
|
startedAt,
|
|
275802
275940
|
finishedAt: finishedAt2,
|
|
275803
275941
|
durationMs: finishedAt2 - startedAt,
|
|
@@ -275830,7 +275968,11 @@ async function executeWorkflow(opts = {}) {
|
|
|
275830
275968
|
meta: entry.meta,
|
|
275831
275969
|
signal: opts.signal,
|
|
275832
275970
|
runId,
|
|
275833
|
-
onLog: opts.onLog
|
|
275971
|
+
onLog: opts.onLog,
|
|
275972
|
+
journal: journalIn,
|
|
275973
|
+
invalidatedKeys: opts.invalidatedKeys,
|
|
275974
|
+
invalidateAll: opts.invalidateAll,
|
|
275975
|
+
onReplay: opts.onReplay
|
|
275834
275976
|
});
|
|
275835
275977
|
let result;
|
|
275836
275978
|
let error40;
|
|
@@ -275847,6 +275989,8 @@ async function executeWorkflow(opts = {}) {
|
|
|
275847
275989
|
result,
|
|
275848
275990
|
logs: rt.logs,
|
|
275849
275991
|
agents: rt.agentResults,
|
|
275992
|
+
journal: serializeJournal(rt.journal),
|
|
275993
|
+
resumed,
|
|
275850
275994
|
startedAt,
|
|
275851
275995
|
finishedAt,
|
|
275852
275996
|
durationMs: finishedAt - startedAt,
|
|
@@ -275876,6 +276020,7 @@ var exports_LocalWorkflowTask = {};
|
|
|
275876
276020
|
__export(exports_LocalWorkflowTask, {
|
|
275877
276021
|
startWorkflowTask: () => startWorkflowTask,
|
|
275878
276022
|
skipWorkflowAgent: () => skipWorkflowAgent,
|
|
276023
|
+
retryWorkflowRun: () => retryWorkflowRun,
|
|
275879
276024
|
retryWorkflowAgent: () => retryWorkflowAgent,
|
|
275880
276025
|
killWorkflowTask: () => killWorkflowTask,
|
|
275881
276026
|
isLocalWorkflowTask: () => isLocalWorkflowTask,
|
|
@@ -275970,7 +276115,8 @@ function startWorkflowTask(opts) {
|
|
|
275970
276115
|
model,
|
|
275971
276116
|
gate,
|
|
275972
276117
|
toolUseId,
|
|
275973
|
-
setAppState
|
|
276118
|
+
setAppState,
|
|
276119
|
+
runAgent: runAgentImpl
|
|
275974
276120
|
} = opts;
|
|
275975
276121
|
const id = generateTaskId("local_workflow");
|
|
275976
276122
|
const runId = generateRunId();
|
|
@@ -275994,18 +276140,24 @@ function startWorkflowTask(opts) {
|
|
|
275994
276140
|
try {
|
|
275995
276141
|
initTaskOutput(id);
|
|
275996
276142
|
} catch {}
|
|
275997
|
-
const abortController = new AbortController;
|
|
275998
276143
|
const control = {
|
|
275999
|
-
abortController,
|
|
276144
|
+
abortController: new AbortController,
|
|
276000
276145
|
agentControllers: new Map,
|
|
276001
276146
|
specs: new Map,
|
|
276147
|
+
journal: undefined,
|
|
276148
|
+
entry: undefined,
|
|
276149
|
+
running: false,
|
|
276002
276150
|
respawn: async () => {
|
|
276003
276151
|
return;
|
|
276152
|
+
},
|
|
276153
|
+
retryAll: async () => {
|
|
276154
|
+
return;
|
|
276004
276155
|
}
|
|
276005
276156
|
};
|
|
276006
276157
|
ACTIVE_RUNS.set(id, control);
|
|
276007
276158
|
let agentCounter = 0;
|
|
276008
276159
|
const getCounter = () => ++agentCounter;
|
|
276160
|
+
const attemptsByAgent = new Map;
|
|
276009
276161
|
const makeOnMessage = (agentId) => (m) => {
|
|
276010
276162
|
try {
|
|
276011
276163
|
if (!m || m.type !== "assistant" || !m.message)
|
|
@@ -276039,15 +276191,19 @@ function startWorkflowTask(opts) {
|
|
|
276039
276191
|
});
|
|
276040
276192
|
} catch {}
|
|
276041
276193
|
};
|
|
276042
|
-
const instrumentedSpawner = (agentId,
|
|
276194
|
+
const instrumentedSpawner = (agentId, attempt) => createRunAgentSpawner({
|
|
276043
276195
|
toolUseContext: context2,
|
|
276044
276196
|
canUseTool,
|
|
276045
276197
|
model,
|
|
276046
276198
|
runId,
|
|
276047
|
-
transcriptSubdir: `${WORKFLOWS_DIR_NAME}/${runId}/${agentId}${
|
|
276048
|
-
onMessage: makeOnMessage(agentId)
|
|
276049
|
-
|
|
276050
|
-
|
|
276199
|
+
transcriptSubdir: `${WORKFLOWS_DIR_NAME}/${runId}/${agentId}${attempt > 1 ? `-r${attempt}` : ""}`,
|
|
276200
|
+
onMessage: makeOnMessage(agentId),
|
|
276201
|
+
...runAgentImpl ? { runAgent: runAgentImpl } : {}
|
|
276202
|
+
});
|
|
276203
|
+
async function runAgentAttempt({ agentId, norm, index, runSignal, fase }) {
|
|
276204
|
+
const attempt = (attemptsByAgent.get(agentId) || 0) + 1;
|
|
276205
|
+
attemptsByAgent.set(agentId, attempt);
|
|
276206
|
+
const isRetry = attempt > 1;
|
|
276051
276207
|
const ac = new AbortController;
|
|
276052
276208
|
control.agentControllers.set(agentId, ac);
|
|
276053
276209
|
control.specs.set(agentId, norm);
|
|
@@ -276060,21 +276216,17 @@ function startWorkflowTask(opts) {
|
|
|
276060
276216
|
status: "running",
|
|
276061
276217
|
endTime: undefined,
|
|
276062
276218
|
error: undefined,
|
|
276219
|
+
replay: false,
|
|
276220
|
+
attempts: attempt,
|
|
276063
276221
|
startTime: Date.now(),
|
|
276064
276222
|
...fase !== undefined ? { fase } : {}
|
|
276065
276223
|
}, setAppState);
|
|
276066
276224
|
if (isRetry) {
|
|
276067
|
-
updateTaskState(id, setAppState, (task) => {
|
|
276068
|
-
if (!isLocalWorkflowTask(task))
|
|
276069
|
-
return task;
|
|
276070
|
-
const agents = task.agents.map((a2) => a2.id === agentId ? { ...a2, attempts: (a2.attempts || 1) + 1 } : a2);
|
|
276071
|
-
return { ...task, agents };
|
|
276072
|
-
});
|
|
276073
276225
|
pushLog(id, `\u21BB reintentando subagente ${norm.tipo}`, setAppState);
|
|
276074
276226
|
} else {
|
|
276075
276227
|
pushLog(id, `\u25B8 subagente ${norm.tipo} iniciado`, setAppState);
|
|
276076
276228
|
}
|
|
276077
|
-
const spawner = instrumentedSpawner(agentId,
|
|
276229
|
+
const spawner = instrumentedSpawner(agentId, attempt);
|
|
276078
276230
|
let result;
|
|
276079
276231
|
try {
|
|
276080
276232
|
result = await spawner(norm, { signal: ac.signal, index });
|
|
@@ -276097,47 +276249,66 @@ function startWorkflowTask(opts) {
|
|
|
276097
276249
|
return result;
|
|
276098
276250
|
}
|
|
276099
276251
|
const trackedSpawn = async (norm, runCtx = {}) => {
|
|
276100
|
-
const n2 = getCounter();
|
|
276252
|
+
const n2 = runCtx.index ?? getCounter();
|
|
276101
276253
|
const agentId = `${runId}-a${n2}`;
|
|
276102
276254
|
return runAgentAttempt({
|
|
276103
276255
|
agentId,
|
|
276104
276256
|
norm,
|
|
276105
276257
|
index: n2,
|
|
276106
276258
|
runSignal: runCtx.signal,
|
|
276107
|
-
isRetry: false,
|
|
276108
276259
|
fase: runCtx.fase
|
|
276109
276260
|
});
|
|
276110
276261
|
};
|
|
276111
|
-
|
|
276112
|
-
const
|
|
276113
|
-
|
|
276114
|
-
|
|
276115
|
-
|
|
276116
|
-
|
|
276117
|
-
|
|
276118
|
-
|
|
276119
|
-
|
|
276120
|
-
|
|
276121
|
-
|
|
276262
|
+
const onReplayHandler = (entry, runCtx) => {
|
|
276263
|
+
const n2 = runCtx.index;
|
|
276264
|
+
const agentId = `${runId}-a${n2}`;
|
|
276265
|
+
const r = entry && entry.result || {};
|
|
276266
|
+
upsertAgent(id, agentId, {
|
|
276267
|
+
tipo: entry.tipo,
|
|
276268
|
+
descripcion: entry.descripcion,
|
|
276269
|
+
prompt: entry.prompt,
|
|
276270
|
+
status: "completed",
|
|
276271
|
+
startTime: Date.now(),
|
|
276272
|
+
endTime: Date.now(),
|
|
276273
|
+
durationMs: r.durationMs,
|
|
276274
|
+
text: r.text,
|
|
276275
|
+
error: undefined,
|
|
276276
|
+
replay: true,
|
|
276277
|
+
...entry.fase !== undefined ? { fase: entry.fase } : {}
|
|
276278
|
+
}, setAppState);
|
|
276279
|
+
pushLog(id, `\u27F2 replay subagente ${entry.tipo || "agente"} (clave a${n2})`, setAppState);
|
|
276122
276280
|
};
|
|
276123
|
-
|
|
276124
|
-
|
|
276125
|
-
|
|
276126
|
-
entry = await resolveWorkflow(workflow, { cwd: cwd2, gate });
|
|
276127
|
-
} catch (e) {
|
|
276128
|
-
finalizeFailed(id, errMessage(e), setAppState);
|
|
276129
|
-
ACTIVE_RUNS.delete(id);
|
|
276281
|
+
async function runOnce({ journalIn, invalidatedKeys, invalidateAll } = {}) {
|
|
276282
|
+
if (control.running) {
|
|
276283
|
+
pushLog(id, "Ya hay una (re)ejecuci\xF3n en curso; reintento ignorado.", setAppState);
|
|
276130
276284
|
return;
|
|
276131
276285
|
}
|
|
276132
|
-
|
|
276286
|
+
control.running = true;
|
|
276287
|
+
control.abortController = new AbortController;
|
|
276288
|
+
agentCounter = 0;
|
|
276289
|
+
if (!control.entry) {
|
|
276290
|
+
let entry;
|
|
276291
|
+
try {
|
|
276292
|
+
entry = await resolveWorkflow(workflow, { cwd: cwd2, gate });
|
|
276293
|
+
} catch (e) {
|
|
276294
|
+
finalizeFailed(id, errMessage(e), setAppState);
|
|
276295
|
+
control.running = false;
|
|
276296
|
+
ACTIVE_RUNS.delete(id);
|
|
276297
|
+
return;
|
|
276298
|
+
}
|
|
276299
|
+
control.entry = entry;
|
|
276300
|
+
const workflowName2 = entry.meta && (entry.meta.nombre || entry.meta.name) || entry.id;
|
|
276301
|
+
updateTaskState(id, setAppState, (task) => {
|
|
276302
|
+
if (!isLocalWorkflowTask(task))
|
|
276303
|
+
return task;
|
|
276304
|
+
return { ...task, workflowName: workflowName2, description: `workflow ${workflowName2}` };
|
|
276305
|
+
});
|
|
276306
|
+
}
|
|
276307
|
+
const workflowName = control.entry.meta ? control.entry.meta.nombre || control.entry.meta.name || control.entry.id : control.entry.id;
|
|
276133
276308
|
updateTaskState(id, setAppState, (task) => {
|
|
276134
276309
|
if (!isLocalWorkflowTask(task))
|
|
276135
276310
|
return task;
|
|
276136
|
-
return {
|
|
276137
|
-
...task,
|
|
276138
|
-
workflowName,
|
|
276139
|
-
description: `workflow ${workflowName}`
|
|
276140
|
-
};
|
|
276311
|
+
return { ...task, status: "running", endTime: undefined, error: undefined };
|
|
276141
276312
|
});
|
|
276142
276313
|
let lastEmit = 0;
|
|
276143
276314
|
const maybeEmit = () => {
|
|
@@ -276162,33 +276333,54 @@ function startWorkflowTask(opts) {
|
|
|
276162
276333
|
let runResult;
|
|
276163
276334
|
try {
|
|
276164
276335
|
runResult = await executeWorkflow({
|
|
276165
|
-
workflow: entry,
|
|
276336
|
+
workflow: control.entry,
|
|
276166
276337
|
args,
|
|
276167
276338
|
cwd: cwd2,
|
|
276168
276339
|
runId,
|
|
276169
|
-
signal: abortController.signal,
|
|
276340
|
+
signal: control.abortController.signal,
|
|
276170
276341
|
spawn: trackedSpawn,
|
|
276171
276342
|
onLog: (logEntry) => {
|
|
276172
276343
|
pushLog(id, logEntry.text, setAppState);
|
|
276173
276344
|
maybeEmit();
|
|
276174
|
-
}
|
|
276345
|
+
},
|
|
276346
|
+
onReplay: onReplayHandler,
|
|
276347
|
+
journal: journalIn,
|
|
276348
|
+
invalidatedKeys,
|
|
276349
|
+
invalidateAll
|
|
276175
276350
|
});
|
|
276176
276351
|
} catch (e) {
|
|
276177
276352
|
finalizeFailed(id, errMessage(e), setAppState);
|
|
276353
|
+
control.running = false;
|
|
276178
276354
|
ACTIVE_RUNS.delete(id);
|
|
276179
276355
|
return;
|
|
276180
276356
|
}
|
|
276181
|
-
|
|
276357
|
+
control.journal = runResult.journal;
|
|
276358
|
+
if (control.abortController.signal.aborted) {
|
|
276182
276359
|
finalizeKilled(id, setAppState);
|
|
276183
276360
|
} else if (runResult.ok) {
|
|
276184
276361
|
finalizeCompleted(id, runResult, setAppState);
|
|
276185
276362
|
} else {
|
|
276186
276363
|
finalizeFailed(id, runResult.error ? runResult.error.message : "El workflow fall\xF3.", setAppState, runResult);
|
|
276187
276364
|
}
|
|
276188
|
-
|
|
276189
|
-
|
|
276365
|
+
control.running = false;
|
|
276366
|
+
return runResult;
|
|
276367
|
+
}
|
|
276368
|
+
control.respawn = async (agentId) => {
|
|
276369
|
+
const ord = ordinalFromAgentId(agentId);
|
|
276370
|
+
if (!Number.isFinite(ord))
|
|
276371
|
+
return;
|
|
276372
|
+
if (!control.journal)
|
|
276373
|
+
return;
|
|
276374
|
+
return runOnce({ journalIn: control.journal, invalidatedKeys: [ord] });
|
|
276375
|
+
};
|
|
276376
|
+
control.retryAll = async () => runOnce({ journalIn: control.journal, invalidateAll: true });
|
|
276377
|
+
runOnce({});
|
|
276190
276378
|
return id;
|
|
276191
276379
|
}
|
|
276380
|
+
function ordinalFromAgentId(agentId) {
|
|
276381
|
+
const m = /-a(\d+)$/.exec(String(agentId || ""));
|
|
276382
|
+
return m ? Number(m[1]) : undefined;
|
|
276383
|
+
}
|
|
276192
276384
|
function serializableResult(value) {
|
|
276193
276385
|
if (value === undefined)
|
|
276194
276386
|
return;
|
|
@@ -276291,6 +276483,12 @@ function retryWorkflowAgent(taskId, agentId, setAppState) {
|
|
|
276291
276483
|
return;
|
|
276292
276484
|
Promise.resolve(control.respawn(agentId)).catch(() => {});
|
|
276293
276485
|
}
|
|
276486
|
+
function retryWorkflowRun(taskId, setAppState) {
|
|
276487
|
+
const control = ACTIVE_RUNS.get(taskId);
|
|
276488
|
+
if (!control)
|
|
276489
|
+
return;
|
|
276490
|
+
Promise.resolve(control.retryAll()).catch(() => {});
|
|
276491
|
+
}
|
|
276294
276492
|
var MAX_LOGS = 200, ACTIVE_RUNS, LocalWorkflowTask, LocalWorkflowTask_default;
|
|
276295
276493
|
var init_LocalWorkflowTask = __esm(() => {
|
|
276296
276494
|
init_Task();
|
|
@@ -277255,9 +277453,9 @@ var init_ProviderTool = __esm(() => {
|
|
|
277255
277453
|
});
|
|
277256
277454
|
|
|
277257
277455
|
// services/knowledge/memory.ts
|
|
277258
|
-
import { createHash as
|
|
277456
|
+
import { createHash as createHash21 } from "crypto";
|
|
277259
277457
|
function addMemory(store, input) {
|
|
277260
|
-
const key = input.key ??
|
|
277458
|
+
const key = input.key ?? createHash21("sha256").update(`${input.title}
|
|
277261
277459
|
${input.text}`).digest("hex").slice(0, 12);
|
|
277262
277460
|
const id = nodeId("memory", key);
|
|
277263
277461
|
const node = store.graph.addNode({
|
|
@@ -277280,12 +277478,12 @@ ${input.text}`).digest("hex").slice(0, 12);
|
|
|
277280
277478
|
var init_memory = () => {};
|
|
277281
277479
|
|
|
277282
277480
|
// services/knowledge/memdirBridge.ts
|
|
277283
|
-
import { createHash as
|
|
277284
|
-
import { mkdir as mkdir26, readFile as
|
|
277481
|
+
import { createHash as createHash22 } from "crypto";
|
|
277482
|
+
import { mkdir as mkdir26, readFile as readFile29, writeFile as writeFile26 } from "fs/promises";
|
|
277285
277483
|
import { join as join90 } from "path";
|
|
277286
277484
|
function memdirKey(text) {
|
|
277287
277485
|
const normalized = text.toLowerCase().replace(/\s+/g, " ").trim();
|
|
277288
|
-
return `memdir-${
|
|
277486
|
+
return `memdir-${createHash22("sha256").update(normalized).digest("hex").slice(0, 12)}`;
|
|
277289
277487
|
}
|
|
277290
277488
|
function slugify(title) {
|
|
277291
277489
|
return title.toLowerCase().normalize("NFD").replace(/[\u0300-\u036F]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "memoria";
|
|
@@ -277313,7 +277511,7 @@ async function syncMemdirToGraph(store, _projectRoot) {
|
|
|
277313
277511
|
try {
|
|
277314
277512
|
let raw;
|
|
277315
277513
|
try {
|
|
277316
|
-
raw = await
|
|
277514
|
+
raw = await readFile29(getAutoMemEntrypoint(), "utf8");
|
|
277317
277515
|
} catch {
|
|
277318
277516
|
return 0;
|
|
277319
277517
|
}
|
|
@@ -277323,7 +277521,7 @@ async function syncMemdirToGraph(store, _projectRoot) {
|
|
|
277323
277521
|
for (const entry of entries) {
|
|
277324
277522
|
if (entry.file) {
|
|
277325
277523
|
try {
|
|
277326
|
-
const topic = await
|
|
277524
|
+
const topic = await readFile29(join90(memdir, entry.file), "utf8");
|
|
277327
277525
|
if (/^origen:\s*grafo\s*$/m.test(topic.slice(0, 400)))
|
|
277328
277526
|
continue;
|
|
277329
277527
|
} catch {}
|
|
@@ -277345,7 +277543,7 @@ async function appendMemoryToMemdir(_projectRoot, title, text) {
|
|
|
277345
277543
|
try {
|
|
277346
277544
|
const memdir = getAutoMemPath();
|
|
277347
277545
|
await mkdir26(memdir, { recursive: true });
|
|
277348
|
-
const hash =
|
|
277546
|
+
const hash = createHash22("sha256").update(`${title}
|
|
277349
277547
|
${text}`).digest("hex").slice(0, 6);
|
|
277350
277548
|
const fileName = `${slugify(title)}-${hash}.md`;
|
|
277351
277549
|
const description = text.replace(/\s+/g, " ").trim().slice(0, 150);
|
|
@@ -277365,7 +277563,7 @@ ${text}`).digest("hex").slice(0, 6);
|
|
|
277365
277563
|
const entrypoint = getAutoMemEntrypoint();
|
|
277366
277564
|
let index = "";
|
|
277367
277565
|
try {
|
|
277368
|
-
index = await
|
|
277566
|
+
index = await readFile29(entrypoint, "utf8");
|
|
277369
277567
|
} catch {}
|
|
277370
277568
|
const pointer = `- [${title.replace(/[\[\]\n]/g, " ").trim()}](${fileName}) \u2014 ${description.slice(0, 100)}`;
|
|
277371
277569
|
if (index.includes(`](${fileName})`))
|
|
@@ -286502,7 +286700,7 @@ var init_TeamDeleteTool = __esm(() => {
|
|
|
286502
286700
|
});
|
|
286503
286701
|
|
|
286504
286702
|
// utils/concurrentSessions.ts
|
|
286505
|
-
import { chmod as chmod7, mkdir as mkdir27, readdir as readdir15, readFile as
|
|
286703
|
+
import { chmod as chmod7, mkdir as mkdir27, readdir as readdir15, readFile as readFile30, unlink as unlink13, writeFile as writeFile29 } from "fs/promises";
|
|
286506
286704
|
import { join as join94 } from "path";
|
|
286507
286705
|
function getSessionsDir() {
|
|
286508
286706
|
return join94(getTheusConfigHomeDir(), "sessions");
|
|
@@ -286547,7 +286745,7 @@ async function registerSession() {
|
|
|
286547
286745
|
async function updatePidFile(patch) {
|
|
286548
286746
|
const pidFile = join94(getSessionsDir(), `${process.pid}.json`);
|
|
286549
286747
|
try {
|
|
286550
|
-
const data = jsonParse(await
|
|
286748
|
+
const data = jsonParse(await readFile30(pidFile, "utf8"));
|
|
286551
286749
|
await writeFile29(pidFile, jsonStringify({ ...data, ...patch }));
|
|
286552
286750
|
} catch (e) {
|
|
286553
286751
|
logForDebugging(`[concurrentSessions] updatePidFile failed: ${errorMessage(e)}`);
|
|
@@ -287341,7 +287539,7 @@ __export(exports_udsInbox, {
|
|
|
287341
287539
|
getDefaultUdsSocketPath: () => getDefaultUdsSocketPath
|
|
287342
287540
|
});
|
|
287343
287541
|
import { createConnection as createConnection2, createServer as createServer6 } from "net";
|
|
287344
|
-
import { chmod as chmod8, mkdir as mkdir28, readdir as readdir16, readFile as
|
|
287542
|
+
import { chmod as chmod8, mkdir as mkdir28, readdir as readdir16, readFile as readFile31, stat as stat31, unlink as unlink14 } from "fs/promises";
|
|
287345
287543
|
import { statSync as statSync8 } from "fs";
|
|
287346
287544
|
import { tmpdir as tmpdir7 } from "os";
|
|
287347
287545
|
import { dirname as dirname37, join as join95 } from "path";
|
|
@@ -287722,7 +287920,7 @@ async function listAllLiveSessions() {
|
|
|
287722
287920
|
if (!isProcessRunning(pid))
|
|
287723
287921
|
return;
|
|
287724
287922
|
try {
|
|
287725
|
-
const data = jsonParse(await
|
|
287923
|
+
const data = jsonParse(await readFile31(join95(dir, file2), "utf8"));
|
|
287726
287924
|
out.push({ ...data, pid });
|
|
287727
287925
|
} catch {}
|
|
287728
287926
|
}));
|
|
@@ -299853,7 +300051,7 @@ var init_config5 = __esm(() => {
|
|
|
299853
300051
|
|
|
299854
300052
|
// utils/readFileInRange.ts
|
|
299855
300053
|
import { createReadStream as createReadStream2, fstat } from "fs";
|
|
299856
|
-
import { stat as fsStat3, readFile as
|
|
300054
|
+
import { stat as fsStat3, readFile as readFile32 } from "fs/promises";
|
|
299857
300055
|
async function readFileInRange(filePath, offset = 0, maxLines, maxBytes, signal, options2) {
|
|
299858
300056
|
signal?.throwIfAborted();
|
|
299859
300057
|
const truncateOnByteLimit = options2?.truncateOnByteLimit ?? false;
|
|
@@ -299865,7 +300063,7 @@ async function readFileInRange(filePath, offset = 0, maxLines, maxBytes, signal,
|
|
|
299865
300063
|
if (!truncateOnByteLimit && maxBytes !== undefined && stats.size > maxBytes) {
|
|
299866
300064
|
throw new FileTooLargeError(stats.size, maxBytes);
|
|
299867
300065
|
}
|
|
299868
|
-
const text = await
|
|
300066
|
+
const text = await readFile32(filePath, { encoding: "utf8", signal });
|
|
299869
300067
|
return readFileInRangeFast(text, stats.mtimeMs, offset, maxLines, truncateOnByteLimit ? maxBytes : undefined);
|
|
299870
300068
|
}
|
|
299871
300069
|
return readFileInRangeStreaming(filePath, offset, maxLines, maxBytes, truncateOnByteLimit, signal);
|
|
@@ -302025,7 +302223,7 @@ var init_heuristicRouter = __esm(() => {
|
|
|
302025
302223
|
});
|
|
302026
302224
|
|
|
302027
302225
|
// services/router/llmJudgeRouter.ts
|
|
302028
|
-
import { createHash as
|
|
302226
|
+
import { createHash as createHash23 } from "crypto";
|
|
302029
302227
|
function pickCheapJudge(catalog) {
|
|
302030
302228
|
const withTools = catalog.filter((c5) => c5.supportsTools && c5.enabled !== false);
|
|
302031
302229
|
if (withTools.length === 0)
|
|
@@ -302159,7 +302357,7 @@ class LlmJudgeRouter {
|
|
|
302159
302357
|
if (!judgeCard)
|
|
302160
302358
|
return base2;
|
|
302161
302359
|
const prompt = buildJudgePrompt(ctx, candidates);
|
|
302162
|
-
const key =
|
|
302360
|
+
const key = createHash23("sha256").update(prompt).digest("hex");
|
|
302163
302361
|
const cached3 = this.cache.get(key);
|
|
302164
302362
|
if (cached3) {
|
|
302165
302363
|
const card = candidates.find((c5) => candidateId(c5) === cached3.id);
|
|
@@ -303396,9 +303594,9 @@ function getTheusEnvMetadata() {
|
|
|
303396
303594
|
};
|
|
303397
303595
|
}
|
|
303398
303596
|
function getBuildAgeMinutes() {
|
|
303399
|
-
if (!{ VERSION: "0.2.
|
|
303597
|
+
if (!{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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)
|
|
303400
303598
|
return;
|
|
303401
|
-
const buildTime = new Date({ VERSION: "0.2.
|
|
303599
|
+
const buildTime = new Date({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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();
|
|
303402
303600
|
if (isNaN(buildTime))
|
|
303403
303601
|
return;
|
|
303404
303602
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -304088,7 +304286,7 @@ var init_types11 = __esm(() => {
|
|
|
304088
304286
|
});
|
|
304089
304287
|
|
|
304090
304288
|
// services/internalLogging.ts
|
|
304091
|
-
import { readFile as
|
|
304289
|
+
import { readFile as readFile33 } from "fs/promises";
|
|
304092
304290
|
async function logPermissionContextForAnts(toolPermissionContext, moment) {
|
|
304093
304291
|
if (process.env.USER_TYPE !== "ant") {
|
|
304094
304292
|
return;
|
|
@@ -304112,7 +304310,7 @@ var init_internalLogging = __esm(() => {
|
|
|
304112
304310
|
const namespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace";
|
|
304113
304311
|
const namespaceNotFound = "namespace not found";
|
|
304114
304312
|
try {
|
|
304115
|
-
const content = await
|
|
304313
|
+
const content = await readFile33(namespacePath, { encoding: "utf8" });
|
|
304116
304314
|
return content.trim();
|
|
304117
304315
|
} catch {
|
|
304118
304316
|
return namespaceNotFound;
|
|
@@ -304126,7 +304324,7 @@ var init_internalLogging = __esm(() => {
|
|
|
304126
304324
|
const containerIdNotFound = "container ID not found";
|
|
304127
304325
|
const containerIdNotFoundInMountinfo = "container ID not found in mountinfo";
|
|
304128
304326
|
try {
|
|
304129
|
-
const mountinfo = (await
|
|
304327
|
+
const mountinfo = (await readFile33(containerIdPath, { encoding: "utf8" })).trim();
|
|
304130
304328
|
const containerIdPattern = /(?:\/docker\/containers\/|\/sandboxes\/)([0-9a-f]{64})/;
|
|
304131
304329
|
const lines = mountinfo.split(`
|
|
304132
304330
|
`);
|
|
@@ -305463,7 +305661,7 @@ var init_postCompactCleanup = __esm(() => {
|
|
|
305463
305661
|
});
|
|
305464
305662
|
|
|
305465
305663
|
// services/SessionMemory/prompts.ts
|
|
305466
|
-
import { readFile as
|
|
305664
|
+
import { readFile as readFile34 } from "fs/promises";
|
|
305467
305665
|
import { join as join100 } from "path";
|
|
305468
305666
|
function getDefaultUpdatePrompt() {
|
|
305469
305667
|
return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "note-taking", "session notes extraction", or these update instructions in the notes content.
|
|
@@ -305507,7 +305705,7 @@ REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edit
|
|
|
305507
305705
|
async function loadSessionMemoryTemplate() {
|
|
305508
305706
|
const templatePath = join100(getTheusConfigHomeDir(), "session-memory", "config", "template.md");
|
|
305509
305707
|
try {
|
|
305510
|
-
return await
|
|
305708
|
+
return await readFile34(templatePath, { encoding: "utf-8" });
|
|
305511
305709
|
} catch (e) {
|
|
305512
305710
|
const code = getErrnoCode(e);
|
|
305513
305711
|
if (code === "ENOENT") {
|
|
@@ -305520,7 +305718,7 @@ async function loadSessionMemoryTemplate() {
|
|
|
305520
305718
|
async function loadSessionMemoryPrompt() {
|
|
305521
305719
|
const promptPath = join100(getTheusConfigHomeDir(), "session-memory", "config", "prompt.md");
|
|
305522
305720
|
try {
|
|
305523
|
-
return await
|
|
305721
|
+
return await readFile34(promptPath, { encoding: "utf-8" });
|
|
305524
305722
|
} catch (e) {
|
|
305525
305723
|
const code = getErrnoCode(e);
|
|
305526
305724
|
if (code === "ENOENT") {
|
|
@@ -307134,8 +307332,8 @@ var init_toolSearch = __esm(() => {
|
|
|
307134
307332
|
});
|
|
307135
307333
|
|
|
307136
307334
|
// services/vcr.ts
|
|
307137
|
-
import { createHash as
|
|
307138
|
-
import { mkdir as mkdir30, readFile as
|
|
307335
|
+
import { createHash as createHash24, randomUUID as randomUUID23 } from "crypto";
|
|
307336
|
+
import { mkdir as mkdir30, readFile as readFile35, writeFile as writeFile31 } from "fs/promises";
|
|
307139
307337
|
import { dirname as dirname39, join as join101 } from "path";
|
|
307140
307338
|
function shouldUseVCR() {
|
|
307141
307339
|
if (false) {}
|
|
@@ -307148,10 +307346,10 @@ async function withFixture(input, fixtureName, f) {
|
|
|
307148
307346
|
if (!shouldUseVCR()) {
|
|
307149
307347
|
return await f();
|
|
307150
307348
|
}
|
|
307151
|
-
const hash =
|
|
307349
|
+
const hash = createHash24("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
|
|
307152
307350
|
const filename = join101(process.env.THEUS_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
|
|
307153
307351
|
try {
|
|
307154
|
-
const cached3 = jsonParse(await
|
|
307352
|
+
const cached3 = jsonParse(await readFile35(filename, { encoding: "utf8" }));
|
|
307155
307353
|
return cached3;
|
|
307156
307354
|
} catch (e) {
|
|
307157
307355
|
const code = getErrnoCode(e);
|
|
@@ -307183,9 +307381,9 @@ async function withVCR(messages, f) {
|
|
|
307183
307381
|
return true;
|
|
307184
307382
|
}));
|
|
307185
307383
|
const dehydratedInput = mapMessages(messagesForAPI.map((_) => _.message.content), dehydrateValue);
|
|
307186
|
-
const filename = join101(process.env.THEUS_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) =>
|
|
307384
|
+
const filename = join101(process.env.THEUS_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) => createHash24("sha1").update(jsonStringify(_)).digest("hex").slice(0, 6)).join("-")}.json`);
|
|
307187
307385
|
try {
|
|
307188
|
-
const cached3 = jsonParse(await
|
|
307386
|
+
const cached3 = jsonParse(await readFile35(filename, { encoding: "utf8" }));
|
|
307189
307387
|
cached3.output.forEach(addCachedCostToTotalSessionCost);
|
|
307190
307388
|
return cached3.output.map((message, index) => mapMessage(message, hydrateValue, index, randomUUID23()));
|
|
307191
307389
|
} catch (e) {
|
|
@@ -307649,7 +307847,7 @@ var init_tokenEstimation = __esm(() => {
|
|
|
307649
307847
|
|
|
307650
307848
|
// utils/pdf.ts
|
|
307651
307849
|
import { randomUUID as randomUUID24 } from "crypto";
|
|
307652
|
-
import { mkdir as mkdir31, readdir as readdir18, readFile as
|
|
307850
|
+
import { mkdir as mkdir31, readdir as readdir18, readFile as readFile36 } from "fs/promises";
|
|
307653
307851
|
import { join as join102 } from "path";
|
|
307654
307852
|
async function readPDF(filePath) {
|
|
307655
307853
|
try {
|
|
@@ -307671,7 +307869,7 @@ async function readPDF(filePath) {
|
|
|
307671
307869
|
}
|
|
307672
307870
|
};
|
|
307673
307871
|
}
|
|
307674
|
-
const fileBuffer = await
|
|
307872
|
+
const fileBuffer = await readFile36(filePath);
|
|
307675
307873
|
const header = fileBuffer.subarray(0, 5).toString("ascii");
|
|
307676
307874
|
if (!header.startsWith("%PDF-")) {
|
|
307677
307875
|
return {
|
|
@@ -311445,7 +311643,7 @@ import {
|
|
|
311445
311643
|
chmod as chmod9,
|
|
311446
311644
|
lstat as lstat5,
|
|
311447
311645
|
readdir as readdir21,
|
|
311448
|
-
readFile as
|
|
311646
|
+
readFile as readFile37,
|
|
311449
311647
|
rename as rename3,
|
|
311450
311648
|
rm as rm5,
|
|
311451
311649
|
stat as stat35,
|
|
@@ -311590,7 +311788,7 @@ async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
|
311590
311788
|
await collectFilesForZip(baseDir, relPath, files, visited);
|
|
311591
311789
|
} else if (fileStat.isFile()) {
|
|
311592
311790
|
try {
|
|
311593
|
-
const content = await
|
|
311791
|
+
const content = await readFile37(fullPath);
|
|
311594
311792
|
files[relPath] = [
|
|
311595
311793
|
new Uint8Array(content),
|
|
311596
311794
|
{ os: 3, attrs: (fileStat.mode & 65535) << 16 }
|
|
@@ -312101,7 +312299,7 @@ var init_marketplaceHelpers = __esm(() => {
|
|
|
312101
312299
|
});
|
|
312102
312300
|
|
|
312103
312301
|
// utils/plugins/officialMarketplaceGcs.ts
|
|
312104
|
-
import { chmod as chmod10, mkdir as mkdir32, readFile as
|
|
312302
|
+
import { chmod as chmod10, mkdir as mkdir32, readFile as readFile38, rename as rename4, rm as rm7, writeFile as writeFile34 } from "fs/promises";
|
|
312105
312303
|
import { dirname as dirname43, join as join107, resolve as resolve36, sep as sep22 } from "path";
|
|
312106
312304
|
async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
|
|
312107
312305
|
const cacheDir = resolve36(marketplacesCacheDir);
|
|
@@ -312126,7 +312324,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
312126
312324
|
throw new Error("latest pointer returned empty body");
|
|
312127
312325
|
}
|
|
312128
312326
|
const sentinelPath = join107(installLocation, ".gcs-sha");
|
|
312129
|
-
const currentSha = await
|
|
312327
|
+
const currentSha = await readFile38(sentinelPath, "utf8").then((s) => s.trim(), () => null);
|
|
312130
312328
|
if (currentSha === sha) {
|
|
312131
312329
|
outcome = "noop";
|
|
312132
312330
|
return sha;
|
|
@@ -313935,7 +314133,7 @@ var init_managedPlugins = __esm(() => {
|
|
|
313935
314133
|
});
|
|
313936
314134
|
|
|
313937
314135
|
// utils/plugins/pluginVersioning.ts
|
|
313938
|
-
import { createHash as
|
|
314136
|
+
import { createHash as createHash25 } from "crypto";
|
|
313939
314137
|
async function calculatePluginVersion(pluginId, source, manifest, installPath, providedVersion, gitCommitSha) {
|
|
313940
314138
|
if (manifest?.version) {
|
|
313941
314139
|
logForDebugging(`Using manifest version for ${pluginId}: ${manifest.version}`);
|
|
@@ -313949,7 +314147,7 @@ async function calculatePluginVersion(pluginId, source, manifest, installPath, p
|
|
|
313949
314147
|
const shortSha = gitCommitSha.substring(0, 12);
|
|
313950
314148
|
if (typeof source === "object" && source.source === "git-subdir") {
|
|
313951
314149
|
const normPath = source.path.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
313952
|
-
const pathHash =
|
|
314150
|
+
const pathHash = createHash25("sha256").update(normPath).digest("hex").substring(0, 8);
|
|
313953
314151
|
const v = `${shortSha}-${pathHash}`;
|
|
313954
314152
|
logForDebugging(`Using git-subdir SHA+path version for ${pluginId}: ${v} (path=${normPath})`);
|
|
313955
314153
|
return v;
|
|
@@ -314230,7 +314428,7 @@ var init_pluginInstallationHelpers = __esm(() => {
|
|
|
314230
314428
|
import {
|
|
314231
314429
|
copyFile as copyFile7,
|
|
314232
314430
|
readdir as readdir23,
|
|
314233
|
-
readFile as
|
|
314431
|
+
readFile as readFile39,
|
|
314234
314432
|
readlink as readlink2,
|
|
314235
314433
|
realpath as realpath11,
|
|
314236
314434
|
rename as rename6,
|
|
@@ -314630,7 +314828,7 @@ async function cachePlugin(source, options2) {
|
|
|
314630
314828
|
let manifest;
|
|
314631
314829
|
if (await pathExists(manifestPath)) {
|
|
314632
314830
|
try {
|
|
314633
|
-
const content = await
|
|
314831
|
+
const content = await readFile39(manifestPath, { encoding: "utf-8" });
|
|
314634
314832
|
const parsed = jsonParse(content);
|
|
314635
314833
|
const result = PluginManifestSchema().safeParse(parsed);
|
|
314636
314834
|
if (result.success) {
|
|
@@ -314654,7 +314852,7 @@ async function cachePlugin(source, options2) {
|
|
|
314654
314852
|
}
|
|
314655
314853
|
} else if (await pathExists(legacyManifestPath)) {
|
|
314656
314854
|
try {
|
|
314657
|
-
const content = await
|
|
314855
|
+
const content = await readFile39(legacyManifestPath, {
|
|
314658
314856
|
encoding: "utf-8"
|
|
314659
314857
|
});
|
|
314660
314858
|
const parsed = jsonParse(content);
|
|
@@ -314704,7 +314902,7 @@ async function loadPluginManifest(manifestPath, pluginName, source) {
|
|
|
314704
314902
|
};
|
|
314705
314903
|
}
|
|
314706
314904
|
try {
|
|
314707
|
-
const content = await
|
|
314905
|
+
const content = await readFile39(manifestPath, { encoding: "utf-8" });
|
|
314708
314906
|
const parsedJson = jsonParse(content);
|
|
314709
314907
|
const result = PluginManifestSchema().safeParse(parsedJson);
|
|
314710
314908
|
if (result.success) {
|
|
@@ -314730,7 +314928,7 @@ async function loadPluginHooks2(hooksConfigPath, pluginName) {
|
|
|
314730
314928
|
if (!await pathExists(hooksConfigPath)) {
|
|
314731
314929
|
throw new Error(`Hooks file not found at ${hooksConfigPath} for plugin ${pluginName}. If the manifest declares hooks, the file must exist.`);
|
|
314732
314930
|
}
|
|
314733
|
-
const content = await
|
|
314931
|
+
const content = await readFile39(hooksConfigPath, { encoding: "utf-8" });
|
|
314734
314932
|
const rawHooksConfig = jsonParse(content);
|
|
314735
314933
|
const validatedPluginHooks = PluginHooksSchema().parse(rawHooksConfig);
|
|
314736
314934
|
return validatedPluginHooks.hooks;
|
|
@@ -315033,7 +315231,7 @@ function parsePluginSettings(raw) {
|
|
|
315033
315231
|
async function loadPluginSettings(pluginPath, manifest) {
|
|
315034
315232
|
const settingsJsonPath = join111(pluginPath, "settings.json");
|
|
315035
315233
|
try {
|
|
315036
|
-
const content = await
|
|
315234
|
+
const content = await readFile39(settingsJsonPath, { encoding: "utf-8" });
|
|
315037
315235
|
const parsed = jsonParse(content);
|
|
315038
315236
|
if (isRecord(parsed)) {
|
|
315039
315237
|
const filtered = parsePluginSettings(parsed);
|
|
@@ -319852,7 +320050,7 @@ function getAssistantMessageFromError(error40, model, options2) {
|
|
|
319852
320050
|
if (process.env.USER_TYPE === "ant") {
|
|
319853
320051
|
const baseMessage = `API Error: 400 ${error40.message}
|
|
319854
320052
|
|
|
319855
|
-
Run /share and post the JSON file to ${{ VERSION: "0.2.
|
|
320053
|
+
Run /share and post the JSON file to ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}.`;
|
|
319856
320054
|
const rewindInstruction = getIsNonInteractiveSession() ? "" : " Then, use /rewind to recover the conversation.";
|
|
319857
320055
|
return createAssistantAPIErrorMessage({
|
|
319858
320056
|
content: baseMessage + rewindInstruction,
|
|
@@ -319888,7 +320086,7 @@ Run /share and post the JSON file to ${{ VERSION: "0.2.30", BUILD_TIME: "1970-01
|
|
|
319888
320086
|
if (process.env.USER_TYPE === "ant" && !process.env.THEUS_MODEL && error40 instanceof Error && error40.message.toLowerCase().includes("invalid model name")) {
|
|
319889
320087
|
const orgId = getOauthAccountInfo()?.organizationUuid;
|
|
319890
320088
|
const baseMsg = `[THEUS-INTERNAL] Your org isn't gated into the \`${model}\` model. Either run \`theus\` with \`THEUS_MODEL=${getDefaultMainLoopModelSetting()}\``;
|
|
319891
|
-
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.2.
|
|
320089
|
+
const msg = orgId ? `${baseMsg} or share your orgId (${orgId}) in ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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.2.31", BUILD_TIME: "1970-01-01T00:00:00.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.`;
|
|
319892
320090
|
return createAssistantAPIErrorMessage({
|
|
319893
320091
|
content: msg,
|
|
319894
320092
|
error: "invalid_request"
|
|
@@ -322890,7 +323088,7 @@ __export(exports_terminalSetup, {
|
|
|
322890
323088
|
call: () => call4
|
|
322891
323089
|
});
|
|
322892
323090
|
import { randomBytes as randomBytes16 } from "crypto";
|
|
322893
|
-
import { copyFile as copyFile8, mkdir as mkdir33, readFile as
|
|
323091
|
+
import { copyFile as copyFile8, mkdir as mkdir33, readFile as readFile40, writeFile as writeFile36 } from "fs/promises";
|
|
322894
323092
|
import { homedir as homedir33, platform as platform5 } from "os";
|
|
322895
323093
|
import { dirname as dirname49, join as join115 } from "path";
|
|
322896
323094
|
import { pathToFileURL as pathToFileURL8 } from "url";
|
|
@@ -323037,7 +323235,7 @@ async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
|
|
|
323037
323235
|
let keybindings = [];
|
|
323038
323236
|
let fileExists = false;
|
|
323039
323237
|
try {
|
|
323040
|
-
content = await
|
|
323238
|
+
content = await readFile40(keybindingsPath, {
|
|
323041
323239
|
encoding: "utf-8"
|
|
323042
323240
|
});
|
|
323043
323241
|
fileExists = true;
|
|
@@ -323184,7 +323382,7 @@ chars = "\\u001B\\r"`;
|
|
|
323184
323382
|
let configExists = false;
|
|
323185
323383
|
for (const path15 of configPaths) {
|
|
323186
323384
|
try {
|
|
323187
|
-
configContent = await
|
|
323385
|
+
configContent = await readFile40(path15, {
|
|
323188
323386
|
encoding: "utf-8"
|
|
323189
323387
|
});
|
|
323190
323388
|
configPath = path15;
|
|
@@ -323246,7 +323444,7 @@ async function installBindingsForZed(theme) {
|
|
|
323246
323444
|
let keymapContent = "[]";
|
|
323247
323445
|
let fileExists = false;
|
|
323248
323446
|
try {
|
|
323249
|
-
keymapContent = await
|
|
323447
|
+
keymapContent = await readFile40(keymapPath, {
|
|
323250
323448
|
encoding: "utf-8"
|
|
323251
323449
|
});
|
|
323252
323450
|
fileExists = true;
|
|
@@ -323318,14 +323516,14 @@ var init_terminalSetup = __esm(() => {
|
|
|
323318
323516
|
});
|
|
323319
323517
|
|
|
323320
323518
|
// utils/pasteStore.ts
|
|
323321
|
-
import { createHash as
|
|
323322
|
-
import { mkdir as mkdir34, readdir as readdir24, readFile as
|
|
323519
|
+
import { createHash as createHash26 } from "crypto";
|
|
323520
|
+
import { mkdir as mkdir34, readdir as readdir24, readFile as readFile41, stat as stat39, unlink as unlink16, writeFile as writeFile37 } from "fs/promises";
|
|
323323
323521
|
import { join as join116 } from "path";
|
|
323324
323522
|
function getPasteStoreDir() {
|
|
323325
323523
|
return join116(getTheusConfigHomeDir(), PASTE_STORE_DIR);
|
|
323326
323524
|
}
|
|
323327
323525
|
function hashPastedText(content) {
|
|
323328
|
-
return
|
|
323526
|
+
return createHash26("sha256").update(content).digest("hex").slice(0, 16);
|
|
323329
323527
|
}
|
|
323330
323528
|
function getPastePath(hash) {
|
|
323331
323529
|
return join116(getPasteStoreDir(), `${hash}.txt`);
|
|
@@ -323344,7 +323542,7 @@ async function storePastedText(hash, content) {
|
|
|
323344
323542
|
async function retrievePastedText(hash) {
|
|
323345
323543
|
try {
|
|
323346
323544
|
const pastePath = getPastePath(hash);
|
|
323347
|
-
return await
|
|
323545
|
+
return await readFile41(pastePath, { encoding: "utf8" });
|
|
323348
323546
|
} catch (error40) {
|
|
323349
323547
|
if (!isENOENT(error40)) {
|
|
323350
323548
|
logForDebugging(`Failed to retrieve paste ${hash}: ${error40}`);
|
|
@@ -329992,7 +330190,7 @@ function buildPrimarySection() {
|
|
|
329992
330190
|
});
|
|
329993
330191
|
return [{
|
|
329994
330192
|
label: "Version",
|
|
329995
|
-
value: { VERSION: "0.2.
|
|
330193
|
+
value: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
329996
330194
|
}, {
|
|
329997
330195
|
label: "Session name",
|
|
329998
330196
|
value: nameValue
|
|
@@ -333808,7 +334006,7 @@ function Config({
|
|
|
333808
334006
|
}
|
|
333809
334007
|
})
|
|
333810
334008
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime185.jsx(ChannelDowngradeDialog, {
|
|
333811
|
-
currentVersion: { VERSION: "0.2.
|
|
334009
|
+
currentVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
333812
334010
|
onChoice: (choice) => {
|
|
333813
334011
|
setShowSubmenu(null);
|
|
333814
334012
|
setTabsHidden(false);
|
|
@@ -333820,7 +334018,7 @@ function Config({
|
|
|
333820
334018
|
autoUpdatesChannel: "stable"
|
|
333821
334019
|
};
|
|
333822
334020
|
if (choice === "stay") {
|
|
333823
|
-
newSettings.minimumVersion = { VERSION: "0.2.
|
|
334021
|
+
newSettings.minimumVersion = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
333824
334022
|
}
|
|
333825
334023
|
updateSettingsForSource("userSettings", newSettings);
|
|
333826
334024
|
setSettingsData((prev_27) => ({
|
|
@@ -341854,7 +342052,7 @@ function HelpV2(t0) {
|
|
|
341854
342052
|
let t6;
|
|
341855
342053
|
if ($2[31] !== tabs) {
|
|
341856
342054
|
t6 = /* @__PURE__ */ jsx_runtime212.jsx(Tabs, {
|
|
341857
|
-
title: `Theus v${{ VERSION: "0.2.
|
|
342055
|
+
title: `Theus v${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}`,
|
|
341858
342056
|
color: "professionalBlue",
|
|
341859
342057
|
defaultTab: "general",
|
|
341860
342058
|
children: tabs
|
|
@@ -343626,7 +343824,7 @@ var init_setupConfig = __esm(() => {
|
|
|
343626
343824
|
|
|
343627
343825
|
// services/theusWebLogin.ts
|
|
343628
343826
|
import { createServer as createServer7 } from "http";
|
|
343629
|
-
import { createHash as
|
|
343827
|
+
import { createHash as createHash27, randomBytes as randomBytes17 } from "crypto";
|
|
343630
343828
|
import { mkdir as mkdir39, writeFile as writeFile42 } from "fs/promises";
|
|
343631
343829
|
import { join as join126 } from "path";
|
|
343632
343830
|
function parseTheusWebLoginArgs(argv) {
|
|
@@ -343849,7 +344047,7 @@ async function runTheusWebLogin(options2 = {}) {
|
|
|
343849
344047
|
}
|
|
343850
344048
|
const state = randomBytes17(18).toString("hex");
|
|
343851
344049
|
const codeVerifier = randomBytes17(32).toString("base64url");
|
|
343852
|
-
const codeChallenge =
|
|
344050
|
+
const codeChallenge = createHash27("sha256").update(codeVerifier).digest("base64url");
|
|
343853
344051
|
const timeoutMs = options2.timeoutMs ?? 5 * 60 * 1000;
|
|
343854
344052
|
return await new Promise((resolvePromise) => {
|
|
343855
344053
|
let settled = false;
|
|
@@ -348702,7 +348900,7 @@ var init_AddMarketplace = __esm(() => {
|
|
|
348702
348900
|
|
|
348703
348901
|
// utils/plugins/installCounts.ts
|
|
348704
348902
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
348705
|
-
import { readFile as
|
|
348903
|
+
import { readFile as readFile42, rename as rename7, unlink as unlink17, writeFile as writeFile43 } from "fs/promises";
|
|
348706
348904
|
import { join as join128 } from "path";
|
|
348707
348905
|
function getInstallCountsCachePath() {
|
|
348708
348906
|
return join128(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
@@ -348710,7 +348908,7 @@ function getInstallCountsCachePath() {
|
|
|
348710
348908
|
async function loadInstallCountsCache() {
|
|
348711
348909
|
const cachePath2 = getInstallCountsCachePath();
|
|
348712
348910
|
try {
|
|
348713
|
-
const content = await
|
|
348911
|
+
const content = await readFile42(cachePath2, { encoding: "utf-8" });
|
|
348714
348912
|
const parsed = jsonParse(content);
|
|
348715
348913
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("fetchedAt" in parsed) || !("counts" in parsed)) {
|
|
348716
348914
|
logForDebugging("Install counts cache has invalid structure");
|
|
@@ -353160,7 +353358,7 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
353160
353358
|
|
|
353161
353359
|
// utils/plugins/pluginFlagging.ts
|
|
353162
353360
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
353163
|
-
import { readFile as
|
|
353361
|
+
import { readFile as readFile43, rename as rename8, unlink as unlink18, writeFile as writeFile44 } from "fs/promises";
|
|
353164
353362
|
import { join as join130 } from "path";
|
|
353165
353363
|
function getFlaggedPluginsPath() {
|
|
353166
353364
|
return join130(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
@@ -353187,7 +353385,7 @@ function parsePluginsData(content) {
|
|
|
353187
353385
|
}
|
|
353188
353386
|
async function readFromDisk() {
|
|
353189
353387
|
try {
|
|
353190
|
-
const content = await
|
|
353388
|
+
const content = await readFile43(getFlaggedPluginsPath(), {
|
|
353191
353389
|
encoding: "utf-8"
|
|
353192
353390
|
});
|
|
353193
353391
|
return parsePluginsData(content);
|
|
@@ -356456,7 +356654,7 @@ function parsePluginArgs(args) {
|
|
|
356456
356654
|
}
|
|
356457
356655
|
|
|
356458
356656
|
// utils/plugins/validatePlugin.ts
|
|
356459
|
-
import { readdir as readdir27, readFile as
|
|
356657
|
+
import { readdir as readdir27, readFile as readFile45, stat as stat41 } from "fs/promises";
|
|
356460
356658
|
import * as path18 from "path";
|
|
356461
356659
|
function detectManifestType(filePath) {
|
|
356462
356660
|
const fileName = path18.basename(filePath);
|
|
@@ -356496,7 +356694,7 @@ async function validatePluginManifest(filePath) {
|
|
|
356496
356694
|
const absolutePath = path18.resolve(filePath);
|
|
356497
356695
|
let content;
|
|
356498
356696
|
try {
|
|
356499
|
-
content = await
|
|
356697
|
+
content = await readFile45(absolutePath, { encoding: "utf-8" });
|
|
356500
356698
|
} catch (error40) {
|
|
356501
356699
|
const code = getErrnoCode(error40);
|
|
356502
356700
|
let message;
|
|
@@ -356620,7 +356818,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
356620
356818
|
const absolutePath = path18.resolve(filePath);
|
|
356621
356819
|
let content;
|
|
356622
356820
|
try {
|
|
356623
|
-
content = await
|
|
356821
|
+
content = await readFile45(absolutePath, { encoding: "utf-8" });
|
|
356624
356822
|
} catch (error40) {
|
|
356625
356823
|
const code = getErrnoCode(error40);
|
|
356626
356824
|
let message;
|
|
@@ -356706,7 +356904,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
356706
356904
|
const pluginJsonPath = path18.join(marketplaceRoot, entry.source, ".theus-plugin", "plugin.json");
|
|
356707
356905
|
let manifestVersion;
|
|
356708
356906
|
try {
|
|
356709
|
-
const raw = await
|
|
356907
|
+
const raw = await readFile45(pluginJsonPath, { encoding: "utf-8" });
|
|
356710
356908
|
const parsed2 = jsonParse(raw);
|
|
356711
356909
|
if (typeof parsed2.version === "string") {
|
|
356712
356910
|
manifestVersion = parsed2.version;
|
|
@@ -356823,7 +357021,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
356823
357021
|
async function validateHooksJson(filePath) {
|
|
356824
357022
|
let content;
|
|
356825
357023
|
try {
|
|
356826
|
-
content = await
|
|
357024
|
+
content = await readFile45(filePath, { encoding: "utf-8" });
|
|
356827
357025
|
} catch (e) {
|
|
356828
357026
|
const code = getErrnoCode(e);
|
|
356829
357027
|
if (code === "ENOENT") {
|
|
@@ -356916,7 +357114,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
356916
357114
|
for (const filePath of files) {
|
|
356917
357115
|
let content;
|
|
356918
357116
|
try {
|
|
356919
|
-
content = await
|
|
357117
|
+
content = await readFile45(filePath, { encoding: "utf-8" });
|
|
356920
357118
|
} catch (e) {
|
|
356921
357119
|
if (isENOENT(e))
|
|
356922
357120
|
continue;
|
|
@@ -356985,7 +357183,7 @@ async function validateManifest2(filePath) {
|
|
|
356985
357183
|
return validateMarketplaceManifest(filePath);
|
|
356986
357184
|
case "unknown": {
|
|
356987
357185
|
try {
|
|
356988
|
-
const content = await
|
|
357186
|
+
const content = await readFile45(absolutePath, { encoding: "utf-8" });
|
|
356989
357187
|
const parsed = jsonParse(content);
|
|
356990
357188
|
if (Array.isArray(parsed.plugins)) {
|
|
356991
357189
|
return validateMarketplaceManifest(filePath);
|
|
@@ -358575,6 +358773,15 @@ var init_mcp3 = __esm(() => {
|
|
|
358575
358773
|
var NOVEDADES;
|
|
358576
358774
|
var init_data = __esm(() => {
|
|
358577
358775
|
NOVEDADES = [
|
|
358776
|
+
{
|
|
358777
|
+
version: "v0.2.31",
|
|
358778
|
+
fecha: "2026-07-13",
|
|
358779
|
+
titulo: "Orquestaci\xF3n completa: reintento que re-integra (corridas resumibles)",
|
|
358780
|
+
puntos: [
|
|
358781
|
+
"Reintentar un subagente ahora RE-INTEGRA en la orquestaci\xF3n: la corrida se reanuda replayando al instante los agentes ya completados (sin gastarlos) y re-ejecuta desde el fallido en adelante, as\xED todo lo que depend\xEDa de \xE9l vuelve a correr con el resultado nuevo. Antes solo re-corr\xEDa el agente aislado.",
|
|
358782
|
+
"Cada corrida se journaliza por clave estable; tambi\xE9n puedes reintentar toda la corrida. Verificado con pruebas de replay determinista."
|
|
358783
|
+
]
|
|
358784
|
+
},
|
|
358578
358785
|
{
|
|
358579
358786
|
version: "v0.2.30",
|
|
358580
358787
|
fecha: "2026-07-13",
|
|
@@ -360271,7 +360478,7 @@ function Onboarding({
|
|
|
360271
360478
|
flexDirection: "column",
|
|
360272
360479
|
children: [
|
|
360273
360480
|
/* @__PURE__ */ jsx_runtime245.jsx(TheusBanner, {
|
|
360274
|
-
version: { VERSION: "0.2.
|
|
360481
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
360275
360482
|
}),
|
|
360276
360483
|
/* @__PURE__ */ jsx_runtime245.jsxs(ThemedBox_default, {
|
|
360277
360484
|
flexDirection: "column",
|
|
@@ -360495,7 +360702,7 @@ var init_providers3 = __esm(() => {
|
|
|
360495
360702
|
});
|
|
360496
360703
|
|
|
360497
360704
|
// utils/releaseNotes.ts
|
|
360498
|
-
import { mkdir as mkdir40, readFile as
|
|
360705
|
+
import { mkdir as mkdir40, readFile as readFile46, writeFile as writeFile45 } from "fs/promises";
|
|
360499
360706
|
import { dirname as dirname56, join as join133 } from "path";
|
|
360500
360707
|
function getChangelogCachePath() {
|
|
360501
360708
|
return join133(getTheusConfigHomeDir(), "cache", "changelog.md");
|
|
@@ -360545,7 +360752,7 @@ async function getStoredChangelog() {
|
|
|
360545
360752
|
}
|
|
360546
360753
|
const cachePath2 = getChangelogCachePath();
|
|
360547
360754
|
try {
|
|
360548
|
-
const content = await
|
|
360755
|
+
const content = await readFile46(cachePath2, "utf-8");
|
|
360549
360756
|
changelogMemoryCache = content;
|
|
360550
360757
|
return content;
|
|
360551
360758
|
} catch {
|
|
@@ -360616,9 +360823,9 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
360616
360823
|
return [];
|
|
360617
360824
|
}
|
|
360618
360825
|
}
|
|
360619
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.
|
|
360826
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
360620
360827
|
if (process.env.USER_TYPE === "ant") {
|
|
360621
|
-
const changelog = { VERSION: "0.2.
|
|
360828
|
+
const changelog = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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;
|
|
360622
360829
|
if (changelog) {
|
|
360623
360830
|
const commits = changelog.trim().split(`
|
|
360624
360831
|
`).filter(Boolean);
|
|
@@ -365021,7 +365228,7 @@ var init_Messages = __esm(() => {
|
|
|
365021
365228
|
let t1;
|
|
365022
365229
|
if ($2[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
365023
365230
|
t1 = /* @__PURE__ */ jsx_runtime258.jsx(TheusSessionHeader, {
|
|
365024
|
-
version: { VERSION: "0.2.
|
|
365231
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
365025
365232
|
});
|
|
365026
365233
|
$2[0] = t1;
|
|
365027
365234
|
} else {
|
|
@@ -378264,6 +378471,8 @@ function nodeMeta(a2) {
|
|
|
378264
378471
|
parts.push(`${Math.round(a2.durationMs / 100) / 10}s`);
|
|
378265
378472
|
if (a2.attempts > 1)
|
|
378266
378473
|
parts.push(`\xD7${a2.attempts}`);
|
|
378474
|
+
if (a2.replay)
|
|
378475
|
+
parts.push("\u27F2");
|
|
378267
378476
|
return parts.join(" ");
|
|
378268
378477
|
}
|
|
378269
378478
|
function BlankLine() {
|
|
@@ -378721,7 +378930,8 @@ function WorkflowDetailDialog({
|
|
|
378721
378930
|
selected.tokenCount ? ` \xB7 ${shortNum(selected.tokenCount)} tok` : "",
|
|
378722
378931
|
selected.toolUseCount ? ` \xB7 ${selected.toolUseCount} ${plural(selected.toolUseCount, "tool")}` : "",
|
|
378723
378932
|
selected.durationMs ? ` \xB7 ${Math.round(selected.durationMs / 100) / 10}s` : "",
|
|
378724
|
-
selected.attempts > 1 ? ` \xB7 intento ${selected.attempts}` : ""
|
|
378933
|
+
selected.attempts > 1 ? ` \xB7 intento ${selected.attempts}` : "",
|
|
378934
|
+
selected.replay ? " \xB7 replay" : ""
|
|
378725
378935
|
]
|
|
378726
378936
|
}),
|
|
378727
378937
|
selected.error ? /* @__PURE__ */ jsx_runtime279.jsx(ThemedText, {
|
|
@@ -379026,7 +379236,7 @@ function BackgroundTasksDialog({
|
|
|
379026
379236
|
onDone,
|
|
379027
379237
|
onKill: task_0.status === "running" && killWorkflowTask2 ? () => killWorkflowTask2(task_0.id, setAppState) : undefined,
|
|
379028
379238
|
onSkipAgent: task_0.status === "running" && skipWorkflowAgent2 ? (agentId) => skipWorkflowAgent2(task_0.id, agentId, setAppState) : undefined,
|
|
379029
|
-
onRetryAgent: task_0.status === "running" && retryWorkflowAgent2 ? (agentId_0) => retryWorkflowAgent2(task_0.id, agentId_0, setAppState) : undefined,
|
|
379239
|
+
onRetryAgent: (task_0.status === "running" || task_0.status === "completed" || task_0.status === "failed") && retryWorkflowAgent2 ? (agentId_0) => retryWorkflowAgent2(task_0.id, agentId_0, setAppState) : undefined,
|
|
379030
379240
|
onBack: goBackToList
|
|
379031
379241
|
}, `workflow-${task_0.id}`);
|
|
379032
379242
|
case "monitor_mcp":
|
|
@@ -380165,7 +380375,7 @@ __export(exports_thinkback, {
|
|
|
380165
380375
|
playAnimation: () => playAnimation,
|
|
380166
380376
|
call: () => call41
|
|
380167
380377
|
});
|
|
380168
|
-
import { readFile as
|
|
380378
|
+
import { readFile as readFile47 } from "fs/promises";
|
|
380169
380379
|
import { join as join134 } from "path";
|
|
380170
380380
|
function getMarketplaceName() {
|
|
380171
380381
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
@@ -380194,7 +380404,7 @@ async function playAnimation(skillDir) {
|
|
|
380194
380404
|
const dataPath = join134(skillDir, "year_in_review.js");
|
|
380195
380405
|
const playerPath = join134(skillDir, "player.js");
|
|
380196
380406
|
try {
|
|
380197
|
-
await
|
|
380407
|
+
await readFile47(dataPath);
|
|
380198
380408
|
} catch (e) {
|
|
380199
380409
|
if (isENOENT(e)) {
|
|
380200
380410
|
return {
|
|
@@ -380209,7 +380419,7 @@ async function playAnimation(skillDir) {
|
|
|
380209
380419
|
};
|
|
380210
380420
|
}
|
|
380211
380421
|
try {
|
|
380212
|
-
await
|
|
380422
|
+
await readFile47(playerPath);
|
|
380213
380423
|
} catch (e) {
|
|
380214
380424
|
if (isENOENT(e)) {
|
|
380215
380425
|
return {
|
|
@@ -387015,7 +387225,7 @@ __export(exports_branch, {
|
|
|
387015
387225
|
call: () => call50
|
|
387016
387226
|
});
|
|
387017
387227
|
import { randomUUID as randomUUID29 } from "crypto";
|
|
387018
|
-
import { mkdir as mkdir41, readFile as
|
|
387228
|
+
import { mkdir as mkdir41, readFile as readFile48, writeFile as writeFile46 } from "fs/promises";
|
|
387019
387229
|
function deriveFirstPrompt(firstUserMessage) {
|
|
387020
387230
|
const content = firstUserMessage?.message?.content;
|
|
387021
387231
|
if (!content)
|
|
@@ -387034,7 +387244,7 @@ async function createFork(customTitle) {
|
|
|
387034
387244
|
await mkdir41(projectDir, { recursive: true, mode: 448 });
|
|
387035
387245
|
let transcriptContent;
|
|
387036
387246
|
try {
|
|
387037
|
-
transcriptContent = await
|
|
387247
|
+
transcriptContent = await readFile48(currentTranscriptPath);
|
|
387038
387248
|
} catch {
|
|
387039
387249
|
throw new Error("No conversation to branch");
|
|
387040
387250
|
}
|
|
@@ -393378,7 +393588,7 @@ var init_rewind = __esm(() => {
|
|
|
393378
393588
|
|
|
393379
393589
|
// utils/heapDumpService.ts
|
|
393380
393590
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync6 } from "fs";
|
|
393381
|
-
import { readdir as readdir28, readFile as
|
|
393591
|
+
import { readdir as readdir28, readFile as readFile49, writeFile as writeFile47 } from "fs/promises";
|
|
393382
393592
|
import { join as join137 } from "path";
|
|
393383
393593
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
393384
393594
|
import {
|
|
@@ -393403,7 +393613,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
393403
393613
|
} catch {}
|
|
393404
393614
|
let smapsRollup;
|
|
393405
393615
|
try {
|
|
393406
|
-
smapsRollup = await
|
|
393616
|
+
smapsRollup = await readFile49("/proc/self/smaps_rollup", "utf8");
|
|
393407
393617
|
} catch {}
|
|
393408
393618
|
const nativeMemory = usage.rss - usage.heapUsed;
|
|
393409
393619
|
const bytesPerSecond = uptimeSeconds > 0 ? usage.rss / uptimeSeconds : 0;
|
|
@@ -393469,7 +393679,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
393469
393679
|
smapsRollup,
|
|
393470
393680
|
platform: process.platform,
|
|
393471
393681
|
nodeVersion: process.version,
|
|
393472
|
-
ccVersion: { VERSION: "0.2.
|
|
393682
|
+
ccVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
393473
393683
|
};
|
|
393474
393684
|
}
|
|
393475
393685
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -394055,7 +394265,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
394055
394265
|
var call57 = async () => {
|
|
394056
394266
|
return {
|
|
394057
394267
|
type: "text",
|
|
394058
|
-
value: { VERSION: "0.2.
|
|
394268
|
+
value: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME ? `${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION} (built ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.BUILD_TIME})` : { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
394059
394269
|
};
|
|
394060
394270
|
}, version2, version_default;
|
|
394061
394271
|
var init_version = __esm(() => {
|
|
@@ -398386,7 +398596,7 @@ __export(exports_update, {
|
|
|
398386
398596
|
update: () => update
|
|
398387
398597
|
});
|
|
398388
398598
|
import { spawn as spawn9, spawnSync as spawnSync8 } from "child_process";
|
|
398389
|
-
import { createHash as
|
|
398599
|
+
import { createHash as createHash28 } from "crypto";
|
|
398390
398600
|
import {
|
|
398391
398601
|
cpSync,
|
|
398392
398602
|
existsSync as existsSync18,
|
|
@@ -398459,7 +398669,7 @@ function isReleaseBundleInstall() {
|
|
|
398459
398669
|
}
|
|
398460
398670
|
}
|
|
398461
398671
|
function sha256File(path19) {
|
|
398462
|
-
return
|
|
398672
|
+
return createHash28("sha256").update(readFileSync23(path19)).digest("hex");
|
|
398463
398673
|
}
|
|
398464
398674
|
async function fetchReleaseChannelVersion() {
|
|
398465
398675
|
try {
|
|
@@ -398497,13 +398707,13 @@ async function updateReleaseBundle() {
|
|
|
398497
398707
|
await gracefulShutdown(1);
|
|
398498
398708
|
return;
|
|
398499
398709
|
}
|
|
398500
|
-
if (gte({ VERSION: "0.2.
|
|
398501
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.
|
|
398710
|
+
if (gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
398711
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
398502
398712
|
`);
|
|
398503
398713
|
await gracefulShutdown(0);
|
|
398504
398714
|
return;
|
|
398505
398715
|
}
|
|
398506
|
-
writeToStdout(`New version available: ${latest} (current: ${{ VERSION: "0.2.
|
|
398716
|
+
writeToStdout(`New version available: ${latest} (current: ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
398507
398717
|
`);
|
|
398508
398718
|
writeToStdout(`Installing update from theus.pe/dl...
|
|
398509
398719
|
`);
|
|
@@ -398537,7 +398747,7 @@ async function updateReleaseBundle() {
|
|
|
398537
398747
|
return;
|
|
398538
398748
|
}
|
|
398539
398749
|
cpSync(staged, bundleDir, { recursive: true, force: true });
|
|
398540
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.
|
|
398750
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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 ${latest}`) + `
|
|
398541
398751
|
`);
|
|
398542
398752
|
await regenerateCompletionCache();
|
|
398543
398753
|
} finally {
|
|
@@ -398550,7 +398760,7 @@ async function updateReleaseBundle() {
|
|
|
398550
398760
|
async function update() {
|
|
398551
398761
|
logEvent("tengu_update_check", {});
|
|
398552
398762
|
await updateNaupa();
|
|
398553
|
-
writeToStdout(`Current version: ${{ VERSION: "0.2.
|
|
398763
|
+
writeToStdout(`Current version: ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
398554
398764
|
`);
|
|
398555
398765
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
398556
398766
|
writeToStdout(`Checking for updates to ${channel2} version...
|
|
@@ -398629,8 +398839,8 @@ async function update() {
|
|
|
398629
398839
|
writeToStdout(`Theus is managed by Homebrew.
|
|
398630
398840
|
`);
|
|
398631
398841
|
const latest = await getLatestVersion(channel2);
|
|
398632
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
398633
|
-
writeToStdout(`Update available: ${{ VERSION: "0.2.
|
|
398842
|
+
if (latest && !gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
398843
|
+
writeToStdout(`Update available: ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
398634
398844
|
`);
|
|
398635
398845
|
writeToStdout(`
|
|
398636
398846
|
`);
|
|
@@ -398646,8 +398856,8 @@ async function update() {
|
|
|
398646
398856
|
writeToStdout(`Theus is managed by winget.
|
|
398647
398857
|
`);
|
|
398648
398858
|
const latest = await getLatestVersion(channel2);
|
|
398649
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
398650
|
-
writeToStdout(`Update available: ${{ VERSION: "0.2.
|
|
398859
|
+
if (latest && !gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
398860
|
+
writeToStdout(`Update available: ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
398651
398861
|
`);
|
|
398652
398862
|
writeToStdout(`
|
|
398653
398863
|
`);
|
|
@@ -398663,8 +398873,8 @@ async function update() {
|
|
|
398663
398873
|
writeToStdout(`Theus is managed by apk.
|
|
398664
398874
|
`);
|
|
398665
398875
|
const latest = await getLatestVersion(channel2);
|
|
398666
|
-
if (latest && !gte({ VERSION: "0.2.
|
|
398667
|
-
writeToStdout(`Update available: ${{ VERSION: "0.2.
|
|
398876
|
+
if (latest && !gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
398877
|
+
writeToStdout(`Update available: ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}
|
|
398668
398878
|
`);
|
|
398669
398879
|
writeToStdout(`
|
|
398670
398880
|
`);
|
|
@@ -398729,11 +398939,11 @@ async function update() {
|
|
|
398729
398939
|
`);
|
|
398730
398940
|
await gracefulShutdown(1);
|
|
398731
398941
|
}
|
|
398732
|
-
if (result.latestVersion === { VERSION: "0.2.
|
|
398733
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.
|
|
398942
|
+
if (result.latestVersion === { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
398943
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
398734
398944
|
`);
|
|
398735
398945
|
} else {
|
|
398736
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.
|
|
398946
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
398737
398947
|
`);
|
|
398738
398948
|
await regenerateCompletionCache();
|
|
398739
398949
|
}
|
|
@@ -398752,9 +398962,9 @@ async function update() {
|
|
|
398752
398962
|
await removeInstalledSymlink();
|
|
398753
398963
|
}
|
|
398754
398964
|
logForDebugging("update: Checking npm registry for latest version");
|
|
398755
|
-
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.
|
|
398965
|
+
logForDebugging(`update: Package URL: ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`);
|
|
398756
398966
|
const npmTag = channel2 === "stable" ? "stable" : "latest";
|
|
398757
|
-
const npmCommand = `npm view ${{ VERSION: "0.2.
|
|
398967
|
+
const npmCommand = `npm view ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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`;
|
|
398758
398968
|
logForDebugging(`update: Running: ${npmCommand}`);
|
|
398759
398969
|
const latestVersion = await getLatestVersion(channel2);
|
|
398760
398970
|
logForDebugging(`update: Latest version from npm: ${latestVersion || "FAILED"}`);
|
|
@@ -398774,7 +398984,7 @@ async function update() {
|
|
|
398774
398984
|
`);
|
|
398775
398985
|
process.stderr.write(` \u2022 Corporate proxy/firewall blocking npm
|
|
398776
398986
|
`);
|
|
398777
|
-
if ({ VERSION: "0.2.
|
|
398987
|
+
if ({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL && !{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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")) {
|
|
398778
398988
|
process.stderr.write(` \u2022 Internal/development build not published to npm
|
|
398779
398989
|
`);
|
|
398780
398990
|
}
|
|
@@ -398786,19 +398996,19 @@ async function update() {
|
|
|
398786
398996
|
`);
|
|
398787
398997
|
process.stderr.write(` \u2022 Run with --debug flag for more details
|
|
398788
398998
|
`);
|
|
398789
|
-
const packageName = { VERSION: "0.2.
|
|
398999
|
+
const packageName = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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");
|
|
398790
399000
|
process.stderr.write(` \u2022 Manually check: npm view ${packageName} version
|
|
398791
399001
|
`);
|
|
398792
399002
|
process.stderr.write(` \u2022 Check if you need to login: npm whoami
|
|
398793
399003
|
`);
|
|
398794
399004
|
await gracefulShutdown(1);
|
|
398795
399005
|
}
|
|
398796
|
-
if (gte({ VERSION: "0.2.
|
|
398797
|
-
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.
|
|
399006
|
+
if (gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
399007
|
+
writeToStdout(source_default.green(`Theus is up to date (${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})`) + `
|
|
398798
399008
|
`);
|
|
398799
399009
|
await gracefulShutdown(0);
|
|
398800
399010
|
}
|
|
398801
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.2.
|
|
399011
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION})
|
|
398802
399012
|
`);
|
|
398803
399013
|
writeToStdout(`Installing update...
|
|
398804
399014
|
`);
|
|
@@ -398843,7 +399053,7 @@ async function update() {
|
|
|
398843
399053
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
398844
399054
|
switch (status2) {
|
|
398845
399055
|
case "success":
|
|
398846
|
-
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.
|
|
399056
|
+
writeToStdout(source_default.green(`Successfully updated from ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`) + `
|
|
398847
399057
|
`);
|
|
398848
399058
|
await regenerateCompletionCache();
|
|
398849
399059
|
break;
|
|
@@ -398853,7 +399063,7 @@ async function update() {
|
|
|
398853
399063
|
if (useLocalUpdate) {
|
|
398854
399064
|
process.stderr.write(`Try manually updating with:
|
|
398855
399065
|
`);
|
|
398856
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
399066
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
398857
399067
|
`);
|
|
398858
399068
|
} else {
|
|
398859
399069
|
process.stderr.write(`Try running with sudo or fix npm permissions
|
|
@@ -398869,7 +399079,7 @@ async function update() {
|
|
|
398869
399079
|
if (useLocalUpdate) {
|
|
398870
399080
|
process.stderr.write(`Try manually updating with:
|
|
398871
399081
|
`);
|
|
398872
|
-
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
399082
|
+
process.stderr.write(` cd ~/.theus/local && npm update ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}
|
|
398873
399083
|
`);
|
|
398874
399084
|
} else {
|
|
398875
399085
|
process.stderr.write(`Or consider using native installation with: theus install
|
|
@@ -405117,7 +405327,7 @@ import {
|
|
|
405117
405327
|
open as fsOpen2,
|
|
405118
405328
|
mkdir as mkdir45,
|
|
405119
405329
|
readdir as readdir29,
|
|
405120
|
-
readFile as
|
|
405330
|
+
readFile as readFile50,
|
|
405121
405331
|
stat as stat42,
|
|
405122
405332
|
unlink as unlink21,
|
|
405123
405333
|
writeFile as writeFile49
|
|
@@ -405173,7 +405383,7 @@ async function writeAgentMetadata(agentId, metadata) {
|
|
|
405173
405383
|
async function readAgentMetadata(agentId) {
|
|
405174
405384
|
const path19 = getAgentMetadataPath(agentId);
|
|
405175
405385
|
try {
|
|
405176
|
-
const raw = await
|
|
405386
|
+
const raw = await readFile50(path19, "utf-8");
|
|
405177
405387
|
return JSON.parse(raw);
|
|
405178
405388
|
} catch (e) {
|
|
405179
405389
|
if (isFsInaccessible(e))
|
|
@@ -405196,7 +405406,7 @@ async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
|
405196
405406
|
async function readRemoteAgentMetadata(taskId) {
|
|
405197
405407
|
const path19 = getRemoteAgentMetadataPath(taskId);
|
|
405198
405408
|
try {
|
|
405199
|
-
const raw = await
|
|
405409
|
+
const raw = await readFile50(path19, "utf-8");
|
|
405200
405410
|
return JSON.parse(raw);
|
|
405201
405411
|
} catch (e) {
|
|
405202
405412
|
if (isFsInaccessible(e))
|
|
@@ -405229,7 +405439,7 @@ async function listRemoteAgentMetadata() {
|
|
|
405229
405439
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
405230
405440
|
continue;
|
|
405231
405441
|
try {
|
|
405232
|
-
const raw = await
|
|
405442
|
+
const raw = await readFile50(join146(dir, entry.name), "utf-8");
|
|
405233
405443
|
results.push(JSON.parse(raw));
|
|
405234
405444
|
} catch (e) {
|
|
405235
405445
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -405571,7 +405781,7 @@ class Project {
|
|
|
405571
405781
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
405572
405782
|
return;
|
|
405573
405783
|
}
|
|
405574
|
-
const content = await
|
|
405784
|
+
const content = await readFile50(this.sessionFile, { encoding: "utf-8" });
|
|
405575
405785
|
const lines = content.split(`
|
|
405576
405786
|
`).filter((line) => {
|
|
405577
405787
|
if (!line.trim())
|
|
@@ -406381,7 +406591,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
406381
406591
|
worktreeSession: worktreeStates.has(sessionId) ? worktreeStates.get(sessionId) : undefined
|
|
406382
406592
|
};
|
|
406383
406593
|
}
|
|
406384
|
-
const content = await
|
|
406594
|
+
const content = await readFile50(filePath, { encoding: "utf-8" });
|
|
406385
406595
|
let parsed;
|
|
406386
406596
|
try {
|
|
406387
406597
|
parsed = jsonParse(content);
|
|
@@ -407043,7 +407253,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
407043
407253
|
}
|
|
407044
407254
|
}
|
|
407045
407255
|
}
|
|
407046
|
-
buf ??= await
|
|
407256
|
+
buf ??= await readFile50(filePath);
|
|
407047
407257
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.THEUS_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
407048
407258
|
buf = walkChainBeforeParse(buf);
|
|
407049
407259
|
}
|
|
@@ -407946,7 +408156,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
407946
408156
|
init_settings2();
|
|
407947
408157
|
init_slowOperations();
|
|
407948
408158
|
init_uuid();
|
|
407949
|
-
VERSION4 = { VERSION: "0.2.
|
|
408159
|
+
VERSION4 = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
407950
408160
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
407951
408161
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
407952
408162
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -409151,7 +409361,7 @@ var init_filesystem = __esm(() => {
|
|
|
409151
409361
|
});
|
|
409152
409362
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
409153
409363
|
const nonce = randomBytes21(16).toString("hex");
|
|
409154
|
-
return join148(getTheusTempDir(), "bundled-skills", { VERSION: "0.2.
|
|
409364
|
+
return join148(getTheusTempDir(), "bundled-skills", { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
409155
409365
|
});
|
|
409156
409366
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
409157
409367
|
});
|
|
@@ -413439,7 +413649,7 @@ import {
|
|
|
413439
413649
|
copyFile as copyFile9,
|
|
413440
413650
|
mkdir as mkdir47,
|
|
413441
413651
|
readdir as readdir30,
|
|
413442
|
-
readFile as
|
|
413652
|
+
readFile as readFile51,
|
|
413443
413653
|
stat as stat45,
|
|
413444
413654
|
symlink as symlink5,
|
|
413445
413655
|
utimes as utimes2
|
|
@@ -413582,7 +413792,7 @@ async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
|
413582
413792
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
413583
413793
|
let includeContent;
|
|
413584
413794
|
try {
|
|
413585
|
-
includeContent = await
|
|
413795
|
+
includeContent = await readFile51(join150(repoRoot, ".worktreeinclude"), "utf-8");
|
|
413586
413796
|
} catch {
|
|
413587
413797
|
return [];
|
|
413588
413798
|
}
|
|
@@ -414330,7 +414540,7 @@ function getSimpleDoingTasksSection() {
|
|
|
414330
414540
|
];
|
|
414331
414541
|
const userHelpSubitems = [
|
|
414332
414542
|
`/help: Get help with using Theus`,
|
|
414333
|
-
`To give feedback, users should ${{ VERSION: "0.2.
|
|
414543
|
+
`To give feedback, users should ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
414334
414544
|
];
|
|
414335
414545
|
const items = [
|
|
414336
414546
|
`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.`,
|
|
@@ -414787,7 +414997,7 @@ var init_prompts4 = __esm(() => {
|
|
|
414787
414997
|
});
|
|
414788
414998
|
|
|
414789
414999
|
// utils/api.ts
|
|
414790
|
-
import { createHash as
|
|
415000
|
+
import { createHash as createHash29 } from "crypto";
|
|
414791
415001
|
function filterSwarmFieldsFromSchema(toolName, schema) {
|
|
414792
415002
|
const fieldsToRemove = SWARM_FIELDS_BY_TOOL[toolName];
|
|
414793
415003
|
if (!fieldsToRemove || fieldsToRemove.length === 0) {
|
|
@@ -414877,7 +415087,7 @@ function logAPIPrefix(systemPrompt) {
|
|
|
414877
415087
|
logEvent("tengu_sysprompt_block", {
|
|
414878
415088
|
snippet: firstSystemPrompt?.slice(0, 20),
|
|
414879
415089
|
length: firstSystemPrompt?.length ?? 0,
|
|
414880
|
-
hash: firstSystemPrompt ?
|
|
415090
|
+
hash: firstSystemPrompt ? createHash29("sha256").update(firstSystemPrompt).digest("hex") : ""
|
|
414881
415091
|
});
|
|
414882
415092
|
}
|
|
414883
415093
|
function splitSysPromptPrefix(systemPrompt, options2) {
|
|
@@ -415203,7 +415413,7 @@ var init_api4 = __esm(() => {
|
|
|
415203
415413
|
});
|
|
415204
415414
|
|
|
415205
415415
|
// utils/fingerprint.ts
|
|
415206
|
-
import { createHash as
|
|
415416
|
+
import { createHash as createHash30 } from "crypto";
|
|
415207
415417
|
function extractFirstMessageText(messages) {
|
|
415208
415418
|
const firstUserMessage = messages.find((msg) => msg.type === "user");
|
|
415209
415419
|
if (!firstUserMessage) {
|
|
@@ -415225,12 +415435,12 @@ function computeFingerprint(messageText, version3) {
|
|
|
415225
415435
|
const indices = [4, 7, 20];
|
|
415226
415436
|
const chars = indices.map((i3) => messageText[i3] || "0").join("");
|
|
415227
415437
|
const fingerprintInput = `${FINGERPRINT_SALT}${chars}${version3}`;
|
|
415228
|
-
const hash =
|
|
415438
|
+
const hash = createHash30("sha256").update(fingerprintInput).digest("hex");
|
|
415229
415439
|
return hash.slice(0, 3);
|
|
415230
415440
|
}
|
|
415231
415441
|
function computeFingerprintFromMessages(messages) {
|
|
415232
415442
|
const firstMessageText = extractFirstMessageText(messages);
|
|
415233
|
-
return computeFingerprint(firstMessageText, { VERSION: "0.2.
|
|
415443
|
+
return computeFingerprint(firstMessageText, { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
415234
415444
|
}
|
|
415235
415445
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
415236
415446
|
var init_fingerprint = () => {};
|
|
@@ -417778,7 +417988,7 @@ async function sideQuery(opts) {
|
|
|
417778
417988
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
417779
417989
|
}
|
|
417780
417990
|
const messageText = extractFirstUserMessageText(messages);
|
|
417781
|
-
const fingerprint = computeFingerprint(messageText, { VERSION: "0.2.
|
|
417991
|
+
const fingerprint = computeFingerprint(messageText, { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION);
|
|
417782
417992
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
417783
417993
|
const systemBlocks = [
|
|
417784
417994
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -419081,7 +419291,7 @@ async function handleMemories(state) {
|
|
|
419081
419291
|
async function runProjectContextMcpServer() {
|
|
419082
419292
|
const projectRoot = process.env.THEUS_PROJECT_ROOT || process.cwd();
|
|
419083
419293
|
const state = new ProjectContextState(projectRoot);
|
|
419084
|
-
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.
|
|
419294
|
+
const server2 = new Server({ name: SERVER_NAME, version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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: {} } });
|
|
419085
419295
|
server2.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
419086
419296
|
tools: TOOL_DEFINITIONS.map((t) => ({
|
|
419087
419297
|
name: t.name,
|
|
@@ -419888,7 +420098,7 @@ var init_selftest = __esm(() => {
|
|
|
419888
420098
|
});
|
|
419889
420099
|
|
|
419890
420100
|
// utils/cronTasksLock.ts
|
|
419891
|
-
import { mkdir as mkdir49, readFile as
|
|
420101
|
+
import { mkdir as mkdir49, readFile as readFile52, unlink as unlink24, writeFile as writeFile50 } from "fs/promises";
|
|
419892
420102
|
import { dirname as dirname63, join as join154 } from "path";
|
|
419893
420103
|
function getLockPath(dir) {
|
|
419894
420104
|
return join154(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
@@ -419896,7 +420106,7 @@ function getLockPath(dir) {
|
|
|
419896
420106
|
async function readLock(dir) {
|
|
419897
420107
|
let raw;
|
|
419898
420108
|
try {
|
|
419899
|
-
raw = await
|
|
420109
|
+
raw = await readFile52(getLockPath(dir), "utf8");
|
|
419900
420110
|
} catch {
|
|
419901
420111
|
return;
|
|
419902
420112
|
}
|
|
@@ -421061,7 +421271,7 @@ function createBridgeLogger(options2) {
|
|
|
421061
421271
|
connectUrl = buildBridgeConnectUrl(environmentId, cachedIngressUrl);
|
|
421062
421272
|
regenerateQr(connectUrl);
|
|
421063
421273
|
if (verbose) {
|
|
421064
|
-
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.
|
|
421274
|
+
write(source_default.dim(`Remote Control`) + ` v${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION}
|
|
421065
421275
|
`);
|
|
421066
421276
|
}
|
|
421067
421277
|
if (verbose) {
|
|
@@ -421880,7 +422090,7 @@ __export(exports_bridgePointer, {
|
|
|
421880
422090
|
clearBridgePointer: () => clearBridgePointer,
|
|
421881
422091
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
421882
422092
|
});
|
|
421883
|
-
import { mkdir as mkdir50, readFile as
|
|
422093
|
+
import { mkdir as mkdir50, readFile as readFile53, stat as stat47, unlink as unlink25, writeFile as writeFile51 } from "fs/promises";
|
|
421884
422094
|
import { dirname as dirname67, join as join158 } from "path";
|
|
421885
422095
|
function getBridgePointerPath(dir) {
|
|
421886
422096
|
return join158(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
@@ -421901,7 +422111,7 @@ async function readBridgePointer(dir) {
|
|
|
421901
422111
|
let mtimeMs;
|
|
421902
422112
|
try {
|
|
421903
422113
|
mtimeMs = (await stat47(path19)).mtimeMs;
|
|
421904
|
-
raw = await
|
|
422114
|
+
raw = await readFile53(path19, "utf8");
|
|
421905
422115
|
} catch {
|
|
421906
422116
|
return null;
|
|
421907
422117
|
}
|
|
@@ -422034,7 +422244,7 @@ function appendToLog(path19, message) {
|
|
|
422034
422244
|
cwd: getFsImplementation().cwd(),
|
|
422035
422245
|
userType: process.env.USER_TYPE,
|
|
422036
422246
|
sessionId: getSessionId(),
|
|
422037
|
-
version: { VERSION: "0.2.
|
|
422247
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
422038
422248
|
};
|
|
422039
422249
|
getLogWriter(path19).write(messageWithTimestamp);
|
|
422040
422250
|
}
|
|
@@ -423304,7 +423514,7 @@ Spawn mode for this project:
|
|
|
423304
423514
|
const api2 = createBridgeApiClient({
|
|
423305
423515
|
baseUrl,
|
|
423306
423516
|
getAccessToken: getBridgeAccessToken2,
|
|
423307
|
-
runnerVersion: { VERSION: "0.2.
|
|
423517
|
+
runnerVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
423308
423518
|
onDebug: logForDebugging,
|
|
423309
423519
|
onAuth401: handleOAuth401Error2,
|
|
423310
423520
|
getTrustedDeviceToken
|
|
@@ -423542,7 +423752,7 @@ async function runBridgeHeadless(opts, signal) {
|
|
|
423542
423752
|
const api2 = createBridgeApiClient({
|
|
423543
423753
|
baseUrl,
|
|
423544
423754
|
getAccessToken: opts.getAccessToken,
|
|
423545
|
-
runnerVersion: { VERSION: "0.2.
|
|
423755
|
+
runnerVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
423546
423756
|
onDebug: log2,
|
|
423547
423757
|
onAuth401: opts.onAuth401,
|
|
423548
423758
|
getTrustedDeviceToken
|
|
@@ -425975,7 +426185,7 @@ __export(exports_upstreamproxy, {
|
|
|
425975
426185
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
425976
426186
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
425977
426187
|
});
|
|
425978
|
-
import { mkdir as mkdir51, readFile as
|
|
426188
|
+
import { mkdir as mkdir51, readFile as readFile54, unlink as unlink26, writeFile as writeFile52 } from "fs/promises";
|
|
425979
426189
|
import { homedir as homedir45 } from "os";
|
|
425980
426190
|
import { join as join161 } from "path";
|
|
425981
426191
|
async function initUpstreamProxy(opts) {
|
|
@@ -426056,7 +426266,7 @@ function resetUpstreamProxyForTests() {
|
|
|
426056
426266
|
}
|
|
426057
426267
|
async function readToken(path19) {
|
|
426058
426268
|
try {
|
|
426059
|
-
const raw = await
|
|
426269
|
+
const raw = await readFile54(path19, "utf8");
|
|
426060
426270
|
return raw.trim() || null;
|
|
426061
426271
|
} catch (err2) {
|
|
426062
426272
|
if (isENOENT(err2))
|
|
@@ -426097,7 +426307,7 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
426097
426307
|
return false;
|
|
426098
426308
|
}
|
|
426099
426309
|
const ccrCa = await resp.text();
|
|
426100
|
-
const systemCa = await
|
|
426310
|
+
const systemCa = await readFile54(systemCaPath, "utf8").catch(() => "");
|
|
426101
426311
|
await mkdir51(join161(outPath, ".."), { recursive: true });
|
|
426102
426312
|
await writeFile52(outPath, systemCa + `
|
|
426103
426313
|
` + ccrCa, "utf8");
|
|
@@ -427606,7 +427816,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
427606
427816
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
427607
427817
|
apiKeySource: getTheusApiKeyWithSource().source,
|
|
427608
427818
|
betas: getSdkBetas(),
|
|
427609
|
-
theus_code_version: { VERSION: "0.2.
|
|
427819
|
+
theus_code_version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
427610
427820
|
output_style: outputStyle2,
|
|
427611
427821
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
427612
427822
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -427646,8 +427856,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
427646
427856
|
}
|
|
427647
427857
|
async function checkEnvLessBridgeMinVersion() {
|
|
427648
427858
|
const cfg = await getEnvLessBridgeConfig();
|
|
427649
|
-
if (cfg.min_version && lt({ VERSION: "0.2.
|
|
427650
|
-
return `Your version of Theus (${{ VERSION: "0.2.
|
|
427859
|
+
if (cfg.min_version && lt({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
427860
|
+
return `Your version of Theus (${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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.
|
|
427651
427861
|
Version ${cfg.min_version} or higher is required. Run \`theus update\` to update.`;
|
|
427652
427862
|
}
|
|
427653
427863
|
return null;
|
|
@@ -429970,7 +430180,7 @@ async function initBridgeCore(params) {
|
|
|
429970
430180
|
const rawApi = createBridgeApiClient({
|
|
429971
430181
|
baseUrl,
|
|
429972
430182
|
getAccessToken,
|
|
429973
|
-
runnerVersion: { VERSION: "0.2.
|
|
430183
|
+
runnerVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
429974
430184
|
onDebug: logForDebugging,
|
|
429975
430185
|
onAuth401,
|
|
429976
430186
|
getTrustedDeviceToken
|
|
@@ -446711,7 +446921,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
446711
446921
|
function getSemverPart(version3) {
|
|
446712
446922
|
return `${import_semver14.major(version3, { loose: true })}.${import_semver14.minor(version3, { loose: true })}.${import_semver14.patch(version3, { loose: true })}`;
|
|
446713
446923
|
}
|
|
446714
|
-
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.
|
|
446924
|
+
function useUpdateNotification(updatedVersion, initialVersion = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION) {
|
|
446715
446925
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react230.useState(() => getSemverPart(initialVersion));
|
|
446716
446926
|
if (!updatedVersion) {
|
|
446717
446927
|
return null;
|
|
@@ -446751,7 +446961,7 @@ function AutoUpdater({
|
|
|
446751
446961
|
return;
|
|
446752
446962
|
}
|
|
446753
446963
|
if (false) {}
|
|
446754
|
-
const currentVersion = { VERSION: "0.2.
|
|
446964
|
+
const currentVersion = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
446755
446965
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
446756
446966
|
let latestVersion = await getLatestVersion(channel2);
|
|
446757
446967
|
const isDisabled2 = isAutoUpdaterDisabled();
|
|
@@ -446887,7 +447097,7 @@ function AutoUpdater({
|
|
|
446887
447097
|
" ",
|
|
446888
447098
|
/* @__PURE__ */ jsx_runtime403.jsx(ThemedText, {
|
|
446889
447099
|
bold: true,
|
|
446890
|
-
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.
|
|
447100
|
+
children: hasLocalInstall ? `cd ~/.theus/local && npm update ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.PACKAGE_URL}` : `npm i -g ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.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}`
|
|
446891
447101
|
})
|
|
446892
447102
|
]
|
|
446893
447103
|
})
|
|
@@ -446964,12 +447174,12 @@ function NativeAutoUpdater({
|
|
|
446964
447174
|
logEvent("tengu_native_auto_updater_start", {});
|
|
446965
447175
|
try {
|
|
446966
447176
|
const maxVersion = await getMaxVersion();
|
|
446967
|
-
if (maxVersion && gt({ VERSION: "0.2.
|
|
447177
|
+
if (maxVersion && gt({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
446968
447178
|
const msg = await getMaxVersionMessage();
|
|
446969
447179
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
446970
447180
|
}
|
|
446971
447181
|
const result = await installLatest(channel2);
|
|
446972
|
-
const currentVersion = { VERSION: "0.2.
|
|
447182
|
+
const currentVersion = { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION;
|
|
446973
447183
|
const latencyMs = Date.now() - startTime2;
|
|
446974
447184
|
if (result.lockFailed) {
|
|
446975
447185
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -447106,17 +447316,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
447106
447316
|
const maxVersion = await getMaxVersion();
|
|
447107
447317
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
447108
447318
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
447109
|
-
if (gte({ VERSION: "0.2.
|
|
447110
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.
|
|
447319
|
+
if (gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)) {
|
|
447320
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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`);
|
|
447111
447321
|
setUpdateAvailable(false);
|
|
447112
447322
|
return;
|
|
447113
447323
|
}
|
|
447114
447324
|
latest = maxVersion;
|
|
447115
447325
|
}
|
|
447116
|
-
const hasUpdate = latest && !gte({ VERSION: "0.2.
|
|
447326
|
+
const hasUpdate = latest && !gte({ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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);
|
|
447117
447327
|
setUpdateAvailable(!!hasUpdate);
|
|
447118
447328
|
if (hasUpdate) {
|
|
447119
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.
|
|
447329
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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}`);
|
|
447120
447330
|
}
|
|
447121
447331
|
};
|
|
447122
447332
|
$2[0] = t1;
|
|
@@ -447150,7 +447360,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
447150
447360
|
wrap: "truncate",
|
|
447151
447361
|
children: [
|
|
447152
447362
|
"currentVersion: ",
|
|
447153
|
-
{ VERSION: "0.2.
|
|
447363
|
+
{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
447154
447364
|
]
|
|
447155
447365
|
});
|
|
447156
447366
|
$2[3] = verbose;
|
|
@@ -455023,7 +455233,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
455023
455233
|
project_dir: getOriginalCwd(),
|
|
455024
455234
|
added_dirs: addedDirs
|
|
455025
455235
|
},
|
|
455026
|
-
version: { VERSION: "0.2.
|
|
455236
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
455027
455237
|
output_style: {
|
|
455028
455238
|
name: outputStyleName
|
|
455029
455239
|
},
|
|
@@ -466416,7 +466626,7 @@ var init_Feedback = __esm(() => {
|
|
|
466416
466626
|
});
|
|
466417
466627
|
|
|
466418
466628
|
// components/FeedbackSurvey/submitTranscriptShare.ts
|
|
466419
|
-
import { readFile as
|
|
466629
|
+
import { readFile as readFile55, stat as stat49 } from "fs/promises";
|
|
466420
466630
|
async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
466421
466631
|
try {
|
|
466422
466632
|
logForDebugging("Collecting transcript for sharing", { level: "info" });
|
|
@@ -466428,14 +466638,14 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
466428
466638
|
const transcriptPath = getTranscriptPath();
|
|
466429
466639
|
const { size } = await stat49(transcriptPath);
|
|
466430
466640
|
if (size <= MAX_TRANSCRIPT_READ_BYTES) {
|
|
466431
|
-
rawTranscriptJsonl = await
|
|
466641
|
+
rawTranscriptJsonl = await readFile55(transcriptPath, "utf-8");
|
|
466432
466642
|
} else {
|
|
466433
466643
|
logForDebugging(`Skipping raw transcript read: file too large (${size} bytes)`, { level: "warn" });
|
|
466434
466644
|
}
|
|
466435
466645
|
} catch {}
|
|
466436
466646
|
const data = {
|
|
466437
466647
|
trigger,
|
|
466438
|
-
version: { VERSION: "0.2.
|
|
466648
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
466439
466649
|
platform: process.platform,
|
|
466440
466650
|
transcript,
|
|
466441
466651
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -467711,7 +467921,7 @@ var init_setupPortable = __esm(() => {
|
|
|
467711
467921
|
});
|
|
467712
467922
|
|
|
467713
467923
|
// utils/theusInChrome/setup.ts
|
|
467714
|
-
import { chmod as chmod12, mkdir as mkdir53, readFile as
|
|
467924
|
+
import { chmod as chmod12, mkdir as mkdir53, readFile as readFile56, writeFile as writeFile55 } from "fs/promises";
|
|
467715
467925
|
import { homedir as homedir48 } from "os";
|
|
467716
467926
|
import { join as join168 } from "path";
|
|
467717
467927
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
@@ -467820,7 +468030,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
467820
468030
|
let anyManifestUpdated = false;
|
|
467821
468031
|
for (const manifestDir of manifestDirs) {
|
|
467822
468032
|
const manifestPath = join168(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
467823
|
-
const existingContent = await
|
|
468033
|
+
const existingContent = await readFile56(manifestPath, "utf-8").catch(() => null);
|
|
467824
468034
|
if (existingContent === manifestContent) {
|
|
467825
468035
|
continue;
|
|
467826
468036
|
}
|
|
@@ -467883,7 +468093,7 @@ ${command7}
|
|
|
467883
468093
|
# Generated by Theus - do not edit manually
|
|
467884
468094
|
exec ${command7}
|
|
467885
468095
|
`;
|
|
467886
|
-
const existingContent = await
|
|
468096
|
+
const existingContent = await readFile56(wrapperPath, "utf-8").catch(() => null);
|
|
467887
468097
|
if (existingContent === scriptContent) {
|
|
467888
468098
|
return wrapperPath;
|
|
467889
468099
|
}
|
|
@@ -479459,7 +479669,7 @@ function completeOnboarding() {
|
|
|
479459
479669
|
saveGlobalConfig((current) => ({
|
|
479460
479670
|
...current,
|
|
479461
479671
|
hasCompletedOnboarding: true,
|
|
479462
|
-
lastOnboardingVersion: { VERSION: "0.2.
|
|
479672
|
+
lastOnboardingVersion: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
479463
479673
|
}));
|
|
479464
479674
|
}
|
|
479465
479675
|
function showDialog(root2, renderer) {
|
|
@@ -486714,11 +486924,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
486714
486924
|
});
|
|
486715
486925
|
|
|
486716
486926
|
// utils/plugins/zipCacheAdapters.ts
|
|
486717
|
-
import { readFile as
|
|
486927
|
+
import { readFile as readFile57 } from "fs/promises";
|
|
486718
486928
|
import { join as join174 } from "path";
|
|
486719
486929
|
async function readZipCacheKnownMarketplaces() {
|
|
486720
486930
|
try {
|
|
486721
|
-
const content = await
|
|
486931
|
+
const content = await readFile57(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
486722
486932
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
486723
486933
|
if (!parsed.success) {
|
|
486724
486934
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -486751,7 +486961,7 @@ async function readMarketplaceJsonContent(dir) {
|
|
|
486751
486961
|
];
|
|
486752
486962
|
for (const candidate of candidates) {
|
|
486753
486963
|
try {
|
|
486754
|
-
return await
|
|
486964
|
+
return await readFile57(candidate, "utf-8");
|
|
486755
486965
|
} catch {}
|
|
486756
486966
|
}
|
|
486757
486967
|
return null;
|
|
@@ -486881,7 +487091,7 @@ __export(exports_print, {
|
|
|
486881
487091
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
486882
487092
|
canBatchWith: () => canBatchWith
|
|
486883
487093
|
});
|
|
486884
|
-
import { readFile as
|
|
487094
|
+
import { readFile as readFile58, stat as stat52 } from "fs/promises";
|
|
486885
487095
|
import { dirname as dirname74 } from "path";
|
|
486886
487096
|
import { cwd as cwd2 } from "process";
|
|
486887
487097
|
import { randomUUID as randomUUID58 } from "crypto";
|
|
@@ -488273,7 +488483,7 @@ ${m.text}
|
|
|
488273
488483
|
const normalizedPath = expandPath(message.request.path);
|
|
488274
488484
|
const diskMtime = Math.floor((await stat52(normalizedPath)).mtimeMs);
|
|
488275
488485
|
if (diskMtime <= message.request.mtime) {
|
|
488276
|
-
const raw = await
|
|
488486
|
+
const raw = await readFile58(normalizedPath, "utf-8");
|
|
488277
488487
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
488278
488488
|
`, `
|
|
488279
488489
|
`);
|
|
@@ -490318,7 +490528,7 @@ async function startMCPServer(cwd3, debug3, verbose) {
|
|
|
490318
490528
|
setCwd(cwd3);
|
|
490319
490529
|
const server2 = new Server({
|
|
490320
490530
|
name: "theus/tengu",
|
|
490321
|
-
version: { VERSION: "0.2.
|
|
490531
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
490322
490532
|
}, {
|
|
490323
490533
|
capabilities: {
|
|
490324
490534
|
tools: {}
|
|
@@ -490448,7 +490658,7 @@ __export(exports_theusDesktop, {
|
|
|
490448
490658
|
readTheusDesktopMcpServers: () => readTheusDesktopMcpServers,
|
|
490449
490659
|
getTheusDesktopConfigPath: () => getTheusDesktopConfigPath
|
|
490450
490660
|
});
|
|
490451
|
-
import { readdir as readdir33, readFile as
|
|
490661
|
+
import { readdir as readdir33, readFile as readFile59, stat as stat53 } from "fs/promises";
|
|
490452
490662
|
import { homedir as homedir51 } from "os";
|
|
490453
490663
|
import { join as join175 } from "path";
|
|
490454
490664
|
async function getTheusDesktopConfigPath() {
|
|
@@ -490496,7 +490706,7 @@ async function readTheusDesktopMcpServers() {
|
|
|
490496
490706
|
const configPath2 = await getTheusDesktopConfigPath();
|
|
490497
490707
|
let configContent;
|
|
490498
490708
|
try {
|
|
490499
|
-
configContent = await
|
|
490709
|
+
configContent = await readFile59(configPath2, { encoding: "utf8" });
|
|
490500
490710
|
} catch (e) {
|
|
490501
490711
|
const code = getErrnoCode(e);
|
|
490502
490712
|
if (code === "ENOENT") {
|
|
@@ -491760,7 +491970,7 @@ async function setupTokenHandler(root2) {
|
|
|
491760
491970
|
gap: 1,
|
|
491761
491971
|
children: [
|
|
491762
491972
|
/* @__PURE__ */ jsx_runtime489.jsx(TheusBanner, {
|
|
491763
|
-
version: { VERSION: "0.2.
|
|
491973
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION
|
|
491764
491974
|
}),
|
|
491765
491975
|
showAuthWarning && /* @__PURE__ */ jsx_runtime489.jsxs(ThemedBox_default, {
|
|
491766
491976
|
flexDirection: "column",
|
|
@@ -493229,7 +493439,7 @@ ${assistantAddendum}` : assistantAddendum;
|
|
|
493229
493439
|
}
|
|
493230
493440
|
}
|
|
493231
493441
|
logForDiagnosticsNoPII("info", "started", {
|
|
493232
|
-
version: { VERSION: "0.2.
|
|
493442
|
+
version: { VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", PACKAGE_URL: "theus-cli", NATIVE_PACKAGE_URL: "theus-cli-native", FEEDBACK_CHANNEL: "theus", VERSION_CHANGELOG: "", ISSUES_EXPLAINER: "report issues to the Theus maintainers" }.VERSION,
|
|
493233
493443
|
is_native_binary: isInBundledMode()
|
|
493234
493444
|
});
|
|
493235
493445
|
registerCleanup(async () => {
|
|
@@ -494097,7 +494307,7 @@ Usage: theus --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
494097
494307
|
pendingHookMessages
|
|
494098
494308
|
}, renderAndRun);
|
|
494099
494309
|
}
|
|
494100
|
-
}).version(`${{ VERSION: "0.2.
|
|
494310
|
+
}).version(`${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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");
|
|
494101
494311
|
program2.option("-w, --worktree [name]", "Crea un nuevo worktree de git para esta sesi\xF3n (opcionalmente indica un nombre)");
|
|
494102
494312
|
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.");
|
|
494103
494313
|
if (canUserConfigureAdvisor()) {
|
|
@@ -494649,7 +494859,7 @@ if (false) {}
|
|
|
494649
494859
|
async function main2() {
|
|
494650
494860
|
const args = process.argv.slice(2);
|
|
494651
494861
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
494652
|
-
console.log(`${{ VERSION: "0.2.
|
|
494862
|
+
console.log(`${{ VERSION: "0.2.31", BUILD_TIME: "1970-01-01T00:00:00.000Z", 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)`);
|
|
494653
494863
|
return;
|
|
494654
494864
|
}
|
|
494655
494865
|
const {
|