ur-agent 1.21.0 → 1.22.0
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/CHANGELOG.md +33 -0
- package/README.md +7 -0
- package/dist/cli.js +690 -416
- package/docs/AGENT_FEATURES.md +11 -0
- package/docs/AGENT_UPGRADE_1.22.0.md +48 -0
- package/docs/USAGE.md +7 -0
- package/documentation/app.js +4 -4
- package/documentation/index.html +1 -1
- package/extensions/vscode-ur-inline-diffs/package.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16939,7 +16939,7 @@ function formatAgentTrendReport(report = buildAgentTrendReport()) {
|
|
|
16939
16939
|
function formatA2AAgentCard(options = {}, pretty = true) {
|
|
16940
16940
|
return JSON.stringify(buildA2AAgentCard(options), null, pretty ? 2 : 0);
|
|
16941
16941
|
}
|
|
16942
|
-
var urVersion = "1.
|
|
16942
|
+
var urVersion = "1.22.0", coverage, priorityRoadmap;
|
|
16943
16943
|
var init_trends = __esm(() => {
|
|
16944
16944
|
coverage = [
|
|
16945
16945
|
{
|
|
@@ -71247,7 +71247,7 @@ var init_auth = __esm(() => {
|
|
|
71247
71247
|
|
|
71248
71248
|
// src/utils/userAgent.ts
|
|
71249
71249
|
function getURCodeUserAgent() {
|
|
71250
|
-
return `ur/${"1.
|
|
71250
|
+
return `ur/${"1.22.0"}`;
|
|
71251
71251
|
}
|
|
71252
71252
|
|
|
71253
71253
|
// src/utils/workloadContext.ts
|
|
@@ -71269,7 +71269,7 @@ function getUserAgent() {
|
|
|
71269
71269
|
const clientApp = process.env.UR_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}` : "";
|
|
71270
71270
|
const workload = getWorkload();
|
|
71271
71271
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
71272
|
-
return `ur-cli/${"1.
|
|
71272
|
+
return `ur-cli/${"1.22.0"} (${process.env.USER_TYPE}, ${process.env.UR_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
71273
71273
|
}
|
|
71274
71274
|
function getMCPUserAgent() {
|
|
71275
71275
|
const parts = [];
|
|
@@ -71283,7 +71283,7 @@ function getMCPUserAgent() {
|
|
|
71283
71283
|
parts.push(`client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}`);
|
|
71284
71284
|
}
|
|
71285
71285
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
71286
|
-
return `ur/${"1.
|
|
71286
|
+
return `ur/${"1.22.0"}${suffix}`;
|
|
71287
71287
|
}
|
|
71288
71288
|
function getWebFetchUserAgent() {
|
|
71289
71289
|
return `UR-User (${getURCodeUserAgent()})`;
|
|
@@ -71421,7 +71421,7 @@ var init_user = __esm(() => {
|
|
|
71421
71421
|
deviceId,
|
|
71422
71422
|
sessionId: getSessionId(),
|
|
71423
71423
|
email: getEmail(),
|
|
71424
|
-
appVersion: "1.
|
|
71424
|
+
appVersion: "1.22.0",
|
|
71425
71425
|
platform: getHostPlatformForAnalytics(),
|
|
71426
71426
|
organizationUuid,
|
|
71427
71427
|
accountUuid,
|
|
@@ -77198,7 +77198,7 @@ var init_metadata = __esm(() => {
|
|
|
77198
77198
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
77199
77199
|
WHITESPACE_REGEX = /\s+/;
|
|
77200
77200
|
getVersionBase = memoize_default(() => {
|
|
77201
|
-
const match = "1.
|
|
77201
|
+
const match = "1.22.0".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
77202
77202
|
return match ? match[0] : undefined;
|
|
77203
77203
|
});
|
|
77204
77204
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -77238,7 +77238,7 @@ var init_metadata = __esm(() => {
|
|
|
77238
77238
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
77239
77239
|
isURCodeAction: isEnvTruthy(process.env.UR_CODE_ACTION),
|
|
77240
77240
|
isURAiAuth: isURAISubscriber2(),
|
|
77241
|
-
version: "1.
|
|
77241
|
+
version: "1.22.0",
|
|
77242
77242
|
versionBase: getVersionBase(),
|
|
77243
77243
|
buildTime: "",
|
|
77244
77244
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
@@ -77908,7 +77908,7 @@ function initialize1PEventLogging() {
|
|
|
77908
77908
|
const platform2 = getPlatform();
|
|
77909
77909
|
const attributes = {
|
|
77910
77910
|
[import_semantic_conventions4.ATTR_SERVICE_NAME]: "ur",
|
|
77911
|
-
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.
|
|
77911
|
+
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.22.0"
|
|
77912
77912
|
};
|
|
77913
77913
|
if (platform2 === "wsl") {
|
|
77914
77914
|
const wslVersion = getWslVersion();
|
|
@@ -77935,7 +77935,7 @@ function initialize1PEventLogging() {
|
|
|
77935
77935
|
})
|
|
77936
77936
|
]
|
|
77937
77937
|
});
|
|
77938
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.
|
|
77938
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.22.0");
|
|
77939
77939
|
}
|
|
77940
77940
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
77941
77941
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -79803,7 +79803,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
79803
79803
|
if (!isAttributionHeaderEnabled()) {
|
|
79804
79804
|
return "";
|
|
79805
79805
|
}
|
|
79806
|
-
const version2 = `${"1.
|
|
79806
|
+
const version2 = `${"1.22.0"}.${fingerprint}`;
|
|
79807
79807
|
const entrypoint = process.env.UR_CODE_ENTRYPOINT ?? "unknown";
|
|
79808
79808
|
const cch = "";
|
|
79809
79809
|
const workload = getWorkload();
|
|
@@ -186485,7 +186485,7 @@ function getTelemetryAttributes() {
|
|
|
186485
186485
|
attributes["session.id"] = sessionId;
|
|
186486
186486
|
}
|
|
186487
186487
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
186488
|
-
attributes["app.version"] = "1.
|
|
186488
|
+
attributes["app.version"] = "1.22.0";
|
|
186489
186489
|
}
|
|
186490
186490
|
const oauthAccount = getOauthAccountInfo();
|
|
186491
186491
|
if (oauthAccount) {
|
|
@@ -222539,7 +222539,7 @@ function getInstallationEnv() {
|
|
|
222539
222539
|
return;
|
|
222540
222540
|
}
|
|
222541
222541
|
function getURCodeVersion() {
|
|
222542
|
-
return "1.
|
|
222542
|
+
return "1.22.0";
|
|
222543
222543
|
}
|
|
222544
222544
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
222545
222545
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -225267,7 +225267,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
225267
225267
|
const client2 = new Client({
|
|
225268
225268
|
name: "ur",
|
|
225269
225269
|
title: "UR",
|
|
225270
|
-
version: "1.
|
|
225270
|
+
version: "1.22.0",
|
|
225271
225271
|
description: "URHQ's agentic coding tool",
|
|
225272
225272
|
websiteUrl: PRODUCT_URL
|
|
225273
225273
|
}, {
|
|
@@ -225621,7 +225621,7 @@ var init_client5 = __esm(() => {
|
|
|
225621
225621
|
const client2 = new Client({
|
|
225622
225622
|
name: "ur",
|
|
225623
225623
|
title: "UR",
|
|
225624
|
-
version: "1.
|
|
225624
|
+
version: "1.22.0",
|
|
225625
225625
|
description: "URHQ's agentic coding tool",
|
|
225626
225626
|
websiteUrl: PRODUCT_URL
|
|
225627
225627
|
}, {
|
|
@@ -235434,9 +235434,9 @@ async function assertMinVersion() {
|
|
|
235434
235434
|
if (false) {}
|
|
235435
235435
|
try {
|
|
235436
235436
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
235437
|
-
if (versionConfig.minVersion && lt("1.
|
|
235437
|
+
if (versionConfig.minVersion && lt("1.22.0", versionConfig.minVersion)) {
|
|
235438
235438
|
console.error(`
|
|
235439
|
-
It looks like your version of UR (${"1.
|
|
235439
|
+
It looks like your version of UR (${"1.22.0"}) needs an update.
|
|
235440
235440
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
235441
235441
|
|
|
235442
235442
|
To update, please run:
|
|
@@ -235652,7 +235652,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
235652
235652
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
235653
235653
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
235654
235654
|
pid: process.pid,
|
|
235655
|
-
currentVersion: "1.
|
|
235655
|
+
currentVersion: "1.22.0"
|
|
235656
235656
|
});
|
|
235657
235657
|
return "in_progress";
|
|
235658
235658
|
}
|
|
@@ -235661,7 +235661,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
235661
235661
|
if (!env2.isRunningWithBun() && env2.isNpmFromWindowsPath()) {
|
|
235662
235662
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
235663
235663
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
235664
|
-
currentVersion: "1.
|
|
235664
|
+
currentVersion: "1.22.0"
|
|
235665
235665
|
});
|
|
235666
235666
|
console.error(`
|
|
235667
235667
|
Error: Windows NPM detected in WSL
|
|
@@ -236196,7 +236196,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
236196
236196
|
}
|
|
236197
236197
|
async function getDoctorDiagnostic() {
|
|
236198
236198
|
const installationType = await getCurrentInstallationType();
|
|
236199
|
-
const version2 = typeof MACRO !== "undefined" ? "1.
|
|
236199
|
+
const version2 = typeof MACRO !== "undefined" ? "1.22.0" : "unknown";
|
|
236200
236200
|
const installationPath = await getInstallationPath();
|
|
236201
236201
|
const invokedBinary = getInvokedBinary();
|
|
236202
236202
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -237131,8 +237131,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
237131
237131
|
const maxVersion = await getMaxVersion();
|
|
237132
237132
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
237133
237133
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
237134
|
-
if (gte("1.
|
|
237135
|
-
logForDebugging(`Native installer: current version ${"1.
|
|
237134
|
+
if (gte("1.22.0", maxVersion)) {
|
|
237135
|
+
logForDebugging(`Native installer: current version ${"1.22.0"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
237136
237136
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
237137
237137
|
latency_ms: Date.now() - startTime,
|
|
237138
237138
|
max_version: maxVersion,
|
|
@@ -237143,7 +237143,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
237143
237143
|
version2 = maxVersion;
|
|
237144
237144
|
}
|
|
237145
237145
|
}
|
|
237146
|
-
if (!forceReinstall && version2 === "1.
|
|
237146
|
+
if (!forceReinstall && version2 === "1.22.0" && await versionIsAvailable(version2) && await isPossibleURBinary(executablePath)) {
|
|
237147
237147
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
237148
237148
|
logEvent("tengu_native_update_complete", {
|
|
237149
237149
|
latency_ms: Date.now() - startTime,
|
|
@@ -332970,7 +332970,7 @@ function Feedback({
|
|
|
332970
332970
|
platform: env2.platform,
|
|
332971
332971
|
gitRepo: envInfo.isGit,
|
|
332972
332972
|
terminal: env2.terminal,
|
|
332973
|
-
version: "1.
|
|
332973
|
+
version: "1.22.0",
|
|
332974
332974
|
transcript: normalizeMessagesForAPI(messages),
|
|
332975
332975
|
errors: sanitizedErrors,
|
|
332976
332976
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -333162,7 +333162,7 @@ function Feedback({
|
|
|
333162
333162
|
", ",
|
|
333163
333163
|
env2.terminal,
|
|
333164
333164
|
", v",
|
|
333165
|
-
"1.
|
|
333165
|
+
"1.22.0"
|
|
333166
333166
|
]
|
|
333167
333167
|
}, undefined, true, undefined, this)
|
|
333168
333168
|
]
|
|
@@ -333268,7 +333268,7 @@ ${sanitizedDescription}
|
|
|
333268
333268
|
` + `**Environment Info**
|
|
333269
333269
|
` + `- Platform: ${env2.platform}
|
|
333270
333270
|
` + `- Terminal: ${env2.terminal}
|
|
333271
|
-
` + `- Version: ${"1.
|
|
333271
|
+
` + `- Version: ${"1.22.0"}
|
|
333272
333272
|
` + `- Feedback ID: ${feedbackId}
|
|
333273
333273
|
` + `
|
|
333274
333274
|
**Errors**
|
|
@@ -336378,7 +336378,7 @@ function buildPrimarySection() {
|
|
|
336378
336378
|
}, undefined, false, undefined, this);
|
|
336379
336379
|
return [{
|
|
336380
336380
|
label: "Version",
|
|
336381
|
-
value: "1.
|
|
336381
|
+
value: "1.22.0"
|
|
336382
336382
|
}, {
|
|
336383
336383
|
label: "Session name",
|
|
336384
336384
|
value: nameValue
|
|
@@ -339656,7 +339656,7 @@ function Config({
|
|
|
339656
339656
|
}
|
|
339657
339657
|
}, undefined, false, undefined, this)
|
|
339658
339658
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime177.jsxDEV(ChannelDowngradeDialog, {
|
|
339659
|
-
currentVersion: "1.
|
|
339659
|
+
currentVersion: "1.22.0",
|
|
339660
339660
|
onChoice: (choice) => {
|
|
339661
339661
|
setShowSubmenu(null);
|
|
339662
339662
|
setTabsHidden(false);
|
|
@@ -339668,7 +339668,7 @@ function Config({
|
|
|
339668
339668
|
autoUpdatesChannel: "stable"
|
|
339669
339669
|
};
|
|
339670
339670
|
if (choice === "stay") {
|
|
339671
|
-
newSettings.minimumVersion = "1.
|
|
339671
|
+
newSettings.minimumVersion = "1.22.0";
|
|
339672
339672
|
}
|
|
339673
339673
|
updateSettingsForSource("userSettings", newSettings);
|
|
339674
339674
|
setSettingsData((prev_27) => ({
|
|
@@ -347738,7 +347738,7 @@ function HelpV2(t0) {
|
|
|
347738
347738
|
let t6;
|
|
347739
347739
|
if ($3[31] !== tabs) {
|
|
347740
347740
|
t6 = /* @__PURE__ */ jsx_dev_runtime204.jsxDEV(Tabs, {
|
|
347741
|
-
title: `UR v${"1.
|
|
347741
|
+
title: `UR v${"1.22.0"}`,
|
|
347742
347742
|
color: "professionalBlue",
|
|
347743
347743
|
defaultTab: "general",
|
|
347744
347744
|
children: tabs
|
|
@@ -367702,7 +367702,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
367702
367702
|
return [];
|
|
367703
367703
|
}
|
|
367704
367704
|
}
|
|
367705
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.
|
|
367705
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.22.0") {
|
|
367706
367706
|
if (process.env.USER_TYPE === "ant") {
|
|
367707
367707
|
const changelog = "";
|
|
367708
367708
|
if (changelog) {
|
|
@@ -367729,7 +367729,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.21.0")
|
|
|
367729
367729
|
releaseNotes
|
|
367730
367730
|
};
|
|
367731
367731
|
}
|
|
367732
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.
|
|
367732
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.22.0") {
|
|
367733
367733
|
if (process.env.USER_TYPE === "ant") {
|
|
367734
367734
|
const changelog = "";
|
|
367735
367735
|
if (changelog) {
|
|
@@ -368899,7 +368899,7 @@ function getRecentActivitySync() {
|
|
|
368899
368899
|
return cachedActivity;
|
|
368900
368900
|
}
|
|
368901
368901
|
function getLogoDisplayData() {
|
|
368902
|
-
const version2 = process.env.DEMO_VERSION ?? "1.
|
|
368902
|
+
const version2 = process.env.DEMO_VERSION ?? "1.22.0";
|
|
368903
368903
|
const serverUrl = getDirectConnectServerUrl();
|
|
368904
368904
|
const displayPath = process.env.DEMO_VERSION ? "/code/ur" : getDisplayPath(getCwd());
|
|
368905
368905
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -369688,7 +369688,7 @@ function LogoV2() {
|
|
|
369688
369688
|
if ($3[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
369689
369689
|
t2 = () => {
|
|
369690
369690
|
const currentConfig = getGlobalConfig();
|
|
369691
|
-
if (currentConfig.lastReleaseNotesSeen === "1.
|
|
369691
|
+
if (currentConfig.lastReleaseNotesSeen === "1.22.0") {
|
|
369692
369692
|
return;
|
|
369693
369693
|
}
|
|
369694
369694
|
saveGlobalConfig(_temp326);
|
|
@@ -370373,12 +370373,12 @@ function LogoV2() {
|
|
|
370373
370373
|
return t41;
|
|
370374
370374
|
}
|
|
370375
370375
|
function _temp326(current) {
|
|
370376
|
-
if (current.lastReleaseNotesSeen === "1.
|
|
370376
|
+
if (current.lastReleaseNotesSeen === "1.22.0") {
|
|
370377
370377
|
return current;
|
|
370378
370378
|
}
|
|
370379
370379
|
return {
|
|
370380
370380
|
...current,
|
|
370381
|
-
lastReleaseNotesSeen: "1.
|
|
370381
|
+
lastReleaseNotesSeen: "1.22.0"
|
|
370382
370382
|
};
|
|
370383
370383
|
}
|
|
370384
370384
|
function _temp243(s_0) {
|
|
@@ -387331,7 +387331,7 @@ function buildToolUseContext(tools, readFileStateCache) {
|
|
|
387331
387331
|
async function handleInitialize() {
|
|
387332
387332
|
return {
|
|
387333
387333
|
name: "ur-agent",
|
|
387334
|
-
version: "1.
|
|
387334
|
+
version: "1.22.0",
|
|
387335
387335
|
protocolVersion: "0.1.0"
|
|
387336
387336
|
};
|
|
387337
387337
|
}
|
|
@@ -396024,11 +396024,47 @@ var init_sdk2 = __esm(() => {
|
|
|
396024
396024
|
});
|
|
396025
396025
|
|
|
396026
396026
|
// src/services/agents/evals.ts
|
|
396027
|
+
var exports_evals = {};
|
|
396028
|
+
__export(exports_evals, {
|
|
396029
|
+
writeRunMetrics: () => writeRunMetrics,
|
|
396030
|
+
writeDashboard: () => writeDashboard,
|
|
396031
|
+
validateEvalSuite: () => validateEvalSuite,
|
|
396032
|
+
suiteSlug: () => suiteSlug,
|
|
396033
|
+
scaffoldEvals: () => scaffoldEvals,
|
|
396034
|
+
saveSuite: () => saveSuite,
|
|
396035
|
+
saveReport: () => saveReport,
|
|
396036
|
+
saveReliabilityReport: () => saveReliabilityReport,
|
|
396037
|
+
runSuiteReliability: () => runSuiteReliability,
|
|
396038
|
+
runSuite: () => runSuite,
|
|
396039
|
+
parseSuiteText: () => parseSuiteText,
|
|
396040
|
+
makeDryJudgeRunner: () => makeDryJudgeRunner,
|
|
396041
|
+
makeDryEvalRunner: () => makeDryEvalRunner,
|
|
396042
|
+
makeCliJudgeRunner: () => makeCliJudgeRunner,
|
|
396043
|
+
makeCliEvalRunner: () => makeCliEvalRunner,
|
|
396044
|
+
loadSuite: () => loadSuite,
|
|
396045
|
+
loadRunMetrics: () => loadRunMetrics,
|
|
396046
|
+
loadReport: () => loadReport,
|
|
396047
|
+
loadAllReports: () => loadAllReports,
|
|
396048
|
+
loadAllReliability: () => loadAllReliability,
|
|
396049
|
+
listSuites: () => listSuites,
|
|
396050
|
+
importBenchmarkSuite: () => importBenchmarkSuite,
|
|
396051
|
+
gradeTrajectory: () => gradeTrajectory,
|
|
396052
|
+
gradeOutput: () => gradeOutput,
|
|
396053
|
+
formatSuiteValidation: () => formatSuiteValidation,
|
|
396054
|
+
formatReliabilityReport: () => formatReliabilityReport,
|
|
396055
|
+
formatEvalReport: () => formatEvalReport,
|
|
396056
|
+
evalsDir: () => evalsDir,
|
|
396057
|
+
defaultEvalSuite: () => defaultEvalSuite,
|
|
396058
|
+
buildDashboardHtml: () => buildDashboardHtml,
|
|
396059
|
+
buildBenchmarkSuite: () => buildBenchmarkSuite,
|
|
396060
|
+
BENCHMARK_ADAPTERS: () => BENCHMARK_ADAPTERS
|
|
396061
|
+
});
|
|
396027
396062
|
import {
|
|
396028
396063
|
existsSync as existsSync39,
|
|
396029
396064
|
mkdirSync as mkdirSync36,
|
|
396030
396065
|
readFileSync as readFileSync45,
|
|
396031
396066
|
readdirSync as readdirSync15,
|
|
396067
|
+
rmSync as rmSync8,
|
|
396032
396068
|
writeFileSync as writeFileSync34
|
|
396033
396069
|
} from "fs";
|
|
396034
396070
|
import { join as join156 } from "path";
|
|
@@ -396158,6 +396194,9 @@ function preview4(text, max2 = 160) {
|
|
|
396158
396194
|
const value = text.replace(/\s+/g, " ").trim();
|
|
396159
396195
|
return value.length <= max2 ? value : `${value.slice(0, max2)}\u2026`;
|
|
396160
396196
|
}
|
|
396197
|
+
function sum(nums) {
|
|
396198
|
+
return nums.reduce((acc, n2) => acc + (n2 ?? 0), 0);
|
|
396199
|
+
}
|
|
396161
396200
|
function buildReport(name, cases) {
|
|
396162
396201
|
const passed = cases.filter((item) => item.passed).length;
|
|
396163
396202
|
const byCategory = {};
|
|
@@ -396167,6 +396206,8 @@ function buildReport(name, cases) {
|
|
|
396167
396206
|
if (item.passed)
|
|
396168
396207
|
bucket.passed += 1;
|
|
396169
396208
|
}
|
|
396209
|
+
const metrics = cases.map((c4) => c4.metrics);
|
|
396210
|
+
const testRuns = metrics.filter((m) => m?.testPassed !== undefined);
|
|
396170
396211
|
return {
|
|
396171
396212
|
name,
|
|
396172
396213
|
generatedAt: new Date().toISOString(),
|
|
@@ -396175,6 +396216,14 @@ function buildReport(name, cases) {
|
|
|
396175
396216
|
failed: cases.length - passed,
|
|
396176
396217
|
passRate: cases.length > 0 ? Number((passed / cases.length).toFixed(2)) : 0,
|
|
396177
396218
|
byCategory,
|
|
396219
|
+
totalDurationMs: sum(metrics.map((m) => m?.durationMs)),
|
|
396220
|
+
totalCostUSD: metrics.length > 0 ? Number(sum(metrics.map((m) => m?.costUSD)).toFixed(6)) : undefined,
|
|
396221
|
+
totalInputTokens: sum(metrics.map((m) => m?.inputTokens)) || undefined,
|
|
396222
|
+
totalOutputTokens: sum(metrics.map((m) => m?.outputTokens)) || undefined,
|
|
396223
|
+
totalFilesChanged: sum(metrics.map((m) => m?.filesChanged)) || undefined,
|
|
396224
|
+
totalCommandFailures: sum(metrics.map((m) => m?.commandFailures)) || undefined,
|
|
396225
|
+
totalHumanEditsNeeded: sum(metrics.map((m) => m?.humanEditsNeeded)) || undefined,
|
|
396226
|
+
testPassRate: testRuns.length > 0 ? Number((testRuns.filter((m) => m?.testPassed).length / testRuns.length).toFixed(2)) : undefined,
|
|
396178
396227
|
cases
|
|
396179
396228
|
};
|
|
396180
396229
|
}
|
|
@@ -396186,11 +396235,13 @@ async function runSuite(suite, runner2, options2 = {}) {
|
|
|
396186
396235
|
let output = "";
|
|
396187
396236
|
let isError = false;
|
|
396188
396237
|
let trajectory;
|
|
396238
|
+
let metrics;
|
|
396189
396239
|
try {
|
|
396190
396240
|
const run = await runner2(evalCase);
|
|
396191
396241
|
output = run.output;
|
|
396192
396242
|
isError = run.isError === true;
|
|
396193
396243
|
trajectory = run.trajectory;
|
|
396244
|
+
metrics = run.metrics;
|
|
396194
396245
|
} catch (error40) {
|
|
396195
396246
|
output = error40 instanceof Error ? error40.message : String(error40);
|
|
396196
396247
|
isError = true;
|
|
@@ -396222,7 +396273,8 @@ async function runSuite(suite, runner2, options2 = {}) {
|
|
|
396222
396273
|
isError,
|
|
396223
396274
|
durationMs: Date.now() - started,
|
|
396224
396275
|
checks: checks4,
|
|
396225
|
-
outputPreview: preview4(output)
|
|
396276
|
+
outputPreview: preview4(output),
|
|
396277
|
+
metrics
|
|
396226
396278
|
});
|
|
396227
396279
|
}
|
|
396228
396280
|
return buildReport(suite.name, results);
|
|
@@ -396258,7 +396310,7 @@ async function runSuiteReliability(suite, runner2, options2) {
|
|
|
396258
396310
|
passRate: Number((bucket.passes / trials).toFixed(2))
|
|
396259
396311
|
}));
|
|
396260
396312
|
const solvedAll = caseResults.filter((c4) => c4.solvedAll).length;
|
|
396261
|
-
const meanPassRate = caseResults.length > 0 ? caseResults.reduce((
|
|
396313
|
+
const meanPassRate = caseResults.length > 0 ? caseResults.reduce((sum2, c4) => sum2 + c4.passRate, 0) / caseResults.length : 0;
|
|
396262
396314
|
return {
|
|
396263
396315
|
name: suite.name,
|
|
396264
396316
|
generatedAt: new Date().toISOString(),
|
|
@@ -396269,8 +396321,95 @@ async function runSuiteReliability(suite, runner2, options2) {
|
|
|
396269
396321
|
cases: caseResults
|
|
396270
396322
|
};
|
|
396271
396323
|
}
|
|
396324
|
+
function metricsFile() {
|
|
396325
|
+
return join156(process.env.UR_EVAL_METRICS_DIR ?? process.cwd(), `.ur-eval-metrics-${process.pid}.json`);
|
|
396326
|
+
}
|
|
396327
|
+
function readChildMetricsFile(path22) {
|
|
396328
|
+
if (!existsSync39(path22))
|
|
396329
|
+
return;
|
|
396330
|
+
try {
|
|
396331
|
+
const parsed = safeParseJSON(readFileSync45(path22, "utf-8"), false);
|
|
396332
|
+
if (parsed && typeof parsed === "object")
|
|
396333
|
+
return parsed;
|
|
396334
|
+
} catch {}
|
|
396335
|
+
return;
|
|
396336
|
+
}
|
|
396337
|
+
function deleteChildMetricsFile(path22) {
|
|
396338
|
+
try {
|
|
396339
|
+
rmSync8(path22, { force: true });
|
|
396340
|
+
} catch {}
|
|
396341
|
+
}
|
|
396342
|
+
async function gitDiffStats(cwd2) {
|
|
396343
|
+
const result = await execFileNoThrowWithCwd("git", ["diff", "--stat"], { cwd: cwd2, timeout: 30000, preserveOutputOnError: true });
|
|
396344
|
+
if (result.code !== 0 || !result.stdout.trim()) {
|
|
396345
|
+
return { filesChanged: 0, insertions: 0, deletions: 0 };
|
|
396346
|
+
}
|
|
396347
|
+
let filesChanged = 0;
|
|
396348
|
+
let insertions = 0;
|
|
396349
|
+
let deletions = 0;
|
|
396350
|
+
for (const line of result.stdout.trim().split(`
|
|
396351
|
+
`)) {
|
|
396352
|
+
if (line.includes("|")) {
|
|
396353
|
+
filesChanged += 1;
|
|
396354
|
+
const match = line.match(/(\d+)\s*insertion|\+(\d+)|(\d+)\s*deletion|-(\d+)/g);
|
|
396355
|
+
if (match) {
|
|
396356
|
+
for (const token of match) {
|
|
396357
|
+
const num = Number(token.replace(/[^0-9]/g, ""));
|
|
396358
|
+
if (Number.isNaN(num))
|
|
396359
|
+
continue;
|
|
396360
|
+
if (token.includes("insertion") || token.includes("+"))
|
|
396361
|
+
insertions += num;
|
|
396362
|
+
if (token.includes("deletion") || token.includes("-"))
|
|
396363
|
+
deletions += num;
|
|
396364
|
+
}
|
|
396365
|
+
}
|
|
396366
|
+
}
|
|
396367
|
+
}
|
|
396368
|
+
return { filesChanged, insertions, deletions };
|
|
396369
|
+
}
|
|
396370
|
+
async function runTestCommand(cwd2, command5) {
|
|
396371
|
+
const result = await execFileNoThrowWithCwd("sh", ["-c", command5], {
|
|
396372
|
+
cwd: cwd2,
|
|
396373
|
+
timeout: 5 * 60000,
|
|
396374
|
+
preserveOutputOnError: true
|
|
396375
|
+
});
|
|
396376
|
+
return {
|
|
396377
|
+
testPassed: result.code === 0,
|
|
396378
|
+
testStdout: result.stdout,
|
|
396379
|
+
testStderr: result.stderr || result.error || ""
|
|
396380
|
+
};
|
|
396381
|
+
}
|
|
396382
|
+
function countCommandFailures(output) {
|
|
396383
|
+
const markers = ["[ERROR]", "Command failed", "exit code 1", "Error:", "FAILED"];
|
|
396384
|
+
let count4 = 0;
|
|
396385
|
+
const lower = output.toLowerCase();
|
|
396386
|
+
for (const marker of markers) {
|
|
396387
|
+
const re = new RegExp(marker.replace(/\[/g, "\\[").replace(/\]/g, "\\]").toLowerCase(), "g");
|
|
396388
|
+
const matches = lower.match(re);
|
|
396389
|
+
if (matches)
|
|
396390
|
+
count4 += matches.length;
|
|
396391
|
+
}
|
|
396392
|
+
return count4;
|
|
396393
|
+
}
|
|
396394
|
+
function countHumanEdits(output) {
|
|
396395
|
+
const markers = ["human edit", "manual edit", "needs edit", "needs human", "human intervention", "cannot proceed"];
|
|
396396
|
+
let count4 = 0;
|
|
396397
|
+
const lower = output.toLowerCase();
|
|
396398
|
+
for (const marker of markers) {
|
|
396399
|
+
const re = new RegExp(marker.toLowerCase(), "g");
|
|
396400
|
+
const matches = lower.match(re);
|
|
396401
|
+
if (matches)
|
|
396402
|
+
count4 += matches.length;
|
|
396403
|
+
}
|
|
396404
|
+
return count4;
|
|
396405
|
+
}
|
|
396406
|
+
function firstModelName(modelUsage) {
|
|
396407
|
+
const names = Object.keys(modelUsage);
|
|
396408
|
+
return names.length > 0 ? names[0] : undefined;
|
|
396409
|
+
}
|
|
396272
396410
|
function makeCliEvalRunner(options2) {
|
|
396273
396411
|
return async (evalCase) => {
|
|
396412
|
+
resetCostState();
|
|
396274
396413
|
const file2 = process.execPath;
|
|
396275
396414
|
const baseArgs = [process.argv[1] ?? ""];
|
|
396276
396415
|
const args = [...baseArgs, "-p", "--output-format", "json"];
|
|
@@ -396281,13 +396420,43 @@ function makeCliEvalRunner(options2) {
|
|
|
396281
396420
|
args.push("--dangerously-skip-permissions");
|
|
396282
396421
|
}
|
|
396283
396422
|
args.push(evalCase.prompt);
|
|
396423
|
+
const childMetricsPath = metricsFile();
|
|
396284
396424
|
const result = await execFileNoThrowWithCwd(file2, args, {
|
|
396285
396425
|
cwd: options2.cwd,
|
|
396286
396426
|
timeout: options2.timeoutMs ?? 30 * 60 * 1000,
|
|
396287
|
-
preserveOutputOnError: true
|
|
396427
|
+
preserveOutputOnError: true,
|
|
396428
|
+
env: {
|
|
396429
|
+
...process.env,
|
|
396430
|
+
UR_EVAL_METRICS_FILE: childMetricsPath
|
|
396431
|
+
}
|
|
396288
396432
|
});
|
|
396289
396433
|
const output = parseHeadlessOutput(result.stdout) || result.stderr || result.error || "";
|
|
396290
|
-
|
|
396434
|
+
const childMetrics = readChildMetricsFile(childMetricsPath);
|
|
396435
|
+
deleteChildMetricsFile(childMetricsPath);
|
|
396436
|
+
const diffStats = await gitDiffStats(options2.cwd);
|
|
396437
|
+
let testResult;
|
|
396438
|
+
if (evalCase.expect.testCommand) {
|
|
396439
|
+
const ran = await runTestCommand(options2.cwd, evalCase.expect.testCommand);
|
|
396440
|
+
testResult = { ...ran, testCommand: evalCase.expect.testCommand };
|
|
396441
|
+
}
|
|
396442
|
+
const modelUsage = getModelUsage();
|
|
396443
|
+
const metrics = {
|
|
396444
|
+
durationMs: 0,
|
|
396445
|
+
costUSD: childMetrics?.costUSD ?? getTotalCostUSD(),
|
|
396446
|
+
inputTokens: childMetrics?.inputTokens ?? getTotalInputTokens(),
|
|
396447
|
+
outputTokens: childMetrics?.outputTokens ?? getTotalOutputTokens(),
|
|
396448
|
+
model: childMetrics?.model ?? firstModelName(modelUsage),
|
|
396449
|
+
filesChanged: diffStats.filesChanged,
|
|
396450
|
+
insertions: diffStats.insertions + (childMetrics?.linesAdded ?? getTotalLinesAdded()),
|
|
396451
|
+
deletions: diffStats.deletions + (childMetrics?.linesRemoved ?? getTotalLinesRemoved()),
|
|
396452
|
+
testPassed: testResult?.testPassed,
|
|
396453
|
+
testCommand: testResult?.testCommand,
|
|
396454
|
+
testStdout: testResult?.testStdout,
|
|
396455
|
+
testStderr: testResult?.testStderr,
|
|
396456
|
+
commandFailures: countCommandFailures(output),
|
|
396457
|
+
humanEditsNeeded: countHumanEdits(output)
|
|
396458
|
+
};
|
|
396459
|
+
return { output, isError: result.code !== 0, metrics };
|
|
396291
396460
|
};
|
|
396292
396461
|
}
|
|
396293
396462
|
function makeDryEvalRunner() {
|
|
@@ -396328,13 +396497,37 @@ function makeDryJudgeRunner(pass = true) {
|
|
|
396328
396497
|
function escapeHtml(text) {
|
|
396329
396498
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
396330
396499
|
}
|
|
396500
|
+
function num(n2, fallback = "\u2014") {
|
|
396501
|
+
return typeof n2 === "number" ? String(n2) : fallback;
|
|
396502
|
+
}
|
|
396503
|
+
function fmtUsd(n2) {
|
|
396504
|
+
return typeof n2 === "number" ? `$${n2.toFixed(6)}` : "\u2014";
|
|
396505
|
+
}
|
|
396331
396506
|
function buildDashboardHtml(reports, reliability = []) {
|
|
396332
396507
|
const generatedAt = new Date().toISOString();
|
|
396508
|
+
const summaryCards = (report) => {
|
|
396509
|
+
const cards = [
|
|
396510
|
+
["Pass rate", `${Math.round(report.passRate * 100)}%`],
|
|
396511
|
+
["Test pass rate", report.testPassRate !== undefined ? `${Math.round(report.testPassRate * 100)}%` : "\u2014"],
|
|
396512
|
+
["Cost", fmtUsd(report.totalCostUSD)],
|
|
396513
|
+
["Tokens", `${num(report.totalInputTokens)} / ${num(report.totalOutputTokens)}`],
|
|
396514
|
+
["Files changed", num(report.totalFilesChanged)],
|
|
396515
|
+
["Command failures", num(report.totalCommandFailures)],
|
|
396516
|
+
["Human edits", num(report.totalHumanEditsNeeded)],
|
|
396517
|
+
["Duration", `${num(report.totalDurationMs, "0")}ms`]
|
|
396518
|
+
];
|
|
396519
|
+
return `<div class="cards">${cards.map(([label, value]) => `<div class="card"><div class="val">${escapeHtml(value)}</div><div class="label">${escapeHtml(label)}</div></div>`).join("")}</div>`;
|
|
396520
|
+
};
|
|
396521
|
+
const timelineRow = (c4) => {
|
|
396522
|
+
const m = c4.metrics;
|
|
396523
|
+
const testBadge = m?.testPassed === true ? '<span class="badge ok">test pass</span>' : m?.testPassed === false ? '<span class="badge bad">test fail</span>' : "";
|
|
396524
|
+
return `<tr class="${c4.passed ? "ok" : "bad"}">` + `<td>${c4.passed ? "\u2713" : "\u2717"}</td>` + `<td>${escapeHtml(c4.id)}</td>` + `<td>${escapeHtml(c4.category)}</td>` + `<td>${escapeHtml(m?.model ?? "\u2014")}</td>` + `<td>${num(c4.durationMs)}ms</td>` + `<td>${fmtUsd(m?.costUSD)}</td>` + `<td>${num(m?.inputTokens)} / ${num(m?.outputTokens)}</td>` + `<td>${num(m?.filesChanged)} <span class="muted">+${num(m?.insertions)} \u2212${num(m?.deletions)}</span></td>` + `<td>${testBadge}</td>` + `<td>${num(m?.commandFailures)}</td>` + `<td>${m?.humanEditsNeeded ? `<span class="badge warn">${m.humanEditsNeeded}</span>` : "\u2014"}</td>` + `<td><code>${escapeHtml(c4.outputPreview.slice(0, 60))}</code></td>` + `</tr>`;
|
|
396525
|
+
};
|
|
396333
396526
|
const card = (report) => {
|
|
396334
396527
|
const pct = Math.round(report.passRate * 100);
|
|
396335
396528
|
const cats = Object.entries(report.byCategory).sort((a2, b) => a2[0].localeCompare(b[0])).map(([cat2, b]) => `<tr><td>${escapeHtml(cat2)}</td><td>${b.passed}/${b.total}</td></tr>`).join("");
|
|
396336
|
-
const rows = report.cases.map(
|
|
396337
|
-
return `<section><h2>${escapeHtml(report.name)} \u2014 ${report.passed}/${report.total} (${pct}%)</h2>` + `<p class="muted">generated ${escapeHtml(report.generatedAt)}</p>` + `<table class="cats"><thead><tr><th>category</th><th>pass</th></tr></thead><tbody>${cats}</tbody></table>` + `<table class="cases"><thead><tr><th></th><th>case</th><th>category</th><th>time</th><th>output</th></tr></thead>` + `<tbody>${rows}</tbody></table></section>`;
|
|
396529
|
+
const rows = report.cases.map(timelineRow).join("");
|
|
396530
|
+
return `<section><h2>${escapeHtml(report.name)} \u2014 ${report.passed}/${report.total} (${pct}%)</h2>` + `<p class="muted">generated ${escapeHtml(report.generatedAt)}</p>` + `${summaryCards(report)}` + `<table class="cats"><thead><tr><th>category</th><th>pass</th></tr></thead><tbody>${cats}</tbody></table>` + `<h3>Task timeline</h3>` + `<table class="cases timeline"><thead><tr><th></th><th>case</th><th>category</th><th>model</th><th>time</th><th>cost</th><th>tokens</th><th>files</th><th>test</th><th>cmd fail</th><th>human</th><th>output</th></tr></thead>` + `<tbody>${rows}</tbody></table></section>`;
|
|
396338
396531
|
};
|
|
396339
396532
|
const relCard = (rel) => {
|
|
396340
396533
|
const rows = rel.cases.map((c4) => `<tr class="${c4.solvedAll ? "ok" : "bad"}"><td>${c4.solvedAll ? "\u2713" : "\u2717"}</td>` + `<td>${escapeHtml(c4.id)}</td><td>${c4.passes}/${c4.trials}</td><td>${Math.round(c4.passRate * 100)}%</td></tr>`).join("");
|
|
@@ -396348,12 +396541,20 @@ function buildDashboardHtml(reports, reliability = []) {
|
|
|
396348
396541
|
<style>
|
|
396349
396542
|
:root { color-scheme: light dark; }
|
|
396350
396543
|
body { font: 14px/1.5 ui-sans-serif, system-ui, sans-serif; margin: 2rem; max-width: 1100px; }
|
|
396351
|
-
h1 { margin: 0 0 .25rem; } .muted { color: #888; font-size: 12px; }
|
|
396544
|
+
h1, h2, h3 { margin: 0 0 .25rem; } h3 { margin-top: 1.25rem; font-size: 1rem; } .muted { color: #888; font-size: 12px; }
|
|
396352
396545
|
section { margin: 1.5rem 0; padding: 1rem; border: 1px solid #8884; border-radius: 8px; }
|
|
396546
|
+
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .75rem; margin: .75rem 0 1rem; }
|
|
396547
|
+
.card { padding: .75rem; border: 1px solid #8883; border-radius: 6px; text-align: center; }
|
|
396548
|
+
.card .val { font-size: 1.15rem; font-weight: 600; }
|
|
396549
|
+
.card .label { font-size: .75rem; color: #888; text-transform: uppercase; letter-spacing: .02em; }
|
|
396353
396550
|
table { border-collapse: collapse; width: 100%; margin-top: .5rem; }
|
|
396354
396551
|
th, td { text-align: left; padding: .25rem .5rem; border-bottom: 1px solid #8882; vertical-align: top; }
|
|
396355
396552
|
table.cats { width: auto; } td:last-child { color: #777; }
|
|
396356
396553
|
tr.bad td:first-child { color: #c0392b; } tr.ok td:first-child { color: #27ae60; }
|
|
396554
|
+
.badge { font-size: .75rem; padding: .1rem .35rem; border-radius: 4px; }
|
|
396555
|
+
.badge.ok { background: #27ae601a; color: #27ae60; }
|
|
396556
|
+
.badge.bad { background: #c0392b1a; color: #c0392b; }
|
|
396557
|
+
.badge.warn { background: #f1c40f1a; color: #bfa30b; }
|
|
396357
396558
|
code { background: #8881; padding: 0 .25rem; border-radius: 4px; }
|
|
396358
396559
|
</style></head>
|
|
396359
396560
|
<body><h1>UR Eval Dashboard</h1><p class="muted">generated ${escapeHtml(generatedAt)} \xB7 local-first, no network</p>
|
|
@@ -396402,6 +396603,26 @@ function writeDashboard(cwd2) {
|
|
|
396402
396603
|
writeFileSync34(path22, html3);
|
|
396403
396604
|
return path22;
|
|
396404
396605
|
}
|
|
396606
|
+
function runsDir(cwd2, suiteName) {
|
|
396607
|
+
return join156(evalsDir(cwd2), ".runs", suiteSlug(suiteName));
|
|
396608
|
+
}
|
|
396609
|
+
function writeRunMetrics(cwd2, suiteName, caseId, metrics) {
|
|
396610
|
+
const dir = runsDir(cwd2, suiteName);
|
|
396611
|
+
mkdirSync36(dir, { recursive: true });
|
|
396612
|
+
const path22 = join156(dir, `${caseId}.json`);
|
|
396613
|
+
writeFileSync34(path22, `${JSON.stringify(metrics, null, 2)}
|
|
396614
|
+
`);
|
|
396615
|
+
return path22;
|
|
396616
|
+
}
|
|
396617
|
+
function loadRunMetrics(cwd2, suiteName, caseId) {
|
|
396618
|
+
const path22 = join156(runsDir(cwd2, suiteName), `${caseId}.json`);
|
|
396619
|
+
if (!existsSync39(path22))
|
|
396620
|
+
return null;
|
|
396621
|
+
const parsed = safeParseJSON(readFileSync45(path22, "utf-8"), false);
|
|
396622
|
+
if (!parsed || typeof parsed !== "object")
|
|
396623
|
+
return null;
|
|
396624
|
+
return parsed;
|
|
396625
|
+
}
|
|
396405
396626
|
function formatReliabilityReport(report, json2) {
|
|
396406
396627
|
if (json2)
|
|
396407
396628
|
return JSON.stringify(report, null, 2);
|
|
@@ -396730,8 +396951,15 @@ function formatEvalReport(report, json2) {
|
|
|
396730
396951
|
const lines = [
|
|
396731
396952
|
`Eval report: ${report.name}`,
|
|
396732
396953
|
`Pass rate: ${report.passed}/${report.total} (${pct}%)`,
|
|
396954
|
+
report.testPassRate !== undefined ? `Test pass rate: ${Math.round(report.testPassRate * 100)}%` : null,
|
|
396955
|
+
report.totalCostUSD !== undefined ? `Cost: $${report.totalCostUSD.toFixed(6)}` : null,
|
|
396956
|
+
report.totalInputTokens !== undefined || report.totalOutputTokens !== undefined ? `Tokens: ${report.totalInputTokens ?? 0} in / ${report.totalOutputTokens ?? 0} out` : null,
|
|
396957
|
+
report.totalFilesChanged !== undefined ? `Files changed: ${report.totalFilesChanged}` : null,
|
|
396958
|
+
report.totalCommandFailures !== undefined ? `Command failures: ${report.totalCommandFailures}` : null,
|
|
396959
|
+
report.totalHumanEditsNeeded !== undefined ? `Human edits needed: ${report.totalHumanEditsNeeded}` : null,
|
|
396960
|
+
report.totalDurationMs > 0 ? `Duration: ${report.totalDurationMs}ms` : null,
|
|
396733
396961
|
""
|
|
396734
|
-
];
|
|
396962
|
+
].filter((line) => line !== null);
|
|
396735
396963
|
const categories = Object.entries(report.byCategory).sort((a2, b) => a2[0].localeCompare(b[0]));
|
|
396736
396964
|
if (categories.length > 0) {
|
|
396737
396965
|
lines.push("By category:");
|
|
@@ -396780,6 +397008,7 @@ var init_evals = __esm(() => {
|
|
|
396780
397008
|
init_execFileNoThrow();
|
|
396781
397009
|
init_json();
|
|
396782
397010
|
init_cliStepRunner();
|
|
397011
|
+
init_state();
|
|
396783
397012
|
BENCHMARK_ADAPTERS = [
|
|
396784
397013
|
{
|
|
396785
397014
|
id: "swe-bench",
|
|
@@ -396809,6 +397038,8 @@ var exports_eval = {};
|
|
|
396809
397038
|
__export(exports_eval, {
|
|
396810
397039
|
call: () => call84
|
|
396811
397040
|
});
|
|
397041
|
+
import { mkdirSync as mkdirSync37, writeFileSync as writeFileSync35 } from "fs";
|
|
397042
|
+
import { join as join157 } from "path";
|
|
396812
397043
|
function optionValue6(tokens, flag) {
|
|
396813
397044
|
const index2 = tokens.indexOf(flag);
|
|
396814
397045
|
return index2 >= 0 ? tokens[index2 + 1] : undefined;
|
|
@@ -396874,6 +397105,25 @@ ${names.map((n2) => ` - ${n2}`).join(`
|
|
|
396874
397105
|
Open it in a browser (local-first, no network).`
|
|
396875
397106
|
};
|
|
396876
397107
|
}
|
|
397108
|
+
if (command5 === "report") {
|
|
397109
|
+
const report = loadReport(cwd2, name);
|
|
397110
|
+
if (!report) {
|
|
397111
|
+
return {
|
|
397112
|
+
type: "text",
|
|
397113
|
+
value: `No saved report for ${name}. Run it first: ur eval run ${name}`
|
|
397114
|
+
};
|
|
397115
|
+
}
|
|
397116
|
+
if (tokens.includes("--dashboard")) {
|
|
397117
|
+
const { buildDashboardHtml: buildDashboardHtml2 } = await Promise.resolve().then(() => (init_evals(), exports_evals));
|
|
397118
|
+
const html3 = buildDashboardHtml2([report], []);
|
|
397119
|
+
const dir = join157(evalsDir(cwd2), ".dashboards");
|
|
397120
|
+
mkdirSync37(dir, { recursive: true });
|
|
397121
|
+
const path22 = join157(dir, `${suiteSlug(report.name)}.html`);
|
|
397122
|
+
writeFileSync35(path22, html3);
|
|
397123
|
+
return { type: "text", value: `Wrote single-suite dashboard to ${path22}` };
|
|
397124
|
+
}
|
|
397125
|
+
return { type: "text", value: formatEvalReport(report, json2) };
|
|
397126
|
+
}
|
|
396877
397127
|
if (command5 === "bench" || command5 === "benchmark") {
|
|
396878
397128
|
if (!name || name === "list") {
|
|
396879
397129
|
return { type: "text", value: formatBenchmarkAdapters(json2) };
|
|
@@ -396905,10 +397155,10 @@ Available: ${BENCHMARK_ADAPTERS.map((adapter2) => adapter2.id).join(", ")}`
|
|
|
396905
397155
|
return {
|
|
396906
397156
|
type: "text",
|
|
396907
397157
|
value: `${BENCHMARK_ADAPTERS.find((adapter2) => adapter2.id === name)?.name ?? name} suite ready: ${result.suite.name}
|
|
396908
|
-
|
|
396909
|
-
|
|
396910
|
-
|
|
396911
|
-
|
|
397158
|
+
records read: ${result.records}
|
|
397159
|
+
cases written: ${result.suite.cases.length}
|
|
397160
|
+
path: ${result.path}
|
|
397161
|
+
Run it locally: ur eval run ${result.suite.name}`
|
|
396912
397162
|
};
|
|
396913
397163
|
} catch (error40) {
|
|
396914
397164
|
const message = error40 instanceof Error ? error40.message : String(error40);
|
|
@@ -396963,9 +397213,17 @@ Available: ${BENCHMARK_ADAPTERS.map((adapter2) => adapter2.id).join(", ")}`
|
|
|
396963
397213
|
saveReliabilityReport(cwd2, reliability);
|
|
396964
397214
|
return { type: "text", value: formatReliabilityReport(reliability, json2) };
|
|
396965
397215
|
}
|
|
397216
|
+
const writeMetrics = tokens.includes("--metrics");
|
|
396966
397217
|
const report = await runSuite(suite, runner2, { category, judge: judge2 });
|
|
396967
397218
|
if (!dryRun)
|
|
396968
397219
|
saveReport(cwd2, report);
|
|
397220
|
+
if (writeMetrics) {
|
|
397221
|
+
const { writeRunMetrics: writeRunMetrics2 } = await Promise.resolve().then(() => (init_evals(), exports_evals));
|
|
397222
|
+
for (const item of report.cases) {
|
|
397223
|
+
if (item.metrics)
|
|
397224
|
+
writeRunMetrics2(cwd2, suite.name, item.id, item.metrics);
|
|
397225
|
+
}
|
|
397226
|
+
}
|
|
396969
397227
|
if (json2)
|
|
396970
397228
|
return { type: "text", value: formatEvalReport(report, true) };
|
|
396971
397229
|
const header = dryRun ? `(dry run \u2014 no model calls; grading exercised offline)
|
|
@@ -396989,7 +397247,7 @@ var init_eval2 = __esm(() => {
|
|
|
396989
397247
|
name: "eval",
|
|
396990
397248
|
aliases: ["evals"],
|
|
396991
397249
|
description: "Public agent eval harness: init, list, validate, run, report, benchmark adapters",
|
|
396992
|
-
argumentHint: "[init|list|validate|run|report|bench] [suite|adapter] [--file <jsonl>] [--dry-run] [--category <c>] [--json]",
|
|
397250
|
+
argumentHint: "[init|list|validate|run|report|bench] [suite|adapter] [--file <jsonl>] [--dry-run] [--category <c>] [--json] [--metrics] [--dashboard]",
|
|
396993
397251
|
supportsNonInteractive: true,
|
|
396994
397252
|
load: () => Promise.resolve().then(() => (init_eval(), exports_eval))
|
|
396995
397253
|
};
|
|
@@ -397028,7 +397286,7 @@ var init_dna2 = __esm(() => {
|
|
|
397028
397286
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
397029
397287
|
import { existsSync as existsSync40, readdirSync as readdirSync16 } from "fs";
|
|
397030
397288
|
import { arch, homedir as homedir30, platform as platform5, release as release2 } from "os";
|
|
397031
|
-
import { join as
|
|
397289
|
+
import { join as join158 } from "path";
|
|
397032
397290
|
function commandExists(bin) {
|
|
397033
397291
|
try {
|
|
397034
397292
|
const cmd = process.platform === "win32" ? "where" : "which";
|
|
@@ -397063,7 +397321,7 @@ function workspaceInfo(cwd2) {
|
|
|
397063
397321
|
try {
|
|
397064
397322
|
fileCount = readdirSync16(cwd2).length;
|
|
397065
397323
|
} catch {}
|
|
397066
|
-
const git5 = existsSync40(
|
|
397324
|
+
const git5 = existsSync40(join158(cwd2, ".git")) ? "yes" : "no";
|
|
397067
397325
|
const dna2 = formatDna(detectProjectDna(cwd2));
|
|
397068
397326
|
return [`workspace: ${cwd2}`, `entries: ${fileCount}`, `git: ${git5}`, "", dna2].join(`
|
|
397069
397327
|
`);
|
|
@@ -397091,16 +397349,16 @@ async function urDoctor(cwd2) {
|
|
|
397091
397349
|
lines.push(` tip: no coder model found \u2014 consider: ollama pull ${pull}`);
|
|
397092
397350
|
}
|
|
397093
397351
|
}
|
|
397094
|
-
const urDir =
|
|
397352
|
+
const urDir = join158(cwd2, ".ur");
|
|
397095
397353
|
if (existsSync40(urDir)) {
|
|
397096
|
-
const have = ["actions.jsonl", "project_dna.md", "mode", "graph", "tools", "research", "memory", "index"].filter((n2) => existsSync40(
|
|
397354
|
+
const have = ["actions.jsonl", "project_dna.md", "mode", "graph", "tools", "research", "memory", "index"].filter((n2) => existsSync40(join158(urDir, n2)));
|
|
397097
397355
|
lines.push(`.ur: present \u2014 ${have.join(", ") || "(empty)"}`);
|
|
397098
397356
|
} else {
|
|
397099
397357
|
lines.push(".ur: missing (run /ur-init)");
|
|
397100
397358
|
}
|
|
397101
|
-
const mcp2 = [
|
|
397359
|
+
const mcp2 = [join158(cwd2, ".ur", "mcp", "servers.toml"), join158(homedir30(), ".ur", "mcp", "servers.toml")].filter(existsSync40);
|
|
397102
397360
|
lines.push(`mcp cfg: ${mcp2.length ? mcp2.join(", ") : "none (.ur/mcp/servers.toml)"}`);
|
|
397103
|
-
lines.push(`playwright: ${existsSync40(
|
|
397361
|
+
lines.push(`playwright: ${existsSync40(join158(cwd2, "node_modules", "playwright")) ? "installed" : "not installed"}`);
|
|
397104
397362
|
return lines.join(`
|
|
397105
397363
|
`);
|
|
397106
397364
|
}
|
|
@@ -397187,8 +397445,8 @@ var init_project2 = __esm(() => {
|
|
|
397187
397445
|
});
|
|
397188
397446
|
|
|
397189
397447
|
// src/ur/notes.ts
|
|
397190
|
-
import { appendFileSync as appendFileSync5, existsSync as existsSync41, mkdirSync as
|
|
397191
|
-
import { dirname as dirname59, join as
|
|
397448
|
+
import { appendFileSync as appendFileSync5, existsSync as existsSync41, mkdirSync as mkdirSync38, readFileSync as readFileSync46, writeFileSync as writeFileSync36 } from "fs";
|
|
397449
|
+
import { dirname as dirname59, join as join159 } from "path";
|
|
397192
397450
|
function readJsonl(file2) {
|
|
397193
397451
|
if (!existsSync41(file2))
|
|
397194
397452
|
return [];
|
|
@@ -397203,7 +397461,7 @@ function readJsonl(file2) {
|
|
|
397203
397461
|
}
|
|
397204
397462
|
function append2(file2, rec) {
|
|
397205
397463
|
try {
|
|
397206
|
-
|
|
397464
|
+
mkdirSync38(dirname59(file2), { recursive: true });
|
|
397207
397465
|
appendFileSync5(file2, JSON.stringify(rec) + `
|
|
397208
397466
|
`);
|
|
397209
397467
|
} catch {}
|
|
@@ -397221,8 +397479,8 @@ function forget(cwd2, needle) {
|
|
|
397221
397479
|
const removed = all4.length - kept.length;
|
|
397222
397480
|
if (removed > 0) {
|
|
397223
397481
|
try {
|
|
397224
|
-
|
|
397225
|
-
|
|
397482
|
+
mkdirSync38(dirname59(file2), { recursive: true });
|
|
397483
|
+
writeFileSync36(file2, kept.map((n2) => JSON.stringify(n2)).join(`
|
|
397226
397484
|
`) + (kept.length ? `
|
|
397227
397485
|
` : ""));
|
|
397228
397486
|
} catch {}
|
|
@@ -397235,7 +397493,7 @@ function addResearch(cwd2, kind, text) {
|
|
|
397235
397493
|
function listResearch(cwd2, kind) {
|
|
397236
397494
|
return readJsonl(researchFile(cwd2, kind));
|
|
397237
397495
|
}
|
|
397238
|
-
var memFile = (cwd2) =>
|
|
397496
|
+
var memFile = (cwd2) => join159(cwd2, ".ur", "memory", "notes.jsonl"), researchFile = (cwd2, kind) => join159(cwd2, ".ur", "research", `${kind}.jsonl`);
|
|
397239
397497
|
var init_notes = () => {};
|
|
397240
397498
|
|
|
397241
397499
|
// src/commands/remember/remember.ts
|
|
@@ -397275,17 +397533,17 @@ var init_remember2 = __esm(() => {
|
|
|
397275
397533
|
// src/services/agents/memoryRetention.ts
|
|
397276
397534
|
import {
|
|
397277
397535
|
existsSync as existsSync42,
|
|
397278
|
-
mkdirSync as
|
|
397536
|
+
mkdirSync as mkdirSync39,
|
|
397279
397537
|
readFileSync as readFileSync47,
|
|
397280
397538
|
readdirSync as readdirSync17,
|
|
397281
|
-
writeFileSync as
|
|
397539
|
+
writeFileSync as writeFileSync37
|
|
397282
397540
|
} from "fs";
|
|
397283
|
-
import { dirname as dirname60, join as
|
|
397541
|
+
import { dirname as dirname60, join as join160 } from "path";
|
|
397284
397542
|
function memoryDir(cwd2) {
|
|
397285
|
-
return
|
|
397543
|
+
return join160(cwd2, ".ur", "memory");
|
|
397286
397544
|
}
|
|
397287
397545
|
function policyPath2(cwd2) {
|
|
397288
|
-
return
|
|
397546
|
+
return join160(memoryDir(cwd2), "retention.json");
|
|
397289
397547
|
}
|
|
397290
397548
|
function defaultMemoryRetentionPolicy() {
|
|
397291
397549
|
return { version: 1, maxEntries: 1000, updatedAt: new Date().toISOString() };
|
|
@@ -397315,8 +397573,8 @@ function saveMemoryRetentionPolicy(cwd2, patch) {
|
|
|
397315
397573
|
decayDays: patch.decayDays === undefined ? current.decayDays : validPositive(patch.decayDays),
|
|
397316
397574
|
updatedAt: new Date().toISOString()
|
|
397317
397575
|
};
|
|
397318
|
-
|
|
397319
|
-
|
|
397576
|
+
mkdirSync39(dirname60(policyPath2(cwd2)), { recursive: true });
|
|
397577
|
+
writeFileSync37(policyPath2(cwd2), `${JSON.stringify(next, null, 2)}
|
|
397320
397578
|
`);
|
|
397321
397579
|
return next;
|
|
397322
397580
|
}
|
|
@@ -397346,7 +397604,7 @@ function readJsonl2(file2) {
|
|
|
397346
397604
|
return records;
|
|
397347
397605
|
}
|
|
397348
397606
|
function writeJsonl(file2, records) {
|
|
397349
|
-
|
|
397607
|
+
writeFileSync37(file2, records.map((r) => JSON.stringify(r)).join(`
|
|
397350
397608
|
`) + (records.length ? `
|
|
397351
397609
|
` : ""));
|
|
397352
397610
|
}
|
|
@@ -397376,7 +397634,7 @@ function memoryJsonlFiles(cwd2) {
|
|
|
397376
397634
|
const dir = memoryDir(cwd2);
|
|
397377
397635
|
if (!existsSync42(dir))
|
|
397378
397636
|
return [];
|
|
397379
|
-
return readdirSync17(dir).filter((name) => name.endsWith(".jsonl")).map((name) =>
|
|
397637
|
+
return readdirSync17(dir).filter((name) => name.endsWith(".jsonl")).map((name) => join160(dir, name));
|
|
397380
397638
|
}
|
|
397381
397639
|
function pruneMemoryRetention(cwd2, policy = loadMemoryRetentionPolicy(cwd2), nowMs = Date.now()) {
|
|
397382
397640
|
const files = memoryJsonlFiles(cwd2).map((file2) => {
|
|
@@ -397497,10 +397755,10 @@ var exports_semantic_memory = {};
|
|
|
397497
397755
|
__export(exports_semantic_memory, {
|
|
397498
397756
|
call: () => call91
|
|
397499
397757
|
});
|
|
397500
|
-
import { existsSync as existsSync43, mkdirSync as
|
|
397501
|
-
import { basename as basename40, join as
|
|
397758
|
+
import { existsSync as existsSync43, mkdirSync as mkdirSync40, readdirSync as readdirSync18, readFileSync as readFileSync48, statSync as statSync10, writeFileSync as writeFileSync38 } from "fs";
|
|
397759
|
+
import { basename as basename40, join as join161 } from "path";
|
|
397502
397760
|
function indexPath3() {
|
|
397503
|
-
return
|
|
397761
|
+
return join161(getCwd(), ".ur", "semantic-memory", "index", "index.json");
|
|
397504
397762
|
}
|
|
397505
397763
|
function tokenize7(value) {
|
|
397506
397764
|
return [...new Set(value.toLowerCase().match(/[a-z0-9_]{3,}/g) ?? [])];
|
|
@@ -397509,15 +397767,15 @@ function sourceFiles() {
|
|
|
397509
397767
|
const cwd2 = getCwd();
|
|
397510
397768
|
const files = [];
|
|
397511
397769
|
for (const file2 of ["UR.md", "README.md"]) {
|
|
397512
|
-
const path22 =
|
|
397770
|
+
const path22 = join161(cwd2, file2);
|
|
397513
397771
|
if (existsSync43(path22))
|
|
397514
397772
|
files.push(path22);
|
|
397515
397773
|
}
|
|
397516
|
-
for (const dir of [
|
|
397774
|
+
for (const dir of [join161(cwd2, ".ur", "memory"), join161(cwd2, ".ur", "docs")]) {
|
|
397517
397775
|
if (!existsSync43(dir))
|
|
397518
397776
|
continue;
|
|
397519
397777
|
for (const file2 of readdirSync18(dir)) {
|
|
397520
|
-
const path22 =
|
|
397778
|
+
const path22 = join161(dir, file2);
|
|
397521
397779
|
if (statSync10(path22).isFile() && /\.(md|txt|jsonl)$/i.test(file2)) {
|
|
397522
397780
|
files.push(path22);
|
|
397523
397781
|
}
|
|
@@ -397541,8 +397799,8 @@ function buildIndex2() {
|
|
|
397541
397799
|
builtAt: new Date().toISOString(),
|
|
397542
397800
|
entries
|
|
397543
397801
|
};
|
|
397544
|
-
|
|
397545
|
-
|
|
397802
|
+
mkdirSync40(join161(getCwd(), ".ur", "semantic-memory", "index"), { recursive: true });
|
|
397803
|
+
writeFileSync38(indexPath3(), `${JSON.stringify(index2, null, 2)}
|
|
397546
397804
|
`);
|
|
397547
397805
|
return index2;
|
|
397548
397806
|
}
|
|
@@ -457044,7 +457302,7 @@ ${lanes.join(`
|
|
|
457044
457302
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
457045
457303
|
return namedUnions[0];
|
|
457046
457304
|
}
|
|
457047
|
-
const namedTypesCount = reduceLeft(namedUnions, (
|
|
457305
|
+
const namedTypesCount = reduceLeft(namedUnions, (sum2, union3) => sum2 + union3.types.length, 0);
|
|
457048
457306
|
if (namedTypesCount + reducedTypes.length === typeSet.length) {
|
|
457049
457307
|
for (const t of namedUnions) {
|
|
457050
457308
|
insertType(reducedTypes, t);
|
|
@@ -511151,7 +511409,7 @@ ${lanes.join(`
|
|
|
511151
511409
|
const distinctFiles = filesInError.filter((value, index2, self2) => index2 === self2.findIndex((file2) => (file2 == null ? undefined : file2.fileName) === (value == null ? undefined : value.fileName)));
|
|
511152
511410
|
if (distinctFiles.length === 0)
|
|
511153
511411
|
return "";
|
|
511154
|
-
const numberLength = (
|
|
511412
|
+
const numberLength = (num2) => Math.log(num2) * Math.LOG10E + 1;
|
|
511155
511413
|
const fileToErrorCount = distinctFiles.map((file2) => [file2, countWhere(filesInError, (fileInError) => fileInError.fileName === file2.fileName)]);
|
|
511156
511414
|
const maxErrors = maxBy(fileToErrorCount, 0, (value) => value[1]);
|
|
511157
511415
|
const headerRow = Diagnostics2.Errors_Files.message;
|
|
@@ -514395,7 +514653,7 @@ ${lanes.join(`
|
|
|
514395
514653
|
reportCountStatistic("Lines of " + key, value);
|
|
514396
514654
|
}
|
|
514397
514655
|
} else {
|
|
514398
|
-
reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (
|
|
514656
|
+
reportCountStatistic("Lines", reduceLeftIterator(lineCounts.values(), (sum2, count4) => sum2 + count4, 0));
|
|
514399
514657
|
}
|
|
514400
514658
|
reportCountStatistic("Identifiers", program.getIdentifierCount());
|
|
514401
514659
|
reportCountStatistic("Symbols", program.getSymbolCount());
|
|
@@ -566731,16 +566989,16 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
566731
566989
|
import { exec as exec6 } from "child_process";
|
|
566732
566990
|
import {
|
|
566733
566991
|
existsSync as existsSync44,
|
|
566734
|
-
mkdirSync as
|
|
566992
|
+
mkdirSync as mkdirSync41,
|
|
566735
566993
|
readFileSync as readFileSync49,
|
|
566736
566994
|
readdirSync as readdirSync19,
|
|
566737
566995
|
statSync as statSync11,
|
|
566738
|
-
writeFileSync as
|
|
566996
|
+
writeFileSync as writeFileSync39
|
|
566739
566997
|
} from "fs";
|
|
566740
|
-
import { dirname as dirname61, extname as extname15, isAbsolute as isAbsolute26, join as
|
|
566998
|
+
import { dirname as dirname61, extname as extname15, isAbsolute as isAbsolute26, join as join162, relative as relative34, resolve as resolve44 } from "path";
|
|
566741
566999
|
import { promisify as promisify4 } from "util";
|
|
566742
567000
|
function repoEditIndexPath(root2) {
|
|
566743
|
-
return
|
|
567001
|
+
return join162(root2, ".ur", "repo-edit", "index.json");
|
|
566744
567002
|
}
|
|
566745
567003
|
function isSkippedDir(pathFromRoot, name) {
|
|
566746
567004
|
if (SKIP_DIRS.has(name))
|
|
@@ -566771,7 +567029,7 @@ function listRepoFiles(root2, maxFiles = 25000) {
|
|
|
566771
567029
|
for (const entry of entries) {
|
|
566772
567030
|
if (files.length >= maxFiles)
|
|
566773
567031
|
return;
|
|
566774
|
-
const full =
|
|
567032
|
+
const full = join162(dir, entry.name);
|
|
566775
567033
|
const rel = normalizeRelPath(relative34(root2, full));
|
|
566776
567034
|
if (entry.isDirectory()) {
|
|
566777
567035
|
if (entry.name.startsWith(".") && entry.name !== ".ur")
|
|
@@ -566847,7 +567105,7 @@ function collectSymbols(file2, content) {
|
|
|
566847
567105
|
}
|
|
566848
567106
|
function buildRepoEditIndex(root2) {
|
|
566849
567107
|
const files = listRepoFiles(root2).map((path22) => {
|
|
566850
|
-
const abs =
|
|
567108
|
+
const abs = join162(root2, path22);
|
|
566851
567109
|
const stat41 = statSync11(abs);
|
|
566852
567110
|
const ext = extname15(path22).toLowerCase();
|
|
566853
567111
|
const text = isTextPath(path22);
|
|
@@ -566877,8 +567135,8 @@ ${content}`),
|
|
|
566877
567135
|
builtAt: new Date().toISOString(),
|
|
566878
567136
|
files
|
|
566879
567137
|
};
|
|
566880
|
-
|
|
566881
|
-
|
|
567138
|
+
mkdirSync41(dirname61(repoEditIndexPath(root2)), { recursive: true });
|
|
567139
|
+
writeFileSync39(repoEditIndexPath(root2), `${JSON.stringify(index2, null, 2)}
|
|
566882
567140
|
`);
|
|
566883
567141
|
return index2;
|
|
566884
567142
|
}
|
|
@@ -566912,7 +567170,7 @@ function searchRepoEditIndex(root2, query2, index2 = loadRepoEditIndex(root2) ??
|
|
|
566912
567170
|
const lines = [];
|
|
566913
567171
|
if (file2.text && score > 0) {
|
|
566914
567172
|
try {
|
|
566915
|
-
const content = readFileSync49(
|
|
567173
|
+
const content = readFileSync49(join162(root2, file2.path), "utf-8");
|
|
566916
567174
|
const split = content.split(`
|
|
566917
567175
|
`);
|
|
566918
567176
|
for (let i3 = 0;i3 < split.length && lines.length < 4; i3++) {
|
|
@@ -566966,7 +567224,7 @@ function planRename(root2, from, to) {
|
|
|
566966
567224
|
if (from === to)
|
|
566967
567225
|
throw new Error("from and to must be different identifiers");
|
|
566968
567226
|
const files = listRepoFiles(root2).filter(isCodePath).flatMap((file2) => {
|
|
566969
|
-
const abs =
|
|
567227
|
+
const abs = join162(root2, file2);
|
|
566970
567228
|
let oldContent;
|
|
566971
567229
|
try {
|
|
566972
567230
|
oldContent = readFileSync49(abs, "utf-8");
|
|
@@ -567026,7 +567284,7 @@ async function runCheck(command5, cwd2) {
|
|
|
567026
567284
|
}
|
|
567027
567285
|
function rollback(root2, snapshots) {
|
|
567028
567286
|
for (const [file2, content] of snapshots) {
|
|
567029
|
-
|
|
567287
|
+
writeFileSync39(join162(root2, file2), content);
|
|
567030
567288
|
}
|
|
567031
567289
|
}
|
|
567032
567290
|
async function applyRename(root2, from, to, options2 = {}) {
|
|
@@ -567039,7 +567297,7 @@ async function applyRename(root2, from, to, options2 = {}) {
|
|
|
567039
567297
|
try {
|
|
567040
567298
|
for (const file2 of plan.files) {
|
|
567041
567299
|
snapshots.set(file2.file, file2.oldContent);
|
|
567042
|
-
|
|
567300
|
+
writeFileSync39(join162(root2, file2.file), file2.newContent);
|
|
567043
567301
|
writtenFiles.push(file2.file);
|
|
567044
567302
|
}
|
|
567045
567303
|
const syntax = plan.files.flatMap((file2) => syntaxErrors(file2.file, file2.newContent));
|
|
@@ -567483,8 +567741,8 @@ var init_cite2 = __esm(() => {
|
|
|
567483
567741
|
});
|
|
567484
567742
|
|
|
567485
567743
|
// src/ur/fileops.ts
|
|
567486
|
-
import { existsSync as existsSync45, mkdirSync as
|
|
567487
|
-
import { extname as extname16, isAbsolute as isAbsolute27, join as
|
|
567744
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync42, readdirSync as readdirSync20, readFileSync as readFileSync50, statSync as statSync12, writeFileSync as writeFileSync40 } from "fs";
|
|
567745
|
+
import { extname as extname16, isAbsolute as isAbsolute27, join as join163, relative as relative35, resolve as resolve45 } from "path";
|
|
567488
567746
|
function readFileSafe2(cwd2, target, maxBytes = 64000) {
|
|
567489
567747
|
const abs = isAbsolute27(target) ? target : resolve45(cwd2, target);
|
|
567490
567748
|
if (!existsSync45(abs))
|
|
@@ -567518,7 +567776,7 @@ function* walk(dir, root2, budget = { n: 0 }, max2 = 8000) {
|
|
|
567518
567776
|
return;
|
|
567519
567777
|
if (e.name.startsWith(".") && e.name !== ".ur")
|
|
567520
567778
|
continue;
|
|
567521
|
-
const full =
|
|
567779
|
+
const full = join163(dir, e.name);
|
|
567522
567780
|
if (e.isDirectory()) {
|
|
567523
567781
|
if (SKIP_DIRS2.has(e.name))
|
|
567524
567782
|
continue;
|
|
@@ -567537,7 +567795,7 @@ function searchFiles(cwd2, query2, maxResults = 60) {
|
|
|
567537
567795
|
continue;
|
|
567538
567796
|
let lines;
|
|
567539
567797
|
try {
|
|
567540
|
-
lines = readFileSync50(
|
|
567798
|
+
lines = readFileSync50(join163(cwd2, rel), "utf8").split(`
|
|
567541
567799
|
`);
|
|
567542
567800
|
} catch {
|
|
567543
567801
|
continue;
|
|
@@ -567555,8 +567813,8 @@ function searchFiles(cwd2, query2, maxResults = 60) {
|
|
|
567555
567813
|
function indexWorkspace(cwd2) {
|
|
567556
567814
|
const files = [...walk(cwd2, cwd2)];
|
|
567557
567815
|
try {
|
|
567558
|
-
|
|
567559
|
-
|
|
567816
|
+
mkdirSync42(join163(cwd2, ".ur", "index"), { recursive: true });
|
|
567817
|
+
writeFileSync40(join163(cwd2, ".ur", "index", "files.txt"), files.join(`
|
|
567560
567818
|
`) + `
|
|
567561
567819
|
`);
|
|
567562
567820
|
} catch {}
|
|
@@ -567981,9 +568239,9 @@ var exports_mode = {};
|
|
|
567981
568239
|
__export(exports_mode, {
|
|
567982
568240
|
call: () => call107
|
|
567983
568241
|
});
|
|
567984
|
-
import { existsSync as existsSync48, mkdirSync as
|
|
567985
|
-
import { join as
|
|
567986
|
-
var MODES, SECURITY_MODES2, file2 = (cwd2) =>
|
|
568242
|
+
import { existsSync as existsSync48, mkdirSync as mkdirSync43, readFileSync as readFileSync51, writeFileSync as writeFileSync41 } from "fs";
|
|
568243
|
+
import { join as join164 } from "path";
|
|
568244
|
+
var MODES, SECURITY_MODES2, file2 = (cwd2) => join164(cwd2, ".ur", "mode"), call107 = async (args) => {
|
|
567987
568245
|
const want = (args ?? "").trim().toLowerCase();
|
|
567988
568246
|
const f = file2(getCwd());
|
|
567989
568247
|
if (!want) {
|
|
@@ -568001,8 +568259,8 @@ available: ${MODES.join(", ")}
|
|
|
568001
568259
|
security: ${SECURITY_MODES2.join(", ")}` };
|
|
568002
568260
|
}
|
|
568003
568261
|
try {
|
|
568004
|
-
|
|
568005
|
-
|
|
568262
|
+
mkdirSync43(join164(getCwd(), ".ur"), { recursive: true });
|
|
568263
|
+
writeFileSync41(f, want + `
|
|
568006
568264
|
`);
|
|
568007
568265
|
} catch {}
|
|
568008
568266
|
return { type: "text", value: `mode \u2192 ${want} (UR will favor ${want}-oriented behavior; persisted to .ur/mode)` };
|
|
@@ -568124,8 +568382,8 @@ var exports_role_mode = {};
|
|
|
568124
568382
|
__export(exports_role_mode, {
|
|
568125
568383
|
call: () => call108
|
|
568126
568384
|
});
|
|
568127
|
-
import { existsSync as existsSync49, mkdirSync as
|
|
568128
|
-
import { join as
|
|
568385
|
+
import { existsSync as existsSync49, mkdirSync as mkdirSync44, writeFileSync as writeFileSync42 } from "fs";
|
|
568386
|
+
import { join as join165 } from "path";
|
|
568129
568387
|
function formatList() {
|
|
568130
568388
|
const lines = ["Built-in role modes:", ""];
|
|
568131
568389
|
for (const mode2 of ROLE_MODES) {
|
|
@@ -568179,17 +568437,17 @@ var call108 = async (args) => {
|
|
|
568179
568437
|
value: `Unknown role mode "${target}". Available: ${listModeNames().join(", ")}, or "all".`
|
|
568180
568438
|
};
|
|
568181
568439
|
}
|
|
568182
|
-
const agentsDir =
|
|
568183
|
-
|
|
568440
|
+
const agentsDir = join165(getCwd(), ".ur", "agents");
|
|
568441
|
+
mkdirSync44(agentsDir, { recursive: true });
|
|
568184
568442
|
const created = [];
|
|
568185
568443
|
const skipped = [];
|
|
568186
568444
|
for (const mode2 of modes) {
|
|
568187
|
-
const path22 =
|
|
568445
|
+
const path22 = join165(agentsDir, `${mode2.name}.md`);
|
|
568188
568446
|
if (existsSync49(path22) && !force) {
|
|
568189
568447
|
skipped.push(`${mode2.name} (exists; use --force to overwrite)`);
|
|
568190
568448
|
continue;
|
|
568191
568449
|
}
|
|
568192
|
-
|
|
568450
|
+
writeFileSync42(path22, renderModeAgent(mode2), { encoding: "utf-8" });
|
|
568193
568451
|
created.push(path22);
|
|
568194
568452
|
}
|
|
568195
568453
|
if (json2) {
|
|
@@ -568235,15 +568493,15 @@ var init_role_mode2 = __esm(() => {
|
|
|
568235
568493
|
});
|
|
568236
568494
|
|
|
568237
568495
|
// src/ur/researchGraph.ts
|
|
568238
|
-
import { appendFileSync as appendFileSync6, existsSync as existsSync50, mkdirSync as
|
|
568239
|
-
import { dirname as dirname62, join as
|
|
568496
|
+
import { appendFileSync as appendFileSync6, existsSync as existsSync50, mkdirSync as mkdirSync45, readFileSync as readFileSync52 } from "fs";
|
|
568497
|
+
import { dirname as dirname62, join as join166 } from "path";
|
|
568240
568498
|
function isEntity(s) {
|
|
568241
568499
|
return ENTITIES.includes(s);
|
|
568242
568500
|
}
|
|
568243
568501
|
function addEntity(cwd2, entity, text) {
|
|
568244
568502
|
try {
|
|
568245
568503
|
const f = file3(cwd2, entity);
|
|
568246
|
-
|
|
568504
|
+
mkdirSync45(dirname62(f), { recursive: true });
|
|
568247
568505
|
appendFileSync6(f, JSON.stringify({ ts: new Date().toISOString(), text }) + `
|
|
568248
568506
|
`);
|
|
568249
568507
|
} catch {}
|
|
@@ -568267,7 +568525,7 @@ function graphSummary(cwd2) {
|
|
|
568267
568525
|
out[e] = listEntity(cwd2, e).length;
|
|
568268
568526
|
return out;
|
|
568269
568527
|
}
|
|
568270
|
-
var ENTITIES, file3 = (cwd2, entity) =>
|
|
568528
|
+
var ENTITIES, file3 = (cwd2, entity) => join166(cwd2, ".ur", "graph", `${entity}.jsonl`);
|
|
568271
568529
|
var init_researchGraph = __esm(() => {
|
|
568272
568530
|
ENTITIES = [
|
|
568273
568531
|
"sources",
|
|
@@ -568336,13 +568594,13 @@ var exports_toolsmith = {};
|
|
|
568336
568594
|
__export(exports_toolsmith, {
|
|
568337
568595
|
call: () => call110
|
|
568338
568596
|
});
|
|
568339
|
-
import { existsSync as existsSync51, mkdirSync as
|
|
568340
|
-
import { join as
|
|
568597
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync46, readdirSync as readdirSync21, writeFileSync as writeFileSync43 } from "fs";
|
|
568598
|
+
import { join as join167 } from "path";
|
|
568341
568599
|
var TEMPLATES, call110 = async (args) => {
|
|
568342
568600
|
const [name, langArg] = (args ?? "").trim().split(/\s+/).filter(Boolean);
|
|
568343
568601
|
const auto = [["python3", "python"], ["node", "node"], ["bash", "bash"], ["go", "go"], ["cargo", "rust"]].find(([bin]) => commandExists(bin))?.[1] ?? "python";
|
|
568344
568602
|
const lang = langArg ?? auto;
|
|
568345
|
-
const dir =
|
|
568603
|
+
const dir = join167(getCwd(), ".ur", "tools");
|
|
568346
568604
|
if (!name) {
|
|
568347
568605
|
const files = existsSync51(dir) ? readdirSync21(dir) : [];
|
|
568348
568606
|
return { type: "text", value: files.length ? `tools:
|
|
@@ -568352,11 +568610,11 @@ var TEMPLATES, call110 = async (args) => {
|
|
|
568352
568610
|
const tpl = TEMPLATES[lang];
|
|
568353
568611
|
if (!tpl)
|
|
568354
568612
|
return { type: "text", value: `unknown lang "${lang}". choose: ${Object.keys(TEMPLATES).join(", ")}` };
|
|
568355
|
-
|
|
568356
|
-
const file4 =
|
|
568613
|
+
mkdirSync46(dir, { recursive: true });
|
|
568614
|
+
const file4 = join167(dir, `${name}.${tpl.ext}`);
|
|
568357
568615
|
if (existsSync51(file4))
|
|
568358
568616
|
return { type: "text", value: `already exists: .ur/tools/${name}.${tpl.ext}` };
|
|
568359
|
-
|
|
568617
|
+
writeFileSync43(file4, tpl.body);
|
|
568360
568618
|
return { type: "text", value: `created .ur/tools/${name}.${tpl.ext}
|
|
568361
568619
|
Ask UR to run it \u2014 it will request approval before executing, and you can keep it as a plugin if useful.` };
|
|
568362
568620
|
};
|
|
@@ -568417,12 +568675,12 @@ __export(exports_browser, {
|
|
|
568417
568675
|
call: () => call111
|
|
568418
568676
|
});
|
|
568419
568677
|
import { existsSync as existsSync52 } from "fs";
|
|
568420
|
-
import { join as
|
|
568678
|
+
import { join as join168 } from "path";
|
|
568421
568679
|
var call111 = async (args) => {
|
|
568422
568680
|
const task = (args ?? "").trim();
|
|
568423
568681
|
if (!task)
|
|
568424
568682
|
return { type: "text", value: "usage: /browser <url|task>" };
|
|
568425
|
-
const hasPlaywright = existsSync52(
|
|
568683
|
+
const hasPlaywright = existsSync52(join168(getCwd(), "node_modules", "playwright")) || existsSync52(join168(getCwd(), "node_modules", "playwright-core"));
|
|
568426
568684
|
if (hasPlaywright) {
|
|
568427
568685
|
return { type: "text", value: `Playwright detected \u2014 ask UR to drive the browser for: ${task}
|
|
568428
568686
|
Risky actions (form submit, downloads, login) require your approval.` };
|
|
@@ -568477,22 +568735,22 @@ var init_ur_doctor2 = __esm(() => {
|
|
|
568477
568735
|
});
|
|
568478
568736
|
|
|
568479
568737
|
// src/utils/urAssets.ts
|
|
568480
|
-
import { existsSync as existsSync53, mkdirSync as
|
|
568481
|
-
import { join as
|
|
568738
|
+
import { existsSync as existsSync53, mkdirSync as mkdirSync47, writeFileSync as writeFileSync44 } from "fs";
|
|
568739
|
+
import { join as join169 } from "path";
|
|
568482
568740
|
function scaffoldUrAssets(cwd2) {
|
|
568483
|
-
const root2 =
|
|
568741
|
+
const root2 = join169(cwd2, ".ur");
|
|
568484
568742
|
const created = [];
|
|
568485
568743
|
const skipped = [];
|
|
568486
|
-
|
|
568744
|
+
mkdirSync47(root2, { recursive: true });
|
|
568487
568745
|
for (const d of DIRS)
|
|
568488
|
-
|
|
568746
|
+
mkdirSync47(join169(root2, d), { recursive: true });
|
|
568489
568747
|
for (const file4 of SEED_FILES) {
|
|
568490
|
-
const full =
|
|
568748
|
+
const full = join169(root2, file4.path);
|
|
568491
568749
|
if (existsSync53(full)) {
|
|
568492
568750
|
skipped.push(file4.path);
|
|
568493
568751
|
continue;
|
|
568494
568752
|
}
|
|
568495
|
-
|
|
568753
|
+
writeFileSync44(full, file4.content);
|
|
568496
568754
|
created.push(file4.path);
|
|
568497
568755
|
}
|
|
568498
568756
|
return { root: root2, created, skipped };
|
|
@@ -568785,7 +569043,7 @@ __export(exports_thinkback, {
|
|
|
568785
569043
|
call: () => call117
|
|
568786
569044
|
});
|
|
568787
569045
|
import { readFile as readFile45 } from "fs/promises";
|
|
568788
|
-
import { join as
|
|
569046
|
+
import { join as join170 } from "path";
|
|
568789
569047
|
function getMarketplaceName() {
|
|
568790
569048
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
568791
569049
|
}
|
|
@@ -568803,15 +569061,15 @@ async function getThinkbackSkillDir() {
|
|
|
568803
569061
|
if (!thinkbackPlugin) {
|
|
568804
569062
|
return null;
|
|
568805
569063
|
}
|
|
568806
|
-
const skillDir =
|
|
569064
|
+
const skillDir = join170(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
568807
569065
|
if (await pathExists(skillDir)) {
|
|
568808
569066
|
return skillDir;
|
|
568809
569067
|
}
|
|
568810
569068
|
return null;
|
|
568811
569069
|
}
|
|
568812
569070
|
async function playAnimation(skillDir) {
|
|
568813
|
-
const dataPath =
|
|
568814
|
-
const playerPath =
|
|
569071
|
+
const dataPath = join170(skillDir, "year_in_review.js");
|
|
569072
|
+
const playerPath = join170(skillDir, "player.js");
|
|
568815
569073
|
try {
|
|
568816
569074
|
await readFile45(dataPath);
|
|
568817
569075
|
} catch (e) {
|
|
@@ -568859,7 +569117,7 @@ async function playAnimation(skillDir) {
|
|
|
568859
569117
|
} catch {} finally {
|
|
568860
569118
|
inkInstance.exitAlternateScreen();
|
|
568861
569119
|
}
|
|
568862
|
-
const htmlPath =
|
|
569120
|
+
const htmlPath = join170(skillDir, "year_in_review.html");
|
|
568863
569121
|
if (await pathExists(htmlPath)) {
|
|
568864
569122
|
const platform6 = getPlatform();
|
|
568865
569123
|
const openCmd = platform6 === "macos" ? "open" : platform6 === "windows" ? "start" : "xdg-open";
|
|
@@ -569195,7 +569453,7 @@ function ThinkbackFlow(t0) {
|
|
|
569195
569453
|
if (!skillDir) {
|
|
569196
569454
|
return;
|
|
569197
569455
|
}
|
|
569198
|
-
const dataPath =
|
|
569456
|
+
const dataPath = join170(skillDir, "year_in_review.js");
|
|
569199
569457
|
pathExists(dataPath).then((exists) => {
|
|
569200
569458
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
569201
569459
|
setHasGenerated(exists);
|
|
@@ -569369,7 +569627,7 @@ var exports_thinkback_play = {};
|
|
|
569369
569627
|
__export(exports_thinkback_play, {
|
|
569370
569628
|
call: () => call118
|
|
569371
569629
|
});
|
|
569372
|
-
import { join as
|
|
569630
|
+
import { join as join171 } from "path";
|
|
569373
569631
|
function getPluginId2() {
|
|
569374
569632
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
569375
569633
|
return `thinkback@${marketplaceName}`;
|
|
@@ -569391,7 +569649,7 @@ async function call118() {
|
|
|
569391
569649
|
value: "Thinkback plugin installation path not found."
|
|
569392
569650
|
};
|
|
569393
569651
|
}
|
|
569394
|
-
const skillDir =
|
|
569652
|
+
const skillDir = join171(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
569395
569653
|
const result = await playAnimation(skillDir);
|
|
569396
569654
|
return { type: "text", value: result.message };
|
|
569397
569655
|
}
|
|
@@ -575345,8 +575603,8 @@ function _temp617() {
|
|
|
575345
575603
|
children: "Esc to close"
|
|
575346
575604
|
}, undefined, false, undefined, this);
|
|
575347
575605
|
}
|
|
575348
|
-
function _temp520(
|
|
575349
|
-
return
|
|
575606
|
+
function _temp520(sum2, hooks) {
|
|
575607
|
+
return sum2 + hooks.length;
|
|
575350
575608
|
}
|
|
575351
575609
|
function _temp425(tool) {
|
|
575352
575610
|
return tool.name;
|
|
@@ -575786,7 +576044,7 @@ var init_types13 = __esm(() => {
|
|
|
575786
576044
|
|
|
575787
576045
|
// src/components/agents/agentFileUtils.ts
|
|
575788
576046
|
import { mkdir as mkdir35, open as open12, unlink as unlink19 } from "fs/promises";
|
|
575789
|
-
import { join as
|
|
576047
|
+
import { join as join172 } from "path";
|
|
575790
576048
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
575791
576049
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
575792
576050
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -575813,26 +576071,26 @@ function getAgentDirectoryPath(location2) {
|
|
|
575813
576071
|
case "flagSettings":
|
|
575814
576072
|
throw new Error(`Cannot get directory path for ${location2} agents`);
|
|
575815
576073
|
case "userSettings":
|
|
575816
|
-
return
|
|
576074
|
+
return join172(getURConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
575817
576075
|
case "projectSettings":
|
|
575818
|
-
return
|
|
576076
|
+
return join172(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
575819
576077
|
case "policySettings":
|
|
575820
|
-
return
|
|
576078
|
+
return join172(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
575821
576079
|
case "localSettings":
|
|
575822
|
-
return
|
|
576080
|
+
return join172(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
575823
576081
|
}
|
|
575824
576082
|
}
|
|
575825
576083
|
function getRelativeAgentDirectoryPath(location2) {
|
|
575826
576084
|
switch (location2) {
|
|
575827
576085
|
case "projectSettings":
|
|
575828
|
-
return
|
|
576086
|
+
return join172(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
575829
576087
|
default:
|
|
575830
576088
|
return getAgentDirectoryPath(location2);
|
|
575831
576089
|
}
|
|
575832
576090
|
}
|
|
575833
576091
|
function getNewAgentFilePath(agent) {
|
|
575834
576092
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
575835
|
-
return
|
|
576093
|
+
return join172(dirPath, `${agent.agentType}.md`);
|
|
575836
576094
|
}
|
|
575837
576095
|
function getActualAgentFilePath(agent) {
|
|
575838
576096
|
if (agent.source === "built-in") {
|
|
@@ -575843,14 +576101,14 @@ function getActualAgentFilePath(agent) {
|
|
|
575843
576101
|
}
|
|
575844
576102
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
575845
576103
|
const filename = agent.filename || agent.agentType;
|
|
575846
|
-
return
|
|
576104
|
+
return join172(dirPath, `${filename}.md`);
|
|
575847
576105
|
}
|
|
575848
576106
|
function getNewRelativeAgentFilePath(agent) {
|
|
575849
576107
|
if (agent.source === "built-in") {
|
|
575850
576108
|
return "Built-in";
|
|
575851
576109
|
}
|
|
575852
576110
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
575853
|
-
return
|
|
576111
|
+
return join172(dirPath, `${agent.agentType}.md`);
|
|
575854
576112
|
}
|
|
575855
576113
|
function getActualRelativeAgentFilePath(agent) {
|
|
575856
576114
|
if (isBuiltInAgent(agent)) {
|
|
@@ -575864,7 +576122,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
575864
576122
|
}
|
|
575865
576123
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
575866
576124
|
const filename = agent.filename || agent.agentType;
|
|
575867
|
-
return
|
|
576125
|
+
return join172(dirPath, `${filename}.md`);
|
|
575868
576126
|
}
|
|
575869
576127
|
async function ensureAgentDirectoryExists(source) {
|
|
575870
576128
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -581726,8 +581984,8 @@ async function refreshActivePlugins(setAppState) {
|
|
|
581726
581984
|
return servers ? Object.keys(servers).length : 0;
|
|
581727
581985
|
}))
|
|
581728
581986
|
]);
|
|
581729
|
-
const mcp_count = mcpCounts.reduce((
|
|
581730
|
-
const lsp_count = lspCounts.reduce((
|
|
581987
|
+
const mcp_count = mcpCounts.reduce((sum2, n2) => sum2 + n2, 0);
|
|
581988
|
+
const lsp_count = lspCounts.reduce((sum2, n2) => sum2 + n2, 0);
|
|
581731
581989
|
setAppState((prev) => ({
|
|
581732
581990
|
...prev,
|
|
581733
581991
|
plugins: {
|
|
@@ -581753,10 +582011,10 @@ async function refreshActivePlugins(setAppState) {
|
|
|
581753
582011
|
logError2(e);
|
|
581754
582012
|
logForDebugging(`refreshActivePlugins: loadPluginHooks failed: ${errorMessage2(e)}`);
|
|
581755
582013
|
}
|
|
581756
|
-
const hook_count = enabled.reduce((
|
|
582014
|
+
const hook_count = enabled.reduce((sum2, p2) => {
|
|
581757
582015
|
if (!p2.hooksConfig)
|
|
581758
|
-
return
|
|
581759
|
-
return
|
|
582016
|
+
return sum2;
|
|
582017
|
+
return sum2 + Object.values(p2.hooksConfig).reduce((s, matchers) => s + (matchers?.reduce((h2, m) => h2 + m.hooks.length, 0) ?? 0), 0);
|
|
581760
582018
|
}, 0);
|
|
581761
582019
|
logForDebugging(`refreshActivePlugins: ${enabled.length} enabled, ${pluginCommands.length} commands, ${agentDefinitions.allAgents.length} agents, ${hook_count} hooks, ${mcp_count} MCP, ${lsp_count} LSP`);
|
|
581762
582020
|
return {
|
|
@@ -581873,9 +582131,9 @@ var init_rewind = __esm(() => {
|
|
|
581873
582131
|
});
|
|
581874
582132
|
|
|
581875
582133
|
// src/utils/heapDumpService.ts
|
|
581876
|
-
import { createWriteStream as createWriteStream3, writeFileSync as
|
|
582134
|
+
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync45 } from "fs";
|
|
581877
582135
|
import { readdir as readdir26, readFile as readFile47, writeFile as writeFile40 } from "fs/promises";
|
|
581878
|
-
import { join as
|
|
582136
|
+
import { join as join173 } from "path";
|
|
581879
582137
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
581880
582138
|
import {
|
|
581881
582139
|
getHeapSnapshot,
|
|
@@ -581965,7 +582223,7 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
|
581965
582223
|
smapsRollup,
|
|
581966
582224
|
platform: process.platform,
|
|
581967
582225
|
nodeVersion: process.version,
|
|
581968
|
-
ccVersion: "1.
|
|
582226
|
+
ccVersion: "1.22.0"
|
|
581969
582227
|
};
|
|
581970
582228
|
}
|
|
581971
582229
|
async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
|
|
@@ -581983,8 +582241,8 @@ async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
|
|
|
581983
582241
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
581984
582242
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
581985
582243
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
581986
|
-
const heapPath =
|
|
581987
|
-
const diagPath =
|
|
582244
|
+
const heapPath = join173(dumpDir, heapFilename);
|
|
582245
|
+
const diagPath = join173(dumpDir, diagFilename);
|
|
581988
582246
|
await writeFile40(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
581989
582247
|
mode: 384
|
|
581990
582248
|
});
|
|
@@ -582012,7 +582270,7 @@ async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
|
|
|
582012
582270
|
}
|
|
582013
582271
|
async function writeHeapSnapshot(filepath) {
|
|
582014
582272
|
if (typeof Bun !== "undefined") {
|
|
582015
|
-
|
|
582273
|
+
writeFileSync45(filepath, Bun.generateHeapSnapshot("v8", "arraybuffer"), {
|
|
582016
582274
|
mode: 384
|
|
582017
582275
|
});
|
|
582018
582276
|
Bun.gc(true);
|
|
@@ -582551,7 +582809,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
582551
582809
|
var call133 = async () => {
|
|
582552
582810
|
return {
|
|
582553
582811
|
type: "text",
|
|
582554
|
-
value: "1.
|
|
582812
|
+
value: "1.22.0"
|
|
582555
582813
|
};
|
|
582556
582814
|
}, version2, version_default;
|
|
582557
582815
|
var init_version = __esm(() => {
|
|
@@ -583823,7 +584081,7 @@ var init_sandbox_toggle2 = __esm(() => {
|
|
|
583823
584081
|
|
|
583824
584082
|
// src/utils/urInChrome/setupPortable.ts
|
|
583825
584083
|
import { readdir as readdir27 } from "fs/promises";
|
|
583826
|
-
import { join as
|
|
584084
|
+
import { join as join174 } from "path";
|
|
583827
584085
|
function getExtensionIds() {
|
|
583828
584086
|
return process.env.USER_TYPE === "ant" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
|
|
583829
584087
|
}
|
|
@@ -583850,7 +584108,7 @@ async function detectExtensionInstallationPortable(browserPaths, log) {
|
|
|
583850
584108
|
}
|
|
583851
584109
|
for (const profile of profileDirs) {
|
|
583852
584110
|
for (const extensionId of extensionIds) {
|
|
583853
|
-
const extensionPath =
|
|
584111
|
+
const extensionPath = join174(browserBasePath, profile, "Extensions", extensionId);
|
|
583854
584112
|
try {
|
|
583855
584113
|
await readdir27(extensionPath);
|
|
583856
584114
|
log?.(`[UR in Chrome] Extension ${extensionId} found in ${browser2} ${profile}`);
|
|
@@ -583874,7 +584132,7 @@ var init_setupPortable = __esm(() => {
|
|
|
583874
584132
|
// src/utils/urInChrome/setup.ts
|
|
583875
584133
|
import { chmod as chmod10, mkdir as mkdir36, readFile as readFile48, writeFile as writeFile41 } from "fs/promises";
|
|
583876
584134
|
import { homedir as homedir31 } from "os";
|
|
583877
|
-
import { join as
|
|
584135
|
+
import { join as join175 } from "path";
|
|
583878
584136
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
583879
584137
|
function shouldEnableURInChrome(chromeFlag) {
|
|
583880
584138
|
if (getIsNonInteractiveSession() && chromeFlag !== true) {
|
|
@@ -583931,8 +584189,8 @@ function setupURInChrome() {
|
|
|
583931
584189
|
};
|
|
583932
584190
|
} else {
|
|
583933
584191
|
const __filename3 = fileURLToPath6(import.meta.url);
|
|
583934
|
-
const __dirname3 =
|
|
583935
|
-
const cliPath =
|
|
584192
|
+
const __dirname3 = join175(__filename3, "..");
|
|
584193
|
+
const cliPath = join175(__dirname3, "cli.js");
|
|
583936
584194
|
createWrapperScript(`"${process.execPath}" "${cliPath}" --chrome-native-host`).then((manifestBinaryPath) => installChromeNativeHostManifest(manifestBinaryPath)).catch((e) => logForDebugging(`[UR in Chrome] Failed to install native host: ${e}`, { level: "error" }));
|
|
583937
584195
|
const mcpConfig = {
|
|
583938
584196
|
[UR_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -583954,8 +584212,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
583954
584212
|
const platform6 = getPlatform();
|
|
583955
584213
|
if (platform6 === "windows") {
|
|
583956
584214
|
const home = homedir31();
|
|
583957
|
-
const appData = process.env.APPDATA ||
|
|
583958
|
-
return [
|
|
584215
|
+
const appData = process.env.APPDATA || join175(home, "AppData", "Local");
|
|
584216
|
+
return [join175(appData, "UR", "ChromeNativeHost")];
|
|
583959
584217
|
}
|
|
583960
584218
|
return getAllNativeMessagingHostsDirs().map(({ path: path22 }) => path22);
|
|
583961
584219
|
}
|
|
@@ -583980,7 +584238,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
583980
584238
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
583981
584239
|
let anyManifestUpdated = false;
|
|
583982
584240
|
for (const manifestDir of manifestDirs) {
|
|
583983
|
-
const manifestPath5 =
|
|
584241
|
+
const manifestPath5 = join175(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
583984
584242
|
const existingContent = await readFile48(manifestPath5, "utf-8").catch(() => null);
|
|
583985
584243
|
if (existingContent === manifestContent) {
|
|
583986
584244
|
continue;
|
|
@@ -583995,7 +584253,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
583995
584253
|
}
|
|
583996
584254
|
}
|
|
583997
584255
|
if (getPlatform() === "windows") {
|
|
583998
|
-
const manifestPath5 =
|
|
584256
|
+
const manifestPath5 = join175(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
583999
584257
|
registerWindowsNativeHosts(manifestPath5);
|
|
584000
584258
|
}
|
|
584001
584259
|
if (anyManifestUpdated) {
|
|
@@ -584033,8 +584291,8 @@ function registerWindowsNativeHosts(manifestPath5) {
|
|
|
584033
584291
|
}
|
|
584034
584292
|
async function createWrapperScript(command7) {
|
|
584035
584293
|
const platform6 = getPlatform();
|
|
584036
|
-
const chromeDir =
|
|
584037
|
-
const wrapperPath = platform6 === "windows" ?
|
|
584294
|
+
const chromeDir = join175(getURConfigHomeDir(), "chrome");
|
|
584295
|
+
const wrapperPath = platform6 === "windows" ? join175(chromeDir, "chrome-native-host.bat") : join175(chromeDir, "chrome-native-host");
|
|
584038
584296
|
const scriptContent = platform6 === "windows" ? `@echo off
|
|
584039
584297
|
REM Chrome native host wrapper script
|
|
584040
584298
|
REM Generated by UR - do not edit manually
|
|
@@ -584606,7 +584864,7 @@ var init_advisor2 = __esm(() => {
|
|
|
584606
584864
|
// src/skills/bundledSkills.ts
|
|
584607
584865
|
import { constants as fsConstants5 } from "fs";
|
|
584608
584866
|
import { mkdir as mkdir37, open as open13 } from "fs/promises";
|
|
584609
|
-
import { dirname as dirname63, isAbsolute as isAbsolute30, join as
|
|
584867
|
+
import { dirname as dirname63, isAbsolute as isAbsolute30, join as join176, normalize as normalize13, sep as pathSep2 } from "path";
|
|
584610
584868
|
function registerBundledSkill(definition) {
|
|
584611
584869
|
const { files: files2 } = definition;
|
|
584612
584870
|
let skillRoot;
|
|
@@ -584654,7 +584912,7 @@ function getBundledSkills() {
|
|
|
584654
584912
|
return [...bundledSkills];
|
|
584655
584913
|
}
|
|
584656
584914
|
function getBundledSkillExtractDir(skillName) {
|
|
584657
|
-
return
|
|
584915
|
+
return join176(getBundledSkillsRoot(), skillName);
|
|
584658
584916
|
}
|
|
584659
584917
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
584660
584918
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -584696,7 +584954,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
584696
584954
|
if (isAbsolute30(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
584697
584955
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
584698
584956
|
}
|
|
584699
|
-
return
|
|
584957
|
+
return join176(baseDir, normalized);
|
|
584700
584958
|
}
|
|
584701
584959
|
function prependBaseDir(blocks, baseDir) {
|
|
584702
584960
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -585057,7 +585315,7 @@ var init_exit2 = __esm(() => {
|
|
|
585057
585315
|
});
|
|
585058
585316
|
|
|
585059
585317
|
// src/components/ExportDialog.tsx
|
|
585060
|
-
import { join as
|
|
585318
|
+
import { join as join177 } from "path";
|
|
585061
585319
|
function ExportDialog({
|
|
585062
585320
|
content,
|
|
585063
585321
|
defaultFilename,
|
|
@@ -585090,7 +585348,7 @@ function ExportDialog({
|
|
|
585090
585348
|
};
|
|
585091
585349
|
const handleFilenameSubmit = () => {
|
|
585092
585350
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
585093
|
-
const filepath =
|
|
585351
|
+
const filepath = join177(getCwd(), finalFilename);
|
|
585094
585352
|
try {
|
|
585095
585353
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
585096
585354
|
encoding: "utf-8",
|
|
@@ -585313,7 +585571,7 @@ __export(exports_export, {
|
|
|
585313
585571
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
585314
585572
|
call: () => call138
|
|
585315
585573
|
});
|
|
585316
|
-
import { join as
|
|
585574
|
+
import { join as join178 } from "path";
|
|
585317
585575
|
function formatTimestamp(date6) {
|
|
585318
585576
|
const year = date6.getFullYear();
|
|
585319
585577
|
const month = String(date6.getMonth() + 1).padStart(2, "0");
|
|
@@ -585357,7 +585615,7 @@ async function call138(onDone, context4, args) {
|
|
|
585357
585615
|
const filename = args.trim();
|
|
585358
585616
|
if (filename) {
|
|
585359
585617
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
585360
|
-
const filepath =
|
|
585618
|
+
const filepath = join178(getCwd(), finalFilename);
|
|
585361
585619
|
try {
|
|
585362
585620
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
585363
585621
|
encoding: "utf-8",
|
|
@@ -587205,7 +587463,7 @@ var require_asciichart = __commonJS((exports) => {
|
|
|
587205
587463
|
// src/utils/statsCache.ts
|
|
587206
587464
|
import { randomBytes as randomBytes17 } from "crypto";
|
|
587207
587465
|
import { open as open14 } from "fs/promises";
|
|
587208
|
-
import { join as
|
|
587466
|
+
import { join as join179 } from "path";
|
|
587209
587467
|
async function withStatsCacheLock(fn) {
|
|
587210
587468
|
while (statsCacheLockPromise) {
|
|
587211
587469
|
await statsCacheLockPromise;
|
|
@@ -587222,7 +587480,7 @@ async function withStatsCacheLock(fn) {
|
|
|
587222
587480
|
}
|
|
587223
587481
|
}
|
|
587224
587482
|
function getStatsCachePath() {
|
|
587225
|
-
return
|
|
587483
|
+
return join179(getURConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
587226
587484
|
}
|
|
587227
587485
|
function getEmptyCache() {
|
|
587228
587486
|
return {
|
|
@@ -587368,7 +587626,7 @@ function mergeCacheWithNewStats(existingCache, newStats, newLastComputedDate) {
|
|
|
587368
587626
|
hourCounts[hourNum] = (hourCounts[hourNum] || 0) + count4;
|
|
587369
587627
|
}
|
|
587370
587628
|
const totalSessions = existingCache.totalSessions + newStats.sessionStats.length;
|
|
587371
|
-
const totalMessages = existingCache.totalMessages + newStats.sessionStats.reduce((
|
|
587629
|
+
const totalMessages = existingCache.totalMessages + newStats.sessionStats.reduce((sum2, s) => sum2 + s.messageCount, 0);
|
|
587372
587630
|
let longestSession = existingCache.longestSession;
|
|
587373
587631
|
for (const session2 of newStats.sessionStats) {
|
|
587374
587632
|
if (!longestSession || session2.duration > longestSession.duration) {
|
|
@@ -587890,12 +588148,12 @@ var init_ansiToPng = __esm(() => {
|
|
|
587890
588148
|
// src/utils/screenshotClipboard.ts
|
|
587891
588149
|
import { mkdir as mkdir38, unlink as unlink20, writeFile as writeFile42 } from "fs/promises";
|
|
587892
588150
|
import { tmpdir as tmpdir9 } from "os";
|
|
587893
|
-
import { join as
|
|
588151
|
+
import { join as join180 } from "path";
|
|
587894
588152
|
async function copyAnsiToClipboard(ansiText, options2) {
|
|
587895
588153
|
try {
|
|
587896
|
-
const tempDir =
|
|
588154
|
+
const tempDir = join180(tmpdir9(), "ur-screenshots");
|
|
587897
588155
|
await mkdir38(tempDir, { recursive: true });
|
|
587898
|
-
const pngPath =
|
|
588156
|
+
const pngPath = join180(tempDir, `screenshot-${Date.now()}.png`);
|
|
587899
588157
|
const pngBuffer = ansiToPng(ansiText, options2);
|
|
587900
588158
|
await writeFile42(pngPath, pngBuffer);
|
|
587901
588159
|
const result = await copyPngToClipboard(pngPath);
|
|
@@ -587966,7 +588224,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
587966
588224
|
|
|
587967
588225
|
// src/utils/stats.ts
|
|
587968
588226
|
import { open as open15 } from "fs/promises";
|
|
587969
|
-
import { basename as basename41, join as
|
|
588227
|
+
import { basename as basename41, join as join181, sep as sep33 } from "path";
|
|
587970
588228
|
async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
587971
588229
|
const { fromDate, toDate } = options2;
|
|
587972
588230
|
const fs12 = getFsImplementation();
|
|
@@ -588144,17 +588402,17 @@ async function getAllSessionFiles() {
|
|
|
588144
588402
|
return [];
|
|
588145
588403
|
throw e;
|
|
588146
588404
|
}
|
|
588147
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
588405
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join181(projectsDir, dirent.name));
|
|
588148
588406
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
588149
588407
|
try {
|
|
588150
588408
|
const entries = await fs12.readdir(projectDir);
|
|
588151
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
588409
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join181(projectDir, dirent.name));
|
|
588152
588410
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
588153
588411
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
588154
|
-
const subagentsDir =
|
|
588412
|
+
const subagentsDir = join181(projectDir, sessionDir.name, "subagents");
|
|
588155
588413
|
try {
|
|
588156
588414
|
const subagentEntries = await fs12.readdir(subagentsDir);
|
|
588157
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
588415
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join181(subagentsDir, dirent.name));
|
|
588158
588416
|
} catch {
|
|
588159
588417
|
return [];
|
|
588160
588418
|
}
|
|
@@ -588949,7 +589207,7 @@ function OverviewTab({
|
|
|
588949
589207
|
} = useTerminalSize();
|
|
588950
589208
|
const modelEntries = Object.entries(stats.modelUsage).sort(([, a2], [, b]) => b.inputTokens + b.outputTokens - (a2.inputTokens + a2.outputTokens));
|
|
588951
589209
|
const favoriteModel = modelEntries[0];
|
|
588952
|
-
const totalTokens = modelEntries.reduce((
|
|
589210
|
+
const totalTokens = modelEntries.reduce((sum2, [, usage20]) => sum2 + usage20.inputTokens + usage20.outputTokens, 0);
|
|
588953
589211
|
const factoid = import_react190.useMemo(() => generateFunFactoid(stats, totalTokens), [stats, totalTokens]);
|
|
588954
589212
|
const rangeDays = dateRange === "7d" ? 7 : dateRange === "30d" ? 30 : stats.totalDays;
|
|
588955
589213
|
let shotStatsData = null;
|
|
@@ -589498,9 +589756,9 @@ function _temp06(t0) {
|
|
|
589498
589756
|
const [model] = t0;
|
|
589499
589757
|
return model;
|
|
589500
589758
|
}
|
|
589501
|
-
function _temp914(
|
|
589759
|
+
function _temp914(sum2, t0) {
|
|
589502
589760
|
const [, usage20] = t0;
|
|
589503
|
-
return
|
|
589761
|
+
return sum2 + usage20.inputTokens + usage20.outputTokens;
|
|
589504
589762
|
}
|
|
589505
589763
|
function _temp815(prev_0) {
|
|
589506
589764
|
return Math.max(prev_0 - 2, 0);
|
|
@@ -589773,7 +590031,7 @@ function renderOverviewToAnsi(stats) {
|
|
|
589773
590031
|
}
|
|
589774
590032
|
const modelEntries = Object.entries(stats.modelUsage).sort(([, a2], [, b]) => b.inputTokens + b.outputTokens - (a2.inputTokens + a2.outputTokens));
|
|
589775
590033
|
const favoriteModel = modelEntries[0];
|
|
589776
|
-
const totalTokens = modelEntries.reduce((
|
|
590034
|
+
const totalTokens = modelEntries.reduce((sum2, [, usage20]) => sum2 + usage20.inputTokens + usage20.outputTokens, 0);
|
|
589777
590035
|
if (favoriteModel) {
|
|
589778
590036
|
lines.push(row("Favorite model", renderModelName(favoriteModel[0]), "Total tokens", formatNumber(totalTokens)));
|
|
589779
590037
|
}
|
|
@@ -589801,7 +590059,7 @@ function renderModelsToAnsi(stats) {
|
|
|
589801
590059
|
return lines;
|
|
589802
590060
|
}
|
|
589803
590061
|
const favoriteModel = modelEntries[0];
|
|
589804
|
-
const totalTokens = modelEntries.reduce((
|
|
590062
|
+
const totalTokens = modelEntries.reduce((sum2, [, usage20]) => sum2 + usage20.inputTokens + usage20.outputTokens, 0);
|
|
589805
590063
|
const chartOutput = generateTokenChart(stats.dailyModelTokens, modelEntries.map(([model]) => model), 80);
|
|
589806
590064
|
if (chartOutput) {
|
|
589807
590065
|
lines.push(source_default.bold("Tokens per Day"));
|
|
@@ -590152,7 +590410,7 @@ import {
|
|
|
590152
590410
|
writeFile as writeFile43
|
|
590153
590411
|
} from "fs/promises";
|
|
590154
590412
|
import { tmpdir as tmpdir10 } from "os";
|
|
590155
|
-
import { extname as extname18, join as
|
|
590413
|
+
import { extname as extname18, join as join182 } from "path";
|
|
590156
590414
|
function getAnalysisModel() {
|
|
590157
590415
|
return getDefaultmodelOModel();
|
|
590158
590416
|
}
|
|
@@ -590160,13 +590418,13 @@ function getInsightsModel() {
|
|
|
590160
590418
|
return getDefaultmodelOModel();
|
|
590161
590419
|
}
|
|
590162
590420
|
function getDataDir() {
|
|
590163
|
-
return
|
|
590421
|
+
return join182(getURConfigHomeDir(), "usage-data");
|
|
590164
590422
|
}
|
|
590165
590423
|
function getFacetsDir() {
|
|
590166
|
-
return
|
|
590424
|
+
return join182(getDataDir(), "facets");
|
|
590167
590425
|
}
|
|
590168
590426
|
function getSessionMetaDir() {
|
|
590169
|
-
return
|
|
590427
|
+
return join182(getDataDir(), "session-meta");
|
|
590170
590428
|
}
|
|
590171
590429
|
function getLanguageFromPath(filePath) {
|
|
590172
590430
|
const ext = extname18(filePath).toLowerCase();
|
|
@@ -590511,7 +590769,7 @@ async function formatTranscriptWithSummarization(log) {
|
|
|
590511
590769
|
`);
|
|
590512
590770
|
}
|
|
590513
590771
|
async function loadCachedFacets(sessionId) {
|
|
590514
|
-
const facetPath =
|
|
590772
|
+
const facetPath = join182(getFacetsDir(), `${sessionId}.json`);
|
|
590515
590773
|
try {
|
|
590516
590774
|
const content = await readFile49(facetPath, { encoding: "utf-8" });
|
|
590517
590775
|
const parsed = jsonParse(content);
|
|
@@ -590530,14 +590788,14 @@ async function saveFacets(facets) {
|
|
|
590530
590788
|
try {
|
|
590531
590789
|
await mkdir39(getFacetsDir(), { recursive: true });
|
|
590532
590790
|
} catch {}
|
|
590533
|
-
const facetPath =
|
|
590791
|
+
const facetPath = join182(getFacetsDir(), `${facets.session_id}.json`);
|
|
590534
590792
|
await writeFile43(facetPath, jsonStringify(facets, null, 2), {
|
|
590535
590793
|
encoding: "utf-8",
|
|
590536
590794
|
mode: 384
|
|
590537
590795
|
});
|
|
590538
590796
|
}
|
|
590539
590797
|
async function loadCachedSessionMeta(sessionId) {
|
|
590540
|
-
const metaPath2 =
|
|
590798
|
+
const metaPath2 = join182(getSessionMetaDir(), `${sessionId}.json`);
|
|
590541
590799
|
try {
|
|
590542
590800
|
const content = await readFile49(metaPath2, { encoding: "utf-8" });
|
|
590543
590801
|
return jsonParse(content);
|
|
@@ -590549,7 +590807,7 @@ async function saveSessionMeta(meta) {
|
|
|
590549
590807
|
try {
|
|
590550
590808
|
await mkdir39(getSessionMetaDir(), { recursive: true });
|
|
590551
590809
|
} catch {}
|
|
590552
|
-
const metaPath2 =
|
|
590810
|
+
const metaPath2 = join182(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
590553
590811
|
await writeFile43(metaPath2, jsonStringify(meta, null, 2), {
|
|
590554
590812
|
encoding: "utf-8",
|
|
590555
590813
|
mode: 384
|
|
@@ -591008,7 +591266,7 @@ function generateTimeOfDayChart(messageHours) {
|
|
|
591008
591266
|
}
|
|
591009
591267
|
const periodCounts = periods.map((p2) => ({
|
|
591010
591268
|
label: p2.label,
|
|
591011
|
-
count: p2.range.reduce((
|
|
591269
|
+
count: p2.range.reduce((sum2, h2) => sum2 + (hourCounts[h2] || 0), 0)
|
|
591012
591270
|
}));
|
|
591013
591271
|
const maxVal = Math.max(...periodCounts.map((p2) => p2.count)) || 1;
|
|
591014
591272
|
const barsHtml = periodCounts.map((p2) => `
|
|
@@ -591606,7 +591864,7 @@ function generateHtmlReport(data, insights) {
|
|
|
591606
591864
|
</html>`;
|
|
591607
591865
|
}
|
|
591608
591866
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
591609
|
-
const version3 = typeof MACRO !== "undefined" ? "1.
|
|
591867
|
+
const version3 = typeof MACRO !== "undefined" ? "1.22.0" : "unknown";
|
|
591610
591868
|
const remote_hosts_collected = remoteStats?.hosts.filter((h2) => h2.sessionCount > 0).map((h2) => h2.name);
|
|
591611
591869
|
const facets_summary = {
|
|
591612
591870
|
total: facets.size,
|
|
@@ -591657,7 +591915,7 @@ async function scanAllSessions() {
|
|
|
591657
591915
|
} catch {
|
|
591658
591916
|
return [];
|
|
591659
591917
|
}
|
|
591660
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
591918
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join182(projectsDir, dirent.name));
|
|
591661
591919
|
const allSessions = [];
|
|
591662
591920
|
for (let i3 = 0;i3 < projectDirs.length; i3++) {
|
|
591663
591921
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i3]);
|
|
@@ -591679,7 +591937,7 @@ async function scanAllSessions() {
|
|
|
591679
591937
|
async function generateUsageReport(options2) {
|
|
591680
591938
|
let remoteStats;
|
|
591681
591939
|
if (process.env.USER_TYPE === "ant" && options2?.collectRemote) {
|
|
591682
|
-
const destDir =
|
|
591940
|
+
const destDir = join182(getURConfigHomeDir(), "projects");
|
|
591683
591941
|
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
591684
591942
|
remoteStats = { hosts, totalCopied };
|
|
591685
591943
|
}
|
|
@@ -591818,7 +592076,7 @@ async function generateUsageReport(options2) {
|
|
|
591818
592076
|
try {
|
|
591819
592077
|
await mkdir39(getDataDir(), { recursive: true });
|
|
591820
592078
|
} catch {}
|
|
591821
|
-
const htmlPath =
|
|
592079
|
+
const htmlPath = join182(getDataDir(), "report.html");
|
|
591822
592080
|
await writeFile43(htmlPath, htmlReport, {
|
|
591823
592081
|
encoding: "utf-8",
|
|
591824
592082
|
mode: 384
|
|
@@ -591914,13 +592172,13 @@ var init_insights = __esm(() => {
|
|
|
591914
592172
|
} : async () => 0;
|
|
591915
592173
|
collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
|
|
591916
592174
|
const result = { copied: 0, skipped: 0 };
|
|
591917
|
-
const tempDir = await mkdtemp(
|
|
592175
|
+
const tempDir = await mkdtemp(join182(tmpdir10(), "ur-hs-"));
|
|
591918
592176
|
try {
|
|
591919
592177
|
const scpResult = await execFileNoThrow("scp", ["-rq", `${homespace}.coder:/root/.ur/projects/`, tempDir], { timeout: 300000 });
|
|
591920
592178
|
if (scpResult.code !== 0) {
|
|
591921
592179
|
return result;
|
|
591922
592180
|
}
|
|
591923
|
-
const projectsDir =
|
|
592181
|
+
const projectsDir = join182(tempDir, "projects");
|
|
591924
592182
|
let projectDirents;
|
|
591925
592183
|
try {
|
|
591926
592184
|
projectDirents = await readdir28(projectsDir, { withFileTypes: true });
|
|
@@ -591929,11 +592187,11 @@ var init_insights = __esm(() => {
|
|
|
591929
592187
|
}
|
|
591930
592188
|
await Promise.all(projectDirents.map(async (dirent) => {
|
|
591931
592189
|
const projectName = dirent.name;
|
|
591932
|
-
const projectPath =
|
|
592190
|
+
const projectPath = join182(projectsDir, projectName);
|
|
591933
592191
|
if (!dirent.isDirectory())
|
|
591934
592192
|
return;
|
|
591935
592193
|
const destProjectName = `${projectName}__${homespace}`;
|
|
591936
|
-
const destProjectPath =
|
|
592194
|
+
const destProjectPath = join182(destDir, destProjectName);
|
|
591937
592195
|
try {
|
|
591938
592196
|
await mkdir39(destProjectPath, { recursive: true });
|
|
591939
592197
|
} catch {}
|
|
@@ -591947,8 +592205,8 @@ var init_insights = __esm(() => {
|
|
|
591947
592205
|
const fileName = fileDirent.name;
|
|
591948
592206
|
if (!fileName.endsWith(".jsonl"))
|
|
591949
592207
|
return;
|
|
591950
|
-
const srcFile =
|
|
591951
|
-
const destFile =
|
|
592208
|
+
const srcFile = join182(projectPath, fileName);
|
|
592209
|
+
const destFile = join182(destProjectPath, fileName);
|
|
591952
592210
|
try {
|
|
591953
592211
|
await copyFile9(srcFile, destFile, fsConstants6.COPYFILE_EXCL);
|
|
591954
592212
|
result.copied++;
|
|
@@ -593044,7 +593302,7 @@ import {
|
|
|
593044
593302
|
unlink as unlink22,
|
|
593045
593303
|
writeFile as writeFile44
|
|
593046
593304
|
} from "fs/promises";
|
|
593047
|
-
import { basename as basename42, dirname as dirname65, join as
|
|
593305
|
+
import { basename as basename42, dirname as dirname65, join as join183 } from "path";
|
|
593048
593306
|
function isTranscriptMessage(entry) {
|
|
593049
593307
|
const t = entry.type;
|
|
593050
593308
|
return t === "user" || t === "assistant" || t === "attachment" || t === "system";
|
|
@@ -593059,18 +593317,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
593059
593317
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
593060
593318
|
}
|
|
593061
593319
|
function getProjectsDir2() {
|
|
593062
|
-
return
|
|
593320
|
+
return join183(getURConfigHomeDir(), "projects");
|
|
593063
593321
|
}
|
|
593064
593322
|
function getTranscriptPath() {
|
|
593065
593323
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
593066
|
-
return
|
|
593324
|
+
return join183(projectDir, `${getSessionId()}.jsonl`);
|
|
593067
593325
|
}
|
|
593068
593326
|
function getTranscriptPathForSession(sessionId) {
|
|
593069
593327
|
if (sessionId === getSessionId()) {
|
|
593070
593328
|
return getTranscriptPath();
|
|
593071
593329
|
}
|
|
593072
593330
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
593073
|
-
return
|
|
593331
|
+
return join183(projectDir, `${sessionId}.jsonl`);
|
|
593074
593332
|
}
|
|
593075
593333
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
593076
593334
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -593082,8 +593340,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
593082
593340
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
593083
593341
|
const sessionId = getSessionId();
|
|
593084
593342
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
593085
|
-
const base2 = subdir ?
|
|
593086
|
-
return
|
|
593343
|
+
const base2 = subdir ? join183(projectDir, sessionId, "subagents", subdir) : join183(projectDir, sessionId, "subagents");
|
|
593344
|
+
return join183(base2, `agent-${agentId}.jsonl`);
|
|
593087
593345
|
}
|
|
593088
593346
|
function getAgentMetadataPath(agentId) {
|
|
593089
593347
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -593106,10 +593364,10 @@ async function readAgentMetadata(agentId) {
|
|
|
593106
593364
|
}
|
|
593107
593365
|
function getRemoteAgentsDir() {
|
|
593108
593366
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
593109
|
-
return
|
|
593367
|
+
return join183(projectDir, getSessionId(), "remote-agents");
|
|
593110
593368
|
}
|
|
593111
593369
|
function getRemoteAgentMetadataPath(taskId) {
|
|
593112
|
-
return
|
|
593370
|
+
return join183(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
593113
593371
|
}
|
|
593114
593372
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
593115
593373
|
const path22 = getRemoteAgentMetadataPath(taskId);
|
|
@@ -593152,7 +593410,7 @@ async function listRemoteAgentMetadata() {
|
|
|
593152
593410
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
593153
593411
|
continue;
|
|
593154
593412
|
try {
|
|
593155
|
-
const raw = await readFile50(
|
|
593413
|
+
const raw = await readFile50(join183(dir, entry.name), "utf-8");
|
|
593156
593414
|
results.push(JSON.parse(raw));
|
|
593157
593415
|
} catch (e) {
|
|
593158
593416
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -593162,7 +593420,7 @@ async function listRemoteAgentMetadata() {
|
|
|
593162
593420
|
}
|
|
593163
593421
|
function sessionIdExists(sessionId) {
|
|
593164
593422
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
593165
|
-
const sessionFile =
|
|
593423
|
+
const sessionFile = join183(projectDir, `${sessionId}.jsonl`);
|
|
593166
593424
|
const fs12 = getFsImplementation();
|
|
593167
593425
|
try {
|
|
593168
593426
|
fs12.statSync(sessionFile);
|
|
@@ -594417,7 +594675,7 @@ async function trackSessionBranchingAnalytics(logs2) {
|
|
|
594417
594675
|
}
|
|
594418
594676
|
const branchCounts = Array.from(sessionIdCounts.values()).filter((c4) => c4 > 1);
|
|
594419
594677
|
const sessionsWithBranches = branchCounts.length;
|
|
594420
|
-
const totalBranches = branchCounts.reduce((
|
|
594678
|
+
const totalBranches = branchCounts.reduce((sum2, count4) => sum2 + count4, 0);
|
|
594421
594679
|
logEvent("tengu_session_forked_branches_fetched", {
|
|
594422
594680
|
total_sessions: sessionIdCounts.size,
|
|
594423
594681
|
sessions_with_branches: sessionsWithBranches,
|
|
@@ -595136,7 +595394,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
595136
595394
|
};
|
|
595137
595395
|
}
|
|
595138
595396
|
async function loadSessionFile(sessionId) {
|
|
595139
|
-
const sessionFile =
|
|
595397
|
+
const sessionFile = join183(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
595140
595398
|
return loadTranscriptFile(sessionFile);
|
|
595141
595399
|
}
|
|
595142
595400
|
function clearSessionMessagesCache() {
|
|
@@ -595204,7 +595462,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
595204
595462
|
} catch {
|
|
595205
595463
|
return [];
|
|
595206
595464
|
}
|
|
595207
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
595465
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join183(projectsDir, dirent.name));
|
|
595208
595466
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
595209
595467
|
const allLogs = logsPerProject.flat();
|
|
595210
595468
|
const deduped = new Map;
|
|
@@ -595229,7 +595487,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
595229
595487
|
} catch {
|
|
595230
595488
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
595231
595489
|
}
|
|
595232
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
595490
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join183(projectsDir, dirent.name));
|
|
595233
595491
|
const rawLogs = [];
|
|
595234
595492
|
for (const projectDir of projectDirs) {
|
|
595235
595493
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -595290,7 +595548,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
595290
595548
|
for (const { path: wtPath, prefix } of indexed) {
|
|
595291
595549
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
595292
595550
|
seenDirs.add(dirName);
|
|
595293
|
-
allLogs.push(...await getSessionFilesLite(
|
|
595551
|
+
allLogs.push(...await getSessionFilesLite(join183(projectsDir, dirent.name), undefined, wtPath));
|
|
595294
595552
|
break;
|
|
595295
595553
|
}
|
|
595296
595554
|
}
|
|
@@ -595359,7 +595617,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
595359
595617
|
return transcripts;
|
|
595360
595618
|
}
|
|
595361
595619
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
595362
|
-
const subagentsDir =
|
|
595620
|
+
const subagentsDir = join183(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
595363
595621
|
let entries;
|
|
595364
595622
|
try {
|
|
595365
595623
|
entries = await readdir29(subagentsDir, { withFileTypes: true });
|
|
@@ -595487,7 +595745,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
595487
595745
|
const sessionId = validateUuid2(basename42(dirent.name, ".jsonl"));
|
|
595488
595746
|
if (!sessionId)
|
|
595489
595747
|
continue;
|
|
595490
|
-
candidates2.push({ sessionId, filePath:
|
|
595748
|
+
candidates2.push({ sessionId, filePath: join183(projectDir, dirent.name) });
|
|
595491
595749
|
}
|
|
595492
595750
|
await Promise.all(candidates2.map(async ({ sessionId, filePath }) => {
|
|
595493
595751
|
try {
|
|
@@ -595626,9 +595884,9 @@ async function readLiteMetadata(filePath, fileSize, buf) {
|
|
|
595626
595884
|
const prNumMatch = tail.lastIndexOf('"prNumber":');
|
|
595627
595885
|
if (prNumMatch >= 0) {
|
|
595628
595886
|
const afterColon = tail.slice(prNumMatch + 11, prNumMatch + 25);
|
|
595629
|
-
const
|
|
595630
|
-
if (
|
|
595631
|
-
prNumber =
|
|
595887
|
+
const num2 = parseInt(afterColon.trim(), 10);
|
|
595888
|
+
if (num2 > 0)
|
|
595889
|
+
prNumber = num2;
|
|
595632
595890
|
}
|
|
595633
595891
|
}
|
|
595634
595892
|
return {
|
|
@@ -595873,7 +596131,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
595873
596131
|
init_settings2();
|
|
595874
596132
|
init_slowOperations();
|
|
595875
596133
|
init_uuid();
|
|
595876
|
-
VERSION5 = typeof MACRO !== "undefined" ? "1.
|
|
596134
|
+
VERSION5 = typeof MACRO !== "undefined" ? "1.22.0" : "unknown";
|
|
595877
596135
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
595878
596136
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
595879
596137
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -595885,7 +596143,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
595885
596143
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
595886
596144
|
agentTranscriptSubdirs = new Map;
|
|
595887
596145
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
595888
|
-
return
|
|
596146
|
+
return join183(getProjectsDir2(), sanitizePath2(projectDir));
|
|
595889
596147
|
});
|
|
595890
596148
|
METADATA_TYPE_MARKERS = [
|
|
595891
596149
|
'"type":"summary"',
|
|
@@ -596123,41 +596381,41 @@ var init_memdir = __esm(() => {
|
|
|
596123
596381
|
});
|
|
596124
596382
|
|
|
596125
596383
|
// src/tools/AgentTool/agentMemory.ts
|
|
596126
|
-
import { join as
|
|
596384
|
+
import { join as join184, normalize as normalize14, sep as sep34 } from "path";
|
|
596127
596385
|
function sanitizeAgentTypeForPath(agentType) {
|
|
596128
596386
|
return agentType.replace(/:/g, "-");
|
|
596129
596387
|
}
|
|
596130
596388
|
function getLocalAgentMemoryDir(dirName) {
|
|
596131
596389
|
if (process.env.UR_CODE_REMOTE_MEMORY_DIR) {
|
|
596132
|
-
return
|
|
596390
|
+
return join184(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep34;
|
|
596133
596391
|
}
|
|
596134
|
-
return
|
|
596392
|
+
return join184(getCwd(), ".ur", "agent-memory-local", dirName) + sep34;
|
|
596135
596393
|
}
|
|
596136
596394
|
function getAgentMemoryDir(agentType, scope) {
|
|
596137
596395
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
596138
596396
|
switch (scope) {
|
|
596139
596397
|
case "project":
|
|
596140
|
-
return
|
|
596398
|
+
return join184(getCwd(), ".ur", "agent-memory", dirName) + sep34;
|
|
596141
596399
|
case "local":
|
|
596142
596400
|
return getLocalAgentMemoryDir(dirName);
|
|
596143
596401
|
case "user":
|
|
596144
|
-
return
|
|
596402
|
+
return join184(getMemoryBaseDir(), "agent-memory", dirName) + sep34;
|
|
596145
596403
|
}
|
|
596146
596404
|
}
|
|
596147
596405
|
function isAgentMemoryPath(absolutePath) {
|
|
596148
596406
|
const normalizedPath = normalize14(absolutePath);
|
|
596149
596407
|
const memoryBase = getMemoryBaseDir();
|
|
596150
|
-
if (normalizedPath.startsWith(
|
|
596408
|
+
if (normalizedPath.startsWith(join184(memoryBase, "agent-memory") + sep34)) {
|
|
596151
596409
|
return true;
|
|
596152
596410
|
}
|
|
596153
|
-
if (normalizedPath.startsWith(
|
|
596411
|
+
if (normalizedPath.startsWith(join184(getCwd(), ".ur", "agent-memory") + sep34)) {
|
|
596154
596412
|
return true;
|
|
596155
596413
|
}
|
|
596156
596414
|
if (process.env.UR_CODE_REMOTE_MEMORY_DIR) {
|
|
596157
|
-
if (normalizedPath.includes(sep34 + "agent-memory-local" + sep34) && normalizedPath.startsWith(
|
|
596415
|
+
if (normalizedPath.includes(sep34 + "agent-memory-local" + sep34) && normalizedPath.startsWith(join184(process.env.UR_CODE_REMOTE_MEMORY_DIR, "projects") + sep34)) {
|
|
596158
596416
|
return true;
|
|
596159
596417
|
}
|
|
596160
|
-
} else if (normalizedPath.startsWith(
|
|
596418
|
+
} else if (normalizedPath.startsWith(join184(getCwd(), ".ur", "agent-memory-local") + sep34)) {
|
|
596161
596419
|
return true;
|
|
596162
596420
|
}
|
|
596163
596421
|
return false;
|
|
@@ -596165,7 +596423,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
596165
596423
|
function getMemoryScopeDisplay(memory2) {
|
|
596166
596424
|
switch (memory2) {
|
|
596167
596425
|
case "user":
|
|
596168
|
-
return `User (${
|
|
596426
|
+
return `User (${join184(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
596169
596427
|
case "project":
|
|
596170
596428
|
return "Project (.ur/agent-memory/)";
|
|
596171
596429
|
case "local":
|
|
@@ -596208,7 +596466,7 @@ var init_agentMemory = __esm(() => {
|
|
|
596208
596466
|
// src/utils/permissions/filesystem.ts
|
|
596209
596467
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
596210
596468
|
import { homedir as homedir32, tmpdir as tmpdir11 } from "os";
|
|
596211
|
-
import { join as
|
|
596469
|
+
import { join as join185, normalize as normalize15, posix as posix9, sep as sep35 } from "path";
|
|
596212
596470
|
function normalizeCaseForComparison(path22) {
|
|
596213
596471
|
return path22.toLowerCase();
|
|
596214
596472
|
}
|
|
@@ -596217,11 +596475,11 @@ function getURSkillScope(filePath) {
|
|
|
596217
596475
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
596218
596476
|
const bases = [
|
|
596219
596477
|
{
|
|
596220
|
-
dir: expandPath(
|
|
596478
|
+
dir: expandPath(join185(getOriginalCwd(), ".ur", "skills")),
|
|
596221
596479
|
prefix: "/.ur/skills/"
|
|
596222
596480
|
},
|
|
596223
596481
|
{
|
|
596224
|
-
dir: expandPath(
|
|
596482
|
+
dir: expandPath(join185(homedir32(), ".ur", "skills")),
|
|
596225
596483
|
prefix: "~/.ur/skills/"
|
|
596226
596484
|
}
|
|
596227
596485
|
];
|
|
@@ -596276,21 +596534,21 @@ function isURConfigFilePath(filePath) {
|
|
|
596276
596534
|
if (isURSettingsPath(filePath)) {
|
|
596277
596535
|
return true;
|
|
596278
596536
|
}
|
|
596279
|
-
const commandsDir =
|
|
596280
|
-
const agentsDir =
|
|
596281
|
-
const skillsDir =
|
|
596537
|
+
const commandsDir = join185(getOriginalCwd(), ".ur", "commands");
|
|
596538
|
+
const agentsDir = join185(getOriginalCwd(), ".ur", "agents");
|
|
596539
|
+
const skillsDir = join185(getOriginalCwd(), ".ur", "skills");
|
|
596282
596540
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
596283
596541
|
}
|
|
596284
596542
|
function isSessionPlanFile(absolutePath) {
|
|
596285
|
-
const expectedPrefix =
|
|
596543
|
+
const expectedPrefix = join185(getPlansDirectory(), getPlanSlug());
|
|
596286
596544
|
const normalizedPath = normalize15(absolutePath);
|
|
596287
596545
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
596288
596546
|
}
|
|
596289
596547
|
function getSessionMemoryDir() {
|
|
596290
|
-
return
|
|
596548
|
+
return join185(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep35;
|
|
596291
596549
|
}
|
|
596292
596550
|
function getSessionMemoryPath() {
|
|
596293
|
-
return
|
|
596551
|
+
return join185(getSessionMemoryDir(), "summary.md");
|
|
596294
596552
|
}
|
|
596295
596553
|
function isSessionMemoryPath(absolutePath) {
|
|
596296
596554
|
const normalizedPath = normalize15(absolutePath);
|
|
@@ -596312,10 +596570,10 @@ function getURTempDirName() {
|
|
|
596312
596570
|
return `ur-${uid}`;
|
|
596313
596571
|
}
|
|
596314
596572
|
function getProjectTempDir() {
|
|
596315
|
-
return
|
|
596573
|
+
return join185(getURTempDir(), sanitizePath2(getOriginalCwd())) + sep35;
|
|
596316
596574
|
}
|
|
596317
596575
|
function getScratchpadDir() {
|
|
596318
|
-
return
|
|
596576
|
+
return join185(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
596319
596577
|
}
|
|
596320
596578
|
async function ensureScratchpadDir() {
|
|
596321
596579
|
if (!isScratchpadEnabled()) {
|
|
@@ -596893,7 +597151,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
596893
597151
|
}
|
|
596894
597152
|
};
|
|
596895
597153
|
}
|
|
596896
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
597154
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join185(getOriginalCwd(), ".ur", "launch.json"))) {
|
|
596897
597155
|
return {
|
|
596898
597156
|
behavior: "allow",
|
|
596899
597157
|
updatedInput: input,
|
|
@@ -596990,7 +597248,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
596990
597248
|
}
|
|
596991
597249
|
};
|
|
596992
597250
|
}
|
|
596993
|
-
const tasksDir =
|
|
597251
|
+
const tasksDir = join185(getURConfigHomeDir(), "tasks") + sep35;
|
|
596994
597252
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
596995
597253
|
return {
|
|
596996
597254
|
behavior: "allow",
|
|
@@ -597001,7 +597259,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
597001
597259
|
}
|
|
597002
597260
|
};
|
|
597003
597261
|
}
|
|
597004
|
-
const teamsReadDir =
|
|
597262
|
+
const teamsReadDir = join185(getURConfigHomeDir(), "teams") + sep35;
|
|
597005
597263
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
597006
597264
|
return {
|
|
597007
597265
|
behavior: "allow",
|
|
@@ -597074,11 +597332,11 @@ var init_filesystem = __esm(() => {
|
|
|
597074
597332
|
try {
|
|
597075
597333
|
resolvedBaseTmpDir = fs12.realpathSync(baseTmpDir);
|
|
597076
597334
|
} catch {}
|
|
597077
|
-
return
|
|
597335
|
+
return join185(resolvedBaseTmpDir, getURTempDirName()) + sep35;
|
|
597078
597336
|
});
|
|
597079
597337
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
597080
597338
|
const nonce = randomBytes18(16).toString("hex");
|
|
597081
|
-
return
|
|
597339
|
+
return join185(getURTempDir(), "bundled-skills", "1.22.0", nonce);
|
|
597082
597340
|
});
|
|
597083
597341
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
597084
597342
|
});
|
|
@@ -597092,10 +597350,10 @@ import {
|
|
|
597092
597350
|
symlink as symlink4,
|
|
597093
597351
|
unlink as unlink23
|
|
597094
597352
|
} from "fs/promises";
|
|
597095
|
-
import { join as
|
|
597353
|
+
import { join as join186 } from "path";
|
|
597096
597354
|
function getTaskOutputDir() {
|
|
597097
597355
|
if (_taskOutputDir === undefined) {
|
|
597098
|
-
_taskOutputDir =
|
|
597356
|
+
_taskOutputDir = join186(getProjectTempDir(), getSessionId(), "tasks");
|
|
597099
597357
|
}
|
|
597100
597358
|
return _taskOutputDir;
|
|
597101
597359
|
}
|
|
@@ -597103,7 +597361,7 @@ async function ensureOutputDir() {
|
|
|
597103
597361
|
await mkdir41(getTaskOutputDir(), { recursive: true });
|
|
597104
597362
|
}
|
|
597105
597363
|
function getTaskOutputPath(taskId) {
|
|
597106
|
-
return
|
|
597364
|
+
return join186(getTaskOutputDir(), `${taskId}.output`);
|
|
597107
597365
|
}
|
|
597108
597366
|
function track(p2) {
|
|
597109
597367
|
_pendingOps.add(p2);
|
|
@@ -601371,7 +601629,7 @@ import {
|
|
|
601371
601629
|
symlink as symlink5,
|
|
601372
601630
|
utimes as utimes2
|
|
601373
601631
|
} from "fs/promises";
|
|
601374
|
-
import { basename as basename44, dirname as dirname66, join as
|
|
601632
|
+
import { basename as basename44, dirname as dirname66, join as join187 } from "path";
|
|
601375
601633
|
function validateWorktreeSlug(slug4) {
|
|
601376
601634
|
if (slug4.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
601377
601635
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug4.length})`);
|
|
@@ -601394,8 +601652,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
601394
601652
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
601395
601653
|
continue;
|
|
601396
601654
|
}
|
|
601397
|
-
const sourcePath =
|
|
601398
|
-
const destPath =
|
|
601655
|
+
const sourcePath = join187(repoRootPath, dir);
|
|
601656
|
+
const destPath = join187(worktreePath, dir);
|
|
601399
601657
|
try {
|
|
601400
601658
|
await symlink5(sourcePath, destPath, "dir");
|
|
601401
601659
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -601419,7 +601677,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
601419
601677
|
return combined.replace(/[/.]/g, "_");
|
|
601420
601678
|
}
|
|
601421
601679
|
function worktreesDir2(repoRoot) {
|
|
601422
|
-
return
|
|
601680
|
+
return join187(repoRoot, ".ur", "worktrees");
|
|
601423
601681
|
}
|
|
601424
601682
|
function flattenSlug(slug4) {
|
|
601425
601683
|
return slug4.replaceAll("/", "+");
|
|
@@ -601428,7 +601686,7 @@ function worktreeBranchName(slug4) {
|
|
|
601428
601686
|
return `worktree-${flattenSlug(slug4)}`;
|
|
601429
601687
|
}
|
|
601430
601688
|
function worktreePathFor(repoRoot, slug4) {
|
|
601431
|
-
return
|
|
601689
|
+
return join187(worktreesDir2(repoRoot), flattenSlug(slug4));
|
|
601432
601690
|
}
|
|
601433
601691
|
async function getOrCreateWorktree(repoRoot, slug4, options2) {
|
|
601434
601692
|
const worktreePath = worktreePathFor(repoRoot, slug4);
|
|
@@ -601509,7 +601767,7 @@ async function getOrCreateWorktree(repoRoot, slug4, options2) {
|
|
|
601509
601767
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
601510
601768
|
let includeContent;
|
|
601511
601769
|
try {
|
|
601512
|
-
includeContent = await readFile51(
|
|
601770
|
+
includeContent = await readFile51(join187(repoRoot, ".worktreeinclude"), "utf-8");
|
|
601513
601771
|
} catch {
|
|
601514
601772
|
return [];
|
|
601515
601773
|
}
|
|
@@ -601564,8 +601822,8 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
601564
601822
|
}
|
|
601565
601823
|
const copied = [];
|
|
601566
601824
|
for (const relativePath2 of files2) {
|
|
601567
|
-
const srcPath =
|
|
601568
|
-
const destPath =
|
|
601825
|
+
const srcPath = join187(repoRoot, relativePath2);
|
|
601826
|
+
const destPath = join187(worktreePath, relativePath2);
|
|
601569
601827
|
try {
|
|
601570
601828
|
await mkdir42(dirname66(destPath), { recursive: true });
|
|
601571
601829
|
await copyFile10(srcPath, destPath);
|
|
@@ -601581,9 +601839,9 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
601581
601839
|
}
|
|
601582
601840
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
601583
601841
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
601584
|
-
const sourceSettingsLocal =
|
|
601842
|
+
const sourceSettingsLocal = join187(repoRoot, localSettingsRelativePath);
|
|
601585
601843
|
try {
|
|
601586
|
-
const destSettingsLocal =
|
|
601844
|
+
const destSettingsLocal = join187(worktreePath, localSettingsRelativePath);
|
|
601587
601845
|
await mkdirRecursive(dirname66(destSettingsLocal));
|
|
601588
601846
|
await copyFile10(sourceSettingsLocal, destSettingsLocal);
|
|
601589
601847
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
@@ -601593,8 +601851,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
601593
601851
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
601594
601852
|
}
|
|
601595
601853
|
}
|
|
601596
|
-
const huskyPath =
|
|
601597
|
-
const gitHooksPath =
|
|
601854
|
+
const huskyPath = join187(repoRoot, ".husky");
|
|
601855
|
+
const gitHooksPath = join187(repoRoot, ".git", "hooks");
|
|
601598
601856
|
let hooksPath = null;
|
|
601599
601857
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
601600
601858
|
try {
|
|
@@ -601869,7 +602127,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
601869
602127
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p2) => p2.test(slug4))) {
|
|
601870
602128
|
continue;
|
|
601871
602129
|
}
|
|
601872
|
-
const worktreePath =
|
|
602130
|
+
const worktreePath = join187(dir, slug4);
|
|
601873
602131
|
if (currentPath === worktreePath) {
|
|
601874
602132
|
continue;
|
|
601875
602133
|
}
|
|
@@ -603109,7 +603367,7 @@ function computeFingerprint(messageText, version3) {
|
|
|
603109
603367
|
}
|
|
603110
603368
|
function computeFingerprintFromMessages(messages) {
|
|
603111
603369
|
const firstMessageText = extractFirstMessageText(messages);
|
|
603112
|
-
return computeFingerprint(firstMessageText, "1.
|
|
603370
|
+
return computeFingerprint(firstMessageText, "1.22.0");
|
|
603113
603371
|
}
|
|
603114
603372
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
603115
603373
|
var init_fingerprint = () => {};
|
|
@@ -604975,7 +605233,7 @@ async function sideQuery(opts) {
|
|
|
604975
605233
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
604976
605234
|
}
|
|
604977
605235
|
const messageText = extractFirstUserMessageText(messages);
|
|
604978
|
-
const fingerprint = computeFingerprint(messageText, "1.
|
|
605236
|
+
const fingerprint = computeFingerprint(messageText, "1.22.0");
|
|
604979
605237
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
604980
605238
|
const systemBlocks = [
|
|
604981
605239
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -605261,7 +605519,7 @@ import {
|
|
|
605261
605519
|
} from "fs/promises";
|
|
605262
605520
|
import { createServer as createServer5 } from "net";
|
|
605263
605521
|
import { homedir as homedir33, platform as platform6 } from "os";
|
|
605264
|
-
import { join as
|
|
605522
|
+
import { join as join188 } from "path";
|
|
605265
605523
|
function log(message, ...args) {
|
|
605266
605524
|
if (LOG_FILE) {
|
|
605267
605525
|
const timestamp2 = new Date().toISOString();
|
|
@@ -605328,7 +605586,7 @@ class ChromeNativeHost {
|
|
|
605328
605586
|
try {
|
|
605329
605587
|
process.kill(pid, 0);
|
|
605330
605588
|
} catch {
|
|
605331
|
-
await unlink24(
|
|
605589
|
+
await unlink24(join188(socketDir, file4)).catch(() => {});
|
|
605332
605590
|
log(`Removed stale socket for PID ${pid}`);
|
|
605333
605591
|
}
|
|
605334
605592
|
}
|
|
@@ -605599,7 +605857,7 @@ var init_chromeNativeHost = __esm(() => {
|
|
|
605599
605857
|
init_slowOperations();
|
|
605600
605858
|
init_common2();
|
|
605601
605859
|
MAX_MESSAGE_SIZE = 1024 * 1024;
|
|
605602
|
-
LOG_FILE = process.env.USER_TYPE === "ant" ?
|
|
605860
|
+
LOG_FILE = process.env.USER_TYPE === "ant" ? join188(homedir33(), ".ur", "debug", "chrome-native-host.txt") : undefined;
|
|
605603
605861
|
messageSchema = lazySchema(() => exports_external2.object({
|
|
605604
605862
|
type: exports_external2.string()
|
|
605605
605863
|
}).passthrough());
|
|
@@ -608109,7 +608367,7 @@ __export(exports_upstreamproxy, {
|
|
|
608109
608367
|
});
|
|
608110
608368
|
import { mkdir as mkdir44, readFile as readFile52, unlink as unlink25, writeFile as writeFile45 } from "fs/promises";
|
|
608111
608369
|
import { homedir as homedir34 } from "os";
|
|
608112
|
-
import { join as
|
|
608370
|
+
import { join as join189 } from "path";
|
|
608113
608371
|
async function initUpstreamProxy(opts) {
|
|
608114
608372
|
if (!isEnvTruthy(process.env.UR_CODE_REMOTE)) {
|
|
608115
608373
|
return state;
|
|
@@ -608130,7 +608388,7 @@ async function initUpstreamProxy(opts) {
|
|
|
608130
608388
|
}
|
|
608131
608389
|
setNonDumpable();
|
|
608132
608390
|
const baseUrl = opts?.ccrBaseUrl ?? "";
|
|
608133
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
608391
|
+
const caBundlePath = opts?.caBundlePath ?? join189(homedir34(), ".ccr", "ca-bundle.crt");
|
|
608134
608392
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
608135
608393
|
if (!caOk)
|
|
608136
608394
|
return state;
|
|
@@ -608230,7 +608488,7 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
608230
608488
|
}
|
|
608231
608489
|
const ccrCa = await resp.text();
|
|
608232
608490
|
const systemCa = await readFile52(systemCaPath, "utf8").catch(() => "");
|
|
608233
|
-
await mkdir44(
|
|
608491
|
+
await mkdir44(join189(outPath, ".."), { recursive: true });
|
|
608234
608492
|
await writeFile45(outPath, systemCa + `
|
|
608235
608493
|
` + ccrCa, "utf8");
|
|
608236
608494
|
return true;
|
|
@@ -609712,7 +609970,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
609712
609970
|
slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
|
|
609713
609971
|
apiKeySource: getURHQApiKeyWithSource().source,
|
|
609714
609972
|
betas: getSdkBetas(),
|
|
609715
|
-
ur_version: "1.
|
|
609973
|
+
ur_version: "1.22.0",
|
|
609716
609974
|
output_style: outputStyle2,
|
|
609717
609975
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
609718
609976
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -611375,8 +611633,8 @@ function QuestionNavigationBar(t0) {
|
|
|
611375
611633
|
}
|
|
611376
611634
|
return t7;
|
|
611377
611635
|
}
|
|
611378
|
-
function _temp343(
|
|
611379
|
-
return
|
|
611636
|
+
function _temp343(sum2, w) {
|
|
611637
|
+
return sum2 + w;
|
|
611380
611638
|
}
|
|
611381
611639
|
function _temp271(header_0) {
|
|
611382
611640
|
return 4 + stringWidth(header_0);
|
|
@@ -616092,7 +616350,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
616092
616350
|
|
|
616093
616351
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
616094
616352
|
import { homedir as homedir35 } from "os";
|
|
616095
|
-
import { basename as basename48, join as
|
|
616353
|
+
import { basename as basename48, join as join190, sep as sep36 } from "path";
|
|
616096
616354
|
function isInURFolder(filePath) {
|
|
616097
616355
|
const absolutePath = expandPath(filePath);
|
|
616098
616356
|
const urFolderPath = expandPath(`${getOriginalCwd()}/.ur`);
|
|
@@ -616102,7 +616360,7 @@ function isInURFolder(filePath) {
|
|
|
616102
616360
|
}
|
|
616103
616361
|
function isInGlobalURFolder(filePath) {
|
|
616104
616362
|
const absolutePath = expandPath(filePath);
|
|
616105
|
-
const globalURFolderPath =
|
|
616363
|
+
const globalURFolderPath = join190(homedir35(), ".ur");
|
|
616106
616364
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
616107
616365
|
const normalizedGlobalURFolderPath = normalizeCaseForComparison(globalURFolderPath);
|
|
616108
616366
|
return normalizedAbsolutePath.startsWith(normalizedGlobalURFolderPath + sep36.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalURFolderPath + "/");
|
|
@@ -624340,7 +624598,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
624340
624598
|
function getSemverPart(version3) {
|
|
624341
624599
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
624342
624600
|
}
|
|
624343
|
-
function useUpdateNotification(updatedVersion, initialVersion = "1.
|
|
624601
|
+
function useUpdateNotification(updatedVersion, initialVersion = "1.22.0") {
|
|
624344
624602
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react224.useState(() => getSemverPart(initialVersion));
|
|
624345
624603
|
if (!updatedVersion) {
|
|
624346
624604
|
return null;
|
|
@@ -624389,7 +624647,7 @@ function AutoUpdater({
|
|
|
624389
624647
|
return;
|
|
624390
624648
|
}
|
|
624391
624649
|
if (false) {}
|
|
624392
|
-
const currentVersion = "1.
|
|
624650
|
+
const currentVersion = "1.22.0";
|
|
624393
624651
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
624394
624652
|
let latestVersion = await getLatestVersion(channel);
|
|
624395
624653
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -624618,12 +624876,12 @@ function NativeAutoUpdater({
|
|
|
624618
624876
|
logEvent("tengu_native_auto_updater_start", {});
|
|
624619
624877
|
try {
|
|
624620
624878
|
const maxVersion = await getMaxVersion();
|
|
624621
|
-
if (maxVersion && gt("1.
|
|
624879
|
+
if (maxVersion && gt("1.22.0", maxVersion)) {
|
|
624622
624880
|
const msg = await getMaxVersionMessage();
|
|
624623
624881
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
624624
624882
|
}
|
|
624625
624883
|
const result = await installLatest(channel);
|
|
624626
|
-
const currentVersion = "1.
|
|
624884
|
+
const currentVersion = "1.22.0";
|
|
624627
624885
|
const latencyMs = Date.now() - startTime;
|
|
624628
624886
|
if (result.lockFailed) {
|
|
624629
624887
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -624760,17 +625018,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
624760
625018
|
const maxVersion = await getMaxVersion();
|
|
624761
625019
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
624762
625020
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
624763
|
-
if (gte("1.
|
|
624764
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.
|
|
625021
|
+
if (gte("1.22.0", maxVersion)) {
|
|
625022
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.22.0"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
624765
625023
|
setUpdateAvailable(false);
|
|
624766
625024
|
return;
|
|
624767
625025
|
}
|
|
624768
625026
|
latest = maxVersion;
|
|
624769
625027
|
}
|
|
624770
|
-
const hasUpdate = latest && !gte("1.
|
|
625028
|
+
const hasUpdate = latest && !gte("1.22.0", latest) && !shouldSkipVersion(latest);
|
|
624771
625029
|
setUpdateAvailable(!!hasUpdate);
|
|
624772
625030
|
if (hasUpdate) {
|
|
624773
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.
|
|
625031
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.22.0"} -> ${latest}`);
|
|
624774
625032
|
}
|
|
624775
625033
|
};
|
|
624776
625034
|
$3[0] = t1;
|
|
@@ -624804,7 +625062,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
624804
625062
|
wrap: "truncate",
|
|
624805
625063
|
children: [
|
|
624806
625064
|
"currentVersion: ",
|
|
624807
|
-
"1.
|
|
625065
|
+
"1.22.0"
|
|
624808
625066
|
]
|
|
624809
625067
|
}, undefined, true, undefined, this);
|
|
624810
625068
|
$3[3] = verbose;
|
|
@@ -630187,9 +630445,9 @@ var require_bit_buffer = __commonJS((exports, module) => {
|
|
|
630187
630445
|
const bufIndex = Math.floor(index2 / 8);
|
|
630188
630446
|
return (this.buffer[bufIndex] >>> 7 - index2 % 8 & 1) === 1;
|
|
630189
630447
|
},
|
|
630190
|
-
put: function(
|
|
630448
|
+
put: function(num2, length) {
|
|
630191
630449
|
for (let i3 = 0;i3 < length; i3++) {
|
|
630192
|
-
this.putBit((
|
|
630450
|
+
this.putBit((num2 >>> length - i3 - 1 & 1) === 1);
|
|
630193
630451
|
}
|
|
630194
630452
|
},
|
|
630195
630453
|
getLengthInBits: function() {
|
|
@@ -633031,12 +633289,12 @@ var require_filter_pack = __commonJS((exports, module) => {
|
|
|
633031
633289
|
}
|
|
633032
633290
|
}
|
|
633033
633291
|
function filterSumNone(pxData, pxPos, byteWidth) {
|
|
633034
|
-
let
|
|
633292
|
+
let sum2 = 0;
|
|
633035
633293
|
let length = pxPos + byteWidth;
|
|
633036
633294
|
for (let i3 = pxPos;i3 < length; i3++) {
|
|
633037
|
-
|
|
633295
|
+
sum2 += Math.abs(pxData[i3]);
|
|
633038
633296
|
}
|
|
633039
|
-
return
|
|
633297
|
+
return sum2;
|
|
633040
633298
|
}
|
|
633041
633299
|
function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
633042
633300
|
for (let x2 = 0;x2 < byteWidth; x2++) {
|
|
@@ -633046,13 +633304,13 @@ var require_filter_pack = __commonJS((exports, module) => {
|
|
|
633046
633304
|
}
|
|
633047
633305
|
}
|
|
633048
633306
|
function filterSumSub(pxData, pxPos, byteWidth, bpp) {
|
|
633049
|
-
let
|
|
633307
|
+
let sum2 = 0;
|
|
633050
633308
|
for (let x2 = 0;x2 < byteWidth; x2++) {
|
|
633051
633309
|
let left = x2 >= bpp ? pxData[pxPos + x2 - bpp] : 0;
|
|
633052
633310
|
let val = pxData[pxPos + x2] - left;
|
|
633053
|
-
|
|
633311
|
+
sum2 += Math.abs(val);
|
|
633054
633312
|
}
|
|
633055
|
-
return
|
|
633313
|
+
return sum2;
|
|
633056
633314
|
}
|
|
633057
633315
|
function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) {
|
|
633058
633316
|
for (let x2 = 0;x2 < byteWidth; x2++) {
|
|
@@ -633062,14 +633320,14 @@ var require_filter_pack = __commonJS((exports, module) => {
|
|
|
633062
633320
|
}
|
|
633063
633321
|
}
|
|
633064
633322
|
function filterSumUp(pxData, pxPos, byteWidth) {
|
|
633065
|
-
let
|
|
633323
|
+
let sum2 = 0;
|
|
633066
633324
|
let length = pxPos + byteWidth;
|
|
633067
633325
|
for (let x2 = pxPos;x2 < length; x2++) {
|
|
633068
633326
|
let up = pxPos > 0 ? pxData[x2 - byteWidth] : 0;
|
|
633069
633327
|
let val = pxData[x2] - up;
|
|
633070
|
-
|
|
633328
|
+
sum2 += Math.abs(val);
|
|
633071
633329
|
}
|
|
633072
|
-
return
|
|
633330
|
+
return sum2;
|
|
633073
633331
|
}
|
|
633074
633332
|
function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
633075
633333
|
for (let x2 = 0;x2 < byteWidth; x2++) {
|
|
@@ -633080,14 +633338,14 @@ var require_filter_pack = __commonJS((exports, module) => {
|
|
|
633080
633338
|
}
|
|
633081
633339
|
}
|
|
633082
633340
|
function filterSumAvg(pxData, pxPos, byteWidth, bpp) {
|
|
633083
|
-
let
|
|
633341
|
+
let sum2 = 0;
|
|
633084
633342
|
for (let x2 = 0;x2 < byteWidth; x2++) {
|
|
633085
633343
|
let left = x2 >= bpp ? pxData[pxPos + x2 - bpp] : 0;
|
|
633086
633344
|
let up = pxPos > 0 ? pxData[pxPos + x2 - byteWidth] : 0;
|
|
633087
633345
|
let val = pxData[pxPos + x2] - (left + up >> 1);
|
|
633088
|
-
|
|
633346
|
+
sum2 += Math.abs(val);
|
|
633089
633347
|
}
|
|
633090
|
-
return
|
|
633348
|
+
return sum2;
|
|
633091
633349
|
}
|
|
633092
633350
|
function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
633093
633351
|
for (let x2 = 0;x2 < byteWidth; x2++) {
|
|
@@ -633099,15 +633357,15 @@ var require_filter_pack = __commonJS((exports, module) => {
|
|
|
633099
633357
|
}
|
|
633100
633358
|
}
|
|
633101
633359
|
function filterSumPaeth(pxData, pxPos, byteWidth, bpp) {
|
|
633102
|
-
let
|
|
633360
|
+
let sum2 = 0;
|
|
633103
633361
|
for (let x2 = 0;x2 < byteWidth; x2++) {
|
|
633104
633362
|
let left = x2 >= bpp ? pxData[pxPos + x2 - bpp] : 0;
|
|
633105
633363
|
let up = pxPos > 0 ? pxData[pxPos + x2 - byteWidth] : 0;
|
|
633106
633364
|
let upleft = pxPos > 0 && x2 >= bpp ? pxData[pxPos + x2 - (byteWidth + bpp)] : 0;
|
|
633107
633365
|
let val = pxData[pxPos + x2] - paethPredictor(left, up, upleft);
|
|
633108
|
-
|
|
633366
|
+
sum2 += Math.abs(val);
|
|
633109
633367
|
}
|
|
633110
|
-
return
|
|
633368
|
+
return sum2;
|
|
633111
633369
|
}
|
|
633112
633370
|
var filters = {
|
|
633113
633371
|
0: filterNone,
|
|
@@ -633144,10 +633402,10 @@ var require_filter_pack = __commonJS((exports, module) => {
|
|
|
633144
633402
|
if (filterTypes.length > 1) {
|
|
633145
633403
|
let min = Infinity;
|
|
633146
633404
|
for (let i3 = 0;i3 < filterTypes.length; i3++) {
|
|
633147
|
-
let
|
|
633148
|
-
if (
|
|
633405
|
+
let sum2 = filterSums[filterTypes[i3]](pxData, pxPos, byteWidth, bpp);
|
|
633406
|
+
if (sum2 < min) {
|
|
633149
633407
|
sel = filterTypes[i3];
|
|
633150
|
-
min =
|
|
633408
|
+
min = sum2;
|
|
633151
633409
|
}
|
|
633152
633410
|
}
|
|
633153
633411
|
}
|
|
@@ -637166,7 +637424,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
637166
637424
|
project_dir: getOriginalCwd(),
|
|
637167
637425
|
added_dirs: addedDirs
|
|
637168
637426
|
},
|
|
637169
|
-
version: "1.
|
|
637427
|
+
version: "1.22.0",
|
|
637170
637428
|
output_style: {
|
|
637171
637429
|
name: outputStyleName
|
|
637172
637430
|
},
|
|
@@ -637398,7 +637656,7 @@ function calculateHorizontalScrollWindow(itemWidths, availableWidth, arrowWidth,
|
|
|
637398
637656
|
};
|
|
637399
637657
|
}
|
|
637400
637658
|
const clampedSelected = Math.max(0, Math.min(selectedIdx, totalItems - 1));
|
|
637401
|
-
const totalWidth = itemWidths.reduce((
|
|
637659
|
+
const totalWidth = itemWidths.reduce((sum2, w) => sum2 + w, 0);
|
|
637402
637660
|
if (totalWidth <= availableWidth) {
|
|
637403
637661
|
return {
|
|
637404
637662
|
startIndex: 0,
|
|
@@ -643274,9 +643532,9 @@ function initSkillImprovement() {
|
|
|
643274
643532
|
async function applySkillImprovement(skillName, updates) {
|
|
643275
643533
|
if (!skillName)
|
|
643276
643534
|
return;
|
|
643277
|
-
const { join:
|
|
643535
|
+
const { join: join191 } = await import("path");
|
|
643278
643536
|
const fs12 = await import("fs/promises");
|
|
643279
|
-
const filePath =
|
|
643537
|
+
const filePath = join191(getCwd(), ".ur", "skills", skillName, "SKILL.md");
|
|
643280
643538
|
let currentContent;
|
|
643281
643539
|
try {
|
|
643282
643540
|
currentContent = await fs12.readFile(filePath, "utf-8");
|
|
@@ -643430,7 +643688,7 @@ function useMoreRight(_args) {
|
|
|
643430
643688
|
// src/utils/cleanup.ts
|
|
643431
643689
|
import * as fs12 from "fs/promises";
|
|
643432
643690
|
import { homedir as homedir36 } from "os";
|
|
643433
|
-
import { join as
|
|
643691
|
+
import { join as join191 } from "path";
|
|
643434
643692
|
function getCutoffDate() {
|
|
643435
643693
|
const settings = getSettings_DEPRECATED() || {};
|
|
643436
643694
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -643455,7 +643713,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
643455
643713
|
try {
|
|
643456
643714
|
const timestamp2 = convertFileNameToDate(file4.name);
|
|
643457
643715
|
if (timestamp2 < cutoffDate) {
|
|
643458
|
-
await getFsImplementation().unlink(
|
|
643716
|
+
await getFsImplementation().unlink(join191(dirPath, file4.name));
|
|
643459
643717
|
if (isMessagePath) {
|
|
643460
643718
|
result.messages++;
|
|
643461
643719
|
} else {
|
|
@@ -643486,7 +643744,7 @@ async function cleanupOldMessageFiles() {
|
|
|
643486
643744
|
} catch {
|
|
643487
643745
|
return result;
|
|
643488
643746
|
}
|
|
643489
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
643747
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join191(baseCachePath, dirent.name));
|
|
643490
643748
|
for (const mcpLogDir of mcpLogDirs) {
|
|
643491
643749
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
643492
643750
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -643525,7 +643783,7 @@ async function cleanupOldSessionFiles() {
|
|
|
643525
643783
|
for (const projectDirent of projectDirents) {
|
|
643526
643784
|
if (!projectDirent.isDirectory())
|
|
643527
643785
|
continue;
|
|
643528
|
-
const projectDir =
|
|
643786
|
+
const projectDir = join191(projectsDir, projectDirent.name);
|
|
643529
643787
|
let entries;
|
|
643530
643788
|
try {
|
|
643531
643789
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -643539,15 +643797,15 @@ async function cleanupOldSessionFiles() {
|
|
|
643539
643797
|
continue;
|
|
643540
643798
|
}
|
|
643541
643799
|
try {
|
|
643542
|
-
if (await unlinkIfOld(
|
|
643800
|
+
if (await unlinkIfOld(join191(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
643543
643801
|
result.messages++;
|
|
643544
643802
|
}
|
|
643545
643803
|
} catch {
|
|
643546
643804
|
result.errors++;
|
|
643547
643805
|
}
|
|
643548
643806
|
} else if (entry.isDirectory()) {
|
|
643549
|
-
const sessionDir =
|
|
643550
|
-
const toolResultsDir =
|
|
643807
|
+
const sessionDir = join191(projectDir, entry.name);
|
|
643808
|
+
const toolResultsDir = join191(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
643551
643809
|
let toolDirs;
|
|
643552
643810
|
try {
|
|
643553
643811
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -643558,14 +643816,14 @@ async function cleanupOldSessionFiles() {
|
|
|
643558
643816
|
for (const toolEntry of toolDirs) {
|
|
643559
643817
|
if (toolEntry.isFile()) {
|
|
643560
643818
|
try {
|
|
643561
|
-
if (await unlinkIfOld(
|
|
643819
|
+
if (await unlinkIfOld(join191(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
643562
643820
|
result.messages++;
|
|
643563
643821
|
}
|
|
643564
643822
|
} catch {
|
|
643565
643823
|
result.errors++;
|
|
643566
643824
|
}
|
|
643567
643825
|
} else if (toolEntry.isDirectory()) {
|
|
643568
|
-
const toolDirPath =
|
|
643826
|
+
const toolDirPath = join191(toolResultsDir, toolEntry.name);
|
|
643569
643827
|
let toolFiles;
|
|
643570
643828
|
try {
|
|
643571
643829
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -643576,7 +643834,7 @@ async function cleanupOldSessionFiles() {
|
|
|
643576
643834
|
if (!tf.isFile())
|
|
643577
643835
|
continue;
|
|
643578
643836
|
try {
|
|
643579
|
-
if (await unlinkIfOld(
|
|
643837
|
+
if (await unlinkIfOld(join191(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
643580
643838
|
result.messages++;
|
|
643581
643839
|
}
|
|
643582
643840
|
} catch {
|
|
@@ -643608,7 +643866,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
643608
643866
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
643609
643867
|
continue;
|
|
643610
643868
|
try {
|
|
643611
|
-
if (await unlinkIfOld(
|
|
643869
|
+
if (await unlinkIfOld(join191(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
643612
643870
|
result.messages++;
|
|
643613
643871
|
}
|
|
643614
643872
|
} catch {
|
|
@@ -643621,7 +643879,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
643621
643879
|
return result;
|
|
643622
643880
|
}
|
|
643623
643881
|
function cleanupOldPlanFiles() {
|
|
643624
|
-
const plansDir =
|
|
643882
|
+
const plansDir = join191(getURConfigHomeDir(), "plans");
|
|
643625
643883
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
643626
643884
|
}
|
|
643627
643885
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -643630,14 +643888,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
643630
643888
|
const fsImpl = getFsImplementation();
|
|
643631
643889
|
try {
|
|
643632
643890
|
const configDir = getURConfigHomeDir();
|
|
643633
|
-
const fileHistoryStorageDir =
|
|
643891
|
+
const fileHistoryStorageDir = join191(configDir, "file-history");
|
|
643634
643892
|
let dirents;
|
|
643635
643893
|
try {
|
|
643636
643894
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
643637
643895
|
} catch {
|
|
643638
643896
|
return result;
|
|
643639
643897
|
}
|
|
643640
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
643898
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join191(fileHistoryStorageDir, dirent.name));
|
|
643641
643899
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
643642
643900
|
try {
|
|
643643
643901
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -643664,14 +643922,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
643664
643922
|
const fsImpl = getFsImplementation();
|
|
643665
643923
|
try {
|
|
643666
643924
|
const configDir = getURConfigHomeDir();
|
|
643667
|
-
const sessionEnvBaseDir =
|
|
643925
|
+
const sessionEnvBaseDir = join191(configDir, "session-env");
|
|
643668
643926
|
let dirents;
|
|
643669
643927
|
try {
|
|
643670
643928
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
643671
643929
|
} catch {
|
|
643672
643930
|
return result;
|
|
643673
643931
|
}
|
|
643674
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
643932
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join191(sessionEnvBaseDir, dirent.name));
|
|
643675
643933
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
643676
643934
|
try {
|
|
643677
643935
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -643693,7 +643951,7 @@ async function cleanupOldDebugLogs() {
|
|
|
643693
643951
|
const cutoffDate = getCutoffDate();
|
|
643694
643952
|
const result = { messages: 0, errors: 0 };
|
|
643695
643953
|
const fsImpl = getFsImplementation();
|
|
643696
|
-
const debugDir =
|
|
643954
|
+
const debugDir = join191(getURConfigHomeDir(), "debug");
|
|
643697
643955
|
let dirents;
|
|
643698
643956
|
try {
|
|
643699
643957
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -643705,7 +643963,7 @@ async function cleanupOldDebugLogs() {
|
|
|
643705
643963
|
continue;
|
|
643706
643964
|
}
|
|
643707
643965
|
try {
|
|
643708
|
-
if (await unlinkIfOld(
|
|
643966
|
+
if (await unlinkIfOld(join191(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
643709
643967
|
result.messages++;
|
|
643710
643968
|
}
|
|
643711
643969
|
} catch {
|
|
@@ -643715,7 +643973,7 @@ async function cleanupOldDebugLogs() {
|
|
|
643715
643973
|
return result;
|
|
643716
643974
|
}
|
|
643717
643975
|
async function cleanupNpmCacheForURHQPackages() {
|
|
643718
|
-
const markerPath =
|
|
643976
|
+
const markerPath = join191(getURConfigHomeDir(), ".npm-cache-cleanup");
|
|
643719
643977
|
try {
|
|
643720
643978
|
const stat47 = await fs12.stat(markerPath);
|
|
643721
643979
|
if (Date.now() - stat47.mtimeMs < ONE_DAY_MS) {
|
|
@@ -643730,7 +643988,7 @@ async function cleanupNpmCacheForURHQPackages() {
|
|
|
643730
643988
|
return;
|
|
643731
643989
|
}
|
|
643732
643990
|
logForDebugging("npm cache cleanup: starting");
|
|
643733
|
-
const npmCachePath =
|
|
643991
|
+
const npmCachePath = join191(homedir36(), ".npm", "_cacache");
|
|
643734
643992
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
643735
643993
|
const startTime = Date.now();
|
|
643736
643994
|
try {
|
|
@@ -643785,7 +644043,7 @@ async function cleanupNpmCacheForURHQPackages() {
|
|
|
643785
644043
|
}
|
|
643786
644044
|
}
|
|
643787
644045
|
async function cleanupOldVersionsThrottled() {
|
|
643788
|
-
const markerPath =
|
|
644046
|
+
const markerPath = join191(getURConfigHomeDir(), ".version-cleanup");
|
|
643789
644047
|
try {
|
|
643790
644048
|
const stat47 = await fs12.stat(markerPath);
|
|
643791
644049
|
if (Date.now() - stat47.mtimeMs < ONE_DAY_MS) {
|
|
@@ -645982,7 +646240,7 @@ async function handlePromptSubmit(params) {
|
|
|
645982
646240
|
const finalInput = expandPastedTextRefs(input, pastedContents);
|
|
645983
646241
|
const pastedTextRefs = parseReferences(input).filter((r) => pastedContents[r.id]?.type === "text");
|
|
645984
646242
|
const pastedTextCount = pastedTextRefs.length;
|
|
645985
|
-
const pastedTextBytes = pastedTextRefs.reduce((
|
|
646243
|
+
const pastedTextBytes = pastedTextRefs.reduce((sum2, r) => sum2 + (pastedContents[r.id]?.content.length ?? 0), 0);
|
|
645986
646244
|
logEvent("tengu_paste_text", { pastedTextCount, pastedTextBytes });
|
|
645987
646245
|
if (!skipSlashCommands && finalInput.trim().startsWith("/")) {
|
|
645988
646246
|
const trimmedInput = finalInput.trim();
|
|
@@ -646681,7 +646939,7 @@ function useManagePlugins({
|
|
|
646681
646939
|
p2.mcpServers = servers;
|
|
646682
646940
|
return servers ? Object.keys(servers).length : 0;
|
|
646683
646941
|
}));
|
|
646684
|
-
const mcp_count = mcpServerCounts.reduce((
|
|
646942
|
+
const mcp_count = mcpServerCounts.reduce((sum2, n3) => sum2 + n3, 0);
|
|
646685
646943
|
const lspServerCounts = await Promise.all(enabled2.map(async (p2) => {
|
|
646686
646944
|
if (p2.lspServers)
|
|
646687
646945
|
return Object.keys(p2.lspServers).length;
|
|
@@ -646690,7 +646948,7 @@ function useManagePlugins({
|
|
|
646690
646948
|
p2.lspServers = servers;
|
|
646691
646949
|
return servers ? Object.keys(servers).length : 0;
|
|
646692
646950
|
}));
|
|
646693
|
-
const lsp_count = lspServerCounts.reduce((
|
|
646951
|
+
const lsp_count = lspServerCounts.reduce((sum2, n3) => sum2 + n3, 0);
|
|
646694
646952
|
reinitializeLspServerManager();
|
|
646695
646953
|
setAppState((prevState) => {
|
|
646696
646954
|
const existingLspErrors = prevState.plugins.errors.filter((e) => e.source === "lsp-manager" || e.source.startsWith("plugin:"));
|
|
@@ -646712,10 +646970,10 @@ function useManagePlugins({
|
|
|
646712
646970
|
};
|
|
646713
646971
|
});
|
|
646714
646972
|
logForDebugging(`Loaded plugins - Enabled: ${enabled2.length}, Disabled: ${disabled.length}, Commands: ${commands.length}, Agents: ${agents2.length}, Errors: ${errors4.length}`);
|
|
646715
|
-
const hook_count = enabled2.reduce((
|
|
646973
|
+
const hook_count = enabled2.reduce((sum2, p2) => {
|
|
646716
646974
|
if (!p2.hooksConfig)
|
|
646717
|
-
return
|
|
646718
|
-
return
|
|
646975
|
+
return sum2;
|
|
646976
|
+
return sum2 + Object.values(p2.hooksConfig).reduce((s, matchers) => s + (matchers?.reduce((h2, m) => h2 + m.hooks.length, 0) ?? 0), 0);
|
|
646719
646977
|
}, 0);
|
|
646720
646978
|
return {
|
|
646721
646979
|
enabled_count: enabled2.length,
|
|
@@ -647028,7 +647286,7 @@ __export(exports_asciicast, {
|
|
|
647028
647286
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
647029
647287
|
});
|
|
647030
647288
|
import { appendFile as appendFile7, rename as rename10 } from "fs/promises";
|
|
647031
|
-
import { basename as basename57, dirname as dirname67, join as
|
|
647289
|
+
import { basename as basename57, dirname as dirname67, join as join193 } from "path";
|
|
647032
647290
|
function getRecordFilePath() {
|
|
647033
647291
|
if (recordingState.filePath !== null) {
|
|
647034
647292
|
return recordingState.filePath;
|
|
@@ -647039,10 +647297,10 @@ function getRecordFilePath() {
|
|
|
647039
647297
|
if (!isEnvTruthy(process.env.UR_CODE_TERMINAL_RECORDING)) {
|
|
647040
647298
|
return null;
|
|
647041
647299
|
}
|
|
647042
|
-
const projectsDir =
|
|
647043
|
-
const projectDir =
|
|
647300
|
+
const projectsDir = join193(getURConfigHomeDir(), "projects");
|
|
647301
|
+
const projectDir = join193(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
647044
647302
|
recordingState.timestamp = Date.now();
|
|
647045
|
-
recordingState.filePath =
|
|
647303
|
+
recordingState.filePath = join193(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
647046
647304
|
return recordingState.filePath;
|
|
647047
647305
|
}
|
|
647048
647306
|
function _resetRecordingStateForTesting() {
|
|
@@ -647051,13 +647309,13 @@ function _resetRecordingStateForTesting() {
|
|
|
647051
647309
|
}
|
|
647052
647310
|
function getSessionRecordingPaths() {
|
|
647053
647311
|
const sessionId = getSessionId();
|
|
647054
|
-
const projectsDir =
|
|
647055
|
-
const projectDir =
|
|
647312
|
+
const projectsDir = join193(getURConfigHomeDir(), "projects");
|
|
647313
|
+
const projectDir = join193(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
647056
647314
|
try {
|
|
647057
647315
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
647058
647316
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
647059
647317
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
647060
|
-
return files2.map((f) =>
|
|
647318
|
+
return files2.map((f) => join193(projectDir, f));
|
|
647061
647319
|
} catch {
|
|
647062
647320
|
return [];
|
|
647063
647321
|
}
|
|
@@ -647067,9 +647325,9 @@ async function renameRecordingForSession() {
|
|
|
647067
647325
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
647068
647326
|
return;
|
|
647069
647327
|
}
|
|
647070
|
-
const projectsDir =
|
|
647071
|
-
const projectDir =
|
|
647072
|
-
const newPath =
|
|
647328
|
+
const projectsDir = join193(getURConfigHomeDir(), "projects");
|
|
647329
|
+
const projectDir = join193(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
647330
|
+
const newPath = join193(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
647073
647331
|
if (oldPath === newPath) {
|
|
647074
647332
|
return;
|
|
647075
647333
|
}
|
|
@@ -648674,7 +648932,7 @@ async function submitTranscriptShare(messages, trigger2, appearanceId) {
|
|
|
648674
648932
|
} catch {}
|
|
648675
648933
|
const data = {
|
|
648676
648934
|
trigger: trigger2,
|
|
648677
|
-
version: "1.
|
|
648935
|
+
version: "1.22.0",
|
|
648678
648936
|
platform: process.platform,
|
|
648679
648937
|
transcript,
|
|
648680
648938
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -649946,7 +650204,7 @@ var init_useChromeExtensionNotification = __esm(() => {
|
|
|
649946
650204
|
});
|
|
649947
650205
|
|
|
649948
650206
|
// src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
649949
|
-
import { join as
|
|
650207
|
+
import { join as join194 } from "path";
|
|
649950
650208
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
649951
650209
|
return isEnvTruthy(process.env.UR_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
649952
650210
|
}
|
|
@@ -650030,7 +650288,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
650030
650288
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
650031
650289
|
}
|
|
650032
650290
|
const cacheDir = getMarketplacesCacheDir();
|
|
650033
|
-
const installLocation =
|
|
650291
|
+
const installLocation = join194(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
650034
650292
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
650035
650293
|
if (gcsSha !== null) {
|
|
650036
650294
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -653045,7 +653303,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
653045
653303
|
});
|
|
653046
653304
|
|
|
653047
653305
|
// src/hooks/useLspPluginRecommendation.tsx
|
|
653048
|
-
import { extname as extname20, join as
|
|
653306
|
+
import { extname as extname20, join as join195 } from "path";
|
|
653049
653307
|
function useLspPluginRecommendation() {
|
|
653050
653308
|
const $3 = import_compiler_runtime347.c(12);
|
|
653051
653309
|
const trackedFiles = useAppState(_temp205);
|
|
@@ -653130,7 +653388,7 @@ function useLspPluginRecommendation() {
|
|
|
653130
653388
|
case "yes": {
|
|
653131
653389
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
653132
653390
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
653133
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
653391
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join195(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
653134
653392
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
653135
653393
|
const settings = getSettingsForSource("userSettings");
|
|
653136
653394
|
updateSettingsForSource("userSettings", {
|
|
@@ -655960,7 +656218,7 @@ var exports_REPL = {};
|
|
|
655960
656218
|
__export(exports_REPL, {
|
|
655961
656219
|
REPL: () => REPL
|
|
655962
656220
|
});
|
|
655963
|
-
import { dirname as dirname69, join as
|
|
656221
|
+
import { dirname as dirname69, join as join196 } from "path";
|
|
655964
656222
|
import { tmpdir as tmpdir12 } from "os";
|
|
655965
656223
|
import { writeFile as writeFile47 } from "fs/promises";
|
|
655966
656224
|
import { randomUUID as randomUUID51 } from "crypto";
|
|
@@ -657724,7 +657982,7 @@ Error: sandbox required but unavailable: ${reason}
|
|
|
657724
657982
|
}
|
|
657725
657983
|
const pastedTextRefs = parseReferences(input).filter((r) => pastedContents[r.id]?.type === "text");
|
|
657726
657984
|
const pastedTextCount = pastedTextRefs.length;
|
|
657727
|
-
const pastedTextBytes = pastedTextRefs.reduce((
|
|
657985
|
+
const pastedTextBytes = pastedTextRefs.reduce((sum2, r) => sum2 + (pastedContents[r.id]?.content.length ?? 0), 0);
|
|
657728
657986
|
logEvent("tengu_paste_text", {
|
|
657729
657987
|
pastedTextCount,
|
|
657730
657988
|
pastedTextBytes
|
|
@@ -658532,7 +658790,7 @@ Note: ctrl + z now suspends UR, ctrl + _ undoes input.
|
|
|
658532
658790
|
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
658533
658791
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
658534
658792
|
const text = raw.replace(/[ \t]+$/gm, "");
|
|
658535
|
-
const path24 =
|
|
658793
|
+
const path24 = join196(tmpdir12(), `cc-transcript-${Date.now()}.txt`);
|
|
658536
658794
|
await writeFile47(path24, text);
|
|
658537
658795
|
const opened = openFileInExternalEditor(path24);
|
|
658538
658796
|
setStatus2(opened ? `opening ${path24}` : `wrote ${path24} \xB7 no $VISUAL/$EDITOR set`);
|
|
@@ -660583,7 +660841,7 @@ function WelcomeV2() {
|
|
|
660583
660841
|
dimColor: true,
|
|
660584
660842
|
children: [
|
|
660585
660843
|
"v",
|
|
660586
|
-
"1.
|
|
660844
|
+
"1.22.0"
|
|
660587
660845
|
]
|
|
660588
660846
|
}, undefined, true, undefined, this)
|
|
660589
660847
|
]
|
|
@@ -661843,7 +662101,7 @@ function completeOnboarding() {
|
|
|
661843
662101
|
saveGlobalConfig((current) => ({
|
|
661844
662102
|
...current,
|
|
661845
662103
|
hasCompletedOnboarding: true,
|
|
661846
|
-
lastOnboardingVersion: "1.
|
|
662104
|
+
lastOnboardingVersion: "1.22.0"
|
|
661847
662105
|
}));
|
|
661848
662106
|
}
|
|
661849
662107
|
function showDialog(root2, renderer) {
|
|
@@ -666074,10 +666332,10 @@ function ipToLong(ip) {
|
|
|
666074
666332
|
return 0;
|
|
666075
666333
|
let value = 0;
|
|
666076
666334
|
for (const part of parts) {
|
|
666077
|
-
const
|
|
666078
|
-
if (Number.isNaN(
|
|
666335
|
+
const num2 = Number.parseInt(part, 10);
|
|
666336
|
+
if (Number.isNaN(num2) || num2 < 0 || num2 > 255)
|
|
666079
666337
|
return 0;
|
|
666080
|
-
value = value << 8 |
|
|
666338
|
+
value = value << 8 | num2;
|
|
666081
666339
|
}
|
|
666082
666340
|
return value >>> 0;
|
|
666083
666341
|
}
|
|
@@ -666894,12 +667152,12 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
666894
667152
|
});
|
|
666895
667153
|
|
|
666896
667154
|
// src/utils/errorLogSink.ts
|
|
666897
|
-
import { dirname as dirname71, join as
|
|
667155
|
+
import { dirname as dirname71, join as join197 } from "path";
|
|
666898
667156
|
function getErrorsPath() {
|
|
666899
|
-
return
|
|
667157
|
+
return join197(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
666900
667158
|
}
|
|
666901
667159
|
function getMCPLogsPath(serverName) {
|
|
666902
|
-
return
|
|
667160
|
+
return join197(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
666903
667161
|
}
|
|
666904
667162
|
function createJsonlWriter(options2) {
|
|
666905
667163
|
const writer = createBufferedWriter(options2);
|
|
@@ -666943,7 +667201,7 @@ function appendToLog(path24, message) {
|
|
|
666943
667201
|
cwd: getFsImplementation().cwd(),
|
|
666944
667202
|
userType: process.env.USER_TYPE,
|
|
666945
667203
|
sessionId: getSessionId(),
|
|
666946
|
-
version: "1.
|
|
667204
|
+
version: "1.22.0"
|
|
666947
667205
|
};
|
|
666948
667206
|
getLogWriter(path24).write(messageWithTimestamp);
|
|
666949
667207
|
}
|
|
@@ -667242,7 +667500,7 @@ var init_sessionMemory = __esm(() => {
|
|
|
667242
667500
|
// src/utils/iTermBackup.ts
|
|
667243
667501
|
import { copyFile as copyFile11, stat as stat49 } from "fs/promises";
|
|
667244
667502
|
import { homedir as homedir38 } from "os";
|
|
667245
|
-
import { join as
|
|
667503
|
+
import { join as join198 } from "path";
|
|
667246
667504
|
function markITerm2SetupComplete() {
|
|
667247
667505
|
saveGlobalConfig((current) => ({
|
|
667248
667506
|
...current,
|
|
@@ -667257,7 +667515,7 @@ function getIterm2RecoveryInfo() {
|
|
|
667257
667515
|
};
|
|
667258
667516
|
}
|
|
667259
667517
|
function getITerm2PlistPath() {
|
|
667260
|
-
return
|
|
667518
|
+
return join198(homedir38(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
667261
667519
|
}
|
|
667262
667520
|
async function checkAndRestoreITerm2Backup() {
|
|
667263
667521
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -670766,7 +671024,7 @@ var init_idleTimeout = __esm(() => {
|
|
|
670766
671024
|
// src/bridge/inboundAttachments.ts
|
|
670767
671025
|
import { randomUUID as randomUUID54 } from "crypto";
|
|
670768
671026
|
import { mkdir as mkdir45, writeFile as writeFile49 } from "fs/promises";
|
|
670769
|
-
import { basename as basename58, join as
|
|
671027
|
+
import { basename as basename58, join as join199 } from "path";
|
|
670770
671028
|
function debug(msg) {
|
|
670771
671029
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
670772
671030
|
}
|
|
@@ -670782,7 +671040,7 @@ function sanitizeFileName(name) {
|
|
|
670782
671040
|
return base2 || "attachment";
|
|
670783
671041
|
}
|
|
670784
671042
|
function uploadsDir() {
|
|
670785
|
-
return
|
|
671043
|
+
return join199(getURConfigHomeDir(), "uploads", getSessionId());
|
|
670786
671044
|
}
|
|
670787
671045
|
async function resolveOne(att) {
|
|
670788
671046
|
const token = getBridgeAccessToken();
|
|
@@ -670811,7 +671069,7 @@ async function resolveOne(att) {
|
|
|
670811
671069
|
const safeName = sanitizeFileName(att.file_name);
|
|
670812
671070
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID54().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
670813
671071
|
const dir = uploadsDir();
|
|
670814
|
-
const outPath =
|
|
671072
|
+
const outPath = join199(dir, `${prefix}-${safeName}`);
|
|
670815
671073
|
try {
|
|
670816
671074
|
await mkdir45(dir, { recursive: true });
|
|
670817
671075
|
await writeFile49(outPath, data);
|
|
@@ -670911,7 +671169,7 @@ var init_sessionUrl = __esm(() => {
|
|
|
670911
671169
|
|
|
670912
671170
|
// src/utils/plugins/zipCacheAdapters.ts
|
|
670913
671171
|
import { readFile as readFile54 } from "fs/promises";
|
|
670914
|
-
import { join as
|
|
671172
|
+
import { join as join200 } from "path";
|
|
670915
671173
|
async function readZipCacheKnownMarketplaces() {
|
|
670916
671174
|
try {
|
|
670917
671175
|
const content = await readFile54(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
@@ -670936,13 +671194,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
670936
671194
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
670937
671195
|
if (content !== null) {
|
|
670938
671196
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
670939
|
-
await atomicWriteToZipCache(
|
|
671197
|
+
await atomicWriteToZipCache(join200(zipCachePath, relPath), content);
|
|
670940
671198
|
}
|
|
670941
671199
|
}
|
|
670942
671200
|
async function readMarketplaceJsonContent(dir) {
|
|
670943
671201
|
const candidates2 = [
|
|
670944
|
-
|
|
670945
|
-
|
|
671202
|
+
join200(dir, ".ur-plugin", "marketplace.json"),
|
|
671203
|
+
join200(dir, "marketplace.json"),
|
|
670946
671204
|
dir
|
|
670947
671205
|
];
|
|
670948
671206
|
for (const candidate of candidates2) {
|
|
@@ -671072,8 +671330,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
671072
671330
|
}
|
|
671073
671331
|
async function checkEnvLessBridgeMinVersion() {
|
|
671074
671332
|
const cfg = await getEnvLessBridgeConfig();
|
|
671075
|
-
if (cfg.min_version && lt("1.
|
|
671076
|
-
return `Your version of UR (${"1.
|
|
671333
|
+
if (cfg.min_version && lt("1.22.0", cfg.min_version)) {
|
|
671334
|
+
return `Your version of UR (${"1.22.0"}) is too old for Remote Control.
|
|
671077
671335
|
Version ${cfg.min_version} or higher is required. Run \`ur update\` to update.`;
|
|
671078
671336
|
}
|
|
671079
671337
|
return null;
|
|
@@ -671401,9 +671659,9 @@ __export(exports_bridgePointer, {
|
|
|
671401
671659
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
671402
671660
|
});
|
|
671403
671661
|
import { mkdir as mkdir46, readFile as readFile55, stat as stat50, unlink as unlink26, writeFile as writeFile50 } from "fs/promises";
|
|
671404
|
-
import { dirname as dirname72, join as
|
|
671662
|
+
import { dirname as dirname72, join as join201 } from "path";
|
|
671405
671663
|
function getBridgePointerPath(dir) {
|
|
671406
|
-
return
|
|
671664
|
+
return join201(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
671407
671665
|
}
|
|
671408
671666
|
async function writeBridgePointer(dir, pointer) {
|
|
671409
671667
|
const path24 = getBridgePointerPath(dir);
|
|
@@ -671547,7 +671805,7 @@ async function initBridgeCore(params) {
|
|
|
671547
671805
|
const rawApi = createBridgeApiClient({
|
|
671548
671806
|
baseUrl,
|
|
671549
671807
|
getAccessToken,
|
|
671550
|
-
runnerVersion: "1.
|
|
671808
|
+
runnerVersion: "1.22.0",
|
|
671551
671809
|
onDebug: logForDebugging,
|
|
671552
671810
|
onAuth401,
|
|
671553
671811
|
getTrustedDeviceToken
|
|
@@ -673411,7 +673669,7 @@ __export(exports_print, {
|
|
|
673411
673669
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
673412
673670
|
canBatchWith: () => canBatchWith
|
|
673413
673671
|
});
|
|
673414
|
-
import { readFile as readFile56, stat as stat51 } from "fs/promises";
|
|
673672
|
+
import { readFile as readFile56, stat as stat51, writeFile as writeFile51 } from "fs/promises";
|
|
673415
673673
|
import { dirname as dirname73 } from "path";
|
|
673416
673674
|
import { cwd as cwd2 } from "process";
|
|
673417
673675
|
import { randomUUID as randomUUID57 } from "crypto";
|
|
@@ -673722,6 +673980,22 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
673722
673980
|
}
|
|
673723
673981
|
logHeadlessProfilerTurn();
|
|
673724
673982
|
if (false) {}
|
|
673983
|
+
if (process.env.UR_EVAL_METRICS_FILE) {
|
|
673984
|
+
const modelUsage = getModelUsage();
|
|
673985
|
+
const metrics = {
|
|
673986
|
+
costUSD: getTotalCostUSD(),
|
|
673987
|
+
inputTokens: getTotalInputTokens(),
|
|
673988
|
+
outputTokens: getTotalOutputTokens(),
|
|
673989
|
+
model: Object.keys(modelUsage)[0],
|
|
673990
|
+
linesAdded: getTotalLinesAdded(),
|
|
673991
|
+
linesRemoved: getTotalLinesRemoved(),
|
|
673992
|
+
apiDurationMs: getTotalAPIDuration()
|
|
673993
|
+
};
|
|
673994
|
+
try {
|
|
673995
|
+
await writeFile51(process.env.UR_EVAL_METRICS_FILE, JSON.stringify(metrics, null, 2) + `
|
|
673996
|
+
`);
|
|
673997
|
+
} catch {}
|
|
673998
|
+
}
|
|
673725
673999
|
gracefulShutdownSync(lastMessage?.type === "result" && lastMessage?.is_error ? 1 : 0);
|
|
673726
674000
|
}
|
|
673727
674001
|
function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initialMessages, canUseTool, sdkMcpConfigs, getAppState, setAppState, agents2, options2, turnInterruptionState) {
|
|
@@ -677212,7 +677486,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
|
|
|
677212
677486
|
setCwd(cwd3);
|
|
677213
677487
|
const server2 = new Server({
|
|
677214
677488
|
name: "ur/tengu",
|
|
677215
|
-
version: "1.
|
|
677489
|
+
version: "1.22.0"
|
|
677216
677490
|
}, {
|
|
677217
677491
|
capabilities: {
|
|
677218
677492
|
tools: {}
|
|
@@ -677344,14 +677618,14 @@ __export(exports_urDesktop, {
|
|
|
677344
677618
|
});
|
|
677345
677619
|
import { readdir as readdir32, readFile as readFile57, stat as stat52 } from "fs/promises";
|
|
677346
677620
|
import { homedir as homedir39 } from "os";
|
|
677347
|
-
import { join as
|
|
677621
|
+
import { join as join202 } from "path";
|
|
677348
677622
|
async function getURDesktopConfigPath() {
|
|
677349
677623
|
const platform7 = getPlatform();
|
|
677350
677624
|
if (!SUPPORTED_PLATFORMS.includes(platform7)) {
|
|
677351
677625
|
throw new Error(`Unsupported platform: ${platform7} - UR Desktop integration only works on macOS and WSL.`);
|
|
677352
677626
|
}
|
|
677353
677627
|
if (platform7 === "macos") {
|
|
677354
|
-
return
|
|
677628
|
+
return join202(homedir39(), "Library", "Application Support", "UR", "ur_desktop_config.json");
|
|
677355
677629
|
}
|
|
677356
677630
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
677357
677631
|
if (windowsHome) {
|
|
@@ -677370,7 +677644,7 @@ async function getURDesktopConfigPath() {
|
|
|
677370
677644
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
677371
677645
|
continue;
|
|
677372
677646
|
}
|
|
677373
|
-
const potentialConfigPath =
|
|
677647
|
+
const potentialConfigPath = join202(usersDir, user.name, "AppData", "Roaming", "UR", "ur_desktop_config.json");
|
|
677374
677648
|
try {
|
|
677375
677649
|
await stat52(potentialConfigPath);
|
|
677376
677650
|
return potentialConfigPath;
|
|
@@ -678279,12 +678553,12 @@ __export(exports_install, {
|
|
|
678279
678553
|
install: () => install
|
|
678280
678554
|
});
|
|
678281
678555
|
import { homedir as homedir40 } from "os";
|
|
678282
|
-
import { join as
|
|
678556
|
+
import { join as join203 } from "path";
|
|
678283
678557
|
function getInstallationPath2() {
|
|
678284
678558
|
const isWindows2 = env2.platform === "win32";
|
|
678285
678559
|
const homeDir = homedir40();
|
|
678286
678560
|
if (isWindows2) {
|
|
678287
|
-
const windowsPath =
|
|
678561
|
+
const windowsPath = join203(homeDir, ".local", "bin", "ur.exe");
|
|
678288
678562
|
return windowsPath.replace(/\//g, "\\");
|
|
678289
678563
|
}
|
|
678290
678564
|
return "~/.local/bin/ur";
|
|
@@ -678823,7 +679097,7 @@ __export(exports_update, {
|
|
|
678823
679097
|
});
|
|
678824
679098
|
async function update() {
|
|
678825
679099
|
logEvent("tengu_update_check", {});
|
|
678826
|
-
writeToStdout(`Current version: ${"1.
|
|
679100
|
+
writeToStdout(`Current version: ${"1.22.0"}
|
|
678827
679101
|
`);
|
|
678828
679102
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
678829
679103
|
writeToStdout(`Checking for updates to ${channel} version...
|
|
@@ -678898,8 +679172,8 @@ async function update() {
|
|
|
678898
679172
|
writeToStdout(`UR is managed by Homebrew.
|
|
678899
679173
|
`);
|
|
678900
679174
|
const latest = await getLatestVersion(channel);
|
|
678901
|
-
if (latest && !gte("1.
|
|
678902
|
-
writeToStdout(`${formatUpdateAvailableMessage("1.
|
|
679175
|
+
if (latest && !gte("1.22.0", latest)) {
|
|
679176
|
+
writeToStdout(`${formatUpdateAvailableMessage("1.22.0", latest)}
|
|
678903
679177
|
`);
|
|
678904
679178
|
writeToStdout(`
|
|
678905
679179
|
`);
|
|
@@ -678915,8 +679189,8 @@ async function update() {
|
|
|
678915
679189
|
writeToStdout(`UR is managed by winget.
|
|
678916
679190
|
`);
|
|
678917
679191
|
const latest = await getLatestVersion(channel);
|
|
678918
|
-
if (latest && !gte("1.
|
|
678919
|
-
writeToStdout(`${formatUpdateAvailableMessage("1.
|
|
679192
|
+
if (latest && !gte("1.22.0", latest)) {
|
|
679193
|
+
writeToStdout(`${formatUpdateAvailableMessage("1.22.0", latest)}
|
|
678920
679194
|
`);
|
|
678921
679195
|
writeToStdout(`
|
|
678922
679196
|
`);
|
|
@@ -678932,8 +679206,8 @@ async function update() {
|
|
|
678932
679206
|
writeToStdout(`UR is managed by apk.
|
|
678933
679207
|
`);
|
|
678934
679208
|
const latest = await getLatestVersion(channel);
|
|
678935
|
-
if (latest && !gte("1.
|
|
678936
|
-
writeToStdout(`${formatUpdateAvailableMessage("1.
|
|
679209
|
+
if (latest && !gte("1.22.0", latest)) {
|
|
679210
|
+
writeToStdout(`${formatUpdateAvailableMessage("1.22.0", latest)}
|
|
678937
679211
|
`);
|
|
678938
679212
|
writeToStdout(`
|
|
678939
679213
|
`);
|
|
@@ -678998,11 +679272,11 @@ async function update() {
|
|
|
678998
679272
|
`);
|
|
678999
679273
|
await gracefulShutdown(1);
|
|
679000
679274
|
}
|
|
679001
|
-
if (result.latestVersion === "1.
|
|
679002
|
-
writeToStdout(source_default.green(`UR is up to date (${"1.
|
|
679275
|
+
if (result.latestVersion === "1.22.0") {
|
|
679276
|
+
writeToStdout(source_default.green(`UR is up to date (${"1.22.0"})`) + `
|
|
679003
679277
|
`);
|
|
679004
679278
|
} else {
|
|
679005
|
-
writeToStdout(source_default.green(`Successfully updated from ${"1.
|
|
679279
|
+
writeToStdout(source_default.green(`Successfully updated from ${"1.22.0"} to version ${result.latestVersion}`) + `
|
|
679006
679280
|
`);
|
|
679007
679281
|
await regenerateCompletionCache();
|
|
679008
679282
|
}
|
|
@@ -679062,12 +679336,12 @@ async function update() {
|
|
|
679062
679336
|
`);
|
|
679063
679337
|
await gracefulShutdown(1);
|
|
679064
679338
|
}
|
|
679065
|
-
if (latestVersion === "1.
|
|
679066
|
-
writeToStdout(source_default.green(`UR is up to date (${"1.
|
|
679339
|
+
if (latestVersion === "1.22.0") {
|
|
679340
|
+
writeToStdout(source_default.green(`UR is up to date (${"1.22.0"})`) + `
|
|
679067
679341
|
`);
|
|
679068
679342
|
await gracefulShutdown(0);
|
|
679069
679343
|
}
|
|
679070
|
-
writeToStdout(`${formatUpdateAvailableMessage("1.
|
|
679344
|
+
writeToStdout(`${formatUpdateAvailableMessage("1.22.0", latestVersion)}
|
|
679071
679345
|
`);
|
|
679072
679346
|
writeToStdout(`Installing update...
|
|
679073
679347
|
`);
|
|
@@ -679112,7 +679386,7 @@ async function update() {
|
|
|
679112
679386
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
679113
679387
|
switch (status2) {
|
|
679114
679388
|
case "success":
|
|
679115
|
-
writeToStdout(source_default.green(`Successfully updated from ${"1.
|
|
679389
|
+
writeToStdout(source_default.green(`Successfully updated from ${"1.22.0"} to version ${latestVersion}`) + `
|
|
679116
679390
|
`);
|
|
679117
679391
|
await regenerateCompletionCache();
|
|
679118
679392
|
break;
|
|
@@ -680388,7 +680662,7 @@ ${customInstructions}` : customInstructions;
|
|
|
680388
680662
|
}
|
|
680389
680663
|
}
|
|
680390
680664
|
logForDiagnosticsNoPII("info", "started", {
|
|
680391
|
-
version: "1.
|
|
680665
|
+
version: "1.22.0",
|
|
680392
680666
|
is_native_binary: isInBundledMode()
|
|
680393
680667
|
});
|
|
680394
680668
|
registerCleanup(async () => {
|
|
@@ -681172,7 +681446,7 @@ Usage: ur --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
681172
681446
|
pendingHookMessages
|
|
681173
681447
|
}, renderAndRun);
|
|
681174
681448
|
}
|
|
681175
|
-
}).version("1.
|
|
681449
|
+
}).version("1.22.0 (Ur)", "-v, --version", "Output the version number");
|
|
681176
681450
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
681177
681451
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
681178
681452
|
if (canUserConfigureAdvisor()) {
|
|
@@ -681969,7 +682243,7 @@ if (false) {}
|
|
|
681969
682243
|
async function main2() {
|
|
681970
682244
|
const args = process.argv.slice(2);
|
|
681971
682245
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
681972
|
-
console.log(`${"1.
|
|
682246
|
+
console.log(`${"1.22.0"} (Ur)`);
|
|
681973
682247
|
return;
|
|
681974
682248
|
}
|
|
681975
682249
|
if (args[0] === "a2a" && args[1] === "serve" && !args.includes("--help") && !args.includes("-h")) {
|