ur-agent 1.28.1 → 1.29.1
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 +20 -0
- package/README.md +47 -10
- package/dist/cli.js +1315 -904
- package/docs/USAGE.md +1 -1
- package/docs/providers.md +5 -1
- package/documentation/index.html +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -52588,20 +52588,12 @@ var init_providerRegistry = __esm(() => {
|
|
|
52588
52588
|
{ id: "codex/o3-mini", displayName: "o3-mini (Codex CLI)", description: "Fast reasoning model through official Codex CLI login" }
|
|
52589
52589
|
],
|
|
52590
52590
|
"claude-code-cli": [
|
|
52591
|
-
{ id: "claude-code/sonnet
|
|
52592
|
-
{ id: "claude-code/opus
|
|
52593
|
-
{ id: "claude-code/
|
|
52594
|
-
{ id: "claude-code/opus-4-6", displayName: "Claude Opus 4.6 (Claude Code)", description: "Subscription model through official Claude Code login" },
|
|
52595
|
-
{ id: "claude-code/opus-4-5", displayName: "Claude Opus 4.5 (Claude Code)", description: "Subscription model through official Claude Code login" },
|
|
52596
|
-
{ id: "claude-code/sonnet-4-6", displayName: "Claude Sonnet 4.6 (Claude Code)", description: "Subscription model through official Claude Code login" },
|
|
52597
|
-
{ id: "claude-code/sonnet-4-5", displayName: "Claude Sonnet 4.5 (Claude Code)", description: "Subscription model through official Claude Code login" },
|
|
52598
|
-
{ id: "claude-code/haiku-4-5", displayName: "Claude Haiku 4.5 (Claude Code)", description: "Subscription model through official Claude Code login" }
|
|
52591
|
+
{ id: "claude-code/sonnet", displayName: "Claude Sonnet (Claude Code)", description: "Claude Code CLI alias resolved by the official CLI", isDefault: true },
|
|
52592
|
+
{ id: "claude-code/opus", displayName: "Claude Opus (Claude Code)", description: "Claude Code CLI alias; requires Opus access on the signed-in account" },
|
|
52593
|
+
{ id: "claude-code/fable", displayName: "Claude Fable (Claude Code)", description: "Claude Code CLI alias resolved by the official CLI where available" }
|
|
52599
52594
|
],
|
|
52600
52595
|
"gemini-cli": [
|
|
52601
|
-
{ id: "gemini-cli/gemini-
|
|
52602
|
-
{ id: "gemini-cli/gemini-3.1-pro", displayName: "Gemini 3.1 Pro (Gemini CLI)", description: "Subscription model through official Gemini CLI login" },
|
|
52603
|
-
{ id: "gemini-cli/gemini-3.1-flash-lite", displayName: "Gemini 3.1 Flash Lite (Gemini CLI)", description: "Subscription model through official Gemini CLI login" },
|
|
52604
|
-
{ id: "gemini-cli/gemini-2.5-pro", displayName: "Gemini 2.5 Pro (Gemini CLI)", description: "Subscription model through official Gemini CLI login" },
|
|
52596
|
+
{ id: "gemini-cli/gemini-2.5-pro", displayName: "Gemini 2.5 Pro (Gemini CLI)", description: "Subscription model through official Gemini CLI login", isDefault: true },
|
|
52605
52597
|
{ id: "gemini-cli/gemini-2.5-flash", displayName: "Gemini 2.5 Flash (Gemini CLI)", description: "Subscription model through official Gemini CLI login" },
|
|
52606
52598
|
{ id: "gemini-cli/gemini-2.5-flash-lite", displayName: "Gemini 2.5 Flash Lite (Gemini CLI)", description: "Subscription model through official Gemini CLI login" }
|
|
52607
52599
|
],
|
|
@@ -56833,8 +56825,9 @@ function createURHQSubscriptionClient(providerId, options) {
|
|
|
56833
56825
|
signal: requestOptions?.signal,
|
|
56834
56826
|
timeoutMs: options.timeoutMs ?? 120000
|
|
56835
56827
|
});
|
|
56836
|
-
|
|
56837
|
-
|
|
56828
|
+
const failure = formatCliFailure(providerId, options.commandPath, model, result);
|
|
56829
|
+
if (failure) {
|
|
56830
|
+
throw new Error(failure);
|
|
56838
56831
|
}
|
|
56839
56832
|
const text = extractText(result.stdout);
|
|
56840
56833
|
if (!text) {
|
|
@@ -56891,6 +56884,58 @@ function cliModelName(model) {
|
|
|
56891
56884
|
const slash = model.indexOf("/");
|
|
56892
56885
|
return slash >= 0 ? model.slice(slash + 1) : model;
|
|
56893
56886
|
}
|
|
56887
|
+
function formatCliFailure(providerId, commandPath, model, result) {
|
|
56888
|
+
const parsed = parseCliJsonFailure(result.stdout);
|
|
56889
|
+
if (result.code === 0 && !parsed?.isError) {
|
|
56890
|
+
return null;
|
|
56891
|
+
}
|
|
56892
|
+
const rawStderr = result.stderr.trim();
|
|
56893
|
+
const rawStdout = result.stdout.trim();
|
|
56894
|
+
const summary = summarizeKnownCliFailure(rawStderr) ?? parsed?.message ?? summarizeKnownCliFailure(rawStdout) ?? firstUsefulLine(rawStderr) ?? firstUsefulLine(rawStdout) ?? "no output";
|
|
56895
|
+
const status = parsed?.status ? ` (status ${parsed.status})` : "";
|
|
56896
|
+
const exit = result.code === 0 ? "reported an error" : `exited ${result.code}`;
|
|
56897
|
+
return `Subscription CLI "${commandPath}" for ${providerId} ${exit}${status} with model "${model}": ${summary}. Suggested action: run /model and choose a valid model for ${providerId}, or run: ur provider doctor ${providerId}. UR did not fall back to another provider.`;
|
|
56898
|
+
}
|
|
56899
|
+
function parseCliJsonFailure(stdout) {
|
|
56900
|
+
const raw = stdout.trim();
|
|
56901
|
+
if (!raw)
|
|
56902
|
+
return null;
|
|
56903
|
+
try {
|
|
56904
|
+
const parsed = JSON.parse(raw);
|
|
56905
|
+
if (!parsed || typeof parsed !== "object")
|
|
56906
|
+
return null;
|
|
56907
|
+
const entry = parsed;
|
|
56908
|
+
const isError = entry.is_error === true || entry.error !== undefined;
|
|
56909
|
+
if (!isError)
|
|
56910
|
+
return null;
|
|
56911
|
+
const message = [entry.result, entry.message, entry.error, entry.response].find((value) => typeof value === "string" && value.trim());
|
|
56912
|
+
const status = typeof entry.api_error_status === "number" || typeof entry.api_error_status === "string" ? entry.api_error_status : undefined;
|
|
56913
|
+
return { isError, status, message: message?.trim() };
|
|
56914
|
+
} catch {
|
|
56915
|
+
return null;
|
|
56916
|
+
}
|
|
56917
|
+
}
|
|
56918
|
+
function summarizeKnownCliFailure(text) {
|
|
56919
|
+
if (!text)
|
|
56920
|
+
return null;
|
|
56921
|
+
const reasonMessage = text.match(/reasonMessage:\s*'([^']+)'/)?.[1];
|
|
56922
|
+
if (reasonMessage)
|
|
56923
|
+
return reasonMessage;
|
|
56924
|
+
if (/IneligibleTierError|UNSUPPORTED_CLIENT/i.test(text)) {
|
|
56925
|
+
return "The selected Gemini CLI account/client is not eligible for this Gemini Code Assist runtime.";
|
|
56926
|
+
}
|
|
56927
|
+
if (/There's an issue with the selected model/i.test(text)) {
|
|
56928
|
+
return firstUsefulLine(text);
|
|
56929
|
+
}
|
|
56930
|
+
return null;
|
|
56931
|
+
}
|
|
56932
|
+
function firstUsefulLine(text) {
|
|
56933
|
+
const line = text.split(/\r?\n/).map((value) => value.trim()).find((value) => value && !value.startsWith("at ") && !value.startsWith("file://"));
|
|
56934
|
+
return line ? truncate(line, 800) : null;
|
|
56935
|
+
}
|
|
56936
|
+
function truncate(value, max) {
|
|
56937
|
+
return value.length > max ? `${value.slice(0, max - 1)}\u2026` : value;
|
|
56938
|
+
}
|
|
56894
56939
|
function messagesToPrompt(params) {
|
|
56895
56940
|
const parts = [];
|
|
56896
56941
|
const system = systemToText3(params.system);
|
|
@@ -69257,7 +69302,7 @@ var init_auth = __esm(() => {
|
|
|
69257
69302
|
|
|
69258
69303
|
// src/utils/userAgent.ts
|
|
69259
69304
|
function getURCodeUserAgent() {
|
|
69260
|
-
return `ur/${"1.
|
|
69305
|
+
return `ur/${"1.29.1"}`;
|
|
69261
69306
|
}
|
|
69262
69307
|
|
|
69263
69308
|
// src/utils/workloadContext.ts
|
|
@@ -69279,7 +69324,7 @@ function getUserAgent() {
|
|
|
69279
69324
|
const clientApp = process.env.UR_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}` : "";
|
|
69280
69325
|
const workload = getWorkload();
|
|
69281
69326
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
69282
|
-
return `ur-cli/${"1.
|
|
69327
|
+
return `ur-cli/${"1.29.1"} (${process.env.USER_TYPE}, ${process.env.UR_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
69283
69328
|
}
|
|
69284
69329
|
function getMCPUserAgent() {
|
|
69285
69330
|
const parts = [];
|
|
@@ -69293,7 +69338,7 @@ function getMCPUserAgent() {
|
|
|
69293
69338
|
parts.push(`client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}`);
|
|
69294
69339
|
}
|
|
69295
69340
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
69296
|
-
return `ur/${"1.
|
|
69341
|
+
return `ur/${"1.29.1"}${suffix}`;
|
|
69297
69342
|
}
|
|
69298
69343
|
function getWebFetchUserAgent() {
|
|
69299
69344
|
return `UR-User (${getURCodeUserAgent()})`;
|
|
@@ -69431,7 +69476,7 @@ var init_user = __esm(() => {
|
|
|
69431
69476
|
deviceId,
|
|
69432
69477
|
sessionId: getSessionId(),
|
|
69433
69478
|
email: getEmail(),
|
|
69434
|
-
appVersion: "1.
|
|
69479
|
+
appVersion: "1.29.1",
|
|
69435
69480
|
platform: getHostPlatformForAnalytics(),
|
|
69436
69481
|
organizationUuid,
|
|
69437
69482
|
accountUuid,
|
|
@@ -74020,7 +74065,7 @@ function truncateToWidthNoEllipsis(text, maxWidth) {
|
|
|
74020
74065
|
}
|
|
74021
74066
|
return result;
|
|
74022
74067
|
}
|
|
74023
|
-
function
|
|
74068
|
+
function truncate2(str, maxWidth, singleLine = false) {
|
|
74024
74069
|
let result = str;
|
|
74025
74070
|
if (singleLine) {
|
|
74026
74071
|
const firstNewline = str.indexOf(`
|
|
@@ -75948,7 +75993,7 @@ var init_metadata = __esm(() => {
|
|
|
75948
75993
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
75949
75994
|
WHITESPACE_REGEX = /\s+/;
|
|
75950
75995
|
getVersionBase = memoize_default(() => {
|
|
75951
|
-
const match = "1.
|
|
75996
|
+
const match = "1.29.1".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
75952
75997
|
return match ? match[0] : undefined;
|
|
75953
75998
|
});
|
|
75954
75999
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -75988,7 +76033,7 @@ var init_metadata = __esm(() => {
|
|
|
75988
76033
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
75989
76034
|
isURCodeAction: isEnvTruthy(process.env.UR_CODE_ACTION),
|
|
75990
76035
|
isURAiAuth: isURAISubscriber2(),
|
|
75991
|
-
version: "1.
|
|
76036
|
+
version: "1.29.1",
|
|
75992
76037
|
versionBase: getVersionBase(),
|
|
75993
76038
|
buildTime: "",
|
|
75994
76039
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
@@ -76658,7 +76703,7 @@ function initialize1PEventLogging() {
|
|
|
76658
76703
|
const platform2 = getPlatform();
|
|
76659
76704
|
const attributes = {
|
|
76660
76705
|
[import_semantic_conventions4.ATTR_SERVICE_NAME]: "ur",
|
|
76661
|
-
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.
|
|
76706
|
+
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.29.1"
|
|
76662
76707
|
};
|
|
76663
76708
|
if (platform2 === "wsl") {
|
|
76664
76709
|
const wslVersion = getWslVersion();
|
|
@@ -76685,7 +76730,7 @@ function initialize1PEventLogging() {
|
|
|
76685
76730
|
})
|
|
76686
76731
|
]
|
|
76687
76732
|
});
|
|
76688
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.
|
|
76733
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.29.1");
|
|
76689
76734
|
}
|
|
76690
76735
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
76691
76736
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -81982,7 +82027,7 @@ function formatAgentTrendReport(report = buildAgentTrendReport()) {
|
|
|
81982
82027
|
function formatA2AAgentCard(options = {}, pretty = true) {
|
|
81983
82028
|
return JSON.stringify(buildA2AAgentCard(options), null, pretty ? 2 : 0);
|
|
81984
82029
|
}
|
|
81985
|
-
var urVersion = "1.
|
|
82030
|
+
var urVersion = "1.29.1", coverage, priorityRoadmap;
|
|
81986
82031
|
var init_trends = __esm(() => {
|
|
81987
82032
|
coverage = [
|
|
81988
82033
|
{
|
|
@@ -83975,7 +84020,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
83975
84020
|
if (!isAttributionHeaderEnabled()) {
|
|
83976
84021
|
return "";
|
|
83977
84022
|
}
|
|
83978
|
-
const version2 = `${"1.
|
|
84023
|
+
const version2 = `${"1.29.1"}.${fingerprint}`;
|
|
83979
84024
|
const entrypoint = process.env.UR_CODE_ENTRYPOINT ?? "unknown";
|
|
83980
84025
|
const cch = "";
|
|
83981
84026
|
const workload = getWorkload();
|
|
@@ -100904,7 +100949,7 @@ function sliceFit(text, start, end) {
|
|
|
100904
100949
|
const s = sliceAnsi(text, start, end);
|
|
100905
100950
|
return stringWidth(s) > end - start ? sliceAnsi(text, start, end - 1) : s;
|
|
100906
100951
|
}
|
|
100907
|
-
function
|
|
100952
|
+
function truncate3(text, columns, position2) {
|
|
100908
100953
|
if (columns < 1)
|
|
100909
100954
|
return "";
|
|
100910
100955
|
if (columns === 1)
|
|
@@ -100942,7 +100987,7 @@ function wrapText2(text, maxWidth, wrapType) {
|
|
|
100942
100987
|
if (wrapType === "truncate-start") {
|
|
100943
100988
|
position2 = "start";
|
|
100944
100989
|
}
|
|
100945
|
-
return
|
|
100990
|
+
return truncate3(text, maxWidth, position2);
|
|
100946
100991
|
}
|
|
100947
100992
|
return text;
|
|
100948
100993
|
}
|
|
@@ -104131,7 +104176,7 @@ var require_truncate = __commonJS((exports, module) => {
|
|
|
104131
104176
|
var parse7 = require_parse4();
|
|
104132
104177
|
var constants4 = require_constants2();
|
|
104133
104178
|
var SemVer = require_semver2();
|
|
104134
|
-
var
|
|
104179
|
+
var truncate4 = (version2, truncation, options) => {
|
|
104135
104180
|
if (!constants4.RELEASE_TYPES.includes(truncation)) {
|
|
104136
104181
|
return null;
|
|
104137
104182
|
}
|
|
@@ -104161,7 +104206,7 @@ var require_truncate = __commonJS((exports, module) => {
|
|
|
104161
104206
|
var isPrerelease = (type) => {
|
|
104162
104207
|
return type.startsWith("pre");
|
|
104163
104208
|
};
|
|
104164
|
-
module.exports =
|
|
104209
|
+
module.exports = truncate4;
|
|
104165
104210
|
});
|
|
104166
104211
|
|
|
104167
104212
|
// node_modules/semver/internal/lrucache.js
|
|
@@ -105158,7 +105203,7 @@ var require_semver3 = __commonJS((exports, module) => {
|
|
|
105158
105203
|
var lte = require_lte();
|
|
105159
105204
|
var cmp = require_cmp();
|
|
105160
105205
|
var coerce = require_coerce();
|
|
105161
|
-
var
|
|
105206
|
+
var truncate4 = require_truncate();
|
|
105162
105207
|
var Comparator = require_comparator();
|
|
105163
105208
|
var Range = require_range2();
|
|
105164
105209
|
var satisfies = require_satisfies();
|
|
@@ -105197,7 +105242,7 @@ var require_semver3 = __commonJS((exports, module) => {
|
|
|
105197
105242
|
lte,
|
|
105198
105243
|
cmp,
|
|
105199
105244
|
coerce,
|
|
105200
|
-
truncate:
|
|
105245
|
+
truncate: truncate4,
|
|
105201
105246
|
Comparator,
|
|
105202
105247
|
Range,
|
|
105203
105248
|
satisfies,
|
|
@@ -132069,7 +132114,7 @@ function formatCommandsWithinBudget(commands, contextWindowTokens) {
|
|
|
132069
132114
|
if (bundledIndices.has(i3))
|
|
132070
132115
|
return fullEntries[i3].full;
|
|
132071
132116
|
const description = getCommandDescription(cmd);
|
|
132072
|
-
return `- ${cmd.name}: ${
|
|
132117
|
+
return `- ${cmd.name}: ${truncate2(description, maxDescLen)}`;
|
|
132073
132118
|
}).join(`
|
|
132074
132119
|
`);
|
|
132075
132120
|
}
|
|
@@ -191648,7 +191693,7 @@ function getTelemetryAttributes() {
|
|
|
191648
191693
|
attributes["session.id"] = sessionId;
|
|
191649
191694
|
}
|
|
191650
191695
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
191651
|
-
attributes["app.version"] = "1.
|
|
191696
|
+
attributes["app.version"] = "1.29.1";
|
|
191652
191697
|
}
|
|
191653
191698
|
const oauthAccount = getOauthAccountInfo();
|
|
191654
191699
|
if (oauthAccount) {
|
|
@@ -227053,7 +227098,7 @@ function getInstallationEnv() {
|
|
|
227053
227098
|
return;
|
|
227054
227099
|
}
|
|
227055
227100
|
function getURCodeVersion() {
|
|
227056
|
-
return "1.
|
|
227101
|
+
return "1.29.1";
|
|
227057
227102
|
}
|
|
227058
227103
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
227059
227104
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -229892,7 +229937,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
229892
229937
|
const client2 = new Client({
|
|
229893
229938
|
name: "ur",
|
|
229894
229939
|
title: "UR",
|
|
229895
|
-
version: "1.
|
|
229940
|
+
version: "1.29.1",
|
|
229896
229941
|
description: "UR-AGENT autonomous engineering workflow engine",
|
|
229897
229942
|
websiteUrl: PRODUCT_URL
|
|
229898
229943
|
}, {
|
|
@@ -230246,7 +230291,7 @@ var init_client5 = __esm(() => {
|
|
|
230246
230291
|
const client2 = new Client({
|
|
230247
230292
|
name: "ur",
|
|
230248
230293
|
title: "UR",
|
|
230249
|
-
version: "1.
|
|
230294
|
+
version: "1.29.1",
|
|
230250
230295
|
description: "UR-AGENT autonomous engineering workflow engine",
|
|
230251
230296
|
websiteUrl: PRODUCT_URL
|
|
230252
230297
|
}, {
|
|
@@ -240062,9 +240107,9 @@ async function assertMinVersion() {
|
|
|
240062
240107
|
if (false) {}
|
|
240063
240108
|
try {
|
|
240064
240109
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
240065
|
-
if (versionConfig.minVersion && lt("1.
|
|
240110
|
+
if (versionConfig.minVersion && lt("1.29.1", versionConfig.minVersion)) {
|
|
240066
240111
|
console.error(`
|
|
240067
|
-
It looks like your version of UR (${"1.
|
|
240112
|
+
It looks like your version of UR (${"1.29.1"}) needs an update.
|
|
240068
240113
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
240069
240114
|
|
|
240070
240115
|
To update, please run:
|
|
@@ -240280,7 +240325,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
240280
240325
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
240281
240326
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
240282
240327
|
pid: process.pid,
|
|
240283
|
-
currentVersion: "1.
|
|
240328
|
+
currentVersion: "1.29.1"
|
|
240284
240329
|
});
|
|
240285
240330
|
return "in_progress";
|
|
240286
240331
|
}
|
|
@@ -240289,7 +240334,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
240289
240334
|
if (!env2.isRunningWithBun() && env2.isNpmFromWindowsPath()) {
|
|
240290
240335
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
240291
240336
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
240292
|
-
currentVersion: "1.
|
|
240337
|
+
currentVersion: "1.29.1"
|
|
240293
240338
|
});
|
|
240294
240339
|
console.error(`
|
|
240295
240340
|
Error: Windows NPM detected in WSL
|
|
@@ -240824,7 +240869,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
240824
240869
|
}
|
|
240825
240870
|
async function getDoctorDiagnostic() {
|
|
240826
240871
|
const installationType = await getCurrentInstallationType();
|
|
240827
|
-
const version2 = typeof MACRO !== "undefined" ? "1.
|
|
240872
|
+
const version2 = typeof MACRO !== "undefined" ? "1.29.1" : "unknown";
|
|
240828
240873
|
const installationPath = await getInstallationPath();
|
|
240829
240874
|
const invokedBinary = getInvokedBinary();
|
|
240830
240875
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -241759,8 +241804,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
241759
241804
|
const maxVersion = await getMaxVersion();
|
|
241760
241805
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
241761
241806
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
241762
|
-
if (gte("1.
|
|
241763
|
-
logForDebugging(`Native installer: current version ${"1.
|
|
241807
|
+
if (gte("1.29.1", maxVersion)) {
|
|
241808
|
+
logForDebugging(`Native installer: current version ${"1.29.1"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
241764
241809
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
241765
241810
|
latency_ms: Date.now() - startTime,
|
|
241766
241811
|
max_version: maxVersion,
|
|
@@ -241771,7 +241816,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
241771
241816
|
version2 = maxVersion;
|
|
241772
241817
|
}
|
|
241773
241818
|
}
|
|
241774
|
-
if (!forceReinstall && version2 === "1.
|
|
241819
|
+
if (!forceReinstall && version2 === "1.29.1" && await versionIsAvailable(version2) && await isPossibleURBinary(executablePath)) {
|
|
241775
241820
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
241776
241821
|
logEvent("tengu_native_update_complete", {
|
|
241777
241822
|
latency_ms: Date.now() - startTime,
|
|
@@ -283728,13 +283773,13 @@ var init_PowerShellTool = __esm(() => {
|
|
|
283728
283773
|
if (description) {
|
|
283729
283774
|
return description;
|
|
283730
283775
|
}
|
|
283731
|
-
return
|
|
283776
|
+
return truncate2(command, TOOL_SUMMARY_MAX_LENGTH);
|
|
283732
283777
|
},
|
|
283733
283778
|
getActivityDescription(input) {
|
|
283734
283779
|
if (!input?.command) {
|
|
283735
283780
|
return "Running command";
|
|
283736
283781
|
}
|
|
283737
|
-
const desc = input.description ??
|
|
283782
|
+
const desc = input.description ?? truncate2(input.command, TOOL_SUMMARY_MAX_LENGTH);
|
|
283738
283783
|
return `Running ${desc}`;
|
|
283739
283784
|
},
|
|
283740
283785
|
isEnabled() {
|
|
@@ -289775,7 +289820,7 @@ function getToolUseSummary3(input) {
|
|
|
289775
289820
|
if (!input?.pattern) {
|
|
289776
289821
|
return null;
|
|
289777
289822
|
}
|
|
289778
|
-
return
|
|
289823
|
+
return truncate2(input.pattern, TOOL_SUMMARY_MAX_LENGTH);
|
|
289779
289824
|
}
|
|
289780
289825
|
var import_compiler_runtime114, jsx_dev_runtime133;
|
|
289781
289826
|
var init_UI10 = __esm(() => {
|
|
@@ -290219,7 +290264,7 @@ function getToolUseSummary4(input) {
|
|
|
290219
290264
|
if (!input?.pattern) {
|
|
290220
290265
|
return null;
|
|
290221
290266
|
}
|
|
290222
|
-
return
|
|
290267
|
+
return truncate2(input.pattern, TOOL_SUMMARY_MAX_LENGTH);
|
|
290223
290268
|
}
|
|
290224
290269
|
var jsx_dev_runtime134, renderToolResultMessage11;
|
|
290225
290270
|
var init_UI11 = __esm(() => {
|
|
@@ -291377,7 +291422,7 @@ function getToolUseSummary6(input) {
|
|
|
291377
291422
|
if (!input?.url) {
|
|
291378
291423
|
return null;
|
|
291379
291424
|
}
|
|
291380
|
-
return
|
|
291425
|
+
return truncate2(input.url, TOOL_SUMMARY_MAX_LENGTH);
|
|
291381
291426
|
}
|
|
291382
291427
|
var jsx_dev_runtime137;
|
|
291383
291428
|
var init_UI13 = __esm(() => {
|
|
@@ -294358,7 +294403,7 @@ function getToolUseSummary7(input) {
|
|
|
294358
294403
|
if (!input?.query) {
|
|
294359
294404
|
return null;
|
|
294360
294405
|
}
|
|
294361
|
-
return
|
|
294406
|
+
return truncate2(input.query, TOOL_SUMMARY_MAX_LENGTH);
|
|
294362
294407
|
}
|
|
294363
294408
|
var jsx_dev_runtime141;
|
|
294364
294409
|
var init_UI16 = __esm(() => {
|
|
@@ -297456,7 +297501,7 @@ function getSymbolAtPosition(filePath, line, character) {
|
|
|
297456
297501
|
const end = start + match[0].length;
|
|
297457
297502
|
if (character >= start && character < end) {
|
|
297458
297503
|
const symbol2 = match[0];
|
|
297459
|
-
return
|
|
297504
|
+
return truncate2(symbol2, 30);
|
|
297460
297505
|
}
|
|
297461
297506
|
}
|
|
297462
297507
|
return null;
|
|
@@ -308179,13 +308224,13 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
308179
308224
|
if (description) {
|
|
308180
308225
|
return description;
|
|
308181
308226
|
}
|
|
308182
|
-
return
|
|
308227
|
+
return truncate2(command, TOOL_SUMMARY_MAX_LENGTH);
|
|
308183
308228
|
},
|
|
308184
308229
|
getActivityDescription(input) {
|
|
308185
308230
|
if (!input?.command) {
|
|
308186
308231
|
return "Running command";
|
|
308187
308232
|
}
|
|
308188
|
-
const desc = input.description ??
|
|
308233
|
+
const desc = input.description ?? truncate2(input.command, TOOL_SUMMARY_MAX_LENGTH);
|
|
308189
308234
|
return `Running ${desc}`;
|
|
308190
308235
|
},
|
|
308191
308236
|
async validateInput(input) {
|
|
@@ -338698,7 +338743,7 @@ function Feedback({
|
|
|
338698
338743
|
platform: env2.platform,
|
|
338699
338744
|
gitRepo: envInfo.isGit,
|
|
338700
338745
|
terminal: env2.terminal,
|
|
338701
|
-
version: "1.
|
|
338746
|
+
version: "1.29.1",
|
|
338702
338747
|
transcript: normalizeMessagesForAPI(messages),
|
|
338703
338748
|
errors: sanitizedErrors,
|
|
338704
338749
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -338890,7 +338935,7 @@ function Feedback({
|
|
|
338890
338935
|
", ",
|
|
338891
338936
|
env2.terminal,
|
|
338892
338937
|
", v",
|
|
338893
|
-
"1.
|
|
338938
|
+
"1.29.1"
|
|
338894
338939
|
]
|
|
338895
338940
|
}, undefined, true, undefined, this)
|
|
338896
338941
|
]
|
|
@@ -338996,7 +339041,7 @@ ${sanitizedDescription}
|
|
|
338996
339041
|
` + `**Environment Info**
|
|
338997
339042
|
` + `- Platform: ${env2.platform}
|
|
338998
339043
|
` + `- Terminal: ${env2.terminal}
|
|
338999
|
-
` + `- Version: ${"1.
|
|
339044
|
+
` + `- Version: ${"1.29.1"}
|
|
339000
339045
|
` + `- Feedback ID: ${feedbackId}
|
|
339001
339046
|
` + `
|
|
339002
339047
|
**Errors**
|
|
@@ -342107,7 +342152,7 @@ function buildPrimarySection() {
|
|
|
342107
342152
|
}, undefined, false, undefined, this);
|
|
342108
342153
|
return [{
|
|
342109
342154
|
label: "Version",
|
|
342110
|
-
value: "1.
|
|
342155
|
+
value: "1.29.1"
|
|
342111
342156
|
}, {
|
|
342112
342157
|
label: "Session name",
|
|
342113
342158
|
value: nameValue
|
|
@@ -345407,7 +345452,7 @@ function Config({
|
|
|
345407
345452
|
}
|
|
345408
345453
|
}, undefined, false, undefined, this)
|
|
345409
345454
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime177.jsxDEV(ChannelDowngradeDialog, {
|
|
345410
|
-
currentVersion: "1.
|
|
345455
|
+
currentVersion: "1.29.1",
|
|
345411
345456
|
onChoice: (choice) => {
|
|
345412
345457
|
setShowSubmenu(null);
|
|
345413
345458
|
setTabsHidden(false);
|
|
@@ -345419,7 +345464,7 @@ function Config({
|
|
|
345419
345464
|
autoUpdatesChannel: "stable"
|
|
345420
345465
|
};
|
|
345421
345466
|
if (choice === "stay") {
|
|
345422
|
-
newSettings.minimumVersion = "1.
|
|
345467
|
+
newSettings.minimumVersion = "1.29.1";
|
|
345423
345468
|
}
|
|
345424
345469
|
updateSettingsForSource("userSettings", newSettings);
|
|
345425
345470
|
setSettingsData((prev_27) => ({
|
|
@@ -345856,7 +345901,7 @@ function OverageCreditUpsell(t0) {
|
|
|
345856
345901
|
const title = getFeedTitle(amount);
|
|
345857
345902
|
let t3;
|
|
345858
345903
|
if ($3[4] !== maxWidth) {
|
|
345859
|
-
t3 = maxWidth ?
|
|
345904
|
+
t3 = maxWidth ? truncate2(FEED_SUBTITLE, maxWidth) : FEED_SUBTITLE;
|
|
345860
345905
|
$3[4] = maxWidth;
|
|
345861
345906
|
$3[5] = t3;
|
|
345862
345907
|
} else {
|
|
@@ -345877,7 +345922,7 @@ function OverageCreditUpsell(t0) {
|
|
|
345877
345922
|
children: [
|
|
345878
345923
|
/* @__PURE__ */ jsx_dev_runtime178.jsxDEV(ThemedText, {
|
|
345879
345924
|
color: "ur",
|
|
345880
|
-
children: maxWidth ?
|
|
345925
|
+
children: maxWidth ? truncate2(title, maxWidth) : title
|
|
345881
345926
|
}, undefined, false, undefined, this),
|
|
345882
345927
|
t4
|
|
345883
345928
|
]
|
|
@@ -345885,7 +345930,7 @@ function OverageCreditUpsell(t0) {
|
|
|
345885
345930
|
break bb0;
|
|
345886
345931
|
}
|
|
345887
345932
|
const text = getUsageText(amount);
|
|
345888
|
-
const display = maxWidth ?
|
|
345933
|
+
const display = maxWidth ? truncate2(text, maxWidth) : text;
|
|
345889
345934
|
const highlightLen = Math.min(getFeedTitle(amount).length, display.length);
|
|
345890
345935
|
t1 = /* @__PURE__ */ jsx_dev_runtime178.jsxDEV(ThemedText, {
|
|
345891
345936
|
dimColor: true,
|
|
@@ -352687,7 +352732,7 @@ function Commands(t0) {
|
|
|
352687
352732
|
t22 = (cmd_0) => ({
|
|
352688
352733
|
label: `/${cmd_0.name}`,
|
|
352689
352734
|
value: cmd_0.name,
|
|
352690
|
-
description:
|
|
352735
|
+
description: truncate2(formatDescriptionWithSource(cmd_0), maxWidth, true)
|
|
352691
352736
|
});
|
|
352692
352737
|
$3[3] = maxWidth;
|
|
352693
352738
|
$3[4] = t22;
|
|
@@ -353489,7 +353534,7 @@ function HelpV2(t0) {
|
|
|
353489
353534
|
let t6;
|
|
353490
353535
|
if ($3[31] !== tabs) {
|
|
353491
353536
|
t6 = /* @__PURE__ */ jsx_dev_runtime204.jsxDEV(Tabs, {
|
|
353492
|
-
title: `UR v${"1.
|
|
353537
|
+
title: `UR v${"1.29.1"}`,
|
|
353493
353538
|
color: "professionalBlue",
|
|
353494
353539
|
defaultTab: "general",
|
|
353495
353540
|
children: tabs
|
|
@@ -354157,6 +354202,768 @@ var init_inlineDiffCommand = __esm(() => {
|
|
|
354157
354202
|
init_cwd2();
|
|
354158
354203
|
});
|
|
354159
354204
|
|
|
354205
|
+
// src/services/agents/acpServer.ts
|
|
354206
|
+
var exports_acpServer = {};
|
|
354207
|
+
__export(exports_acpServer, {
|
|
354208
|
+
stopAcpServer: () => stopAcpServer,
|
|
354209
|
+
serveAcp: () => serveAcp,
|
|
354210
|
+
handleAcpRequest: () => handleAcpRequest,
|
|
354211
|
+
getAcpServerPort: () => getAcpServerPort
|
|
354212
|
+
});
|
|
354213
|
+
import { randomUUID as randomUUID34 } from "crypto";
|
|
354214
|
+
function jsonResponse2(status, body) {
|
|
354215
|
+
return new Response(JSON.stringify(body, null, 2), {
|
|
354216
|
+
status,
|
|
354217
|
+
headers: { "content-type": "application/json" }
|
|
354218
|
+
});
|
|
354219
|
+
}
|
|
354220
|
+
function rpcResponse(id, result, error40) {
|
|
354221
|
+
if (error40) {
|
|
354222
|
+
return { jsonrpc: "2.0", id, error: error40 };
|
|
354223
|
+
}
|
|
354224
|
+
return { jsonrpc: "2.0", id, result };
|
|
354225
|
+
}
|
|
354226
|
+
function rpcError(id, code, message, data) {
|
|
354227
|
+
return { jsonrpc: "2.0", id, error: { code, message, data } };
|
|
354228
|
+
}
|
|
354229
|
+
function createAcpId() {
|
|
354230
|
+
return `acp_${Date.now().toString(36)}_${randomUUID34().slice(0, 8)}`;
|
|
354231
|
+
}
|
|
354232
|
+
function now6() {
|
|
354233
|
+
return new Date().toISOString();
|
|
354234
|
+
}
|
|
354235
|
+
function isLoopback2(host) {
|
|
354236
|
+
return host === "127.0.0.1" || host === "localhost" || host === "::1";
|
|
354237
|
+
}
|
|
354238
|
+
function authorizeAcp(request, options2) {
|
|
354239
|
+
return authorizeRequest(request, { token: options2.token });
|
|
354240
|
+
}
|
|
354241
|
+
function mapBackgroundStatus2(status) {
|
|
354242
|
+
switch (status) {
|
|
354243
|
+
case "queued":
|
|
354244
|
+
return "submitted";
|
|
354245
|
+
case "running":
|
|
354246
|
+
return "working";
|
|
354247
|
+
case "completed":
|
|
354248
|
+
return "completed";
|
|
354249
|
+
case "failed":
|
|
354250
|
+
return "failed";
|
|
354251
|
+
case "canceled":
|
|
354252
|
+
return "canceled";
|
|
354253
|
+
}
|
|
354254
|
+
}
|
|
354255
|
+
function buildToolUseContext(tools, readFileStateCache) {
|
|
354256
|
+
return {
|
|
354257
|
+
abortController: createAbortController(),
|
|
354258
|
+
options: {
|
|
354259
|
+
commands: MCP_COMMANDS,
|
|
354260
|
+
tools,
|
|
354261
|
+
mainLoopModel: getMainLoopModel(),
|
|
354262
|
+
thinkingConfig: { type: "disabled" },
|
|
354263
|
+
mcpClients: [],
|
|
354264
|
+
mcpResources: {},
|
|
354265
|
+
isNonInteractiveSession: true,
|
|
354266
|
+
debug: false,
|
|
354267
|
+
verbose: false,
|
|
354268
|
+
agentDefinitions: { activeAgents: [], allAgents: [] }
|
|
354269
|
+
},
|
|
354270
|
+
getAppState: () => getDefaultAppState(),
|
|
354271
|
+
setAppState: () => {},
|
|
354272
|
+
messages: [],
|
|
354273
|
+
readFileState: readFileStateCache,
|
|
354274
|
+
setInProgressToolUseIDs: () => {},
|
|
354275
|
+
setResponseLength: () => {},
|
|
354276
|
+
updateFileHistoryState: () => {},
|
|
354277
|
+
updateAttributionState: () => {}
|
|
354278
|
+
};
|
|
354279
|
+
}
|
|
354280
|
+
async function handleInitialize(options2) {
|
|
354281
|
+
return {
|
|
354282
|
+
name: "ur-agent",
|
|
354283
|
+
version: "1.29.1",
|
|
354284
|
+
protocolVersion: "0.1.0",
|
|
354285
|
+
workspaceRoot: options2.cwd,
|
|
354286
|
+
capabilities: {
|
|
354287
|
+
tools: true,
|
|
354288
|
+
tasks: true,
|
|
354289
|
+
sessions: true,
|
|
354290
|
+
ide: true,
|
|
354291
|
+
streaming: false,
|
|
354292
|
+
cancellation: true
|
|
354293
|
+
}
|
|
354294
|
+
};
|
|
354295
|
+
}
|
|
354296
|
+
async function handleSessionNew(params, options2) {
|
|
354297
|
+
const cwd2 = typeof params?.cwd === "string" ? params.cwd : options2.cwd;
|
|
354298
|
+
const session = { id: `sess_${randomUUID34()}`, cwd: cwd2, createdAt: now6() };
|
|
354299
|
+
acpSessions.set(session.id, session);
|
|
354300
|
+
return { sessionId: session.id, workspaceRoot: session.cwd };
|
|
354301
|
+
}
|
|
354302
|
+
async function handleSessionPrompt(params, options2) {
|
|
354303
|
+
const sessionId = typeof params?.sessionId === "string" ? params.sessionId : undefined;
|
|
354304
|
+
if (sessionId && !acpSessions.has(sessionId)) {
|
|
354305
|
+
throw new Error(`unknown session: ${sessionId}`);
|
|
354306
|
+
}
|
|
354307
|
+
const sent = await handleTasksSend(params, options2);
|
|
354308
|
+
return { sessionId: sessionId ?? null, ...sent };
|
|
354309
|
+
}
|
|
354310
|
+
async function handleSessionCancel(params, options2) {
|
|
354311
|
+
const taskId = typeof params?.taskId === "string" ? params.taskId : undefined;
|
|
354312
|
+
if (taskId) {
|
|
354313
|
+
return handleTasksCancel({ id: taskId }, options2);
|
|
354314
|
+
}
|
|
354315
|
+
const sessionId = typeof params?.sessionId === "string" ? params.sessionId : "";
|
|
354316
|
+
acpSessions.delete(sessionId);
|
|
354317
|
+
return { sessionId, canceled: true };
|
|
354318
|
+
}
|
|
354319
|
+
async function handleToolsList() {
|
|
354320
|
+
const toolPermissionContext = getEmptyToolPermissionContext();
|
|
354321
|
+
const tools = getTools(toolPermissionContext);
|
|
354322
|
+
return {
|
|
354323
|
+
tools: tools.filter((tool) => tool.isEnabled()).map((tool) => ({
|
|
354324
|
+
name: tool.name,
|
|
354325
|
+
description: tool.searchHint ?? tool.name,
|
|
354326
|
+
inputSchema: zodToJsonSchema3(tool.inputSchema)
|
|
354327
|
+
}))
|
|
354328
|
+
};
|
|
354329
|
+
}
|
|
354330
|
+
async function handleToolsCall(params, options2) {
|
|
354331
|
+
const name = typeof params?.name === "string" ? params.name : "";
|
|
354332
|
+
const args = params?.arguments ?? {};
|
|
354333
|
+
if (!name) {
|
|
354334
|
+
throw new Error("missing tool name");
|
|
354335
|
+
}
|
|
354336
|
+
const toolPermissionContext = getEmptyToolPermissionContext();
|
|
354337
|
+
const readFileStateCache = createFileStateCacheWithSizeLimit(100, 25 * 1024 * 1024);
|
|
354338
|
+
const tools = getTools(toolPermissionContext);
|
|
354339
|
+
const tool = findToolByName(tools, name);
|
|
354340
|
+
if (!tool) {
|
|
354341
|
+
throw new Error(`tool not found: ${name}`);
|
|
354342
|
+
}
|
|
354343
|
+
if (!tool.isEnabled()) {
|
|
354344
|
+
throw new Error(`tool not enabled: ${name}`);
|
|
354345
|
+
}
|
|
354346
|
+
const context4 = buildToolUseContext(tools, readFileStateCache);
|
|
354347
|
+
const validationResult = await tool.validateInput?.(args, context4);
|
|
354348
|
+
if (validationResult?.result === false) {
|
|
354349
|
+
throw new Error(`invalid input: ${validationResult.message}`);
|
|
354350
|
+
}
|
|
354351
|
+
const result = await tool.call(args, context4, hasPermissionsToUseTool, createAssistantMessage({ content: [] }));
|
|
354352
|
+
return { result: result.data };
|
|
354353
|
+
}
|
|
354354
|
+
async function handleIdeDiffCapture(params, options2) {
|
|
354355
|
+
const result = await createIdeDiffBundle(options2.cwd, {
|
|
354356
|
+
title: typeof params?.title === "string" ? params.title : undefined,
|
|
354357
|
+
baseRef: typeof params?.baseRef === "string" ? params.baseRef : undefined,
|
|
354358
|
+
staged: params?.staged === true,
|
|
354359
|
+
diff: typeof params?.diff === "string" ? params.diff : undefined
|
|
354360
|
+
});
|
|
354361
|
+
if (result.error) {
|
|
354362
|
+
throw new Error(result.error);
|
|
354363
|
+
}
|
|
354364
|
+
return {
|
|
354365
|
+
bundle: result.bundle,
|
|
354366
|
+
command: result.command,
|
|
354367
|
+
empty: !result.bundle
|
|
354368
|
+
};
|
|
354369
|
+
}
|
|
354370
|
+
async function handleIdeSelect(params, options2) {
|
|
354371
|
+
const id = typeof params?.id === "string" ? params.id : "";
|
|
354372
|
+
if (!id) {
|
|
354373
|
+
throw new Error("missing diff id");
|
|
354374
|
+
}
|
|
354375
|
+
const bundle = getIdeDiffBundle(options2.cwd, id);
|
|
354376
|
+
if (!bundle) {
|
|
354377
|
+
throw new Error("IDE diff not found");
|
|
354378
|
+
}
|
|
354379
|
+
return { bundle, patch: readIdeDiffPatch(options2.cwd, id) };
|
|
354380
|
+
}
|
|
354381
|
+
function headlessCommand2(prompt) {
|
|
354382
|
+
return [
|
|
354383
|
+
process.execPath,
|
|
354384
|
+
process.argv[1] ?? "",
|
|
354385
|
+
"-p",
|
|
354386
|
+
"--output-format",
|
|
354387
|
+
"json",
|
|
354388
|
+
prompt
|
|
354389
|
+
];
|
|
354390
|
+
}
|
|
354391
|
+
async function runSynchronousTask2(options2, prompt) {
|
|
354392
|
+
const command3 = headlessCommand2(prompt);
|
|
354393
|
+
const createdAt = now6();
|
|
354394
|
+
const record3 = {
|
|
354395
|
+
id: createAcpId(),
|
|
354396
|
+
prompt,
|
|
354397
|
+
status: "working",
|
|
354398
|
+
mode: "sync",
|
|
354399
|
+
createdAt,
|
|
354400
|
+
updatedAt: createdAt
|
|
354401
|
+
};
|
|
354402
|
+
if (options2.dryRun) {
|
|
354403
|
+
record3.status = "completed";
|
|
354404
|
+
record3.result = { dryRun: true, command: command3 };
|
|
354405
|
+
return record3;
|
|
354406
|
+
}
|
|
354407
|
+
const result = await execFileNoThrowWithCwd(command3[0], command3.slice(1), {
|
|
354408
|
+
cwd: options2.cwd,
|
|
354409
|
+
timeout: 30 * 60 * 1000,
|
|
354410
|
+
preserveOutputOnError: true
|
|
354411
|
+
});
|
|
354412
|
+
record3.updatedAt = now6();
|
|
354413
|
+
record3.status = result.code === 0 ? "completed" : "failed";
|
|
354414
|
+
record3.result = {
|
|
354415
|
+
code: result.code,
|
|
354416
|
+
stdout: result.stdout,
|
|
354417
|
+
stderr: result.stderr || result.error
|
|
354418
|
+
};
|
|
354419
|
+
return record3;
|
|
354420
|
+
}
|
|
354421
|
+
function rememberTask(task) {
|
|
354422
|
+
acpTasks.set(task.id, task);
|
|
354423
|
+
return task;
|
|
354424
|
+
}
|
|
354425
|
+
async function startAsynchronousTask2(options2, prompt) {
|
|
354426
|
+
const background = await startBackgroundTask({
|
|
354427
|
+
cwd: options2.cwd,
|
|
354428
|
+
task: `ACP delegated task: ${prompt}`,
|
|
354429
|
+
dryRun: options2.dryRun
|
|
354430
|
+
});
|
|
354431
|
+
const createdAt = now6();
|
|
354432
|
+
return {
|
|
354433
|
+
id: createAcpId(),
|
|
354434
|
+
prompt,
|
|
354435
|
+
backgroundTaskId: background.task.id,
|
|
354436
|
+
status: options2.dryRun ? "submitted" : mapBackgroundStatus2(background.task.status),
|
|
354437
|
+
mode: "async",
|
|
354438
|
+
createdAt,
|
|
354439
|
+
updatedAt: createdAt,
|
|
354440
|
+
result: options2.dryRun ? { dryRun: true, command: background.command } : undefined
|
|
354441
|
+
};
|
|
354442
|
+
}
|
|
354443
|
+
async function handleTasksSend(params, options2) {
|
|
354444
|
+
const prompt = typeof params?.prompt === "string" ? params.prompt : "";
|
|
354445
|
+
if (!prompt.trim()) {
|
|
354446
|
+
throw new Error("missing prompt");
|
|
354447
|
+
}
|
|
354448
|
+
const mode = params?.mode === "sync" ? "sync" : "async";
|
|
354449
|
+
if (mode === "sync") {
|
|
354450
|
+
const task2 = await runSynchronousTask2(options2, prompt);
|
|
354451
|
+
return { task: rememberTask(task2) };
|
|
354452
|
+
}
|
|
354453
|
+
const task = rememberTask(await startAsynchronousTask2(options2, prompt));
|
|
354454
|
+
return { task, statusUrl: `/acp/tasks/${encodeURIComponent(task.id)}` };
|
|
354455
|
+
}
|
|
354456
|
+
function hydrateTask(cwd2, record3) {
|
|
354457
|
+
if (!record3.backgroundTaskId)
|
|
354458
|
+
return record3;
|
|
354459
|
+
const background = getBackgroundTask(cwd2, record3.backgroundTaskId);
|
|
354460
|
+
if (!background) {
|
|
354461
|
+
return {
|
|
354462
|
+
...record3,
|
|
354463
|
+
status: record3.status === "canceled" ? "canceled" : "failed",
|
|
354464
|
+
error: record3.error ?? `background task not found: ${record3.backgroundTaskId}`
|
|
354465
|
+
};
|
|
354466
|
+
}
|
|
354467
|
+
return {
|
|
354468
|
+
...record3,
|
|
354469
|
+
status: mapBackgroundStatus2(background.status),
|
|
354470
|
+
updatedAt: background.updatedAt,
|
|
354471
|
+
result: {
|
|
354472
|
+
...typeof record3.result === "object" && record3.result !== null ? record3.result : {},
|
|
354473
|
+
exitCode: background.exitCode
|
|
354474
|
+
}
|
|
354475
|
+
};
|
|
354476
|
+
}
|
|
354477
|
+
function listTasks3(options2) {
|
|
354478
|
+
const knownBackgroundIds = new Set([...acpTasks.values()].map((task) => task.backgroundTaskId).filter((id) => typeof id === "string"));
|
|
354479
|
+
const persisted = listBackgroundTasks(options2.cwd).filter((bg) => bg.task.startsWith("ACP delegated task:")).filter((bg) => !knownBackgroundIds.has(bg.id)).map((bg) => {
|
|
354480
|
+
const createdAt = bg.createdAt ?? now6();
|
|
354481
|
+
return hydrateTask(options2.cwd, {
|
|
354482
|
+
id: createAcpId(),
|
|
354483
|
+
prompt: bg.task.replace(/^ACP delegated task:\s*/u, ""),
|
|
354484
|
+
backgroundTaskId: bg.id,
|
|
354485
|
+
status: mapBackgroundStatus2(bg.status),
|
|
354486
|
+
mode: "async",
|
|
354487
|
+
createdAt,
|
|
354488
|
+
updatedAt: bg.updatedAt ?? createdAt
|
|
354489
|
+
});
|
|
354490
|
+
});
|
|
354491
|
+
return [
|
|
354492
|
+
...[...acpTasks.values()].map((task) => hydrateTask(options2.cwd, task)),
|
|
354493
|
+
...persisted
|
|
354494
|
+
].sort((a2, b) => b.createdAt.localeCompare(a2.createdAt));
|
|
354495
|
+
}
|
|
354496
|
+
async function handleTasksGet(params, options2) {
|
|
354497
|
+
const id = typeof params?.id === "string" ? params.id : "";
|
|
354498
|
+
const tasks = listTasks3(options2);
|
|
354499
|
+
if (!id) {
|
|
354500
|
+
return { tasks };
|
|
354501
|
+
}
|
|
354502
|
+
const task = tasks.find((t) => t.id === id);
|
|
354503
|
+
if (!task) {
|
|
354504
|
+
throw new Error("task not found");
|
|
354505
|
+
}
|
|
354506
|
+
const log = task.backgroundTaskId ? readBackgroundLog(options2.cwd, task.backgroundTaskId) : null;
|
|
354507
|
+
return { task, log };
|
|
354508
|
+
}
|
|
354509
|
+
async function handleTasksCancel(params, options2) {
|
|
354510
|
+
const id = typeof params?.id === "string" ? params.id : "";
|
|
354511
|
+
const task = listTasks3(options2).find((t) => t.id === id);
|
|
354512
|
+
if (!task) {
|
|
354513
|
+
throw new Error("task not found");
|
|
354514
|
+
}
|
|
354515
|
+
if (task.backgroundTaskId) {
|
|
354516
|
+
stopBackgroundTask(options2.cwd, task.backgroundTaskId);
|
|
354517
|
+
}
|
|
354518
|
+
const canceled = { ...task, status: "canceled", updatedAt: now6() };
|
|
354519
|
+
acpTasks.set(canceled.id, canceled);
|
|
354520
|
+
return { task: canceled };
|
|
354521
|
+
}
|
|
354522
|
+
async function dispatchMethod(method, params, options2) {
|
|
354523
|
+
switch (method) {
|
|
354524
|
+
case "initialize":
|
|
354525
|
+
return handleInitialize(options2);
|
|
354526
|
+
case "session/new":
|
|
354527
|
+
return handleSessionNew(params, options2);
|
|
354528
|
+
case "session/prompt":
|
|
354529
|
+
return handleSessionPrompt(params, options2);
|
|
354530
|
+
case "session/cancel":
|
|
354531
|
+
return handleSessionCancel(params, options2);
|
|
354532
|
+
case "tools/list":
|
|
354533
|
+
return handleToolsList();
|
|
354534
|
+
case "tools/call":
|
|
354535
|
+
return handleToolsCall(params, options2);
|
|
354536
|
+
case "tasks/send":
|
|
354537
|
+
return handleTasksSend(params, options2);
|
|
354538
|
+
case "tasks/get":
|
|
354539
|
+
return handleTasksGet(params, options2);
|
|
354540
|
+
case "tasks/cancel":
|
|
354541
|
+
return handleTasksCancel(params, options2);
|
|
354542
|
+
case "ide/diffCapture":
|
|
354543
|
+
return handleIdeDiffCapture(params, options2);
|
|
354544
|
+
case "ide/select":
|
|
354545
|
+
return handleIdeSelect(params, options2);
|
|
354546
|
+
case "shutdown":
|
|
354547
|
+
setTimeout(() => {
|
|
354548
|
+
stopAcpServer();
|
|
354549
|
+
}, 10);
|
|
354550
|
+
return { ok: true };
|
|
354551
|
+
default:
|
|
354552
|
+
throw new Error(`unknown method: ${method}`);
|
|
354553
|
+
}
|
|
354554
|
+
}
|
|
354555
|
+
async function handleAcpRequest(request, options2) {
|
|
354556
|
+
const url3 = new URL(request.url);
|
|
354557
|
+
if (request.method === "GET" && url3.pathname === "/healthz") {
|
|
354558
|
+
return jsonResponse2(200, rpcResponse(null, { ok: true }));
|
|
354559
|
+
}
|
|
354560
|
+
if (url3.pathname !== "/acp") {
|
|
354561
|
+
return jsonResponse2(404, { error: "not found" });
|
|
354562
|
+
}
|
|
354563
|
+
const auth2 = authorizeAcp(request, options2);
|
|
354564
|
+
if (!auth2.ok) {
|
|
354565
|
+
return jsonResponse2(401, rpcError(null, -32001, auth2.reason ?? "unauthorized"));
|
|
354566
|
+
}
|
|
354567
|
+
let body = null;
|
|
354568
|
+
try {
|
|
354569
|
+
body = await request.json();
|
|
354570
|
+
} catch {
|
|
354571
|
+
return jsonResponse2(400, rpcError(null, -32700, "parse error"));
|
|
354572
|
+
}
|
|
354573
|
+
const id = body?.id ?? null;
|
|
354574
|
+
const method = body?.method;
|
|
354575
|
+
if (typeof method !== "string") {
|
|
354576
|
+
return jsonResponse2(400, rpcError(id, -32600, "invalid request"));
|
|
354577
|
+
}
|
|
354578
|
+
if (options2.debug) {
|
|
354579
|
+
console.error(`[acp] ${method} ${jsonStringify(body.params ?? {})}`);
|
|
354580
|
+
}
|
|
354581
|
+
try {
|
|
354582
|
+
const result = await dispatchMethod(method, body.params, options2);
|
|
354583
|
+
if (options2.debug) {
|
|
354584
|
+
console.error(`[acp] ${method} -> ok`);
|
|
354585
|
+
}
|
|
354586
|
+
return jsonResponse2(200, rpcResponse(id, result));
|
|
354587
|
+
} catch (error40) {
|
|
354588
|
+
logError2(error40);
|
|
354589
|
+
const message = error40 instanceof Error ? error40.message : String(error40);
|
|
354590
|
+
if (options2.debug) {
|
|
354591
|
+
console.error(`[acp] ${method} -> error: ${message}`);
|
|
354592
|
+
}
|
|
354593
|
+
return jsonResponse2(500, rpcError(id, -32603, message));
|
|
354594
|
+
}
|
|
354595
|
+
}
|
|
354596
|
+
function getAcpServerPort() {
|
|
354597
|
+
return acpServer?.port ?? null;
|
|
354598
|
+
}
|
|
354599
|
+
async function stopAcpServer() {
|
|
354600
|
+
if (acpServer) {
|
|
354601
|
+
acpServer.stop();
|
|
354602
|
+
acpServer = null;
|
|
354603
|
+
}
|
|
354604
|
+
acpTasks.clear();
|
|
354605
|
+
acpSessions.clear();
|
|
354606
|
+
}
|
|
354607
|
+
function pickFallbackPort() {
|
|
354608
|
+
return 49152 + Math.floor(Math.random() * 16384);
|
|
354609
|
+
}
|
|
354610
|
+
function startAcpHttpServer(options2) {
|
|
354611
|
+
const ports = options2.port === 0 ? [0, ...Array.from({ length: 10 }, () => pickFallbackPort())] : [options2.port];
|
|
354612
|
+
let lastError;
|
|
354613
|
+
for (const port of ports) {
|
|
354614
|
+
try {
|
|
354615
|
+
return Bun.serve({
|
|
354616
|
+
hostname: options2.host,
|
|
354617
|
+
port,
|
|
354618
|
+
fetch: (request) => handleAcpRequest(request, options2)
|
|
354619
|
+
});
|
|
354620
|
+
} catch (error40) {
|
|
354621
|
+
lastError = error40;
|
|
354622
|
+
if (options2.port !== 0 || getErrnoCode(error40) !== "EADDRINUSE") {
|
|
354623
|
+
throw error40;
|
|
354624
|
+
}
|
|
354625
|
+
}
|
|
354626
|
+
}
|
|
354627
|
+
throw lastError;
|
|
354628
|
+
}
|
|
354629
|
+
async function serveAcp(options2) {
|
|
354630
|
+
if (!isLoopback2(options2.host) && !options2.token) {
|
|
354631
|
+
throw new Error("Refusing to bind ACP server off-loopback without --token");
|
|
354632
|
+
}
|
|
354633
|
+
if (typeof Bun === "undefined" || typeof Bun.serve !== "function") {
|
|
354634
|
+
throw new Error("ACP server requires the Bun runtime");
|
|
354635
|
+
}
|
|
354636
|
+
await stopAcpServer();
|
|
354637
|
+
acpTasks.clear();
|
|
354638
|
+
acpServer = startAcpHttpServer(options2);
|
|
354639
|
+
console.log(`ACP server listening on http://${options2.host}:${acpServer.port}`);
|
|
354640
|
+
await new Promise(() => {});
|
|
354641
|
+
}
|
|
354642
|
+
var MCP_COMMANDS, acpTasks, acpSessions, acpServer = null;
|
|
354643
|
+
var init_acpServer = __esm(() => {
|
|
354644
|
+
init_AppStateStore();
|
|
354645
|
+
init_Tool();
|
|
354646
|
+
init_messages();
|
|
354647
|
+
init_permissions2();
|
|
354648
|
+
init_tools2();
|
|
354649
|
+
init_abortController();
|
|
354650
|
+
init_fileStateCache();
|
|
354651
|
+
init_execFileNoThrow();
|
|
354652
|
+
init_errors();
|
|
354653
|
+
init_model();
|
|
354654
|
+
init_log2();
|
|
354655
|
+
init_slowOperations();
|
|
354656
|
+
init_zodToJsonSchema2();
|
|
354657
|
+
init_ideDiffs();
|
|
354658
|
+
init_backgroundRunner();
|
|
354659
|
+
init_a2aServer();
|
|
354660
|
+
MCP_COMMANDS = [];
|
|
354661
|
+
acpTasks = new Map;
|
|
354662
|
+
acpSessions = new Map;
|
|
354663
|
+
});
|
|
354664
|
+
|
|
354665
|
+
// src/services/agents/ideConfig.ts
|
|
354666
|
+
function resolveIdeTarget(value) {
|
|
354667
|
+
const normalized = value.trim().toLowerCase().replace(/[\s_]+/g, "-");
|
|
354668
|
+
const aliases = {
|
|
354669
|
+
vscode: "vscode",
|
|
354670
|
+
"vs-code": "vscode",
|
|
354671
|
+
code: "vscode",
|
|
354672
|
+
cursor: "cursor",
|
|
354673
|
+
windsurf: "windsurf",
|
|
354674
|
+
zed: "zed",
|
|
354675
|
+
jetbrains: "jetbrains",
|
|
354676
|
+
intellij: "jetbrains",
|
|
354677
|
+
idea: "jetbrains",
|
|
354678
|
+
pycharm: "jetbrains",
|
|
354679
|
+
webstorm: "jetbrains",
|
|
354680
|
+
goland: "jetbrains",
|
|
354681
|
+
neovim: "neovim",
|
|
354682
|
+
nvim: "neovim",
|
|
354683
|
+
vim: "neovim",
|
|
354684
|
+
generic: "generic-acp",
|
|
354685
|
+
"generic-acp": "generic-acp",
|
|
354686
|
+
acp: "generic-acp"
|
|
354687
|
+
};
|
|
354688
|
+
const id = aliases[normalized];
|
|
354689
|
+
return id ? IDE_TARGETS.find((t) => t.id === id) ?? null : null;
|
|
354690
|
+
}
|
|
354691
|
+
function zedSettings(command3) {
|
|
354692
|
+
return JSON.stringify({ agent_servers: { UR: { command: command3, args: ["acp", "stdio"] } } }, null, 2);
|
|
354693
|
+
}
|
|
354694
|
+
function neovimSnippet(command3) {
|
|
354695
|
+
return [
|
|
354696
|
+
"-- Requires an ACP-capable Neovim client (e.g. a plugin that speaks the",
|
|
354697
|
+
"-- Agent Client Protocol over stdio). Point it at the UR ACP agent:",
|
|
354698
|
+
'require("acp").setup({',
|
|
354699
|
+
" servers = {",
|
|
354700
|
+
` ur = { command = "${command3}", args = { "acp", "stdio" } },`,
|
|
354701
|
+
" },",
|
|
354702
|
+
"})"
|
|
354703
|
+
].join(`
|
|
354704
|
+
`);
|
|
354705
|
+
}
|
|
354706
|
+
function generateIdeConfig(target, options2 = {}) {
|
|
354707
|
+
const command3 = options2.command ?? "ur";
|
|
354708
|
+
const meta = IDE_TARGETS.find((t) => t.id === target);
|
|
354709
|
+
switch (target) {
|
|
354710
|
+
case "zed":
|
|
354711
|
+
return {
|
|
354712
|
+
target,
|
|
354713
|
+
label: meta.label,
|
|
354714
|
+
kind: meta.kind,
|
|
354715
|
+
summary: "Zed connects to UR as an external agent over the stdio Agent Client Protocol.",
|
|
354716
|
+
steps: [
|
|
354717
|
+
"Add the agent server block below to your Zed settings.json.",
|
|
354718
|
+
"Restart Zed or reload settings.",
|
|
354719
|
+
'Open the Agent panel and select "UR".'
|
|
354720
|
+
],
|
|
354721
|
+
files: [{ path: ".zed/settings.json", language: "json", content: zedSettings(command3) }],
|
|
354722
|
+
limitations: [
|
|
354723
|
+
"Streaming is emitted as agent_message_chunk updates; token-level streaming depends on the active provider."
|
|
354724
|
+
]
|
|
354725
|
+
};
|
|
354726
|
+
case "neovim":
|
|
354727
|
+
return {
|
|
354728
|
+
target,
|
|
354729
|
+
label: meta.label,
|
|
354730
|
+
kind: meta.kind,
|
|
354731
|
+
summary: "Neovim connects to UR over stdio ACP through an ACP-capable client plugin.",
|
|
354732
|
+
steps: [
|
|
354733
|
+
"Install a Neovim plugin that speaks ACP over stdio.",
|
|
354734
|
+
"Register the UR agent using the snippet below.",
|
|
354735
|
+
"Open the agent UI provided by that plugin."
|
|
354736
|
+
],
|
|
354737
|
+
files: [{ path: "ur-acp.lua", language: "lua", content: neovimSnippet(command3) }],
|
|
354738
|
+
limitations: [
|
|
354739
|
+
"UR does not ship a Neovim plugin; a third-party ACP client is required."
|
|
354740
|
+
]
|
|
354741
|
+
};
|
|
354742
|
+
case "generic-acp":
|
|
354743
|
+
return {
|
|
354744
|
+
target,
|
|
354745
|
+
label: meta.label,
|
|
354746
|
+
kind: meta.kind,
|
|
354747
|
+
summary: "Any ACP-compatible client can launch UR as a stdio agent, or use the HTTP JSON-RPC server.",
|
|
354748
|
+
steps: [
|
|
354749
|
+
`Stdio ACP agent: run \`${command3} acp stdio\` and speak JSON-RPC (initialize, session/new, session/prompt, session/cancel).`,
|
|
354750
|
+
`HTTP JSON-RPC: run \`${command3} acp serve --host 127.0.0.1 --port 8123\` and POST to /acp.`
|
|
354751
|
+
],
|
|
354752
|
+
files: [
|
|
354753
|
+
{
|
|
354754
|
+
path: "ur-acp.json",
|
|
354755
|
+
language: "json",
|
|
354756
|
+
content: JSON.stringify({ stdio: { command: command3, args: ["acp", "stdio"] }, http: { url: "http://127.0.0.1:8123/acp" } }, null, 2)
|
|
354757
|
+
}
|
|
354758
|
+
],
|
|
354759
|
+
limitations: [
|
|
354760
|
+
"The HTTP server is JSON-RPC over HTTP, not Zed-style stdio ACP; use the stdio agent for native ACP editors."
|
|
354761
|
+
]
|
|
354762
|
+
};
|
|
354763
|
+
case "jetbrains":
|
|
354764
|
+
return {
|
|
354765
|
+
target,
|
|
354766
|
+
label: meta.label,
|
|
354767
|
+
kind: meta.kind,
|
|
354768
|
+
summary: "JetBrains IDEs integrate through the UR JetBrains plugin (manual install).",
|
|
354769
|
+
steps: [
|
|
354770
|
+
"Install the UR plugin for your JetBrains IDE.",
|
|
354771
|
+
"Restart the IDE.",
|
|
354772
|
+
"Run `/ide` inside a UR session to connect to the running IDE."
|
|
354773
|
+
],
|
|
354774
|
+
files: [],
|
|
354775
|
+
limitations: [
|
|
354776
|
+
"No auto-generated config file; the plugin must be installed manually.",
|
|
354777
|
+
"Inline apply/reject requires the JetBrains plugin."
|
|
354778
|
+
]
|
|
354779
|
+
};
|
|
354780
|
+
default: {
|
|
354781
|
+
return {
|
|
354782
|
+
target,
|
|
354783
|
+
label: meta.label,
|
|
354784
|
+
kind: meta.kind,
|
|
354785
|
+
summary: `${meta.label} integrates through the UR extension and the /ide connect flow.`,
|
|
354786
|
+
steps: [
|
|
354787
|
+
`Install the UR extension in ${meta.label} (\`${command3} ide install\` offers the bundled VSIX).`,
|
|
354788
|
+
`Run \`${command3}\` in your project, then \`/ide\` to connect to the running editor.`,
|
|
354789
|
+
"Use the UR Inline Diffs view to preview, apply, or reject proposed patches."
|
|
354790
|
+
],
|
|
354791
|
+
files: [
|
|
354792
|
+
{
|
|
354793
|
+
path: ".vscode/settings.json",
|
|
354794
|
+
language: "json",
|
|
354795
|
+
content: JSON.stringify({ "ur.inlineDiffs.enabled": true }, null, 2)
|
|
354796
|
+
}
|
|
354797
|
+
],
|
|
354798
|
+
limitations: [
|
|
354799
|
+
"Apply/reject and context sharing require the UR extension to be installed and the editor running."
|
|
354800
|
+
]
|
|
354801
|
+
};
|
|
354802
|
+
}
|
|
354803
|
+
}
|
|
354804
|
+
}
|
|
354805
|
+
function formatIdeConfig(result, json2 = false) {
|
|
354806
|
+
if (json2)
|
|
354807
|
+
return JSON.stringify(result, null, 2);
|
|
354808
|
+
const lines = [
|
|
354809
|
+
`${result.label} \u2014 ${result.kind}`,
|
|
354810
|
+
result.summary,
|
|
354811
|
+
"",
|
|
354812
|
+
"Steps:",
|
|
354813
|
+
...result.steps.map((s, i3) => ` ${i3 + 1}. ${s}`)
|
|
354814
|
+
];
|
|
354815
|
+
for (const file2 of result.files) {
|
|
354816
|
+
lines.push("", `${file2.path}:`, "```" + file2.language, file2.content, "```");
|
|
354817
|
+
}
|
|
354818
|
+
if (result.limitations.length > 0) {
|
|
354819
|
+
lines.push("", "Limitations:", ...result.limitations.map((l) => ` - ${l}`));
|
|
354820
|
+
}
|
|
354821
|
+
return lines.join(`
|
|
354822
|
+
`);
|
|
354823
|
+
}
|
|
354824
|
+
function formatIdeStatus(status, json2 = false) {
|
|
354825
|
+
if (json2)
|
|
354826
|
+
return JSON.stringify(status, null, 2);
|
|
354827
|
+
const ide = status.detectedIdes.length > 0 ? status.detectedIdes.map((i3) => `${i3.name}${i3.connected ? " (connected)" : ""}`).join(", ") : "none detected";
|
|
354828
|
+
const lines = [
|
|
354829
|
+
`Workspace: ${status.workspaceRoot}`,
|
|
354830
|
+
`ACP server: ${status.acp.running ? `running on ${status.acp.host}:${status.acp.port}` : "not running"}`,
|
|
354831
|
+
`Provider: ${status.provider.label} (${status.provider.authLabel})`,
|
|
354832
|
+
`Model: ${status.provider.model ?? "(none selected)"}`,
|
|
354833
|
+
`Runtime backend: ${status.provider.runtimeBackend}`,
|
|
354834
|
+
`Plugins loaded: ${status.pluginCount}`,
|
|
354835
|
+
`Detected IDEs: ${ide}`
|
|
354836
|
+
];
|
|
354837
|
+
if (status.warnings.length > 0) {
|
|
354838
|
+
lines.push("Warnings:", ...status.warnings.map((w) => ` - ${w}`));
|
|
354839
|
+
}
|
|
354840
|
+
return lines.join(`
|
|
354841
|
+
`);
|
|
354842
|
+
}
|
|
354843
|
+
function ideDoctorChecks(status) {
|
|
354844
|
+
const checks4 = [];
|
|
354845
|
+
checks4.push(status.workspaceRoot ? { name: "workspace", status: "pass", message: `Workspace root: ${status.workspaceRoot}` } : { name: "workspace", status: "fail", message: "No workspace root detected. Run inside a project directory." });
|
|
354846
|
+
checks4.push(status.acp.running ? { name: "acp", status: "pass", message: `ACP server running on ${status.acp.host}:${status.acp.port}` } : { name: "acp", status: "warn", message: "ACP server not running. Start it with: ur acp serve (HTTP) or ur acp stdio (ACP editors)." });
|
|
354847
|
+
checks4.push(status.provider.ready ? { name: "provider", status: "pass", message: `${status.provider.label} ready with model ${status.provider.model ?? "(none)"}` } : { name: "provider", status: "warn", message: `${status.provider.label} not ready. Run: ur provider doctor` });
|
|
354848
|
+
checks4.push(status.detectedIdes.length > 0 ? { name: "ide", status: "pass", message: `Detected: ${status.detectedIdes.map((i3) => i3.name).join(", ")}` } : { name: "ide", status: "warn", message: "No running IDE with the UR extension detected. Run: ur ide config <editor>." });
|
|
354849
|
+
for (const warning of status.warnings) {
|
|
354850
|
+
checks4.push({ name: "warning", status: "warn", message: warning });
|
|
354851
|
+
}
|
|
354852
|
+
return checks4;
|
|
354853
|
+
}
|
|
354854
|
+
function formatIdeDoctor(status, json2 = false) {
|
|
354855
|
+
const checks4 = ideDoctorChecks(status);
|
|
354856
|
+
if (json2)
|
|
354857
|
+
return JSON.stringify({ ok: checks4.every((c4) => c4.status !== "fail"), checks: checks4 }, null, 2);
|
|
354858
|
+
const ok = checks4.every((c4) => c4.status !== "fail");
|
|
354859
|
+
return [
|
|
354860
|
+
`IDE doctor: ${ok ? "ready" : "not ready"}`,
|
|
354861
|
+
...checks4.map((c4) => ` ${c4.status.toUpperCase()} ${c4.name}: ${c4.message}`)
|
|
354862
|
+
].join(`
|
|
354863
|
+
`);
|
|
354864
|
+
}
|
|
354865
|
+
var IDE_TARGETS;
|
|
354866
|
+
var init_ideConfig = __esm(() => {
|
|
354867
|
+
IDE_TARGETS = [
|
|
354868
|
+
{ id: "vscode", label: "VS Code", kind: "native-extension" },
|
|
354869
|
+
{ id: "cursor", label: "Cursor", kind: "native-extension" },
|
|
354870
|
+
{ id: "windsurf", label: "Windsurf", kind: "native-extension" },
|
|
354871
|
+
{ id: "zed", label: "Zed", kind: "stdio-acp" },
|
|
354872
|
+
{ id: "jetbrains", label: "JetBrains IDEs", kind: "manual" },
|
|
354873
|
+
{ id: "neovim", label: "Neovim", kind: "stdio-acp" },
|
|
354874
|
+
{ id: "generic-acp", label: "Generic ACP client", kind: "stdio-acp" }
|
|
354875
|
+
];
|
|
354876
|
+
});
|
|
354877
|
+
|
|
354878
|
+
// src/commands/ide/ideInfoCommand.ts
|
|
354879
|
+
var exports_ideInfoCommand = {};
|
|
354880
|
+
__export(exports_ideInfoCommand, {
|
|
354881
|
+
runIdeInfoCommand: () => runIdeInfoCommand,
|
|
354882
|
+
collectIdeStatus: () => collectIdeStatus
|
|
354883
|
+
});
|
|
354884
|
+
function pluginCount() {
|
|
354885
|
+
try {
|
|
354886
|
+
return Object.keys(loadInstalledPluginsV2().plugins ?? {}).length;
|
|
354887
|
+
} catch {
|
|
354888
|
+
return 0;
|
|
354889
|
+
}
|
|
354890
|
+
}
|
|
354891
|
+
async function detectedIdeNames() {
|
|
354892
|
+
try {
|
|
354893
|
+
const ides = await detectRunningIDEs();
|
|
354894
|
+
return { names: ides.map(toIDEDisplayName) };
|
|
354895
|
+
} catch (error40) {
|
|
354896
|
+
return { names: [], warning: `IDE detection failed: ${error40 instanceof Error ? error40.message : String(error40)}` };
|
|
354897
|
+
}
|
|
354898
|
+
}
|
|
354899
|
+
async function collectIdeStatus(cwd2) {
|
|
354900
|
+
const port = getAcpServerPort();
|
|
354901
|
+
const runtime = getProviderRuntimeInfo();
|
|
354902
|
+
const detected = await detectedIdeNames();
|
|
354903
|
+
const warnings = [];
|
|
354904
|
+
if (detected.warning)
|
|
354905
|
+
warnings.push(detected.warning);
|
|
354906
|
+
if (!runtime.model)
|
|
354907
|
+
warnings.push("No model selected. Run /model or: ur config set model <model>.");
|
|
354908
|
+
return {
|
|
354909
|
+
workspaceRoot: cwd2,
|
|
354910
|
+
acp: { running: port !== null, port, host: "127.0.0.1" },
|
|
354911
|
+
provider: {
|
|
354912
|
+
label: runtime.providerLabel,
|
|
354913
|
+
model: runtime.model,
|
|
354914
|
+
runtimeBackend: runtime.runtimeBackend,
|
|
354915
|
+
authLabel: runtime.authLabel,
|
|
354916
|
+
ready: Boolean(runtime.model)
|
|
354917
|
+
},
|
|
354918
|
+
pluginCount: pluginCount(),
|
|
354919
|
+
detectedIdes: detected.names.map((name) => ({ name, connected: false })),
|
|
354920
|
+
warnings
|
|
354921
|
+
};
|
|
354922
|
+
}
|
|
354923
|
+
function usage2() {
|
|
354924
|
+
return [
|
|
354925
|
+
"Usage:",
|
|
354926
|
+
" ur ide status [--json]",
|
|
354927
|
+
" ur ide doctor [--json]",
|
|
354928
|
+
` ur ide config <${IDE_TARGETS.map((t) => t.id).join("|")}> [--json]`
|
|
354929
|
+
].join(`
|
|
354930
|
+
`);
|
|
354931
|
+
}
|
|
354932
|
+
async function runIdeInfoCommand(args, cwd2 = getCwd2()) {
|
|
354933
|
+
const tokens = parseArguments2(args);
|
|
354934
|
+
const json2 = tokens.includes("--json");
|
|
354935
|
+
const positional = tokens.filter((t) => !t.startsWith("--"));
|
|
354936
|
+
const action2 = positional[0] ?? "status";
|
|
354937
|
+
if (action2 === "status") {
|
|
354938
|
+
return formatIdeStatus(await collectIdeStatus(cwd2), json2);
|
|
354939
|
+
}
|
|
354940
|
+
if (action2 === "doctor") {
|
|
354941
|
+
return formatIdeDoctor(await collectIdeStatus(cwd2), json2);
|
|
354942
|
+
}
|
|
354943
|
+
if (action2 === "config") {
|
|
354944
|
+
const targetArg = positional[1];
|
|
354945
|
+
if (!targetArg) {
|
|
354946
|
+
return `Choose an IDE target: ${IDE_TARGETS.map((t) => t.id).join(", ")}
|
|
354947
|
+
${usage2()}`;
|
|
354948
|
+
}
|
|
354949
|
+
const target = resolveIdeTarget(targetArg);
|
|
354950
|
+
if (!target) {
|
|
354951
|
+
return `Unknown IDE "${targetArg}". Supported: ${IDE_TARGETS.map((t) => t.id).join(", ")}`;
|
|
354952
|
+
}
|
|
354953
|
+
return formatIdeConfig(generateIdeConfig(target.id), json2);
|
|
354954
|
+
}
|
|
354955
|
+
return usage2();
|
|
354956
|
+
}
|
|
354957
|
+
var init_ideInfoCommand = __esm(() => {
|
|
354958
|
+
init_acpServer();
|
|
354959
|
+
init_ideConfig();
|
|
354960
|
+
init_providerRegistry();
|
|
354961
|
+
init_argumentSubstitution();
|
|
354962
|
+
init_cwd2();
|
|
354963
|
+
init_ide();
|
|
354964
|
+
init_installedPluginsManager();
|
|
354965
|
+
});
|
|
354966
|
+
|
|
354160
354967
|
// src/commands/ide/ide.tsx
|
|
354161
354968
|
var exports_ide = {};
|
|
354162
354969
|
__export(exports_ide, {
|
|
@@ -354646,6 +355453,12 @@ async function call23(onDone, context4, args) {
|
|
|
354646
355453
|
onDone(await runIdeDiffCommand(trimmedArgs));
|
|
354647
355454
|
return null;
|
|
354648
355455
|
}
|
|
355456
|
+
const infoAction = trimmedArgs.split(/\s+/)[0];
|
|
355457
|
+
if (infoAction === "status" || infoAction === "doctor" || infoAction === "config") {
|
|
355458
|
+
const { runIdeInfoCommand: runIdeInfoCommand2 } = await Promise.resolve().then(() => (init_ideInfoCommand(), exports_ideInfoCommand));
|
|
355459
|
+
onDone(await runIdeInfoCommand2(trimmedArgs));
|
|
355460
|
+
return null;
|
|
355461
|
+
}
|
|
354649
355462
|
const {
|
|
354650
355463
|
options: {
|
|
354651
355464
|
dynamicMcpConfig
|
|
@@ -354698,7 +355511,7 @@ async function call23(onDone, context4, args) {
|
|
|
354698
355511
|
context4.onInstallIDEExtension(ide);
|
|
354699
355512
|
if (isJetBrainsIde(ide)) {
|
|
354700
355513
|
onDone(`Installed plugin to ${source_default.bold(toIDEDisplayName(ide))}
|
|
354701
|
-
|
|
355514
|
+
Please ${source_default.bold("restart your IDE")} completely for it to take effect`);
|
|
354702
355515
|
} else {
|
|
354703
355516
|
onDone(`Installed extension to ${source_default.bold(toIDEDisplayName(ide))}`);
|
|
354704
355517
|
}
|
|
@@ -354882,7 +355695,7 @@ var init_ide3 = __esm(() => {
|
|
|
354882
355695
|
type: "local-jsx",
|
|
354883
355696
|
name: "ide",
|
|
354884
355697
|
description: "Manage IDE integrations, status, and inline diff bundles",
|
|
354885
|
-
argumentHint: "[open|diff capture|diff list|diff show <id>]",
|
|
355698
|
+
argumentHint: "[open|status|doctor|config <editor>|diff capture|diff list|diff show <id>]",
|
|
354886
355699
|
load: () => Promise.resolve().then(() => (init_ide2(), exports_ide))
|
|
354887
355700
|
};
|
|
354888
355701
|
ide_default = ide;
|
|
@@ -363391,8 +364204,8 @@ async function loadInstallCountsCache() {
|
|
|
363391
364204
|
logForDebugging("Install counts cache has malformed entries");
|
|
363392
364205
|
return null;
|
|
363393
364206
|
}
|
|
363394
|
-
const
|
|
363395
|
-
if (
|
|
364207
|
+
const now7 = Date.now();
|
|
364208
|
+
if (now7 - fetchedAt > CACHE_TTL_MS3) {
|
|
363396
364209
|
logForDebugging("Install counts cache is stale (>24h old)");
|
|
363397
364210
|
return null;
|
|
363398
364211
|
}
|
|
@@ -367319,7 +368132,7 @@ function ManageMarketplaces({
|
|
|
367319
368132
|
}, undefined, true, undefined, this);
|
|
367320
368133
|
}
|
|
367321
368134
|
if (internalView === "confirm-remove" && selectedMarketplace) {
|
|
367322
|
-
const
|
|
368135
|
+
const pluginCount2 = selectedMarketplace.installedPlugins?.length || 0;
|
|
367323
368136
|
return /* @__PURE__ */ jsx_dev_runtime238.jsxDEV(ThemedBox_default, {
|
|
367324
368137
|
flexDirection: "column",
|
|
367325
368138
|
children: [
|
|
@@ -367338,15 +368151,15 @@ function ManageMarketplaces({
|
|
|
367338
368151
|
/* @__PURE__ */ jsx_dev_runtime238.jsxDEV(ThemedBox_default, {
|
|
367339
368152
|
flexDirection: "column",
|
|
367340
368153
|
children: [
|
|
367341
|
-
|
|
368154
|
+
pluginCount2 > 0 && /* @__PURE__ */ jsx_dev_runtime238.jsxDEV(ThemedBox_default, {
|
|
367342
368155
|
marginTop: 1,
|
|
367343
368156
|
children: /* @__PURE__ */ jsx_dev_runtime238.jsxDEV(ThemedText, {
|
|
367344
368157
|
color: "warning",
|
|
367345
368158
|
children: [
|
|
367346
368159
|
"This will also uninstall ",
|
|
367347
|
-
|
|
368160
|
+
pluginCount2,
|
|
367348
368161
|
" ",
|
|
367349
|
-
plural(
|
|
368162
|
+
plural(pluginCount2, "plugin"),
|
|
367350
368163
|
" from this marketplace:"
|
|
367351
368164
|
]
|
|
367352
368165
|
}, undefined, true, undefined, this)
|
|
@@ -367924,10 +368737,10 @@ async function writeToDisk(plugins) {
|
|
|
367924
368737
|
}
|
|
367925
368738
|
async function loadFlaggedPlugins() {
|
|
367926
368739
|
const all4 = await readFromDisk();
|
|
367927
|
-
const
|
|
368740
|
+
const now7 = Date.now();
|
|
367928
368741
|
let changed = false;
|
|
367929
368742
|
for (const [id, entry] of Object.entries(all4)) {
|
|
367930
|
-
if (entry.seenAt &&
|
|
368743
|
+
if (entry.seenAt && now7 - new Date(entry.seenAt).getTime() >= SEEN_EXPIRY_MS) {
|
|
367931
368744
|
delete all4[id];
|
|
367932
368745
|
changed = true;
|
|
367933
368746
|
}
|
|
@@ -367957,13 +368770,13 @@ async function markFlaggedPluginsSeen(pluginIds) {
|
|
|
367957
368770
|
if (cache4 === null) {
|
|
367958
368771
|
cache4 = await readFromDisk();
|
|
367959
368772
|
}
|
|
367960
|
-
const
|
|
368773
|
+
const now7 = new Date().toISOString();
|
|
367961
368774
|
let changed = false;
|
|
367962
368775
|
const updated = { ...cache4 };
|
|
367963
368776
|
for (const id of pluginIds) {
|
|
367964
368777
|
const entry = updated[id];
|
|
367965
368778
|
if (entry && !entry.seenAt) {
|
|
367966
|
-
updated[id] = { ...entry, seenAt:
|
|
368779
|
+
updated[id] = { ...entry, seenAt: now7 };
|
|
367967
368780
|
changed = true;
|
|
367968
368781
|
}
|
|
367969
368782
|
}
|
|
@@ -373591,7 +374404,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
373591
374404
|
return [];
|
|
373592
374405
|
}
|
|
373593
374406
|
}
|
|
373594
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.
|
|
374407
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.29.1") {
|
|
373595
374408
|
if (process.env.USER_TYPE === "ant") {
|
|
373596
374409
|
const changelog = "";
|
|
373597
374410
|
if (changelog) {
|
|
@@ -373618,7 +374431,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.28.1")
|
|
|
373618
374431
|
releaseNotes
|
|
373619
374432
|
};
|
|
373620
374433
|
}
|
|
373621
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.
|
|
374434
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.29.1") {
|
|
373622
374435
|
if (process.env.USER_TYPE === "ant") {
|
|
373623
374436
|
const changelog = "";
|
|
373624
374437
|
if (changelog) {
|
|
@@ -374788,7 +375601,7 @@ function getRecentActivitySync() {
|
|
|
374788
375601
|
return cachedActivity;
|
|
374789
375602
|
}
|
|
374790
375603
|
function getLogoDisplayData() {
|
|
374791
|
-
const version2 = process.env.DEMO_VERSION ?? "1.
|
|
375604
|
+
const version2 = process.env.DEMO_VERSION ?? "1.29.1";
|
|
374792
375605
|
const serverUrl = getDirectConnectServerUrl();
|
|
374793
375606
|
const displayPath = process.env.DEMO_VERSION ? "/code/ur" : getDisplayPath(getCwd2());
|
|
374794
375607
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -374808,13 +375621,13 @@ function formatModelAndBilling(modelName, billingType, availableWidth) {
|
|
|
374808
375621
|
if (shouldSplit) {
|
|
374809
375622
|
return {
|
|
374810
375623
|
shouldSplit: true,
|
|
374811
|
-
truncatedModel:
|
|
374812
|
-
truncatedBilling:
|
|
375624
|
+
truncatedModel: truncate2(modelName, availableWidth),
|
|
375625
|
+
truncatedBilling: truncate2(billingType, availableWidth)
|
|
374813
375626
|
};
|
|
374814
375627
|
}
|
|
374815
375628
|
return {
|
|
374816
375629
|
shouldSplit: false,
|
|
374817
|
-
truncatedModel:
|
|
375630
|
+
truncatedModel: truncate2(modelName, Math.max(availableWidth - stringWidth(billingType) - separator.length, 10)),
|
|
374818
375631
|
truncatedBilling: billingType
|
|
374819
375632
|
};
|
|
374820
375633
|
}
|
|
@@ -374985,8 +375798,8 @@ function checkCachedPassesEligibility() {
|
|
|
374985
375798
|
};
|
|
374986
375799
|
}
|
|
374987
375800
|
const { eligible: eligible2, timestamp } = cachedEntry;
|
|
374988
|
-
const
|
|
374989
|
-
const needsRefresh =
|
|
375801
|
+
const now7 = Date.now();
|
|
375802
|
+
const needsRefresh = now7 - timestamp > CACHE_EXPIRATION_MS;
|
|
374990
375803
|
return {
|
|
374991
375804
|
eligible: eligible2,
|
|
374992
375805
|
needsRefresh,
|
|
@@ -375060,13 +375873,13 @@ async function getCachedOrFetchPassesEligibility() {
|
|
|
375060
375873
|
}
|
|
375061
375874
|
const config3 = getGlobalConfig();
|
|
375062
375875
|
const cachedEntry = config3.passesEligibilityCache?.[orgId];
|
|
375063
|
-
const
|
|
375876
|
+
const now7 = Date.now();
|
|
375064
375877
|
if (!cachedEntry) {
|
|
375065
375878
|
logForDebugging("Passes: No cache, fetching eligibility in background (command unavailable this session)");
|
|
375066
375879
|
fetchAndStorePassesEligibility();
|
|
375067
375880
|
return null;
|
|
375068
375881
|
}
|
|
375069
|
-
if (
|
|
375882
|
+
if (now7 - cachedEntry.timestamp > CACHE_EXPIRATION_MS) {
|
|
375070
375883
|
logForDebugging("Passes: Cache stale, returning cached data and refreshing in background");
|
|
375071
375884
|
fetchAndStorePassesEligibility();
|
|
375072
375885
|
const { timestamp: timestamp2, ...response2 } = cachedEntry;
|
|
@@ -375254,7 +376067,7 @@ function CondensedLogo() {
|
|
|
375254
376067
|
}
|
|
375255
376068
|
import_react143.useEffect(t2, t3);
|
|
375256
376069
|
const textWidth = Math.max(columns - 15, 20);
|
|
375257
|
-
const truncatedVersion =
|
|
376070
|
+
const truncatedVersion = truncate2(version2, Math.max(textWidth - 13, 6));
|
|
375258
376071
|
const effortSuffix = getEffortSuffix(model, effortValue);
|
|
375259
376072
|
const {
|
|
375260
376073
|
shouldSplit,
|
|
@@ -375577,7 +376390,7 @@ function LogoV2() {
|
|
|
375577
376390
|
if ($3[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
375578
376391
|
t2 = () => {
|
|
375579
376392
|
const currentConfig = getGlobalConfig();
|
|
375580
|
-
if (currentConfig.lastReleaseNotesSeen === "1.
|
|
376393
|
+
if (currentConfig.lastReleaseNotesSeen === "1.29.1") {
|
|
375581
376394
|
return;
|
|
375582
376395
|
}
|
|
375583
376396
|
saveGlobalConfig(_temp326);
|
|
@@ -375654,7 +376467,7 @@ function LogoV2() {
|
|
|
375654
376467
|
const t9 = fullModelDisplayName + effortSuffix;
|
|
375655
376468
|
let t10;
|
|
375656
376469
|
if ($3[13] !== t9) {
|
|
375657
|
-
t10 =
|
|
376470
|
+
t10 = truncate2(t9, LEFT_PANEL_MAX_WIDTH - 20);
|
|
375658
376471
|
$3[13] = t9;
|
|
375659
376472
|
$3[14] = t10;
|
|
375660
376473
|
} else {
|
|
@@ -376262,12 +377075,12 @@ function LogoV2() {
|
|
|
376262
377075
|
return t41;
|
|
376263
377076
|
}
|
|
376264
377077
|
function _temp326(current) {
|
|
376265
|
-
if (current.lastReleaseNotesSeen === "1.
|
|
377078
|
+
if (current.lastReleaseNotesSeen === "1.29.1") {
|
|
376266
377079
|
return current;
|
|
376267
377080
|
}
|
|
376268
377081
|
return {
|
|
376269
377082
|
...current,
|
|
376270
|
-
lastReleaseNotesSeen: "1.
|
|
377083
|
+
lastReleaseNotesSeen: "1.29.1"
|
|
376271
377084
|
};
|
|
376272
377085
|
}
|
|
376273
377086
|
function _temp243(s_0) {
|
|
@@ -385054,7 +385867,7 @@ function BackgroundTask(t0) {
|
|
|
385054
385867
|
const t1 = task.kind === "monitor" ? task.description : task.command;
|
|
385055
385868
|
let t2;
|
|
385056
385869
|
if ($3[0] !== activityLimit || $3[1] !== t1) {
|
|
385057
|
-
t2 =
|
|
385870
|
+
t2 = truncate2(t1, activityLimit, true);
|
|
385058
385871
|
$3[0] = activityLimit;
|
|
385059
385872
|
$3[1] = t1;
|
|
385060
385873
|
$3[2] = t2;
|
|
@@ -385122,7 +385935,7 @@ function BackgroundTask(t0) {
|
|
|
385122
385935
|
}
|
|
385123
385936
|
let t3;
|
|
385124
385937
|
if ($3[12] !== activityLimit || $3[13] !== task.title) {
|
|
385125
|
-
t3 =
|
|
385938
|
+
t3 = truncate2(task.title, activityLimit, true);
|
|
385126
385939
|
$3[12] = activityLimit;
|
|
385127
385940
|
$3[13] = task.title;
|
|
385128
385941
|
$3[14] = t3;
|
|
@@ -385171,7 +385984,7 @@ function BackgroundTask(t0) {
|
|
|
385171
385984
|
case "local_agent": {
|
|
385172
385985
|
let t1;
|
|
385173
385986
|
if ($3[22] !== activityLimit || $3[23] !== task.description) {
|
|
385174
|
-
t1 =
|
|
385987
|
+
t1 = truncate2(task.description, activityLimit, true);
|
|
385175
385988
|
$3[22] = activityLimit;
|
|
385176
385989
|
$3[23] = task.description;
|
|
385177
385990
|
$3[24] = t1;
|
|
@@ -385246,7 +386059,7 @@ function BackgroundTask(t0) {
|
|
|
385246
386059
|
T0 = ThemedText;
|
|
385247
386060
|
t1 = true;
|
|
385248
386061
|
t2 = ": ";
|
|
385249
|
-
t3 =
|
|
386062
|
+
t3 = truncate2(activity, activityLimit, true);
|
|
385250
386063
|
$3[32] = activityLimit;
|
|
385251
386064
|
$3[33] = task;
|
|
385252
386065
|
$3[34] = T0;
|
|
@@ -385301,7 +386114,7 @@ function BackgroundTask(t0) {
|
|
|
385301
386114
|
const t1 = task.workflowName ?? task.summary ?? task.description;
|
|
385302
386115
|
let t2;
|
|
385303
386116
|
if ($3[54] !== activityLimit || $3[55] !== t1) {
|
|
385304
|
-
t2 =
|
|
386117
|
+
t2 = truncate2(t1, activityLimit, true);
|
|
385305
386118
|
$3[54] = activityLimit;
|
|
385306
386119
|
$3[55] = t1;
|
|
385307
386120
|
$3[56] = t2;
|
|
@@ -385352,7 +386165,7 @@ function BackgroundTask(t0) {
|
|
|
385352
386165
|
case "monitor_mcp": {
|
|
385353
386166
|
let t1;
|
|
385354
386167
|
if ($3[67] !== activityLimit || $3[68] !== task.description) {
|
|
385355
|
-
t1 =
|
|
386168
|
+
t1 = truncate2(task.description, activityLimit, true);
|
|
385356
386169
|
$3[67] = activityLimit;
|
|
385357
386170
|
$3[68] = task.description;
|
|
385358
386171
|
$3[69] = t1;
|
|
@@ -386230,7 +387043,7 @@ var init_InProcessTeammateDetailDialog = __esm(() => {
|
|
|
386230
387043
|
});
|
|
386231
387044
|
|
|
386232
387045
|
// src/utils/messages/mappers.ts
|
|
386233
|
-
import { randomUUID as
|
|
387046
|
+
import { randomUUID as randomUUID35 } from "crypto";
|
|
386234
387047
|
function toInternalMessages(messages) {
|
|
386235
387048
|
return messages.flatMap((message) => {
|
|
386236
387049
|
switch (message.type) {
|
|
@@ -386249,7 +387062,7 @@ function toInternalMessages(messages) {
|
|
|
386249
387062
|
{
|
|
386250
387063
|
type: "user",
|
|
386251
387064
|
message: message.message,
|
|
386252
|
-
uuid: message.uuid ??
|
|
387065
|
+
uuid: message.uuid ?? randomUUID35(),
|
|
386253
387066
|
timestamp: message.timestamp ?? new Date().toISOString(),
|
|
386254
387067
|
isMeta: message.isSynthetic
|
|
386255
387068
|
}
|
|
@@ -393022,7 +393835,7 @@ function positionals3(tokens) {
|
|
|
393022
393835
|
}
|
|
393023
393836
|
return values2;
|
|
393024
393837
|
}
|
|
393025
|
-
function
|
|
393838
|
+
function usage3() {
|
|
393026
393839
|
return [
|
|
393027
393840
|
"Usage:",
|
|
393028
393841
|
' ur bg run "<task>" [--worktree] [--pr] [--title "..."] [--body "..."] [--base main] [--model m] [--route auto|cheap|strong|default] [--max-turns N] [--skip-permissions] [--dry-run] [--json]',
|
|
@@ -393066,7 +393879,7 @@ var call55 = async (args) => {
|
|
|
393066
393879
|
if (action3 === "run") {
|
|
393067
393880
|
const task = pos.slice(1).join(" ").trim();
|
|
393068
393881
|
if (!task)
|
|
393069
|
-
return { type: "text", value:
|
|
393882
|
+
return { type: "text", value: usage3() };
|
|
393070
393883
|
const options2 = startOptions(tokens, task);
|
|
393071
393884
|
if (options2.offline && isNetworkRestricted2()) {
|
|
393072
393885
|
return { type: "text", value: "Background task is already running in offline/local-first mode." };
|
|
@@ -393087,7 +393900,7 @@ Log: ${result.task.logFile}`
|
|
|
393087
393900
|
if (action3 === "fanout") {
|
|
393088
393901
|
const task = pos.slice(1).join(" ").trim();
|
|
393089
393902
|
if (!task)
|
|
393090
|
-
return { type: "text", value:
|
|
393903
|
+
return { type: "text", value: usage3() };
|
|
393091
393904
|
const results = await fanoutBackgroundTasks({
|
|
393092
393905
|
...startOptions(tokens, task),
|
|
393093
393906
|
agents: numberOption(tokens, "--agents") ?? 3
|
|
@@ -393102,7 +393915,7 @@ Log: ${result.task.logFile}`
|
|
|
393102
393915
|
}
|
|
393103
393916
|
const id = pos[1];
|
|
393104
393917
|
if (!id)
|
|
393105
|
-
return { type: "text", value:
|
|
393918
|
+
return { type: "text", value: usage3() };
|
|
393106
393919
|
if (action3 === "status" || action3 === "show") {
|
|
393107
393920
|
const task = getBackgroundTask(cwd2, id);
|
|
393108
393921
|
if (!task)
|
|
@@ -393121,7 +393934,7 @@ Log: ${result.task.logFile}`
|
|
|
393121
393934
|
const task = await runBackgroundWorker(cwd2, id);
|
|
393122
393935
|
return { type: "text", value: json2 ? JSON.stringify(task, null, 2) : formatBackgroundTask(task) };
|
|
393123
393936
|
}
|
|
393124
|
-
return { type: "text", value:
|
|
393937
|
+
return { type: "text", value: usage3() };
|
|
393125
393938
|
};
|
|
393126
393939
|
var init_bg = __esm(() => {
|
|
393127
393940
|
init_argumentSubstitution();
|
|
@@ -393178,413 +393991,6 @@ var init_a2a_card2 = __esm(() => {
|
|
|
393178
393991
|
a2a_card_default = a2aCard;
|
|
393179
393992
|
});
|
|
393180
393993
|
|
|
393181
|
-
// src/services/agents/acpServer.ts
|
|
393182
|
-
var exports_acpServer = {};
|
|
393183
|
-
__export(exports_acpServer, {
|
|
393184
|
-
stopAcpServer: () => stopAcpServer,
|
|
393185
|
-
serveAcp: () => serveAcp,
|
|
393186
|
-
handleAcpRequest: () => handleAcpRequest,
|
|
393187
|
-
getAcpServerPort: () => getAcpServerPort
|
|
393188
|
-
});
|
|
393189
|
-
import { randomUUID as randomUUID35 } from "crypto";
|
|
393190
|
-
function jsonResponse2(status2, body) {
|
|
393191
|
-
return new Response(JSON.stringify(body, null, 2), {
|
|
393192
|
-
status: status2,
|
|
393193
|
-
headers: { "content-type": "application/json" }
|
|
393194
|
-
});
|
|
393195
|
-
}
|
|
393196
|
-
function rpcResponse(id, result, error40) {
|
|
393197
|
-
if (error40) {
|
|
393198
|
-
return { jsonrpc: "2.0", id, error: error40 };
|
|
393199
|
-
}
|
|
393200
|
-
return { jsonrpc: "2.0", id, result };
|
|
393201
|
-
}
|
|
393202
|
-
function rpcError(id, code, message, data) {
|
|
393203
|
-
return { jsonrpc: "2.0", id, error: { code, message, data } };
|
|
393204
|
-
}
|
|
393205
|
-
function createAcpId() {
|
|
393206
|
-
return `acp_${Date.now().toString(36)}_${randomUUID35().slice(0, 8)}`;
|
|
393207
|
-
}
|
|
393208
|
-
function now6() {
|
|
393209
|
-
return new Date().toISOString();
|
|
393210
|
-
}
|
|
393211
|
-
function isLoopback2(host) {
|
|
393212
|
-
return host === "127.0.0.1" || host === "localhost" || host === "::1";
|
|
393213
|
-
}
|
|
393214
|
-
function authorizeAcp(request, options2) {
|
|
393215
|
-
return authorizeRequest(request, { token: options2.token });
|
|
393216
|
-
}
|
|
393217
|
-
function mapBackgroundStatus2(status2) {
|
|
393218
|
-
switch (status2) {
|
|
393219
|
-
case "queued":
|
|
393220
|
-
return "submitted";
|
|
393221
|
-
case "running":
|
|
393222
|
-
return "working";
|
|
393223
|
-
case "completed":
|
|
393224
|
-
return "completed";
|
|
393225
|
-
case "failed":
|
|
393226
|
-
return "failed";
|
|
393227
|
-
case "canceled":
|
|
393228
|
-
return "canceled";
|
|
393229
|
-
}
|
|
393230
|
-
}
|
|
393231
|
-
function buildToolUseContext(tools, readFileStateCache) {
|
|
393232
|
-
return {
|
|
393233
|
-
abortController: createAbortController(),
|
|
393234
|
-
options: {
|
|
393235
|
-
commands: MCP_COMMANDS,
|
|
393236
|
-
tools,
|
|
393237
|
-
mainLoopModel: getMainLoopModel(),
|
|
393238
|
-
thinkingConfig: { type: "disabled" },
|
|
393239
|
-
mcpClients: [],
|
|
393240
|
-
mcpResources: {},
|
|
393241
|
-
isNonInteractiveSession: true,
|
|
393242
|
-
debug: false,
|
|
393243
|
-
verbose: false,
|
|
393244
|
-
agentDefinitions: { activeAgents: [], allAgents: [] }
|
|
393245
|
-
},
|
|
393246
|
-
getAppState: () => getDefaultAppState(),
|
|
393247
|
-
setAppState: () => {},
|
|
393248
|
-
messages: [],
|
|
393249
|
-
readFileState: readFileStateCache,
|
|
393250
|
-
setInProgressToolUseIDs: () => {},
|
|
393251
|
-
setResponseLength: () => {},
|
|
393252
|
-
updateFileHistoryState: () => {},
|
|
393253
|
-
updateAttributionState: () => {}
|
|
393254
|
-
};
|
|
393255
|
-
}
|
|
393256
|
-
async function handleInitialize() {
|
|
393257
|
-
return {
|
|
393258
|
-
name: "ur-agent",
|
|
393259
|
-
version: "1.28.1",
|
|
393260
|
-
protocolVersion: "0.1.0"
|
|
393261
|
-
};
|
|
393262
|
-
}
|
|
393263
|
-
async function handleToolsList() {
|
|
393264
|
-
const toolPermissionContext = getEmptyToolPermissionContext();
|
|
393265
|
-
const tools = getTools(toolPermissionContext);
|
|
393266
|
-
return {
|
|
393267
|
-
tools: tools.filter((tool) => tool.isEnabled()).map((tool) => ({
|
|
393268
|
-
name: tool.name,
|
|
393269
|
-
description: tool.searchHint ?? tool.name,
|
|
393270
|
-
inputSchema: zodToJsonSchema3(tool.inputSchema)
|
|
393271
|
-
}))
|
|
393272
|
-
};
|
|
393273
|
-
}
|
|
393274
|
-
async function handleToolsCall(params, options2) {
|
|
393275
|
-
const name = typeof params?.name === "string" ? params.name : "";
|
|
393276
|
-
const args = params?.arguments ?? {};
|
|
393277
|
-
if (!name) {
|
|
393278
|
-
throw new Error("missing tool name");
|
|
393279
|
-
}
|
|
393280
|
-
const toolPermissionContext = getEmptyToolPermissionContext();
|
|
393281
|
-
const readFileStateCache = createFileStateCacheWithSizeLimit(100, 25 * 1024 * 1024);
|
|
393282
|
-
const tools = getTools(toolPermissionContext);
|
|
393283
|
-
const tool = findToolByName(tools, name);
|
|
393284
|
-
if (!tool) {
|
|
393285
|
-
throw new Error(`tool not found: ${name}`);
|
|
393286
|
-
}
|
|
393287
|
-
if (!tool.isEnabled()) {
|
|
393288
|
-
throw new Error(`tool not enabled: ${name}`);
|
|
393289
|
-
}
|
|
393290
|
-
const context4 = buildToolUseContext(tools, readFileStateCache);
|
|
393291
|
-
const validationResult = await tool.validateInput?.(args, context4);
|
|
393292
|
-
if (validationResult?.result === false) {
|
|
393293
|
-
throw new Error(`invalid input: ${validationResult.message}`);
|
|
393294
|
-
}
|
|
393295
|
-
const result = await tool.call(args, context4, hasPermissionsToUseTool, createAssistantMessage({ content: [] }));
|
|
393296
|
-
return { result: result.data };
|
|
393297
|
-
}
|
|
393298
|
-
async function handleIdeDiffCapture(params, options2) {
|
|
393299
|
-
const result = await createIdeDiffBundle(options2.cwd, {
|
|
393300
|
-
title: typeof params?.title === "string" ? params.title : undefined,
|
|
393301
|
-
baseRef: typeof params?.baseRef === "string" ? params.baseRef : undefined,
|
|
393302
|
-
staged: params?.staged === true,
|
|
393303
|
-
diff: typeof params?.diff === "string" ? params.diff : undefined
|
|
393304
|
-
});
|
|
393305
|
-
if (result.error) {
|
|
393306
|
-
throw new Error(result.error);
|
|
393307
|
-
}
|
|
393308
|
-
return {
|
|
393309
|
-
bundle: result.bundle,
|
|
393310
|
-
command: result.command,
|
|
393311
|
-
empty: !result.bundle
|
|
393312
|
-
};
|
|
393313
|
-
}
|
|
393314
|
-
async function handleIdeSelect(params, options2) {
|
|
393315
|
-
const id = typeof params?.id === "string" ? params.id : "";
|
|
393316
|
-
if (!id) {
|
|
393317
|
-
throw new Error("missing diff id");
|
|
393318
|
-
}
|
|
393319
|
-
const bundle = getIdeDiffBundle(options2.cwd, id);
|
|
393320
|
-
if (!bundle) {
|
|
393321
|
-
throw new Error("IDE diff not found");
|
|
393322
|
-
}
|
|
393323
|
-
return { bundle, patch: readIdeDiffPatch(options2.cwd, id) };
|
|
393324
|
-
}
|
|
393325
|
-
function headlessCommand2(prompt) {
|
|
393326
|
-
return [
|
|
393327
|
-
process.execPath,
|
|
393328
|
-
process.argv[1] ?? "",
|
|
393329
|
-
"-p",
|
|
393330
|
-
"--output-format",
|
|
393331
|
-
"json",
|
|
393332
|
-
prompt
|
|
393333
|
-
];
|
|
393334
|
-
}
|
|
393335
|
-
async function runSynchronousTask2(options2, prompt) {
|
|
393336
|
-
const command5 = headlessCommand2(prompt);
|
|
393337
|
-
const createdAt = now6();
|
|
393338
|
-
const record3 = {
|
|
393339
|
-
id: createAcpId(),
|
|
393340
|
-
prompt,
|
|
393341
|
-
status: "working",
|
|
393342
|
-
mode: "sync",
|
|
393343
|
-
createdAt,
|
|
393344
|
-
updatedAt: createdAt
|
|
393345
|
-
};
|
|
393346
|
-
if (options2.dryRun) {
|
|
393347
|
-
record3.status = "completed";
|
|
393348
|
-
record3.result = { dryRun: true, command: command5 };
|
|
393349
|
-
return record3;
|
|
393350
|
-
}
|
|
393351
|
-
const result = await execFileNoThrowWithCwd(command5[0], command5.slice(1), {
|
|
393352
|
-
cwd: options2.cwd,
|
|
393353
|
-
timeout: 30 * 60 * 1000,
|
|
393354
|
-
preserveOutputOnError: true
|
|
393355
|
-
});
|
|
393356
|
-
record3.updatedAt = now6();
|
|
393357
|
-
record3.status = result.code === 0 ? "completed" : "failed";
|
|
393358
|
-
record3.result = {
|
|
393359
|
-
code: result.code,
|
|
393360
|
-
stdout: result.stdout,
|
|
393361
|
-
stderr: result.stderr || result.error
|
|
393362
|
-
};
|
|
393363
|
-
return record3;
|
|
393364
|
-
}
|
|
393365
|
-
function rememberTask(task) {
|
|
393366
|
-
acpTasks.set(task.id, task);
|
|
393367
|
-
return task;
|
|
393368
|
-
}
|
|
393369
|
-
async function startAsynchronousTask2(options2, prompt) {
|
|
393370
|
-
const background = await startBackgroundTask({
|
|
393371
|
-
cwd: options2.cwd,
|
|
393372
|
-
task: `ACP delegated task: ${prompt}`,
|
|
393373
|
-
dryRun: options2.dryRun
|
|
393374
|
-
});
|
|
393375
|
-
const createdAt = now6();
|
|
393376
|
-
return {
|
|
393377
|
-
id: createAcpId(),
|
|
393378
|
-
prompt,
|
|
393379
|
-
backgroundTaskId: background.task.id,
|
|
393380
|
-
status: options2.dryRun ? "submitted" : mapBackgroundStatus2(background.task.status),
|
|
393381
|
-
mode: "async",
|
|
393382
|
-
createdAt,
|
|
393383
|
-
updatedAt: createdAt,
|
|
393384
|
-
result: options2.dryRun ? { dryRun: true, command: background.command } : undefined
|
|
393385
|
-
};
|
|
393386
|
-
}
|
|
393387
|
-
async function handleTasksSend(params, options2) {
|
|
393388
|
-
const prompt = typeof params?.prompt === "string" ? params.prompt : "";
|
|
393389
|
-
if (!prompt.trim()) {
|
|
393390
|
-
throw new Error("missing prompt");
|
|
393391
|
-
}
|
|
393392
|
-
const mode = params?.mode === "sync" ? "sync" : "async";
|
|
393393
|
-
if (mode === "sync") {
|
|
393394
|
-
const task2 = await runSynchronousTask2(options2, prompt);
|
|
393395
|
-
return { task: rememberTask(task2) };
|
|
393396
|
-
}
|
|
393397
|
-
const task = rememberTask(await startAsynchronousTask2(options2, prompt));
|
|
393398
|
-
return { task, statusUrl: `/acp/tasks/${encodeURIComponent(task.id)}` };
|
|
393399
|
-
}
|
|
393400
|
-
function hydrateTask(cwd2, record3) {
|
|
393401
|
-
if (!record3.backgroundTaskId)
|
|
393402
|
-
return record3;
|
|
393403
|
-
const background = getBackgroundTask(cwd2, record3.backgroundTaskId);
|
|
393404
|
-
if (!background) {
|
|
393405
|
-
return {
|
|
393406
|
-
...record3,
|
|
393407
|
-
status: record3.status === "canceled" ? "canceled" : "failed",
|
|
393408
|
-
error: record3.error ?? `background task not found: ${record3.backgroundTaskId}`
|
|
393409
|
-
};
|
|
393410
|
-
}
|
|
393411
|
-
return {
|
|
393412
|
-
...record3,
|
|
393413
|
-
status: mapBackgroundStatus2(background.status),
|
|
393414
|
-
updatedAt: background.updatedAt,
|
|
393415
|
-
result: {
|
|
393416
|
-
...typeof record3.result === "object" && record3.result !== null ? record3.result : {},
|
|
393417
|
-
exitCode: background.exitCode
|
|
393418
|
-
}
|
|
393419
|
-
};
|
|
393420
|
-
}
|
|
393421
|
-
function listTasks3(options2) {
|
|
393422
|
-
const knownBackgroundIds = new Set([...acpTasks.values()].map((task) => task.backgroundTaskId).filter((id) => typeof id === "string"));
|
|
393423
|
-
const persisted = listBackgroundTasks(options2.cwd).filter((bg2) => bg2.task.startsWith("ACP delegated task:")).filter((bg2) => !knownBackgroundIds.has(bg2.id)).map((bg2) => {
|
|
393424
|
-
const createdAt = bg2.createdAt ?? now6();
|
|
393425
|
-
return hydrateTask(options2.cwd, {
|
|
393426
|
-
id: createAcpId(),
|
|
393427
|
-
prompt: bg2.task.replace(/^ACP delegated task:\s*/u, ""),
|
|
393428
|
-
backgroundTaskId: bg2.id,
|
|
393429
|
-
status: mapBackgroundStatus2(bg2.status),
|
|
393430
|
-
mode: "async",
|
|
393431
|
-
createdAt,
|
|
393432
|
-
updatedAt: bg2.updatedAt ?? createdAt
|
|
393433
|
-
});
|
|
393434
|
-
});
|
|
393435
|
-
return [
|
|
393436
|
-
...[...acpTasks.values()].map((task) => hydrateTask(options2.cwd, task)),
|
|
393437
|
-
...persisted
|
|
393438
|
-
].sort((a2, b) => b.createdAt.localeCompare(a2.createdAt));
|
|
393439
|
-
}
|
|
393440
|
-
async function handleTasksGet(params, options2) {
|
|
393441
|
-
const id = typeof params?.id === "string" ? params.id : "";
|
|
393442
|
-
const tasks2 = listTasks3(options2);
|
|
393443
|
-
if (!id) {
|
|
393444
|
-
return { tasks: tasks2 };
|
|
393445
|
-
}
|
|
393446
|
-
const task = tasks2.find((t) => t.id === id);
|
|
393447
|
-
if (!task) {
|
|
393448
|
-
throw new Error("task not found");
|
|
393449
|
-
}
|
|
393450
|
-
const log = task.backgroundTaskId ? readBackgroundLog(options2.cwd, task.backgroundTaskId) : null;
|
|
393451
|
-
return { task, log };
|
|
393452
|
-
}
|
|
393453
|
-
async function handleTasksCancel(params, options2) {
|
|
393454
|
-
const id = typeof params?.id === "string" ? params.id : "";
|
|
393455
|
-
const task = listTasks3(options2).find((t) => t.id === id);
|
|
393456
|
-
if (!task) {
|
|
393457
|
-
throw new Error("task not found");
|
|
393458
|
-
}
|
|
393459
|
-
if (task.backgroundTaskId) {
|
|
393460
|
-
stopBackgroundTask(options2.cwd, task.backgroundTaskId);
|
|
393461
|
-
}
|
|
393462
|
-
const canceled = { ...task, status: "canceled", updatedAt: now6() };
|
|
393463
|
-
acpTasks.set(canceled.id, canceled);
|
|
393464
|
-
return { task: canceled };
|
|
393465
|
-
}
|
|
393466
|
-
async function dispatchMethod(method, params, options2) {
|
|
393467
|
-
switch (method) {
|
|
393468
|
-
case "initialize":
|
|
393469
|
-
return handleInitialize();
|
|
393470
|
-
case "tools/list":
|
|
393471
|
-
return handleToolsList();
|
|
393472
|
-
case "tools/call":
|
|
393473
|
-
return handleToolsCall(params, options2);
|
|
393474
|
-
case "tasks/send":
|
|
393475
|
-
return handleTasksSend(params, options2);
|
|
393476
|
-
case "tasks/get":
|
|
393477
|
-
return handleTasksGet(params, options2);
|
|
393478
|
-
case "tasks/cancel":
|
|
393479
|
-
return handleTasksCancel(params, options2);
|
|
393480
|
-
case "ide/diffCapture":
|
|
393481
|
-
return handleIdeDiffCapture(params, options2);
|
|
393482
|
-
case "ide/select":
|
|
393483
|
-
return handleIdeSelect(params, options2);
|
|
393484
|
-
case "shutdown":
|
|
393485
|
-
return {};
|
|
393486
|
-
default:
|
|
393487
|
-
throw new Error(`unknown method: ${method}`);
|
|
393488
|
-
}
|
|
393489
|
-
}
|
|
393490
|
-
async function handleAcpRequest(request, options2) {
|
|
393491
|
-
const url3 = new URL(request.url);
|
|
393492
|
-
if (request.method === "GET" && url3.pathname === "/healthz") {
|
|
393493
|
-
return jsonResponse2(200, rpcResponse(null, { ok: true }));
|
|
393494
|
-
}
|
|
393495
|
-
if (url3.pathname !== "/acp") {
|
|
393496
|
-
return jsonResponse2(404, { error: "not found" });
|
|
393497
|
-
}
|
|
393498
|
-
const auth2 = authorizeAcp(request, options2);
|
|
393499
|
-
if (!auth2.ok) {
|
|
393500
|
-
return jsonResponse2(401, rpcError(null, -32001, auth2.reason ?? "unauthorized"));
|
|
393501
|
-
}
|
|
393502
|
-
let body = null;
|
|
393503
|
-
try {
|
|
393504
|
-
body = await request.json();
|
|
393505
|
-
} catch {
|
|
393506
|
-
return jsonResponse2(400, rpcError(null, -32700, "parse error"));
|
|
393507
|
-
}
|
|
393508
|
-
const id = body?.id ?? null;
|
|
393509
|
-
const method = body?.method;
|
|
393510
|
-
if (typeof method !== "string") {
|
|
393511
|
-
return jsonResponse2(400, rpcError(id, -32600, "invalid request"));
|
|
393512
|
-
}
|
|
393513
|
-
try {
|
|
393514
|
-
const result = await dispatchMethod(method, body.params, options2);
|
|
393515
|
-
return jsonResponse2(200, rpcResponse(id, result));
|
|
393516
|
-
} catch (error40) {
|
|
393517
|
-
logError2(error40);
|
|
393518
|
-
const message = error40 instanceof Error ? error40.message : String(error40);
|
|
393519
|
-
return jsonResponse2(500, rpcError(id, -32603, message));
|
|
393520
|
-
}
|
|
393521
|
-
}
|
|
393522
|
-
function getAcpServerPort() {
|
|
393523
|
-
return acpServer?.port ?? null;
|
|
393524
|
-
}
|
|
393525
|
-
async function stopAcpServer() {
|
|
393526
|
-
if (acpServer) {
|
|
393527
|
-
acpServer.stop();
|
|
393528
|
-
acpServer = null;
|
|
393529
|
-
}
|
|
393530
|
-
acpTasks.clear();
|
|
393531
|
-
}
|
|
393532
|
-
function pickFallbackPort() {
|
|
393533
|
-
return 49152 + Math.floor(Math.random() * 16384);
|
|
393534
|
-
}
|
|
393535
|
-
function startAcpHttpServer(options2) {
|
|
393536
|
-
const ports = options2.port === 0 ? [0, ...Array.from({ length: 10 }, () => pickFallbackPort())] : [options2.port];
|
|
393537
|
-
let lastError;
|
|
393538
|
-
for (const port of ports) {
|
|
393539
|
-
try {
|
|
393540
|
-
return Bun.serve({
|
|
393541
|
-
hostname: options2.host,
|
|
393542
|
-
port,
|
|
393543
|
-
fetch: (request) => handleAcpRequest(request, options2)
|
|
393544
|
-
});
|
|
393545
|
-
} catch (error40) {
|
|
393546
|
-
lastError = error40;
|
|
393547
|
-
if (options2.port !== 0 || getErrnoCode(error40) !== "EADDRINUSE") {
|
|
393548
|
-
throw error40;
|
|
393549
|
-
}
|
|
393550
|
-
}
|
|
393551
|
-
}
|
|
393552
|
-
throw lastError;
|
|
393553
|
-
}
|
|
393554
|
-
async function serveAcp(options2) {
|
|
393555
|
-
if (!isLoopback2(options2.host) && !options2.token) {
|
|
393556
|
-
throw new Error("Refusing to bind ACP server off-loopback without --token");
|
|
393557
|
-
}
|
|
393558
|
-
if (typeof Bun === "undefined" || typeof Bun.serve !== "function") {
|
|
393559
|
-
throw new Error("ACP server requires the Bun runtime");
|
|
393560
|
-
}
|
|
393561
|
-
await stopAcpServer();
|
|
393562
|
-
acpTasks.clear();
|
|
393563
|
-
acpServer = startAcpHttpServer(options2);
|
|
393564
|
-
console.log(`ACP server listening on http://${options2.host}:${acpServer.port}`);
|
|
393565
|
-
await new Promise(() => {});
|
|
393566
|
-
}
|
|
393567
|
-
var MCP_COMMANDS, acpTasks, acpServer = null;
|
|
393568
|
-
var init_acpServer = __esm(() => {
|
|
393569
|
-
init_AppStateStore();
|
|
393570
|
-
init_Tool();
|
|
393571
|
-
init_messages();
|
|
393572
|
-
init_permissions2();
|
|
393573
|
-
init_tools2();
|
|
393574
|
-
init_abortController();
|
|
393575
|
-
init_fileStateCache();
|
|
393576
|
-
init_execFileNoThrow();
|
|
393577
|
-
init_errors();
|
|
393578
|
-
init_model();
|
|
393579
|
-
init_log2();
|
|
393580
|
-
init_zodToJsonSchema2();
|
|
393581
|
-
init_ideDiffs();
|
|
393582
|
-
init_backgroundRunner();
|
|
393583
|
-
init_a2aServer();
|
|
393584
|
-
MCP_COMMANDS = [];
|
|
393585
|
-
acpTasks = new Map;
|
|
393586
|
-
});
|
|
393587
|
-
|
|
393588
393994
|
// src/commands/acp/acp.tsx
|
|
393589
393995
|
var exports_acp = {};
|
|
393590
393996
|
__export(exports_acp, {
|
|
@@ -393613,7 +394019,7 @@ function positionals4(tokens) {
|
|
|
393613
394019
|
}
|
|
393614
394020
|
return values2;
|
|
393615
394021
|
}
|
|
393616
|
-
function
|
|
394022
|
+
function usage4() {
|
|
393617
394023
|
return [
|
|
393618
394024
|
"Usage:",
|
|
393619
394025
|
" ur acp serve [--host 127.0.0.1] [--port 8123] [--token <secret>] [--dry-run]",
|
|
@@ -393646,7 +394052,7 @@ var call57 = async (args) => {
|
|
|
393646
394052
|
value: json2 ? JSON.stringify(result, null, 2) : `ACP server: ${result.running ? `running on port ${result.port}` : "not running"}`
|
|
393647
394053
|
};
|
|
393648
394054
|
}
|
|
393649
|
-
return { type: "text", value:
|
|
394055
|
+
return { type: "text", value: usage4() };
|
|
393650
394056
|
};
|
|
393651
394057
|
var init_acp = __esm(() => {
|
|
393652
394058
|
init_argumentSubstitution();
|
|
@@ -394085,7 +394491,7 @@ async function runDueAutomations(options2 = {}) {
|
|
|
394085
394491
|
const results = await Promise.all(specs.map((spec) => runSpec(spec, { dryRun: options2.dryRun ?? false, dueOnly: true, nowMs })));
|
|
394086
394492
|
return results.filter((result) => !result.skipped);
|
|
394087
394493
|
}
|
|
394088
|
-
function
|
|
394494
|
+
function usage5() {
|
|
394089
394495
|
return [
|
|
394090
394496
|
"Usage:",
|
|
394091
394497
|
" ur automation list [--json]",
|
|
@@ -394170,7 +394576,7 @@ var call58 = async (args) => {
|
|
|
394170
394576
|
const schedule = option5(tokens, "--schedule");
|
|
394171
394577
|
const prompt = option5(tokens, "--prompt");
|
|
394172
394578
|
if (!name || !schedule || !prompt) {
|
|
394173
|
-
return { type: "text", value:
|
|
394579
|
+
return { type: "text", value: usage5() };
|
|
394174
394580
|
}
|
|
394175
394581
|
if (!parseCronExpression(schedule) || nextCronRunMs(schedule, Date.now()) === null) {
|
|
394176
394582
|
return {
|
|
@@ -394201,7 +394607,7 @@ Expected a 5-field cron expression with a next run in the next year.`
|
|
|
394201
394607
|
if (command5 === "show") {
|
|
394202
394608
|
const name = positional[1];
|
|
394203
394609
|
if (!name)
|
|
394204
|
-
return { type: "text", value:
|
|
394610
|
+
return { type: "text", value: usage5() };
|
|
394205
394611
|
const path22 = automationPath(name);
|
|
394206
394612
|
if (!existsSync24(path22)) {
|
|
394207
394613
|
return { type: "text", value: `Automation not found: ${sanitizeName2(name)}` };
|
|
@@ -394219,7 +394625,7 @@ Expected a 5-field cron expression with a next run in the next year.`
|
|
|
394219
394625
|
if (command5 === "enable" || command5 === "disable") {
|
|
394220
394626
|
const name = positional[1];
|
|
394221
394627
|
if (!name)
|
|
394222
|
-
return { type: "text", value:
|
|
394628
|
+
return { type: "text", value: usage5() };
|
|
394223
394629
|
const path22 = automationPath(name);
|
|
394224
394630
|
if (!existsSync24(path22)) {
|
|
394225
394631
|
return { type: "text", value: `Automation not found: ${sanitizeName2(name)}` };
|
|
@@ -394254,7 +394660,7 @@ Expected a 5-field cron expression with a next run in the next year.`
|
|
|
394254
394660
|
if (command5 === "delete" || command5 === "remove") {
|
|
394255
394661
|
const name = positional[1];
|
|
394256
394662
|
if (!name)
|
|
394257
|
-
return { type: "text", value:
|
|
394663
|
+
return { type: "text", value: usage5() };
|
|
394258
394664
|
const path22 = automationPath(name);
|
|
394259
394665
|
if (!existsSync24(path22)) {
|
|
394260
394666
|
return { type: "text", value: `Automation not found: ${sanitizeName2(name)}` };
|
|
@@ -394262,7 +394668,7 @@ Expected a 5-field cron expression with a next run in the next year.`
|
|
|
394262
394668
|
unlinkSync4(path22);
|
|
394263
394669
|
return { type: "text", value: `Deleted automation ${sanitizeName2(name)}` };
|
|
394264
394670
|
}
|
|
394265
|
-
return { type: "text", value:
|
|
394671
|
+
return { type: "text", value: usage5() };
|
|
394266
394672
|
};
|
|
394267
394673
|
var init_automation = __esm(() => {
|
|
394268
394674
|
init_argumentSubstitution();
|
|
@@ -394323,7 +394729,7 @@ function positionals6(tokens) {
|
|
|
394323
394729
|
}
|
|
394324
394730
|
return values2;
|
|
394325
394731
|
}
|
|
394326
|
-
function
|
|
394732
|
+
function usage6() {
|
|
394327
394733
|
return [
|
|
394328
394734
|
"Usage:",
|
|
394329
394735
|
' ur exec "prompt" [--concurrency 1] [--max-turns 10] [--model qwen3-coder:480b-cloud] [--output-dir ./outputs]',
|
|
@@ -394444,7 +394850,7 @@ var call59 = async (args) => {
|
|
|
394444
394850
|
const dryRun = tokens.includes("--dry-run");
|
|
394445
394851
|
const prompts = await readPrompts(tokens);
|
|
394446
394852
|
if (prompts.length === 0) {
|
|
394447
|
-
return { type: "text", value:
|
|
394853
|
+
return { type: "text", value: usage6() };
|
|
394448
394854
|
}
|
|
394449
394855
|
const results = await runExecPool(prompts, {
|
|
394450
394856
|
cwd: getCwd2(),
|
|
@@ -395236,7 +395642,7 @@ function formatExecutionPlan(plan, json2) {
|
|
|
395236
395642
|
].filter(Boolean);
|
|
395237
395643
|
lines.push(`${step.order}. ${step.role} \u2192 subagent_type: ${step.agent}${tags.length ? ` [${tags.join(", ")}]` : ""}`);
|
|
395238
395644
|
lines.push(` Goal: ${step.goal}`);
|
|
395239
|
-
lines.push(` Agent({ subagent_type: "${step.agent}", description: "${step.role}: ${
|
|
395645
|
+
lines.push(` Agent({ subagent_type: "${step.agent}", description: "${step.role}: ${truncate5(plan.task, 40)}", prompt: ${JSON.stringify(step.prompt)} })`);
|
|
395240
395646
|
lines.push("");
|
|
395241
395647
|
}
|
|
395242
395648
|
if (plan.loop) {
|
|
@@ -395247,7 +395653,7 @@ function formatExecutionPlan(plan, json2) {
|
|
|
395247
395653
|
return lines.join(`
|
|
395248
395654
|
`);
|
|
395249
395655
|
}
|
|
395250
|
-
function
|
|
395656
|
+
function truncate5(value, max2) {
|
|
395251
395657
|
return value.length <= max2 ? value : `${value.slice(0, max2)}\u2026`;
|
|
395252
395658
|
}
|
|
395253
395659
|
var AGENT_PATTERNS;
|
|
@@ -396989,7 +397395,7 @@ __export(exports_worktree, {
|
|
|
396989
397395
|
call: () => call65
|
|
396990
397396
|
});
|
|
396991
397397
|
import { rm as rm10 } from "fs/promises";
|
|
396992
|
-
function
|
|
397398
|
+
function usage7() {
|
|
396993
397399
|
return [
|
|
396994
397400
|
"Usage:",
|
|
396995
397401
|
" ur worktree list [--json]",
|
|
@@ -397047,7 +397453,7 @@ var call65 = async (args) => {
|
|
|
397047
397453
|
if (action3 === "status" || action3 === "show") {
|
|
397048
397454
|
const id = pos[1];
|
|
397049
397455
|
if (!id)
|
|
397050
|
-
return { type: "text", value:
|
|
397456
|
+
return { type: "text", value: usage7() };
|
|
397051
397457
|
const tasks2 = listBackgroundTasks(cwd2);
|
|
397052
397458
|
const task = tasks2.find((t) => t.id === id || t.worktree?.path?.includes(id));
|
|
397053
397459
|
if (!task)
|
|
@@ -397094,7 +397500,7 @@ var call65 = async (args) => {
|
|
|
397094
397500
|
return { type: "text", value: ["Cleaned worktrees:", ...results].join(`
|
|
397095
397501
|
`) };
|
|
397096
397502
|
}
|
|
397097
|
-
return { type: "text", value:
|
|
397503
|
+
return { type: "text", value: usage7() };
|
|
397098
397504
|
};
|
|
397099
397505
|
var init_worktree = __esm(() => {
|
|
397100
397506
|
init_argumentSubstitution();
|
|
@@ -397157,10 +397563,10 @@ function inspectMessages(messages) {
|
|
|
397157
397563
|
const role = message.message?.role ?? message.type;
|
|
397158
397564
|
if (role === "assistant")
|
|
397159
397565
|
summary.assistantTurns++;
|
|
397160
|
-
const
|
|
397161
|
-
if (
|
|
397162
|
-
summary.tokens.input +=
|
|
397163
|
-
summary.tokens.output +=
|
|
397566
|
+
const usage8 = message.message?.usage;
|
|
397567
|
+
if (usage8) {
|
|
397568
|
+
summary.tokens.input += usage8.input_tokens ?? 0;
|
|
397569
|
+
summary.tokens.output += usage8.output_tokens ?? 0;
|
|
397164
397570
|
}
|
|
397165
397571
|
const content = message.message?.content;
|
|
397166
397572
|
if (!Array.isArray(content)) {
|
|
@@ -398406,7 +398812,7 @@ function positionals7(tokens) {
|
|
|
398406
398812
|
}
|
|
398407
398813
|
return values2;
|
|
398408
398814
|
}
|
|
398409
|
-
function
|
|
398815
|
+
function usage8() {
|
|
398410
398816
|
return [
|
|
398411
398817
|
"Usage:",
|
|
398412
398818
|
" ur crew list [--json]",
|
|
@@ -398436,7 +398842,7 @@ var call70 = async (args) => {
|
|
|
398436
398842
|
if (action3 === "create") {
|
|
398437
398843
|
const goal = option8(tokens, "--goal");
|
|
398438
398844
|
if (!name || !goal)
|
|
398439
|
-
return { type: "text", value:
|
|
398845
|
+
return { type: "text", value: usage8() };
|
|
398440
398846
|
const decompose = tokens.includes("--decompose");
|
|
398441
398847
|
const decomposed = decompose ? await decomposeTask(goal, { cwd: cwd2, dryRun: tokens.includes("--dry-run") }) : undefined;
|
|
398442
398848
|
const spec = createCrew(cwd2, name, goal, { lead: option8(tokens, "--lead"), decomposed });
|
|
@@ -398450,7 +398856,7 @@ ${formatCrew(spec, false)}`
|
|
|
398450
398856
|
if (action3 === "plan") {
|
|
398451
398857
|
const goal = option8(tokens, "--goal");
|
|
398452
398858
|
if (!goal)
|
|
398453
|
-
return { type: "text", value:
|
|
398859
|
+
return { type: "text", value: usage8() };
|
|
398454
398860
|
const tasks2 = await decomposeTask(goal, { cwd: cwd2, dryRun: tokens.includes("--dry-run") });
|
|
398455
398861
|
const result = {
|
|
398456
398862
|
goal,
|
|
@@ -398461,7 +398867,7 @@ ${formatCrew(spec, false)}`
|
|
|
398461
398867
|
return { type: "text", value: formatDecomposition(result, json2) };
|
|
398462
398868
|
}
|
|
398463
398869
|
if (!name)
|
|
398464
|
-
return { type: "text", value:
|
|
398870
|
+
return { type: "text", value: usage8() };
|
|
398465
398871
|
if (action3 === "show") {
|
|
398466
398872
|
const spec = loadCrew(cwd2, name);
|
|
398467
398873
|
if (!spec)
|
|
@@ -398523,7 +398929,7 @@ ${events2.join(`
|
|
|
398523
398929
|
`)}` : "";
|
|
398524
398930
|
return { type: "text", value: `${formatRunCrewResult(result, json2)}${trace4}` };
|
|
398525
398931
|
}
|
|
398526
|
-
return { type: "text", value:
|
|
398932
|
+
return { type: "text", value: usage8() };
|
|
398527
398933
|
};
|
|
398528
398934
|
var init_crew2 = __esm(() => {
|
|
398529
398935
|
init_crew();
|
|
@@ -398702,7 +399108,7 @@ function positionals8(tokens) {
|
|
|
398702
399108
|
}
|
|
398703
399109
|
return values2;
|
|
398704
399110
|
}
|
|
398705
|
-
function
|
|
399111
|
+
function usage9() {
|
|
398706
399112
|
return [
|
|
398707
399113
|
"Usage:",
|
|
398708
399114
|
" ur goal list [--json]",
|
|
@@ -398728,7 +399134,7 @@ var call71 = async (args) => {
|
|
|
398728
399134
|
if (action3 === "add" || action3 === "create") {
|
|
398729
399135
|
const objective = option9(tokens, "--objective");
|
|
398730
399136
|
if (!name || !objective)
|
|
398731
|
-
return { type: "text", value:
|
|
399137
|
+
return { type: "text", value: usage9() };
|
|
398732
399138
|
const spec = createGoal(cwd2, name, objective, {
|
|
398733
399139
|
workflow: option9(tokens, "--workflow"),
|
|
398734
399140
|
pattern: option9(tokens, "--pattern")
|
|
@@ -398738,7 +399144,7 @@ var call71 = async (args) => {
|
|
|
398738
399144
|
${formatGoal(spec, false)}` };
|
|
398739
399145
|
}
|
|
398740
399146
|
if (!name)
|
|
398741
|
-
return { type: "text", value:
|
|
399147
|
+
return { type: "text", value: usage9() };
|
|
398742
399148
|
if (action3 === "show") {
|
|
398743
399149
|
const spec = loadGoal(cwd2, name);
|
|
398744
399150
|
if (!spec)
|
|
@@ -398797,7 +399203,7 @@ ${formatGoal(spec, false)}` };
|
|
|
398797
399203
|
value: json2 ? JSON.stringify({ goal: spec.name, run: result }, null, 2) : `Resumed goal ${spec.name} via workflow ${spec.workflow}: ${result.status} (${result.steps.filter((s) => s.status === "done").length}/${result.steps.length} steps done).`
|
|
398798
399204
|
};
|
|
398799
399205
|
}
|
|
398800
|
-
return { type: "text", value:
|
|
399206
|
+
return { type: "text", value: usage9() };
|
|
398801
399207
|
};
|
|
398802
399208
|
var init_goal = __esm(() => {
|
|
398803
399209
|
init_goals();
|
|
@@ -399861,7 +400267,7 @@ var exports_spec2 = {};
|
|
|
399861
400267
|
__export(exports_spec2, {
|
|
399862
400268
|
call: () => call72
|
|
399863
400269
|
});
|
|
399864
|
-
function
|
|
400270
|
+
function usage10() {
|
|
399865
400271
|
return [
|
|
399866
400272
|
"Usage:",
|
|
399867
400273
|
" ur spec list [--json]",
|
|
@@ -399914,7 +400320,7 @@ var PHASES2, VALUE_FLAGS, call72 = async (args) => {
|
|
|
399914
400320
|
if (action3 === "init" || action3 === "create") {
|
|
399915
400321
|
const goal2 = option10(tokens, "--goal");
|
|
399916
400322
|
if (!name || !goal2)
|
|
399917
|
-
return { type: "text", value:
|
|
400323
|
+
return { type: "text", value: usage10() };
|
|
399918
400324
|
const meta = createSpec(cwd2, name, goal2);
|
|
399919
400325
|
return {
|
|
399920
400326
|
type: "text",
|
|
@@ -399922,7 +400328,7 @@ var PHASES2, VALUE_FLAGS, call72 = async (args) => {
|
|
|
399922
400328
|
};
|
|
399923
400329
|
}
|
|
399924
400330
|
if (!name)
|
|
399925
|
-
return { type: "text", value:
|
|
400331
|
+
return { type: "text", value: usage10() };
|
|
399926
400332
|
if (action3 === "show") {
|
|
399927
400333
|
const phase = asPhase(positional[2]) ?? "requirements";
|
|
399928
400334
|
const body = readPhase(cwd2, name, phase);
|
|
@@ -400055,7 +400461,7 @@ ${ran}${trace4}`
|
|
|
400055
400461
|
value: json2 ? JSON.stringify({ name, deleted }, null, 2) : deleted ? `Deleted spec ${name}.` : notFound3(name)
|
|
400056
400462
|
};
|
|
400057
400463
|
}
|
|
400058
|
-
return { type: "text", value:
|
|
400464
|
+
return { type: "text", value: usage10() };
|
|
400059
400465
|
};
|
|
400060
400466
|
var init_spec2 = __esm(() => {
|
|
400061
400467
|
init_spec();
|
|
@@ -400753,7 +401159,7 @@ function freeText(tokens, valueFlags) {
|
|
|
400753
401159
|
}
|
|
400754
401160
|
return parts.slice(1).join(" ").trim();
|
|
400755
401161
|
}
|
|
400756
|
-
function
|
|
401162
|
+
function usage11() {
|
|
400757
401163
|
return [
|
|
400758
401164
|
"Usage:",
|
|
400759
401165
|
' ur escalate plan "<task>" [--json]',
|
|
@@ -400795,7 +401201,7 @@ var VALUE_FLAGS2, call73 = async (args) => {
|
|
|
400795
401201
|
}
|
|
400796
401202
|
const task = freeText(tokens, VALUE_FLAGS2);
|
|
400797
401203
|
if (!task)
|
|
400798
|
-
return { type: "text", value:
|
|
401204
|
+
return { type: "text", value: usage11() };
|
|
400799
401205
|
const { models } = await listModelCapabilities();
|
|
400800
401206
|
const maxTurnsRaw = option11(tokens, "--max-turns");
|
|
400801
401207
|
const maxTurns = maxTurnsRaw ? Number(maxTurnsRaw) : undefined;
|
|
@@ -400859,7 +401265,7 @@ var exports_learn = {};
|
|
|
400859
401265
|
__export(exports_learn, {
|
|
400860
401266
|
call: () => call74
|
|
400861
401267
|
});
|
|
400862
|
-
function
|
|
401268
|
+
function usage12() {
|
|
400863
401269
|
return [
|
|
400864
401270
|
"Usage:",
|
|
400865
401271
|
" ur learn [run] [--reflect] [--dry-run] [--json]",
|
|
@@ -400891,7 +401297,7 @@ var call74 = async (args) => {
|
|
|
400891
401297
|
const json2 = tokens.includes("--json");
|
|
400892
401298
|
const action3 = tokens.find((token) => !token.startsWith("--")) ?? "run";
|
|
400893
401299
|
if (action3 === "help")
|
|
400894
|
-
return { type: "text", value:
|
|
401300
|
+
return { type: "text", value: usage12() };
|
|
400895
401301
|
if (action3 === "stats") {
|
|
400896
401302
|
return { type: "text", value: formatStats(loadStats(cwd2), json2) };
|
|
400897
401303
|
}
|
|
@@ -400929,7 +401335,7 @@ Best for coding: ${codingBest.model} (${Math.round(codingBest.rate * 100)}%).` :
|
|
|
400929
401335
|
});
|
|
400930
401336
|
return { type: "text", value: formatLearnResult(result, json2) };
|
|
400931
401337
|
}
|
|
400932
|
-
return { type: "text", value:
|
|
401338
|
+
return { type: "text", value: usage12() };
|
|
400933
401339
|
};
|
|
400934
401340
|
var init_learn = __esm(() => {
|
|
400935
401341
|
init_escalation();
|
|
@@ -400962,7 +401368,7 @@ function optionValue5(tokens, flag) {
|
|
|
400962
401368
|
const index2 = tokens.indexOf(flag);
|
|
400963
401369
|
return index2 >= 0 ? tokens[index2 + 1] : undefined;
|
|
400964
401370
|
}
|
|
400965
|
-
function
|
|
401371
|
+
function usage13() {
|
|
400966
401372
|
return [
|
|
400967
401373
|
"Usage:",
|
|
400968
401374
|
" ur guardrails list [--json]",
|
|
@@ -400982,7 +401388,7 @@ var call75 = async (args) => {
|
|
|
400982
401388
|
const json2 = tokens.includes("--json");
|
|
400983
401389
|
const action3 = tokens.find((token) => !token.startsWith("--")) ?? "list";
|
|
400984
401390
|
if (action3 === "help")
|
|
400985
|
-
return { type: "text", value:
|
|
401391
|
+
return { type: "text", value: usage13() };
|
|
400986
401392
|
if (action3 === "init") {
|
|
400987
401393
|
const result = scaffoldGuardrails(cwd2, { force: tokens.includes("--force") });
|
|
400988
401394
|
return {
|
|
@@ -401031,7 +401437,7 @@ var call75 = async (args) => {
|
|
|
401031
401437
|
text = tokens.filter((token) => !token.startsWith("--") && token !== "check").join(" ");
|
|
401032
401438
|
}
|
|
401033
401439
|
if (!text)
|
|
401034
|
-
return { type: "text", value:
|
|
401440
|
+
return { type: "text", value: usage13() };
|
|
401035
401441
|
const phase = optionValue5(tokens, "--phase") ?? "both";
|
|
401036
401442
|
const decision = await evaluateGuardrails(config3, text, {
|
|
401037
401443
|
phase,
|
|
@@ -401040,7 +401446,7 @@ var call75 = async (args) => {
|
|
|
401040
401446
|
});
|
|
401041
401447
|
return { type: "text", value: formatDecision(decision, json2) };
|
|
401042
401448
|
}
|
|
401043
|
-
return { type: "text", value:
|
|
401449
|
+
return { type: "text", value: usage13() };
|
|
401044
401450
|
};
|
|
401045
401451
|
var init_guardrails2 = __esm(() => {
|
|
401046
401452
|
init_guardrails();
|
|
@@ -401165,7 +401571,7 @@ function optionValue6(tokens, flag) {
|
|
|
401165
401571
|
const index2 = tokens.indexOf(flag);
|
|
401166
401572
|
return index2 >= 0 ? tokens[index2 + 1] : undefined;
|
|
401167
401573
|
}
|
|
401168
|
-
function
|
|
401574
|
+
function usage14() {
|
|
401169
401575
|
return [
|
|
401170
401576
|
"Usage:",
|
|
401171
401577
|
" ur devcontainer status [--json]",
|
|
@@ -401184,7 +401590,7 @@ var call76 = async (args) => {
|
|
|
401184
401590
|
const json2 = tokens.includes("--json");
|
|
401185
401591
|
const action3 = tokens.find((token) => !token.startsWith("--")) ?? "status";
|
|
401186
401592
|
if (action3 === "help")
|
|
401187
|
-
return { type: "text", value:
|
|
401593
|
+
return { type: "text", value: usage14() };
|
|
401188
401594
|
if (action3 === "init") {
|
|
401189
401595
|
const result = scaffoldExecTarget(cwd2, {
|
|
401190
401596
|
force: tokens.includes("--force"),
|
|
@@ -401207,7 +401613,7 @@ var call76 = async (args) => {
|
|
|
401207
401613
|
const sepIndex = tokens.indexOf("--");
|
|
401208
401614
|
const rawParts = sepIndex >= 0 ? tokens.slice(sepIndex + 1) : tokens.filter((t) => t !== action3 && !t.startsWith("--"));
|
|
401209
401615
|
if (rawParts.length === 0)
|
|
401210
|
-
return { type: "text", value:
|
|
401616
|
+
return { type: "text", value: usage14() };
|
|
401211
401617
|
const wrapped = wrapCommand(config3, { file: rawParts[0], args: rawParts.slice(1) }, cwd2);
|
|
401212
401618
|
if (tokens.includes("--dry-run")) {
|
|
401213
401619
|
return {
|
|
@@ -401236,7 +401642,7 @@ ${run.stderr}`.trim();
|
|
|
401236
401642
|
${body}` : ""}`
|
|
401237
401643
|
};
|
|
401238
401644
|
}
|
|
401239
|
-
return { type: "text", value:
|
|
401645
|
+
return { type: "text", value: usage14() };
|
|
401240
401646
|
};
|
|
401241
401647
|
var init_devcontainer = __esm(() => {
|
|
401242
401648
|
init_execFileNoThrow();
|
|
@@ -402428,7 +402834,7 @@ var exports_safety = {};
|
|
|
402428
402834
|
__export(exports_safety, {
|
|
402429
402835
|
call: () => call80
|
|
402430
402836
|
});
|
|
402431
|
-
function
|
|
402837
|
+
function usage15() {
|
|
402432
402838
|
return [
|
|
402433
402839
|
"Usage:",
|
|
402434
402840
|
" ur safety status [--json]",
|
|
@@ -402477,7 +402883,7 @@ var call80 = async (args) => {
|
|
|
402477
402883
|
if (action3 === "check") {
|
|
402478
402884
|
const command5 = option15(tokens, "--command") ?? positionals10(tokens).slice(1).join(" ");
|
|
402479
402885
|
if (!command5)
|
|
402480
|
-
return { type: "text", value:
|
|
402886
|
+
return { type: "text", value: usage15() };
|
|
402481
402887
|
return {
|
|
402482
402888
|
type: "text",
|
|
402483
402889
|
value: formatShellSafetyEvaluation(evaluateShellSafetyPolicy(command5, cwd2), json2)
|
|
@@ -402507,7 +402913,7 @@ var call80 = async (args) => {
|
|
|
402507
402913
|
`)
|
|
402508
402914
|
};
|
|
402509
402915
|
}
|
|
402510
|
-
return { type: "text", value:
|
|
402916
|
+
return { type: "text", value: usage15() };
|
|
402511
402917
|
};
|
|
402512
402918
|
var init_safety = __esm(() => {
|
|
402513
402919
|
init_argumentSubstitution();
|
|
@@ -402535,7 +402941,7 @@ var exports_sandbox = {};
|
|
|
402535
402941
|
__export(exports_sandbox, {
|
|
402536
402942
|
call: () => call81
|
|
402537
402943
|
});
|
|
402538
|
-
function
|
|
402944
|
+
function usage16() {
|
|
402539
402945
|
return [
|
|
402540
402946
|
"Usage:",
|
|
402541
402947
|
" ur sandbox status [--json]",
|
|
@@ -402630,7 +403036,7 @@ var call81 = async (args) => {
|
|
|
402630
403036
|
if (action3 === "eval") {
|
|
402631
403037
|
const command5 = pos.slice(1).join(" ");
|
|
402632
403038
|
if (!command5)
|
|
402633
|
-
return { type: "text", value:
|
|
403039
|
+
return { type: "text", value: usage16() };
|
|
402634
403040
|
const policy = loadProjectSafetyPolicy(cwd2);
|
|
402635
403041
|
const evaluation = evaluateShellSafetyPolicy(command5, cwd2);
|
|
402636
403042
|
const result = {
|
|
@@ -402654,7 +403060,7 @@ var call81 = async (args) => {
|
|
|
402654
403060
|
`)
|
|
402655
403061
|
};
|
|
402656
403062
|
}
|
|
402657
|
-
return { type: "text", value:
|
|
403063
|
+
return { type: "text", value: usage16() };
|
|
402658
403064
|
};
|
|
402659
403065
|
var init_sandbox = __esm(() => {
|
|
402660
403066
|
init_argumentSubstitution();
|
|
@@ -402682,7 +403088,7 @@ var exports_context_pack = {};
|
|
|
402682
403088
|
__export(exports_context_pack, {
|
|
402683
403089
|
call: () => call82
|
|
402684
403090
|
});
|
|
402685
|
-
function
|
|
403091
|
+
function usage17() {
|
|
402686
403092
|
return [
|
|
402687
403093
|
"Usage:",
|
|
402688
403094
|
" ur context-pack scan [--json]",
|
|
@@ -402779,7 +403185,7 @@ var MEMORY_KINDS, call82 = async (args) => {
|
|
|
402779
403185
|
if (action3 === "remember") {
|
|
402780
403186
|
const input = rememberInput(tokens);
|
|
402781
403187
|
if (!input)
|
|
402782
|
-
return { type: "text", value:
|
|
403188
|
+
return { type: "text", value: usage17() };
|
|
402783
403189
|
const { kind, text, ...meta } = input;
|
|
402784
403190
|
const entry = appendProjectMemory(cwd2, kind, text, meta);
|
|
402785
403191
|
return {
|
|
@@ -402797,7 +403203,7 @@ var MEMORY_KINDS, call82 = async (args) => {
|
|
|
402797
403203
|
if (action3 === "status") {
|
|
402798
403204
|
return { type: "text", value: contextStatus(cwd2) };
|
|
402799
403205
|
}
|
|
402800
|
-
return { type: "text", value:
|
|
403206
|
+
return { type: "text", value: usage17() };
|
|
402801
403207
|
};
|
|
402802
403208
|
var init_context_pack = __esm(() => {
|
|
402803
403209
|
init_argumentSubstitution();
|
|
@@ -402845,7 +403251,7 @@ function positionals13(tokens) {
|
|
|
402845
403251
|
}
|
|
402846
403252
|
return values2;
|
|
402847
403253
|
}
|
|
402848
|
-
function
|
|
403254
|
+
function usage18() {
|
|
402849
403255
|
return [
|
|
402850
403256
|
"Usage:",
|
|
402851
403257
|
" ur artifacts list [--json]",
|
|
@@ -402877,7 +403283,7 @@ var KINDS, call83 = async (args) => {
|
|
|
402877
403283
|
const kind = option17(tokens, "--kind") ?? "note";
|
|
402878
403284
|
const title = option17(tokens, "--title");
|
|
402879
403285
|
if (!title || !KINDS.has(kind))
|
|
402880
|
-
return { type: "text", value:
|
|
403286
|
+
return { type: "text", value: usage18() };
|
|
402881
403287
|
const artifact = recordArtifact(cwd2, {
|
|
402882
403288
|
kind,
|
|
402883
403289
|
title,
|
|
@@ -402907,7 +403313,7 @@ var KINDS, call83 = async (args) => {
|
|
|
402907
403313
|
};
|
|
402908
403314
|
}
|
|
402909
403315
|
if (!id)
|
|
402910
|
-
return { type: "text", value:
|
|
403316
|
+
return { type: "text", value: usage18() };
|
|
402911
403317
|
if (action3 === "show") {
|
|
402912
403318
|
const artifact = getArtifact(cwd2, id);
|
|
402913
403319
|
if (!artifact)
|
|
@@ -402942,7 +403348,7 @@ var KINDS, call83 = async (args) => {
|
|
|
402942
403348
|
if (action3 === "delete" || action3 === "remove") {
|
|
402943
403349
|
return { type: "text", value: deleteArtifact(cwd2, id) ? `Deleted artifact ${id}.` : `Artifact not found: ${id}` };
|
|
402944
403350
|
}
|
|
402945
|
-
return { type: "text", value:
|
|
403351
|
+
return { type: "text", value: usage18() };
|
|
402946
403352
|
};
|
|
402947
403353
|
var init_artifacts2 = __esm(() => {
|
|
402948
403354
|
init_artifacts();
|
|
@@ -403116,7 +403522,7 @@ function option18(tokens, name) {
|
|
|
403116
403522
|
return;
|
|
403117
403523
|
return tokens[index2 + 1];
|
|
403118
403524
|
}
|
|
403119
|
-
function
|
|
403525
|
+
function usage19() {
|
|
403120
403526
|
return [
|
|
403121
403527
|
"Usage:",
|
|
403122
403528
|
" ur trigger parse --file payload.json [--source github|slack|generic] [--keyword /ur] [--json]",
|
|
@@ -403138,12 +403544,12 @@ var call84 = async (args) => {
|
|
|
403138
403544
|
const maxTurnsRaw = option18(tokens, "--max-turns");
|
|
403139
403545
|
const maxTurns = maxTurnsRaw ? Number(maxTurnsRaw) : undefined;
|
|
403140
403546
|
if (action3 !== "parse" && action3 !== "run") {
|
|
403141
|
-
return { type: "text", value:
|
|
403547
|
+
return { type: "text", value: usage19() };
|
|
403142
403548
|
}
|
|
403143
403549
|
if (!file2) {
|
|
403144
403550
|
return { type: "text", value: `Missing --file <payload.json>.
|
|
403145
403551
|
|
|
403146
|
-
${
|
|
403552
|
+
${usage19()}` };
|
|
403147
403553
|
}
|
|
403148
403554
|
if (!existsSync44(file2)) {
|
|
403149
403555
|
return { type: "text", value: `Payload file not found: ${file2}` };
|
|
@@ -405376,7 +405782,7 @@ var exports_task = {};
|
|
|
405376
405782
|
__export(exports_task, {
|
|
405377
405783
|
call: () => call88
|
|
405378
405784
|
});
|
|
405379
|
-
function
|
|
405785
|
+
function usage20() {
|
|
405380
405786
|
return [
|
|
405381
405787
|
"Usage:",
|
|
405382
405788
|
" ur task start <name> [--worktree] [--base <branch>] [--model <model>] [--max-turns <n>] [--json]",
|
|
@@ -405454,7 +405860,7 @@ var call88 = async (args) => {
|
|
|
405454
405860
|
if (action3 === "start") {
|
|
405455
405861
|
const name = pos[1];
|
|
405456
405862
|
if (!name)
|
|
405457
|
-
return { type: "text", value:
|
|
405863
|
+
return { type: "text", value: usage20() };
|
|
405458
405864
|
if (!findGitRoot(cwd2)) {
|
|
405459
405865
|
return { type: "text", value: "task start requires a git repository." };
|
|
405460
405866
|
}
|
|
@@ -405480,7 +405886,7 @@ var call88 = async (args) => {
|
|
|
405480
405886
|
if (action3 === "run") {
|
|
405481
405887
|
const id = pos[1];
|
|
405482
405888
|
if (!id)
|
|
405483
|
-
return { type: "text", value:
|
|
405889
|
+
return { type: "text", value: usage20() };
|
|
405484
405890
|
const existing2 = getBackgroundTask(cwd2, id) ?? listBackgroundTasks(cwd2).find((t) => t.id.startsWith(id));
|
|
405485
405891
|
if (!existing2)
|
|
405486
405892
|
return { type: "text", value: `Task ${id} not found.` };
|
|
@@ -405503,7 +405909,7 @@ Log: ${task.logFile}`
|
|
|
405503
405909
|
if (action3 === "pr") {
|
|
405504
405910
|
const id = pos[1];
|
|
405505
405911
|
if (!id)
|
|
405506
|
-
return { type: "text", value:
|
|
405912
|
+
return { type: "text", value: usage20() };
|
|
405507
405913
|
const task = getBackgroundTask(cwd2, id);
|
|
405508
405914
|
if (!task)
|
|
405509
405915
|
return { type: "text", value: `Task ${id} not found.` };
|
|
@@ -405558,13 +405964,13 @@ ${pr.stderr || ""}`.trim()
|
|
|
405558
405964
|
if (action3 === "status") {
|
|
405559
405965
|
const id = pos[1];
|
|
405560
405966
|
if (!id)
|
|
405561
|
-
return { type: "text", value:
|
|
405967
|
+
return { type: "text", value: usage20() };
|
|
405562
405968
|
const task = getBackgroundTask(cwd2, id) ?? listBackgroundTasks(cwd2).find((t) => t.id.startsWith(id));
|
|
405563
405969
|
if (!task)
|
|
405564
405970
|
return { type: "text", value: `Task ${id} not found.` };
|
|
405565
405971
|
return { type: "text", value: formatTask(task, json2) };
|
|
405566
405972
|
}
|
|
405567
|
-
return { type: "text", value:
|
|
405973
|
+
return { type: "text", value: usage20() };
|
|
405568
405974
|
};
|
|
405569
405975
|
var init_task = __esm(() => {
|
|
405570
405976
|
init_argumentSubstitution();
|
|
@@ -405997,7 +406403,7 @@ function option20(tokens, name) {
|
|
|
405997
406403
|
function positional(tokens) {
|
|
405998
406404
|
return tokens.find((t) => !t.startsWith("--") && !/^\d+$/.test(t)) ?? "show";
|
|
405999
406405
|
}
|
|
406000
|
-
function
|
|
406406
|
+
function usage21() {
|
|
406001
406407
|
return [
|
|
406002
406408
|
"Usage:",
|
|
406003
406409
|
" ur memory retention show [--json]",
|
|
@@ -406035,7 +406441,7 @@ var call93 = async (args) => {
|
|
|
406035
406441
|
value: formatMemoryRetention(pruneMemoryRetention(cwd2), json2)
|
|
406036
406442
|
};
|
|
406037
406443
|
}
|
|
406038
|
-
return { type: "text", value:
|
|
406444
|
+
return { type: "text", value: usage21() };
|
|
406039
406445
|
};
|
|
406040
406446
|
var init_memory_retention = __esm(() => {
|
|
406041
406447
|
init_argumentSubstitution();
|
|
@@ -428164,34 +428570,34 @@ ${lanes.join(`
|
|
|
428164
428570
|
directories: directoriesMatcher,
|
|
428165
428571
|
exclude: excludeMatcher
|
|
428166
428572
|
};
|
|
428167
|
-
function getRegularExpressionForWildcard(specs, basePath,
|
|
428168
|
-
const patterns = getRegularExpressionsForWildcards(specs, basePath,
|
|
428573
|
+
function getRegularExpressionForWildcard(specs, basePath, usage22) {
|
|
428574
|
+
const patterns = getRegularExpressionsForWildcards(specs, basePath, usage22);
|
|
428169
428575
|
if (!patterns || !patterns.length) {
|
|
428170
428576
|
return;
|
|
428171
428577
|
}
|
|
428172
428578
|
const pattern2 = patterns.map((pattern22) => `(?:${pattern22})`).join("|");
|
|
428173
|
-
const terminator =
|
|
428579
|
+
const terminator = usage22 === "exclude" ? "(?:$|/)" : "$";
|
|
428174
428580
|
return `^(?:${pattern2})${terminator}`;
|
|
428175
428581
|
}
|
|
428176
|
-
function getRegularExpressionsForWildcards(specs, basePath,
|
|
428582
|
+
function getRegularExpressionsForWildcards(specs, basePath, usage22) {
|
|
428177
428583
|
if (specs === undefined || specs.length === 0) {
|
|
428178
428584
|
return;
|
|
428179
428585
|
}
|
|
428180
|
-
return flatMap(specs, (spec2) => spec2 && getSubPatternFromSpec(spec2, basePath,
|
|
428586
|
+
return flatMap(specs, (spec2) => spec2 && getSubPatternFromSpec(spec2, basePath, usage22, wildcardMatchers[usage22]));
|
|
428181
428587
|
}
|
|
428182
428588
|
function isImplicitGlob(lastPathComponent) {
|
|
428183
428589
|
return !/[.*?]/.test(lastPathComponent);
|
|
428184
428590
|
}
|
|
428185
|
-
function getPatternFromSpec(spec2, basePath,
|
|
428186
|
-
const pattern2 = spec2 && getSubPatternFromSpec(spec2, basePath,
|
|
428187
|
-
return pattern2 && `^(?:${pattern2})${
|
|
428591
|
+
function getPatternFromSpec(spec2, basePath, usage22) {
|
|
428592
|
+
const pattern2 = spec2 && getSubPatternFromSpec(spec2, basePath, usage22, wildcardMatchers[usage22]);
|
|
428593
|
+
return pattern2 && `^(?:${pattern2})${usage22 === "exclude" ? "(?:$|/)" : "$"}`;
|
|
428188
428594
|
}
|
|
428189
|
-
function getSubPatternFromSpec(spec2, basePath,
|
|
428595
|
+
function getSubPatternFromSpec(spec2, basePath, usage22, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage22]) {
|
|
428190
428596
|
let subpattern = "";
|
|
428191
428597
|
let hasWrittenComponent = false;
|
|
428192
428598
|
const components = getNormalizedPathComponents(spec2, basePath);
|
|
428193
428599
|
const lastComponent = last2(components);
|
|
428194
|
-
if (
|
|
428600
|
+
if (usage22 !== "exclude" && lastComponent === "**") {
|
|
428195
428601
|
return;
|
|
428196
428602
|
}
|
|
428197
428603
|
components[0] = removeTrailingDirectorySeparator(components[0]);
|
|
@@ -428203,14 +428609,14 @@ ${lanes.join(`
|
|
|
428203
428609
|
if (component === "**") {
|
|
428204
428610
|
subpattern += doubleAsteriskRegexFragment;
|
|
428205
428611
|
} else {
|
|
428206
|
-
if (
|
|
428612
|
+
if (usage22 === "directories") {
|
|
428207
428613
|
subpattern += "(?:";
|
|
428208
428614
|
optionalCount++;
|
|
428209
428615
|
}
|
|
428210
428616
|
if (hasWrittenComponent) {
|
|
428211
428617
|
subpattern += directorySeparator;
|
|
428212
428618
|
}
|
|
428213
|
-
if (
|
|
428619
|
+
if (usage22 !== "exclude") {
|
|
428214
428620
|
let componentPattern = "";
|
|
428215
428621
|
if (component.charCodeAt(0) === 42) {
|
|
428216
428622
|
componentPattern += "(?:[^./]" + singleAsteriskRegexFragment + ")?";
|
|
@@ -454760,80 +455166,80 @@ ${lanes.join(`
|
|
|
454760
455166
|
}
|
|
454761
455167
|
return Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration");
|
|
454762
455168
|
}
|
|
454763
|
-
function isBlockScopedNameDeclaredBeforeUse(declaration,
|
|
455169
|
+
function isBlockScopedNameDeclaredBeforeUse(declaration, usage22) {
|
|
454764
455170
|
const declarationFile = getSourceFileOfNode(declaration);
|
|
454765
|
-
const useFile = getSourceFileOfNode(
|
|
455171
|
+
const useFile = getSourceFileOfNode(usage22);
|
|
454766
455172
|
const declContainer = getEnclosingBlockScopeContainer(declaration);
|
|
454767
455173
|
if (declarationFile !== useFile) {
|
|
454768
|
-
if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !compilerOptions.outFile || isInTypeQuery(
|
|
455174
|
+
if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !compilerOptions.outFile || isInTypeQuery(usage22) || declaration.flags & 33554432) {
|
|
454769
455175
|
return true;
|
|
454770
455176
|
}
|
|
454771
|
-
if (isUsedInFunctionOrInstanceProperty(
|
|
455177
|
+
if (isUsedInFunctionOrInstanceProperty(usage22, declaration)) {
|
|
454772
455178
|
return true;
|
|
454773
455179
|
}
|
|
454774
455180
|
const sourceFiles2 = host.getSourceFiles();
|
|
454775
455181
|
return sourceFiles2.indexOf(declarationFile) <= sourceFiles2.indexOf(useFile);
|
|
454776
455182
|
}
|
|
454777
|
-
if (!!(
|
|
455183
|
+
if (!!(usage22.flags & 16777216) || isInTypeQuery(usage22) || isInAmbientOrTypeNode(usage22)) {
|
|
454778
455184
|
return true;
|
|
454779
455185
|
}
|
|
454780
|
-
if (declaration.pos <=
|
|
455186
|
+
if (declaration.pos <= usage22.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage22.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
|
454781
455187
|
if (declaration.kind === 209) {
|
|
454782
|
-
const errorBindingElement = getAncestor(
|
|
455188
|
+
const errorBindingElement = getAncestor(usage22, 209);
|
|
454783
455189
|
if (errorBindingElement) {
|
|
454784
455190
|
return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) || declaration.pos < errorBindingElement.pos;
|
|
454785
455191
|
}
|
|
454786
|
-
return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 261),
|
|
455192
|
+
return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 261), usage22);
|
|
454787
455193
|
} else if (declaration.kind === 261) {
|
|
454788
|
-
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration,
|
|
455194
|
+
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage22);
|
|
454789
455195
|
} else if (isClassLike(declaration)) {
|
|
454790
|
-
const container = findAncestor(
|
|
455196
|
+
const container = findAncestor(usage22, (n2) => n2 === declaration ? "quit" : isComputedPropertyName(n2) ? n2.parent.parent === declaration : !legacyDecorators && isDecorator(n2) && (n2.parent === declaration || isMethodDeclaration(n2.parent) && n2.parent.parent === declaration || isGetOrSetAccessorDeclaration(n2.parent) && n2.parent.parent === declaration || isPropertyDeclaration(n2.parent) && n2.parent.parent === declaration || isParameter(n2.parent) && n2.parent.parent.parent === declaration));
|
|
454791
455197
|
if (!container) {
|
|
454792
455198
|
return true;
|
|
454793
455199
|
}
|
|
454794
455200
|
if (!legacyDecorators && isDecorator(container)) {
|
|
454795
|
-
return !!findAncestor(
|
|
455201
|
+
return !!findAncestor(usage22, (n2) => n2 === container ? "quit" : isFunctionLike(n2) && !getImmediatelyInvokedFunctionExpression(n2));
|
|
454796
455202
|
}
|
|
454797
455203
|
return false;
|
|
454798
455204
|
} else if (isPropertyDeclaration(declaration)) {
|
|
454799
|
-
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration,
|
|
455205
|
+
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage22, false);
|
|
454800
455206
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
454801
|
-
return !(emitStandardClassFields && getContainingClass(declaration) === getContainingClass(
|
|
455207
|
+
return !(emitStandardClassFields && getContainingClass(declaration) === getContainingClass(usage22) && isUsedInFunctionOrInstanceProperty(usage22, declaration));
|
|
454802
455208
|
}
|
|
454803
455209
|
return true;
|
|
454804
455210
|
}
|
|
454805
|
-
if (
|
|
455211
|
+
if (usage22.parent.kind === 282 || usage22.parent.kind === 278 && usage22.parent.isExportEquals) {
|
|
454806
455212
|
return true;
|
|
454807
455213
|
}
|
|
454808
|
-
if (
|
|
455214
|
+
if (usage22.kind === 278 && usage22.isExportEquals) {
|
|
454809
455215
|
return true;
|
|
454810
455216
|
}
|
|
454811
|
-
if (isUsedInFunctionOrInstanceProperty(
|
|
455217
|
+
if (isUsedInFunctionOrInstanceProperty(usage22, declaration)) {
|
|
454812
455218
|
if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
454813
|
-
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration,
|
|
455219
|
+
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage22, true);
|
|
454814
455220
|
} else {
|
|
454815
455221
|
return true;
|
|
454816
455222
|
}
|
|
454817
455223
|
}
|
|
454818
455224
|
return false;
|
|
454819
|
-
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2,
|
|
455225
|
+
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage23) {
|
|
454820
455226
|
switch (declaration2.parent.parent.kind) {
|
|
454821
455227
|
case 244:
|
|
454822
455228
|
case 249:
|
|
454823
455229
|
case 251:
|
|
454824
|
-
if (isSameScopeDescendentOf(
|
|
455230
|
+
if (isSameScopeDescendentOf(usage23, declaration2, declContainer)) {
|
|
454825
455231
|
return true;
|
|
454826
455232
|
}
|
|
454827
455233
|
break;
|
|
454828
455234
|
}
|
|
454829
455235
|
const grandparent = declaration2.parent.parent;
|
|
454830
|
-
return isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(
|
|
455236
|
+
return isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(usage23, grandparent.expression, declContainer);
|
|
454831
455237
|
}
|
|
454832
|
-
function isUsedInFunctionOrInstanceProperty(
|
|
454833
|
-
return isUsedInFunctionOrInstancePropertyWorker(
|
|
455238
|
+
function isUsedInFunctionOrInstanceProperty(usage23, declaration2) {
|
|
455239
|
+
return isUsedInFunctionOrInstancePropertyWorker(usage23, declaration2);
|
|
454834
455240
|
}
|
|
454835
|
-
function isUsedInFunctionOrInstancePropertyWorker(
|
|
454836
|
-
return !!findAncestor(
|
|
455241
|
+
function isUsedInFunctionOrInstancePropertyWorker(usage23, declaration2) {
|
|
455242
|
+
return !!findAncestor(usage23, (current) => {
|
|
454837
455243
|
if (current === declContainer) {
|
|
454838
455244
|
return "quit";
|
|
454839
455245
|
}
|
|
@@ -454841,7 +455247,7 @@ ${lanes.join(`
|
|
|
454841
455247
|
return !getImmediatelyInvokedFunctionExpression(current);
|
|
454842
455248
|
}
|
|
454843
455249
|
if (isClassStaticBlockDeclaration(current)) {
|
|
454844
|
-
return declaration2.pos <
|
|
455250
|
+
return declaration2.pos < usage23.pos;
|
|
454845
455251
|
}
|
|
454846
455252
|
const propertyDeclaration = tryCast(current.parent, isPropertyDeclaration);
|
|
454847
455253
|
if (propertyDeclaration) {
|
|
@@ -454851,7 +455257,7 @@ ${lanes.join(`
|
|
|
454851
455257
|
if (declaration2.kind === 175) {
|
|
454852
455258
|
return true;
|
|
454853
455259
|
}
|
|
454854
|
-
if (isPropertyDeclaration(declaration2) && getContainingClass(
|
|
455260
|
+
if (isPropertyDeclaration(declaration2) && getContainingClass(usage23) === getContainingClass(declaration2)) {
|
|
454855
455261
|
const propName = declaration2.name;
|
|
454856
455262
|
if (isIdentifier(propName) || isPrivateIdentifier(propName)) {
|
|
454857
455263
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(declaration2));
|
|
@@ -454863,7 +455269,7 @@ ${lanes.join(`
|
|
|
454863
455269
|
}
|
|
454864
455270
|
} else {
|
|
454865
455271
|
const isDeclarationInstanceProperty = declaration2.kind === 173 && !isStatic(declaration2);
|
|
454866
|
-
if (!isDeclarationInstanceProperty || getContainingClass(
|
|
455272
|
+
if (!isDeclarationInstanceProperty || getContainingClass(usage23) !== getContainingClass(declaration2)) {
|
|
454867
455273
|
return true;
|
|
454868
455274
|
}
|
|
454869
455275
|
}
|
|
@@ -454881,11 +455287,11 @@ ${lanes.join(`
|
|
|
454881
455287
|
return false;
|
|
454882
455288
|
});
|
|
454883
455289
|
}
|
|
454884
|
-
function isPropertyImmediatelyReferencedWithinDeclaration(declaration2,
|
|
454885
|
-
if (
|
|
455290
|
+
function isPropertyImmediatelyReferencedWithinDeclaration(declaration2, usage23, stopAtAnyPropertyDeclaration) {
|
|
455291
|
+
if (usage23.end > declaration2.end) {
|
|
454886
455292
|
return false;
|
|
454887
455293
|
}
|
|
454888
|
-
const ancestorChangingReferenceScope = findAncestor(
|
|
455294
|
+
const ancestorChangingReferenceScope = findAncestor(usage23, (node) => {
|
|
454889
455295
|
if (node === declaration2) {
|
|
454890
455296
|
return "quit";
|
|
454891
455297
|
}
|
|
@@ -455276,25 +455682,25 @@ ${lanes.join(`
|
|
|
455276
455682
|
function isSyntacticDefault(node) {
|
|
455277
455683
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
455278
455684
|
}
|
|
455279
|
-
function getEmitSyntaxForModuleSpecifierExpression(
|
|
455280
|
-
return isStringLiteralLike(
|
|
455685
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage22) {
|
|
455686
|
+
return isStringLiteralLike(usage22) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage22), usage22) : undefined;
|
|
455281
455687
|
}
|
|
455282
455688
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
455283
455689
|
return usageMode === 99 && targetMode === 1;
|
|
455284
455690
|
}
|
|
455285
|
-
function isOnlyImportableAsDefault(
|
|
455691
|
+
function isOnlyImportableAsDefault(usage22, resolvedModule) {
|
|
455286
455692
|
if (100 <= moduleKind && moduleKind <= 199) {
|
|
455287
|
-
const usageMode = getEmitSyntaxForModuleSpecifierExpression(
|
|
455693
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage22);
|
|
455288
455694
|
if (usageMode === 99) {
|
|
455289
|
-
resolvedModule ?? (resolvedModule = resolveExternalModuleName(
|
|
455695
|
+
resolvedModule ?? (resolvedModule = resolveExternalModuleName(usage22, usage22, true));
|
|
455290
455696
|
const targetFile = resolvedModule && getSourceFileOfModule(resolvedModule);
|
|
455291
455697
|
return targetFile && (isJsonSourceFile(targetFile) || getDeclarationFileExtension(targetFile.fileName) === ".d.json.ts");
|
|
455292
455698
|
}
|
|
455293
455699
|
}
|
|
455294
455700
|
return false;
|
|
455295
455701
|
}
|
|
455296
|
-
function canHaveSyntheticDefault(file2, moduleSymbol, dontResolveAlias,
|
|
455297
|
-
const usageMode = file2 && getEmitSyntaxForModuleSpecifierExpression(
|
|
455702
|
+
function canHaveSyntheticDefault(file2, moduleSymbol, dontResolveAlias, usage22) {
|
|
455703
|
+
const usageMode = file2 && getEmitSyntaxForModuleSpecifierExpression(usage22);
|
|
455298
455704
|
if (file2 && usageMode !== undefined) {
|
|
455299
455705
|
const targetMode = host.getImpliedNodeFormatForEmit(file2);
|
|
455300
455706
|
if (usageMode === 99 && targetMode === 1 && 100 <= moduleKind && moduleKind <= 199) {
|
|
@@ -513932,39 +514338,39 @@ ${lanes.join(`
|
|
|
513932
514338
|
}
|
|
513933
514339
|
return false;
|
|
513934
514340
|
}
|
|
513935
|
-
function getModeForUsageLocation(file2,
|
|
513936
|
-
return getModeForUsageLocationWorker(file2,
|
|
514341
|
+
function getModeForUsageLocation(file2, usage22, compilerOptions) {
|
|
514342
|
+
return getModeForUsageLocationWorker(file2, usage22, compilerOptions);
|
|
513937
514343
|
}
|
|
513938
|
-
function getModeForUsageLocationWorker(file2,
|
|
513939
|
-
if (isImportDeclaration(
|
|
513940
|
-
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(
|
|
514344
|
+
function getModeForUsageLocationWorker(file2, usage22, compilerOptions) {
|
|
514345
|
+
if (isImportDeclaration(usage22.parent) || isExportDeclaration(usage22.parent) || isJSDocImportTag(usage22.parent)) {
|
|
514346
|
+
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage22.parent);
|
|
513941
514347
|
if (isTypeOnly) {
|
|
513942
|
-
const override = getResolutionModeOverride(
|
|
514348
|
+
const override = getResolutionModeOverride(usage22.parent.attributes);
|
|
513943
514349
|
if (override) {
|
|
513944
514350
|
return override;
|
|
513945
514351
|
}
|
|
513946
514352
|
}
|
|
513947
514353
|
}
|
|
513948
|
-
if (
|
|
513949
|
-
const override = getResolutionModeOverride(
|
|
514354
|
+
if (usage22.parent.parent && isImportTypeNode(usage22.parent.parent)) {
|
|
514355
|
+
const override = getResolutionModeOverride(usage22.parent.parent.attributes);
|
|
513950
514356
|
if (override) {
|
|
513951
514357
|
return override;
|
|
513952
514358
|
}
|
|
513953
514359
|
}
|
|
513954
514360
|
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
513955
|
-
return getEmitSyntaxForUsageLocationWorker(file2,
|
|
514361
|
+
return getEmitSyntaxForUsageLocationWorker(file2, usage22, compilerOptions);
|
|
513956
514362
|
}
|
|
513957
514363
|
}
|
|
513958
|
-
function getEmitSyntaxForUsageLocationWorker(file2,
|
|
514364
|
+
function getEmitSyntaxForUsageLocationWorker(file2, usage22, compilerOptions) {
|
|
513959
514365
|
var _a2;
|
|
513960
514366
|
if (!compilerOptions) {
|
|
513961
514367
|
return;
|
|
513962
514368
|
}
|
|
513963
|
-
const exprParentParent = (_a2 = walkUpParenthesizedExpressions(
|
|
513964
|
-
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
514369
|
+
const exprParentParent = (_a2 = walkUpParenthesizedExpressions(usage22.parent)) == null ? undefined : _a2.parent;
|
|
514370
|
+
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(usage22.parent, false)) {
|
|
513965
514371
|
return 1;
|
|
513966
514372
|
}
|
|
513967
|
-
if (isImportCall(walkUpParenthesizedExpressions(
|
|
514373
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage22.parent))) {
|
|
513968
514374
|
return shouldTransformImportCallWorker(file2, compilerOptions) ? 1 : 99;
|
|
513969
514375
|
}
|
|
513970
514376
|
const fileEmitMode = getEmitModuleFormatOfFileWorker(file2, compilerOptions);
|
|
@@ -516551,11 +516957,11 @@ ${lanes.join(`
|
|
|
516551
516957
|
}
|
|
516552
516958
|
return symlinks;
|
|
516553
516959
|
}
|
|
516554
|
-
function getModeForUsageLocation2(file2,
|
|
516555
|
-
return getModeForUsageLocationWorker(file2,
|
|
516960
|
+
function getModeForUsageLocation2(file2, usage22) {
|
|
516961
|
+
return getModeForUsageLocationWorker(file2, usage22, getCompilerOptionsForFile(file2));
|
|
516556
516962
|
}
|
|
516557
|
-
function getEmitSyntaxForUsageLocation(file2,
|
|
516558
|
-
return getEmitSyntaxForUsageLocationWorker(file2,
|
|
516963
|
+
function getEmitSyntaxForUsageLocation(file2, usage22) {
|
|
516964
|
+
return getEmitSyntaxForUsageLocationWorker(file2, usage22, getCompilerOptionsForFile(file2));
|
|
516559
516965
|
}
|
|
516560
516966
|
function getModeForResolutionAtIndex2(file2, index2) {
|
|
516561
516967
|
return getModeForUsageLocation2(file2, getModuleNameStringLiteralAt(file2, index2));
|
|
@@ -532028,23 +532434,23 @@ interface Symbol {
|
|
|
532028
532434
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
532029
532435
|
}
|
|
532030
532436
|
}
|
|
532031
|
-
function getNewStatementsAndRemoveFromOldFile(oldFile, targetFile,
|
|
532437
|
+
function getNewStatementsAndRemoveFromOldFile(oldFile, targetFile, usage22, changes, toMove, program, host, preferences, importAdderForNewFile, importAdderForOldFile) {
|
|
532032
532438
|
const checker = program.getTypeChecker();
|
|
532033
532439
|
const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective);
|
|
532034
532440
|
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, program, host, !!oldFile.commonJsModuleIndicator);
|
|
532035
532441
|
const quotePreference = getQuotePreference(oldFile, preferences);
|
|
532036
|
-
addImportsForMovedSymbols(
|
|
532037
|
-
deleteUnusedOldImports(oldFile, toMove.all,
|
|
532442
|
+
addImportsForMovedSymbols(usage22.oldFileImportsFromTargetFile, targetFile.fileName, importAdderForOldFile, program);
|
|
532443
|
+
deleteUnusedOldImports(oldFile, toMove.all, usage22.unusedImportsFromOldFile, importAdderForOldFile);
|
|
532038
532444
|
importAdderForOldFile.writeFixes(changes, quotePreference);
|
|
532039
532445
|
deleteMovedStatements(oldFile, toMove.ranges, changes);
|
|
532040
|
-
updateImportsInOtherFiles(changes, program, host, oldFile,
|
|
532041
|
-
addExportsInOldFile(oldFile,
|
|
532042
|
-
addTargetFileImports(oldFile,
|
|
532446
|
+
updateImportsInOtherFiles(changes, program, host, oldFile, usage22.movedSymbols, targetFile.fileName, quotePreference);
|
|
532447
|
+
addExportsInOldFile(oldFile, usage22.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
|
532448
|
+
addTargetFileImports(oldFile, usage22.oldImportsNeededByTargetFile, usage22.targetFileImportsFromOldFile, checker, program, importAdderForNewFile);
|
|
532043
532449
|
if (!isFullSourceFile(targetFile) && prologueDirectives.length) {
|
|
532044
532450
|
changes.insertStatementsInNewFile(targetFile.fileName, prologueDirectives, oldFile);
|
|
532045
532451
|
}
|
|
532046
532452
|
importAdderForNewFile.writeFixes(changes, quotePreference);
|
|
532047
|
-
const body = addExports(oldFile, toMove.all, arrayFrom(
|
|
532453
|
+
const body = addExports(oldFile, toMove.all, arrayFrom(usage22.oldFileImportsFromTargetFile.keys()), useEsModuleSyntax);
|
|
532048
532454
|
if (isFullSourceFile(targetFile) && targetFile.statements.length > 0) {
|
|
532049
532455
|
moveStatementsToTargetFile(changes, program, body, targetFile, toMove);
|
|
532050
532456
|
} else if (isFullSourceFile(targetFile)) {
|
|
@@ -532395,10 +532801,10 @@ interface Symbol {
|
|
|
532395
532801
|
function createNewFileName(oldFile, program, host, toMove) {
|
|
532396
532802
|
const checker = program.getTypeChecker();
|
|
532397
532803
|
if (toMove) {
|
|
532398
|
-
const
|
|
532804
|
+
const usage22 = getUsageInfo(oldFile, toMove.all, checker);
|
|
532399
532805
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
532400
532806
|
const extension = extensionFromPath(oldFile.fileName);
|
|
532401
|
-
const newFileName = combinePaths(currentDirectory, makeUniqueFilename(inferNewFileName(
|
|
532807
|
+
const newFileName = combinePaths(currentDirectory, makeUniqueFilename(inferNewFileName(usage22.oldFileImportsFromTargetFile, usage22.movedSymbols), extension, currentDirectory, host)) + extension;
|
|
532402
532808
|
return newFileName;
|
|
532403
532809
|
}
|
|
532404
532810
|
return "";
|
|
@@ -532916,12 +533322,12 @@ interface Symbol {
|
|
|
532916
533322
|
});
|
|
532917
533323
|
function doChange4(oldFile, program, toMove, changes, host, context4, preferences) {
|
|
532918
533324
|
const checker = program.getTypeChecker();
|
|
532919
|
-
const
|
|
533325
|
+
const usage22 = getUsageInfo(oldFile, toMove.all, checker);
|
|
532920
533326
|
const newFilename = createNewFileName(oldFile, program, host, toMove);
|
|
532921
533327
|
const newSourceFile = createFutureSourceFile(newFilename, oldFile.externalModuleIndicator ? 99 : oldFile.commonJsModuleIndicator ? 1 : undefined, program, host);
|
|
532922
533328
|
const importAdderForOldFile = ts_codefix_exports.createImportAdder(oldFile, context4.program, context4.preferences, context4.host);
|
|
532923
533329
|
const importAdderForNewFile = ts_codefix_exports.createImportAdder(newSourceFile, context4.program, context4.preferences, context4.host);
|
|
532924
|
-
getNewStatementsAndRemoveFromOldFile(oldFile, newSourceFile,
|
|
533330
|
+
getNewStatementsAndRemoveFromOldFile(oldFile, newSourceFile, usage22, changes, toMove, program, host, preferences, importAdderForNewFile, importAdderForOldFile);
|
|
532925
533331
|
addNewFileToTsconfig(program, changes, oldFile.fileName, newFilename, hostGetCanonicalFileName(host));
|
|
532926
533332
|
}
|
|
532927
533333
|
var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
|
|
@@ -534840,17 +535246,17 @@ ${newComment.split(`
|
|
|
534840
535246
|
const parameters = [];
|
|
534841
535247
|
const callArguments = [];
|
|
534842
535248
|
let writes;
|
|
534843
|
-
usagesInScope.forEach((
|
|
535249
|
+
usagesInScope.forEach((usage22, name) => {
|
|
534844
535250
|
let typeNode;
|
|
534845
535251
|
if (!isJS) {
|
|
534846
|
-
let type = checker.getTypeOfSymbolAtLocation(
|
|
535252
|
+
let type = checker.getTypeOfSymbolAtLocation(usage22.symbol, usage22.node);
|
|
534847
535253
|
type = checker.getBaseTypeOfLiteralType(type);
|
|
534848
535254
|
typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1, 8);
|
|
534849
535255
|
}
|
|
534850
535256
|
const paramDecl = factory2.createParameterDeclaration(undefined, undefined, name, undefined, typeNode);
|
|
534851
535257
|
parameters.push(paramDecl);
|
|
534852
|
-
if (
|
|
534853
|
-
(writes || (writes = [])).push(
|
|
535258
|
+
if (usage22.usage === 2) {
|
|
535259
|
+
(writes || (writes = [])).push(usage22);
|
|
534854
535260
|
}
|
|
534855
535261
|
callArguments.push(factory2.createIdentifier(name));
|
|
534856
535262
|
});
|
|
@@ -535400,8 +535806,8 @@ ${newComment.split(`
|
|
|
535400
535806
|
forEachChild(node, collectUsages);
|
|
535401
535807
|
}
|
|
535402
535808
|
}
|
|
535403
|
-
function recordUsage(n2,
|
|
535404
|
-
const symbolId = recordUsagebySymbol(n2,
|
|
535809
|
+
function recordUsage(n2, usage22, isTypeNode2) {
|
|
535810
|
+
const symbolId = recordUsagebySymbol(n2, usage22, isTypeNode2);
|
|
535405
535811
|
if (symbolId) {
|
|
535406
535812
|
for (let i3 = 0;i3 < scopes.length; i3++) {
|
|
535407
535813
|
const substitution = substitutionsPerScope[i3].get(symbolId);
|
|
@@ -535411,22 +535817,22 @@ ${newComment.split(`
|
|
|
535411
535817
|
}
|
|
535412
535818
|
}
|
|
535413
535819
|
}
|
|
535414
|
-
function recordUsagebySymbol(identifier,
|
|
535820
|
+
function recordUsagebySymbol(identifier, usage22, isTypeName) {
|
|
535415
535821
|
const symbol2 = getSymbolReferencedByIdentifier(identifier);
|
|
535416
535822
|
if (!symbol2) {
|
|
535417
535823
|
return;
|
|
535418
535824
|
}
|
|
535419
535825
|
const symbolId = getSymbolId(symbol2).toString();
|
|
535420
535826
|
const lastUsage = seenUsages.get(symbolId);
|
|
535421
|
-
if (lastUsage && lastUsage >=
|
|
535827
|
+
if (lastUsage && lastUsage >= usage22) {
|
|
535422
535828
|
return symbolId;
|
|
535423
535829
|
}
|
|
535424
|
-
seenUsages.set(symbolId,
|
|
535830
|
+
seenUsages.set(symbolId, usage22);
|
|
535425
535831
|
if (lastUsage) {
|
|
535426
535832
|
for (const perScope of usagesPerScope) {
|
|
535427
535833
|
const prevEntry = perScope.usages.get(identifier.text);
|
|
535428
535834
|
if (prevEntry) {
|
|
535429
|
-
perScope.usages.set(identifier.text, { usage:
|
|
535835
|
+
perScope.usages.set(identifier.text, { usage: usage22, symbol: symbol2, node: identifier });
|
|
535430
535836
|
}
|
|
535431
535837
|
}
|
|
535432
535838
|
return symbolId;
|
|
@@ -535439,7 +535845,7 @@ ${newComment.split(`
|
|
|
535439
535845
|
if (rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) {
|
|
535440
535846
|
return;
|
|
535441
535847
|
}
|
|
535442
|
-
if (targetRange.facts & 2 &&
|
|
535848
|
+
if (targetRange.facts & 2 && usage22 === 2) {
|
|
535443
535849
|
const diag22 = createDiagnosticForNode(identifier, Messages2.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators);
|
|
535444
535850
|
for (const errors4 of functionErrorsPerScope) {
|
|
535445
535851
|
errors4.push(diag22);
|
|
@@ -535465,7 +535871,7 @@ ${newComment.split(`
|
|
|
535465
535871
|
constantErrorsPerScope[i3].push(diag22);
|
|
535466
535872
|
}
|
|
535467
535873
|
} else {
|
|
535468
|
-
usagesPerScope[i3].usages.set(identifier.text, { usage:
|
|
535874
|
+
usagesPerScope[i3].usages.set(identifier.text, { usage: usage22, symbol: symbol2, node: identifier });
|
|
535469
535875
|
}
|
|
535470
535876
|
}
|
|
535471
535877
|
}
|
|
@@ -541175,9 +541581,9 @@ ${newComment.split(`
|
|
|
541175
541581
|
}
|
|
541176
541582
|
const checker = program.getTypeChecker();
|
|
541177
541583
|
for (const specifier2 of nonTypeOnlySpecifiers) {
|
|
541178
|
-
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (
|
|
541179
|
-
const symbol2 = checker.getSymbolAtLocation(
|
|
541180
|
-
return !!symbol2 && checker.symbolIsValue(symbol2) || !isValidTypeOnlyAliasUseSite(
|
|
541584
|
+
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage22) => {
|
|
541585
|
+
const symbol2 = checker.getSymbolAtLocation(usage22);
|
|
541586
|
+
return !!symbol2 && checker.symbolIsValue(symbol2) || !isValidTypeOnlyAliasUseSite(usage22);
|
|
541181
541587
|
});
|
|
541182
541588
|
if (isUsedAsValue) {
|
|
541183
541589
|
return false;
|
|
@@ -546318,12 +546724,12 @@ ${newComment.split(`
|
|
|
546318
546724
|
if (references.length === 0 || !declaration.parameters) {
|
|
546319
546725
|
return;
|
|
546320
546726
|
}
|
|
546321
|
-
const
|
|
546727
|
+
const usage22 = createEmptyUsage();
|
|
546322
546728
|
for (const reference of references) {
|
|
546323
546729
|
cancellationToken.throwIfCancellationRequested();
|
|
546324
|
-
calculateUsageOfNode(reference,
|
|
546730
|
+
calculateUsageOfNode(reference, usage22);
|
|
546325
546731
|
}
|
|
546326
|
-
const calls = [...
|
|
546732
|
+
const calls = [...usage22.constructs || [], ...usage22.calls || []];
|
|
546327
546733
|
return declaration.parameters.map((parameter, parameterIndex) => {
|
|
546328
546734
|
const types4 = [];
|
|
546329
546735
|
const isRest = isRestParameter(parameter);
|
|
@@ -546353,98 +546759,98 @@ ${newComment.split(`
|
|
|
546353
546759
|
});
|
|
546354
546760
|
}
|
|
546355
546761
|
function thisParameter() {
|
|
546356
|
-
const
|
|
546762
|
+
const usage22 = createEmptyUsage();
|
|
546357
546763
|
for (const reference of references) {
|
|
546358
546764
|
cancellationToken.throwIfCancellationRequested();
|
|
546359
|
-
calculateUsageOfNode(reference,
|
|
546765
|
+
calculateUsageOfNode(reference, usage22);
|
|
546360
546766
|
}
|
|
546361
|
-
return combineTypes(
|
|
546767
|
+
return combineTypes(usage22.candidateThisTypes || emptyArray);
|
|
546362
546768
|
}
|
|
546363
546769
|
function inferTypesFromReferencesSingle(references2) {
|
|
546364
|
-
const
|
|
546770
|
+
const usage22 = createEmptyUsage();
|
|
546365
546771
|
for (const reference of references2) {
|
|
546366
546772
|
cancellationToken.throwIfCancellationRequested();
|
|
546367
|
-
calculateUsageOfNode(reference,
|
|
546773
|
+
calculateUsageOfNode(reference, usage22);
|
|
546368
546774
|
}
|
|
546369
|
-
return inferTypes(
|
|
546775
|
+
return inferTypes(usage22);
|
|
546370
546776
|
}
|
|
546371
|
-
function calculateUsageOfNode(node,
|
|
546777
|
+
function calculateUsageOfNode(node, usage22) {
|
|
546372
546778
|
while (isRightSideOfQualifiedNameOrPropertyAccess(node)) {
|
|
546373
546779
|
node = node.parent;
|
|
546374
546780
|
}
|
|
546375
546781
|
switch (node.parent.kind) {
|
|
546376
546782
|
case 245:
|
|
546377
|
-
inferTypeFromExpressionStatement(node,
|
|
546783
|
+
inferTypeFromExpressionStatement(node, usage22);
|
|
546378
546784
|
break;
|
|
546379
546785
|
case 226:
|
|
546380
|
-
|
|
546786
|
+
usage22.isNumber = true;
|
|
546381
546787
|
break;
|
|
546382
546788
|
case 225:
|
|
546383
|
-
inferTypeFromPrefixUnaryExpression(node.parent,
|
|
546789
|
+
inferTypeFromPrefixUnaryExpression(node.parent, usage22);
|
|
546384
546790
|
break;
|
|
546385
546791
|
case 227:
|
|
546386
|
-
inferTypeFromBinaryExpression(node, node.parent,
|
|
546792
|
+
inferTypeFromBinaryExpression(node, node.parent, usage22);
|
|
546387
546793
|
break;
|
|
546388
546794
|
case 297:
|
|
546389
546795
|
case 298:
|
|
546390
|
-
inferTypeFromSwitchStatementLabel(node.parent,
|
|
546796
|
+
inferTypeFromSwitchStatementLabel(node.parent, usage22);
|
|
546391
546797
|
break;
|
|
546392
546798
|
case 214:
|
|
546393
546799
|
case 215:
|
|
546394
546800
|
if (node.parent.expression === node) {
|
|
546395
|
-
inferTypeFromCallExpression(node.parent,
|
|
546801
|
+
inferTypeFromCallExpression(node.parent, usage22);
|
|
546396
546802
|
} else {
|
|
546397
|
-
inferTypeFromContextualType(node,
|
|
546803
|
+
inferTypeFromContextualType(node, usage22);
|
|
546398
546804
|
}
|
|
546399
546805
|
break;
|
|
546400
546806
|
case 212:
|
|
546401
|
-
inferTypeFromPropertyAccessExpression(node.parent,
|
|
546807
|
+
inferTypeFromPropertyAccessExpression(node.parent, usage22);
|
|
546402
546808
|
break;
|
|
546403
546809
|
case 213:
|
|
546404
|
-
inferTypeFromPropertyElementExpression(node.parent, node,
|
|
546810
|
+
inferTypeFromPropertyElementExpression(node.parent, node, usage22);
|
|
546405
546811
|
break;
|
|
546406
546812
|
case 304:
|
|
546407
546813
|
case 305:
|
|
546408
|
-
inferTypeFromPropertyAssignment(node.parent,
|
|
546814
|
+
inferTypeFromPropertyAssignment(node.parent, usage22);
|
|
546409
546815
|
break;
|
|
546410
546816
|
case 173:
|
|
546411
|
-
inferTypeFromPropertyDeclaration(node.parent,
|
|
546817
|
+
inferTypeFromPropertyDeclaration(node.parent, usage22);
|
|
546412
546818
|
break;
|
|
546413
546819
|
case 261: {
|
|
546414
546820
|
const { name, initializer: initializer3 } = node.parent;
|
|
546415
546821
|
if (node === name) {
|
|
546416
546822
|
if (initializer3) {
|
|
546417
|
-
addCandidateType(
|
|
546823
|
+
addCandidateType(usage22, checker.getTypeAtLocation(initializer3));
|
|
546418
546824
|
}
|
|
546419
546825
|
break;
|
|
546420
546826
|
}
|
|
546421
546827
|
}
|
|
546422
546828
|
default:
|
|
546423
|
-
return inferTypeFromContextualType(node,
|
|
546829
|
+
return inferTypeFromContextualType(node, usage22);
|
|
546424
546830
|
}
|
|
546425
546831
|
}
|
|
546426
|
-
function inferTypeFromContextualType(node,
|
|
546832
|
+
function inferTypeFromContextualType(node, usage22) {
|
|
546427
546833
|
if (isExpressionNode(node)) {
|
|
546428
|
-
addCandidateType(
|
|
546834
|
+
addCandidateType(usage22, checker.getContextualType(node));
|
|
546429
546835
|
}
|
|
546430
546836
|
}
|
|
546431
|
-
function inferTypeFromExpressionStatement(node,
|
|
546432
|
-
addCandidateType(
|
|
546837
|
+
function inferTypeFromExpressionStatement(node, usage22) {
|
|
546838
|
+
addCandidateType(usage22, isCallExpression(node) ? checker.getVoidType() : checker.getAnyType());
|
|
546433
546839
|
}
|
|
546434
|
-
function inferTypeFromPrefixUnaryExpression(node,
|
|
546840
|
+
function inferTypeFromPrefixUnaryExpression(node, usage22) {
|
|
546435
546841
|
switch (node.operator) {
|
|
546436
546842
|
case 46:
|
|
546437
546843
|
case 47:
|
|
546438
546844
|
case 41:
|
|
546439
546845
|
case 55:
|
|
546440
|
-
|
|
546846
|
+
usage22.isNumber = true;
|
|
546441
546847
|
break;
|
|
546442
546848
|
case 40:
|
|
546443
|
-
|
|
546849
|
+
usage22.isNumberOrString = true;
|
|
546444
546850
|
break;
|
|
546445
546851
|
}
|
|
546446
546852
|
}
|
|
546447
|
-
function inferTypeFromBinaryExpression(node, parent22,
|
|
546853
|
+
function inferTypeFromBinaryExpression(node, parent22, usage22) {
|
|
546448
546854
|
switch (parent22.operatorToken.kind) {
|
|
546449
546855
|
case 43:
|
|
546450
546856
|
case 42:
|
|
@@ -546474,22 +546880,22 @@ ${newComment.split(`
|
|
|
546474
546880
|
case 34:
|
|
546475
546881
|
const operandType = checker.getTypeAtLocation(parent22.left === node ? parent22.right : parent22.left);
|
|
546476
546882
|
if (operandType.flags & 1056) {
|
|
546477
|
-
addCandidateType(
|
|
546883
|
+
addCandidateType(usage22, operandType);
|
|
546478
546884
|
} else {
|
|
546479
|
-
|
|
546885
|
+
usage22.isNumber = true;
|
|
546480
546886
|
}
|
|
546481
546887
|
break;
|
|
546482
546888
|
case 65:
|
|
546483
546889
|
case 40:
|
|
546484
546890
|
const otherOperandType = checker.getTypeAtLocation(parent22.left === node ? parent22.right : parent22.left);
|
|
546485
546891
|
if (otherOperandType.flags & 1056) {
|
|
546486
|
-
addCandidateType(
|
|
546892
|
+
addCandidateType(usage22, otherOperandType);
|
|
546487
546893
|
} else if (otherOperandType.flags & 296) {
|
|
546488
|
-
|
|
546894
|
+
usage22.isNumber = true;
|
|
546489
546895
|
} else if (otherOperandType.flags & 402653316) {
|
|
546490
|
-
|
|
546896
|
+
usage22.isString = true;
|
|
546491
546897
|
} else if (otherOperandType.flags & 1) {} else {
|
|
546492
|
-
|
|
546898
|
+
usage22.isNumberOrString = true;
|
|
546493
546899
|
}
|
|
546494
546900
|
break;
|
|
546495
546901
|
case 64:
|
|
@@ -546500,17 +546906,17 @@ ${newComment.split(`
|
|
|
546500
546906
|
case 77:
|
|
546501
546907
|
case 78:
|
|
546502
546908
|
case 76:
|
|
546503
|
-
addCandidateType(
|
|
546909
|
+
addCandidateType(usage22, checker.getTypeAtLocation(parent22.left === node ? parent22.right : parent22.left));
|
|
546504
546910
|
break;
|
|
546505
546911
|
case 103:
|
|
546506
546912
|
if (node === parent22.left) {
|
|
546507
|
-
|
|
546913
|
+
usage22.isString = true;
|
|
546508
546914
|
}
|
|
546509
546915
|
break;
|
|
546510
546916
|
case 57:
|
|
546511
546917
|
case 61:
|
|
546512
546918
|
if (node === parent22.left && (node.parent.parent.kind === 261 || isAssignmentExpression(node.parent.parent, true))) {
|
|
546513
|
-
addCandidateType(
|
|
546919
|
+
addCandidateType(usage22, checker.getTypeAtLocation(parent22.right));
|
|
546514
546920
|
}
|
|
546515
546921
|
break;
|
|
546516
546922
|
case 56:
|
|
@@ -546519,10 +546925,10 @@ ${newComment.split(`
|
|
|
546519
546925
|
break;
|
|
546520
546926
|
}
|
|
546521
546927
|
}
|
|
546522
|
-
function inferTypeFromSwitchStatementLabel(parent22,
|
|
546523
|
-
addCandidateType(
|
|
546928
|
+
function inferTypeFromSwitchStatementLabel(parent22, usage22) {
|
|
546929
|
+
addCandidateType(usage22, checker.getTypeAtLocation(parent22.parent.parent.expression));
|
|
546524
546930
|
}
|
|
546525
|
-
function inferTypeFromCallExpression(parent22,
|
|
546931
|
+
function inferTypeFromCallExpression(parent22, usage22) {
|
|
546526
546932
|
const call96 = {
|
|
546527
546933
|
argumentTypes: [],
|
|
546528
546934
|
return_: createEmptyUsage()
|
|
@@ -546534,41 +546940,41 @@ ${newComment.split(`
|
|
|
546534
546940
|
}
|
|
546535
546941
|
calculateUsageOfNode(parent22, call96.return_);
|
|
546536
546942
|
if (parent22.kind === 214) {
|
|
546537
|
-
(
|
|
546943
|
+
(usage22.calls || (usage22.calls = [])).push(call96);
|
|
546538
546944
|
} else {
|
|
546539
|
-
(
|
|
546945
|
+
(usage22.constructs || (usage22.constructs = [])).push(call96);
|
|
546540
546946
|
}
|
|
546541
546947
|
}
|
|
546542
|
-
function inferTypeFromPropertyAccessExpression(parent22,
|
|
546948
|
+
function inferTypeFromPropertyAccessExpression(parent22, usage22) {
|
|
546543
546949
|
const name = escapeLeadingUnderscores(parent22.name.text);
|
|
546544
|
-
if (!
|
|
546545
|
-
|
|
546950
|
+
if (!usage22.properties) {
|
|
546951
|
+
usage22.properties = /* @__PURE__ */ new Map;
|
|
546546
546952
|
}
|
|
546547
|
-
const propertyUsage =
|
|
546953
|
+
const propertyUsage = usage22.properties.get(name) || createEmptyUsage();
|
|
546548
546954
|
calculateUsageOfNode(parent22, propertyUsage);
|
|
546549
|
-
|
|
546955
|
+
usage22.properties.set(name, propertyUsage);
|
|
546550
546956
|
}
|
|
546551
|
-
function inferTypeFromPropertyElementExpression(parent22, node,
|
|
546957
|
+
function inferTypeFromPropertyElementExpression(parent22, node, usage22) {
|
|
546552
546958
|
if (node === parent22.argumentExpression) {
|
|
546553
|
-
|
|
546959
|
+
usage22.isNumberOrString = true;
|
|
546554
546960
|
return;
|
|
546555
546961
|
} else {
|
|
546556
546962
|
const indexType = checker.getTypeAtLocation(parent22.argumentExpression);
|
|
546557
546963
|
const indexUsage = createEmptyUsage();
|
|
546558
546964
|
calculateUsageOfNode(parent22, indexUsage);
|
|
546559
546965
|
if (indexType.flags & 296) {
|
|
546560
|
-
|
|
546966
|
+
usage22.numberIndex = indexUsage;
|
|
546561
546967
|
} else {
|
|
546562
|
-
|
|
546968
|
+
usage22.stringIndex = indexUsage;
|
|
546563
546969
|
}
|
|
546564
546970
|
}
|
|
546565
546971
|
}
|
|
546566
|
-
function inferTypeFromPropertyAssignment(assignment,
|
|
546972
|
+
function inferTypeFromPropertyAssignment(assignment, usage22) {
|
|
546567
546973
|
const nodeWithRealType = isVariableDeclaration(assignment.parent.parent) ? assignment.parent.parent : assignment.parent;
|
|
546568
|
-
addCandidateThisType(
|
|
546974
|
+
addCandidateThisType(usage22, checker.getTypeAtLocation(nodeWithRealType));
|
|
546569
546975
|
}
|
|
546570
|
-
function inferTypeFromPropertyDeclaration(declaration,
|
|
546571
|
-
addCandidateThisType(
|
|
546976
|
+
function inferTypeFromPropertyDeclaration(declaration, usage22) {
|
|
546977
|
+
addCandidateThisType(usage22, checker.getTypeAtLocation(declaration.parent));
|
|
546572
546978
|
}
|
|
546573
546979
|
function removeLowPriorityInferences(inferences, priorities) {
|
|
546574
546980
|
const toRemove = [];
|
|
@@ -546582,8 +546988,8 @@ ${newComment.split(`
|
|
|
546582
546988
|
}
|
|
546583
546989
|
return inferences.filter((i3) => toRemove.every((f) => !f(i3)));
|
|
546584
546990
|
}
|
|
546585
|
-
function combineFromUsage(
|
|
546586
|
-
return combineTypes(inferTypes(
|
|
546991
|
+
function combineFromUsage(usage22) {
|
|
546992
|
+
return combineTypes(inferTypes(usage22));
|
|
546587
546993
|
}
|
|
546588
546994
|
function combineTypes(inferences) {
|
|
546589
546995
|
if (!inferences.length)
|
|
@@ -546652,26 +547058,26 @@ ${newComment.split(`
|
|
|
546652
547058
|
indexInfos.push(checker.createIndexInfo(checker.getNumberType(), checker.getUnionType(numberIndices), numberIndexReadonly));
|
|
546653
547059
|
return checker.createAnonymousType(anons[0].symbol, members, calls, constructs, indexInfos);
|
|
546654
547060
|
}
|
|
546655
|
-
function inferTypes(
|
|
547061
|
+
function inferTypes(usage22) {
|
|
546656
547062
|
var _a2, _b2, _c219;
|
|
546657
547063
|
const types4 = [];
|
|
546658
|
-
if (
|
|
547064
|
+
if (usage22.isNumber) {
|
|
546659
547065
|
types4.push(checker.getNumberType());
|
|
546660
547066
|
}
|
|
546661
|
-
if (
|
|
547067
|
+
if (usage22.isString) {
|
|
546662
547068
|
types4.push(checker.getStringType());
|
|
546663
547069
|
}
|
|
546664
|
-
if (
|
|
547070
|
+
if (usage22.isNumberOrString) {
|
|
546665
547071
|
types4.push(checker.getUnionType([checker.getStringType(), checker.getNumberType()]));
|
|
546666
547072
|
}
|
|
546667
|
-
if (
|
|
546668
|
-
types4.push(checker.createArrayType(combineFromUsage(
|
|
547073
|
+
if (usage22.numberIndex) {
|
|
547074
|
+
types4.push(checker.createArrayType(combineFromUsage(usage22.numberIndex)));
|
|
546669
547075
|
}
|
|
546670
|
-
if (((_a2 =
|
|
546671
|
-
types4.push(inferStructuralType(
|
|
547076
|
+
if (((_a2 = usage22.properties) == null ? undefined : _a2.size) || ((_b2 = usage22.constructs) == null ? undefined : _b2.length) || usage22.stringIndex) {
|
|
547077
|
+
types4.push(inferStructuralType(usage22));
|
|
546672
547078
|
}
|
|
546673
|
-
const candidateTypes = (
|
|
546674
|
-
const callsType = ((_c219 =
|
|
547079
|
+
const candidateTypes = (usage22.candidateTypes || []).map((t) => checker.getBaseTypeOfLiteralType(t));
|
|
547080
|
+
const callsType = ((_c219 = usage22.calls) == null ? undefined : _c219.length) ? inferStructuralType(usage22) : undefined;
|
|
546675
547081
|
if (callsType && candidateTypes) {
|
|
546676
547082
|
types4.push(checker.getUnionType([callsType, ...candidateTypes], 2));
|
|
546677
547083
|
} else {
|
|
@@ -546682,36 +547088,36 @@ ${newComment.split(`
|
|
|
546682
547088
|
types4.push(...candidateTypes);
|
|
546683
547089
|
}
|
|
546684
547090
|
}
|
|
546685
|
-
types4.push(...inferNamedTypesFromProperties(
|
|
547091
|
+
types4.push(...inferNamedTypesFromProperties(usage22));
|
|
546686
547092
|
return types4;
|
|
546687
547093
|
}
|
|
546688
|
-
function inferStructuralType(
|
|
547094
|
+
function inferStructuralType(usage22) {
|
|
546689
547095
|
const members = /* @__PURE__ */ new Map;
|
|
546690
|
-
if (
|
|
546691
|
-
|
|
547096
|
+
if (usage22.properties) {
|
|
547097
|
+
usage22.properties.forEach((u4, name) => {
|
|
546692
547098
|
const symbol2 = checker.createSymbol(4, name);
|
|
546693
547099
|
symbol2.links.type = combineFromUsage(u4);
|
|
546694
547100
|
members.set(name, symbol2);
|
|
546695
547101
|
});
|
|
546696
547102
|
}
|
|
546697
|
-
const callSignatures =
|
|
546698
|
-
const constructSignatures =
|
|
546699
|
-
const indexInfos =
|
|
547103
|
+
const callSignatures = usage22.calls ? [getSignatureFromCalls(usage22.calls)] : [];
|
|
547104
|
+
const constructSignatures = usage22.constructs ? [getSignatureFromCalls(usage22.constructs)] : [];
|
|
547105
|
+
const indexInfos = usage22.stringIndex ? [checker.createIndexInfo(checker.getStringType(), combineFromUsage(usage22.stringIndex), false)] : [];
|
|
546700
547106
|
return checker.createAnonymousType(undefined, members, callSignatures, constructSignatures, indexInfos);
|
|
546701
547107
|
}
|
|
546702
|
-
function inferNamedTypesFromProperties(
|
|
546703
|
-
if (!
|
|
547108
|
+
function inferNamedTypesFromProperties(usage22) {
|
|
547109
|
+
if (!usage22.properties || !usage22.properties.size)
|
|
546704
547110
|
return [];
|
|
546705
|
-
const types4 = builtins.filter((t) => allPropertiesAreAssignableToUsage(t,
|
|
547111
|
+
const types4 = builtins.filter((t) => allPropertiesAreAssignableToUsage(t, usage22));
|
|
546706
547112
|
if (0 < types4.length && types4.length < 3) {
|
|
546707
|
-
return types4.map((t) => inferInstantiationFromUsage(t,
|
|
547113
|
+
return types4.map((t) => inferInstantiationFromUsage(t, usage22));
|
|
546708
547114
|
}
|
|
546709
547115
|
return [];
|
|
546710
547116
|
}
|
|
546711
|
-
function allPropertiesAreAssignableToUsage(type,
|
|
546712
|
-
if (!
|
|
547117
|
+
function allPropertiesAreAssignableToUsage(type, usage22) {
|
|
547118
|
+
if (!usage22.properties)
|
|
546713
547119
|
return false;
|
|
546714
|
-
return !forEachEntry2(
|
|
547120
|
+
return !forEachEntry2(usage22.properties, (propUsage, name) => {
|
|
546715
547121
|
const source = checker.getTypeOfPropertyOfType(type, name);
|
|
546716
547122
|
if (!source) {
|
|
546717
547123
|
return true;
|
|
@@ -546724,8 +547130,8 @@ ${newComment.split(`
|
|
|
546724
547130
|
}
|
|
546725
547131
|
});
|
|
546726
547132
|
}
|
|
546727
|
-
function inferInstantiationFromUsage(type,
|
|
546728
|
-
if (!(getObjectFlags(type) & 4) || !
|
|
547133
|
+
function inferInstantiationFromUsage(type, usage22) {
|
|
547134
|
+
if (!(getObjectFlags(type) & 4) || !usage22.properties) {
|
|
546729
547135
|
return type;
|
|
546730
547136
|
}
|
|
546731
547137
|
const generic = type.target;
|
|
@@ -546733,7 +547139,7 @@ ${newComment.split(`
|
|
|
546733
547139
|
if (!singleTypeParameter)
|
|
546734
547140
|
return type;
|
|
546735
547141
|
const types4 = [];
|
|
546736
|
-
|
|
547142
|
+
usage22.properties.forEach((propUsage, name) => {
|
|
546737
547143
|
const genericPropertyType = checker.getTypeOfPropertyOfType(generic, name);
|
|
546738
547144
|
Debug.assert(!!genericPropertyType, "generic should have all the properties of its reference.");
|
|
546739
547145
|
types4.push(...inferTypeParameters(genericPropertyType, combineFromUsage(propUsage), singleTypeParameter));
|
|
@@ -546805,14 +547211,14 @@ ${newComment.split(`
|
|
|
546805
547211
|
const returnType = combineFromUsage(combineUsages(calls.map((call96) => call96.return_)));
|
|
546806
547212
|
return checker.createSignature(undefined, undefined, undefined, parameters2, returnType, undefined, length2, 0);
|
|
546807
547213
|
}
|
|
546808
|
-
function addCandidateType(
|
|
547214
|
+
function addCandidateType(usage22, type) {
|
|
546809
547215
|
if (type && !(type.flags & 1) && !(type.flags & 131072)) {
|
|
546810
|
-
(
|
|
547216
|
+
(usage22.candidateTypes || (usage22.candidateTypes = [])).push(type);
|
|
546811
547217
|
}
|
|
546812
547218
|
}
|
|
546813
|
-
function addCandidateThisType(
|
|
547219
|
+
function addCandidateThisType(usage22, type) {
|
|
546814
547220
|
if (type && !(type.flags & 1) && !(type.flags & 131072)) {
|
|
546815
|
-
(
|
|
547221
|
+
(usage22.candidateThisTypes || (usage22.candidateThisTypes = [])).push(type);
|
|
546816
547222
|
}
|
|
546817
547223
|
}
|
|
546818
547224
|
}
|
|
@@ -562699,10 +563105,10 @@ ${options2.prefix}` : `
|
|
|
562699
563105
|
Debug.assertIsDefined(originalProgram, "no original program found");
|
|
562700
563106
|
const originalProgramTypeChecker = originalProgram.getTypeChecker();
|
|
562701
563107
|
const usageInfoRange = getUsageInfoRangeForPasteEdits(copiedFrom);
|
|
562702
|
-
const
|
|
563108
|
+
const usage22 = getUsageInfo(copiedFrom.file, statements, originalProgramTypeChecker, getExistingLocals(updatedFile, statements, originalProgramTypeChecker), usageInfoRange);
|
|
562703
563109
|
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
|
|
562704
|
-
addExportsInOldFile(copiedFrom.file,
|
|
562705
|
-
addTargetFileImports(copiedFrom.file,
|
|
563110
|
+
addExportsInOldFile(copiedFrom.file, usage22.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
|
563111
|
+
addTargetFileImports(copiedFrom.file, usage22.oldImportsNeededByTargetFile, usage22.targetFileImportsFromOldFile, originalProgramTypeChecker, updatedProgram, importAdder);
|
|
562706
563112
|
} else {
|
|
562707
563113
|
const context4 = {
|
|
562708
563114
|
sourceFile: updatedFile,
|
|
@@ -577267,7 +577673,7 @@ var exports_repo_edit = {};
|
|
|
577267
577673
|
__export(exports_repo_edit, {
|
|
577268
577674
|
call: () => call96
|
|
577269
577675
|
});
|
|
577270
|
-
function
|
|
577676
|
+
function usage22() {
|
|
577271
577677
|
return [
|
|
577272
577678
|
"Usage:",
|
|
577273
577679
|
" ur repo-edit index [--json]",
|
|
@@ -577394,7 +577800,7 @@ var call96 = async (args) => {
|
|
|
577394
577800
|
if (action3 === "search") {
|
|
577395
577801
|
const query2 = positionals15(tokens).slice(1).join(" ");
|
|
577396
577802
|
if (!query2)
|
|
577397
|
-
return { type: "text", value:
|
|
577803
|
+
return { type: "text", value: usage22() };
|
|
577398
577804
|
const hits = searchRepoEditIndex(root2, query2);
|
|
577399
577805
|
return {
|
|
577400
577806
|
type: "text",
|
|
@@ -577404,7 +577810,7 @@ var call96 = async (args) => {
|
|
|
577404
577810
|
if (action3 === "rename") {
|
|
577405
577811
|
const rename10 = renameArgs(tokens);
|
|
577406
577812
|
if (!rename10)
|
|
577407
|
-
return { type: "text", value:
|
|
577813
|
+
return { type: "text", value: usage22() };
|
|
577408
577814
|
const file2 = option21(tokens, "--file");
|
|
577409
577815
|
const location2 = file2 ? parseSymbolLocation(rename10.from) : { name: rename10.from };
|
|
577410
577816
|
const plan = await planRenameAst({
|
|
@@ -577426,7 +577832,7 @@ var call96 = async (args) => {
|
|
|
577426
577832
|
if (action3 === "apply") {
|
|
577427
577833
|
const rename10 = renameArgs(tokens);
|
|
577428
577834
|
if (!rename10)
|
|
577429
|
-
return { type: "text", value:
|
|
577835
|
+
return { type: "text", value: usage22() };
|
|
577430
577836
|
const file2 = option21(tokens, "--file");
|
|
577431
577837
|
const location2 = file2 ? parseSymbolLocation(rename10.from) : { name: rename10.from };
|
|
577432
577838
|
const result = await applyRenameAst({
|
|
@@ -577448,7 +577854,7 @@ var call96 = async (args) => {
|
|
|
577448
577854
|
if (action3 === "move") {
|
|
577449
577855
|
const move = moveArgs(tokens);
|
|
577450
577856
|
if (!move)
|
|
577451
|
-
return { type: "text", value:
|
|
577857
|
+
return { type: "text", value: usage22() };
|
|
577452
577858
|
const file2 = option21(tokens, "--file");
|
|
577453
577859
|
if (!file2)
|
|
577454
577860
|
return { type: "text", value: "move requires --file <source-file>" };
|
|
@@ -577507,7 +577913,7 @@ var call96 = async (args) => {
|
|
|
577507
577913
|
if (action3 === "callers") {
|
|
577508
577914
|
const symbol2 = callersArgs(tokens);
|
|
577509
577915
|
if (!symbol2)
|
|
577510
|
-
return { type: "text", value:
|
|
577916
|
+
return { type: "text", value: usage22() };
|
|
577511
577917
|
const file2 = option21(tokens, "--file");
|
|
577512
577918
|
const location2 = parseSymbolLocation(symbol2);
|
|
577513
577919
|
const plan = await findCallersAst({ root: root2, symbol: location2.name, file: file2 });
|
|
@@ -577516,7 +577922,7 @@ var call96 = async (args) => {
|
|
|
577516
577922
|
if (action3 === "plan" || action3 === "preview") {
|
|
577517
577923
|
const rename10 = renameArgs(tokens);
|
|
577518
577924
|
if (!rename10)
|
|
577519
|
-
return { type: "text", value:
|
|
577925
|
+
return { type: "text", value: usage22() };
|
|
577520
577926
|
const plan = planRename(root2, rename10.from, rename10.to);
|
|
577521
577927
|
if (action3 === "plan") {
|
|
577522
577928
|
return {
|
|
@@ -577535,7 +577941,7 @@ var call96 = async (args) => {
|
|
|
577535
577941
|
value: `repo-edit failed: ${error40 instanceof Error ? error40.message : String(error40)}`
|
|
577536
577942
|
};
|
|
577537
577943
|
}
|
|
577538
|
-
return { type: "text", value:
|
|
577944
|
+
return { type: "text", value: usage22() };
|
|
577539
577945
|
};
|
|
577540
577946
|
var init_repo_edit = __esm(() => {
|
|
577541
577947
|
init_argumentSubstitution();
|
|
@@ -592169,7 +592575,7 @@ import {
|
|
|
592169
592575
|
getHeapStatistics
|
|
592170
592576
|
} from "v8";
|
|
592171
592577
|
async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
592172
|
-
const
|
|
592578
|
+
const usage23 = process.memoryUsage();
|
|
592173
592579
|
const heapStats = getHeapStatistics();
|
|
592174
592580
|
const resourceUsage = process.resourceUsage();
|
|
592175
592581
|
const uptimeSeconds = process.uptime();
|
|
@@ -592187,8 +592593,8 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
|
592187
592593
|
try {
|
|
592188
592594
|
smapsRollup = await readFile47("/proc/self/smaps_rollup", "utf8");
|
|
592189
592595
|
} catch {}
|
|
592190
|
-
const nativeMemory =
|
|
592191
|
-
const bytesPerSecond = uptimeSeconds > 0 ?
|
|
592596
|
+
const nativeMemory = usage23.rss - usage23.heapUsed;
|
|
592597
|
+
const bytesPerSecond = uptimeSeconds > 0 ? usage23.rss / uptimeSeconds : 0;
|
|
592192
592598
|
const mbPerHour = bytesPerSecond * 3600 / (1024 * 1024);
|
|
592193
592599
|
const potentialLeaks = [];
|
|
592194
592600
|
if (heapStats.number_of_detached_contexts > 0) {
|
|
@@ -592197,7 +592603,7 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
|
592197
592603
|
if (activeHandles > 100) {
|
|
592198
592604
|
potentialLeaks.push(`${activeHandles} active handles - possible timer/socket leak`);
|
|
592199
592605
|
}
|
|
592200
|
-
if (nativeMemory >
|
|
592606
|
+
if (nativeMemory > usage23.heapUsed) {
|
|
592201
592607
|
potentialLeaks.push("Native memory > heap - leak may be in native addons (node-pty, sharp, etc.)");
|
|
592202
592608
|
}
|
|
592203
592609
|
if (mbPerHour > 100) {
|
|
@@ -592213,11 +592619,11 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
|
592213
592619
|
dumpNumber,
|
|
592214
592620
|
uptimeSeconds,
|
|
592215
592621
|
memoryUsage: {
|
|
592216
|
-
heapUsed:
|
|
592217
|
-
heapTotal:
|
|
592218
|
-
external:
|
|
592219
|
-
arrayBuffers:
|
|
592220
|
-
rss:
|
|
592622
|
+
heapUsed: usage23.heapUsed,
|
|
592623
|
+
heapTotal: usage23.heapTotal,
|
|
592624
|
+
external: usage23.external,
|
|
592625
|
+
arrayBuffers: usage23.arrayBuffers,
|
|
592626
|
+
rss: usage23.rss
|
|
592221
592627
|
},
|
|
592222
592628
|
memoryGrowthRate: {
|
|
592223
592629
|
bytesPerSecond,
|
|
@@ -592251,7 +592657,7 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
|
592251
592657
|
smapsRollup,
|
|
592252
592658
|
platform: process.platform,
|
|
592253
592659
|
nodeVersion: process.version,
|
|
592254
|
-
ccVersion: "1.
|
|
592660
|
+
ccVersion: "1.29.1"
|
|
592255
592661
|
};
|
|
592256
592662
|
}
|
|
592257
592663
|
async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
|
|
@@ -592837,7 +593243,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
592837
593243
|
var call136 = async () => {
|
|
592838
593244
|
return {
|
|
592839
593245
|
type: "text",
|
|
592840
|
-
value: "1.
|
|
593246
|
+
value: "1.29.1"
|
|
592841
593247
|
};
|
|
592842
593248
|
}, version2, version_default;
|
|
592843
593249
|
var init_version = __esm(() => {
|
|
@@ -598494,20 +598900,20 @@ function mergeCacheWithNewStats(existingCache, newStats, newLastComputedDate) {
|
|
|
598494
598900
|
}
|
|
598495
598901
|
}
|
|
598496
598902
|
const modelUsage = { ...existingCache.modelUsage };
|
|
598497
|
-
for (const [model,
|
|
598903
|
+
for (const [model, usage23] of Object.entries(newStats.modelUsage)) {
|
|
598498
598904
|
if (modelUsage[model]) {
|
|
598499
598905
|
modelUsage[model] = {
|
|
598500
|
-
inputTokens: modelUsage[model].inputTokens +
|
|
598501
|
-
outputTokens: modelUsage[model].outputTokens +
|
|
598502
|
-
cacheReadInputTokens: modelUsage[model].cacheReadInputTokens +
|
|
598503
|
-
cacheCreationInputTokens: modelUsage[model].cacheCreationInputTokens +
|
|
598504
|
-
webSearchRequests: modelUsage[model].webSearchRequests +
|
|
598505
|
-
costUSD: modelUsage[model].costUSD +
|
|
598506
|
-
contextWindow: Math.max(modelUsage[model].contextWindow,
|
|
598507
|
-
maxOutputTokens: Math.max(modelUsage[model].maxOutputTokens,
|
|
598906
|
+
inputTokens: modelUsage[model].inputTokens + usage23.inputTokens,
|
|
598907
|
+
outputTokens: modelUsage[model].outputTokens + usage23.outputTokens,
|
|
598908
|
+
cacheReadInputTokens: modelUsage[model].cacheReadInputTokens + usage23.cacheReadInputTokens,
|
|
598909
|
+
cacheCreationInputTokens: modelUsage[model].cacheCreationInputTokens + usage23.cacheCreationInputTokens,
|
|
598910
|
+
webSearchRequests: modelUsage[model].webSearchRequests + usage23.webSearchRequests,
|
|
598911
|
+
costUSD: modelUsage[model].costUSD + usage23.costUSD,
|
|
598912
|
+
contextWindow: Math.max(modelUsage[model].contextWindow, usage23.contextWindow),
|
|
598913
|
+
maxOutputTokens: Math.max(modelUsage[model].maxOutputTokens, usage23.maxOutputTokens)
|
|
598508
598914
|
};
|
|
598509
598915
|
} else {
|
|
598510
|
-
modelUsage[model] = { ...
|
|
598916
|
+
modelUsage[model] = { ...usage23 };
|
|
598511
598917
|
}
|
|
598512
598918
|
}
|
|
598513
598919
|
const hourCounts = { ...existingCache.hourCounts };
|
|
@@ -599238,7 +599644,7 @@ async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
|
599238
599644
|
}
|
|
599239
599645
|
}
|
|
599240
599646
|
if (message.message?.usage) {
|
|
599241
|
-
const
|
|
599647
|
+
const usage23 = message.message.usage;
|
|
599242
599648
|
const model = message.message.model || "unknown";
|
|
599243
599649
|
if (model === SYNTHETIC_MODEL) {
|
|
599244
599650
|
continue;
|
|
@@ -599255,11 +599661,11 @@ async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
|
599255
599661
|
maxOutputTokens: 0
|
|
599256
599662
|
};
|
|
599257
599663
|
}
|
|
599258
|
-
modelUsageAgg[model].inputTokens +=
|
|
599259
|
-
modelUsageAgg[model].outputTokens +=
|
|
599260
|
-
modelUsageAgg[model].cacheReadInputTokens +=
|
|
599261
|
-
modelUsageAgg[model].cacheCreationInputTokens +=
|
|
599262
|
-
const totalTokens = (
|
|
599664
|
+
modelUsageAgg[model].inputTokens += usage23.input_tokens || 0;
|
|
599665
|
+
modelUsageAgg[model].outputTokens += usage23.output_tokens || 0;
|
|
599666
|
+
modelUsageAgg[model].cacheReadInputTokens += usage23.cache_read_input_tokens || 0;
|
|
599667
|
+
modelUsageAgg[model].cacheCreationInputTokens += usage23.cache_creation_input_tokens || 0;
|
|
599668
|
+
const totalTokens = (usage23.input_tokens || 0) + (usage23.output_tokens || 0);
|
|
599263
599669
|
if (totalTokens > 0) {
|
|
599264
599670
|
const dayTokens = dailyModelTokensMap.get(dateKey) || {};
|
|
599265
599671
|
dayTokens[model] = (dayTokens[model] || 0) + totalTokens;
|
|
@@ -599350,20 +599756,20 @@ function cacheToStats(cache5, todayStats) {
|
|
|
599350
599756
|
}
|
|
599351
599757
|
const modelUsage = { ...cache5.modelUsage };
|
|
599352
599758
|
if (todayStats) {
|
|
599353
|
-
for (const [model,
|
|
599759
|
+
for (const [model, usage23] of Object.entries(todayStats.modelUsage)) {
|
|
599354
599760
|
if (modelUsage[model]) {
|
|
599355
599761
|
modelUsage[model] = {
|
|
599356
|
-
inputTokens: modelUsage[model].inputTokens +
|
|
599357
|
-
outputTokens: modelUsage[model].outputTokens +
|
|
599358
|
-
cacheReadInputTokens: modelUsage[model].cacheReadInputTokens +
|
|
599359
|
-
cacheCreationInputTokens: modelUsage[model].cacheCreationInputTokens +
|
|
599360
|
-
webSearchRequests: modelUsage[model].webSearchRequests +
|
|
599361
|
-
costUSD: modelUsage[model].costUSD +
|
|
599362
|
-
contextWindow: Math.max(modelUsage[model].contextWindow,
|
|
599363
|
-
maxOutputTokens: Math.max(modelUsage[model].maxOutputTokens,
|
|
599762
|
+
inputTokens: modelUsage[model].inputTokens + usage23.inputTokens,
|
|
599763
|
+
outputTokens: modelUsage[model].outputTokens + usage23.outputTokens,
|
|
599764
|
+
cacheReadInputTokens: modelUsage[model].cacheReadInputTokens + usage23.cacheReadInputTokens,
|
|
599765
|
+
cacheCreationInputTokens: modelUsage[model].cacheCreationInputTokens + usage23.cacheCreationInputTokens,
|
|
599766
|
+
webSearchRequests: modelUsage[model].webSearchRequests + usage23.webSearchRequests,
|
|
599767
|
+
costUSD: modelUsage[model].costUSD + usage23.costUSD,
|
|
599768
|
+
contextWindow: Math.max(modelUsage[model].contextWindow, usage23.contextWindow),
|
|
599769
|
+
maxOutputTokens: Math.max(modelUsage[model].maxOutputTokens, usage23.maxOutputTokens)
|
|
599364
599770
|
};
|
|
599365
599771
|
} else {
|
|
599366
|
-
modelUsage[model] = { ...
|
|
599772
|
+
modelUsage[model] = { ...usage23 };
|
|
599367
599773
|
}
|
|
599368
599774
|
}
|
|
599369
599775
|
}
|
|
@@ -600097,7 +600503,7 @@ function OverviewTab({
|
|
|
600097
600503
|
} = useTerminalSize();
|
|
600098
600504
|
const modelEntries = Object.entries(stats.modelUsage).sort(([, a2], [, b]) => b.inputTokens + b.outputTokens - (a2.inputTokens + a2.outputTokens));
|
|
600099
600505
|
const favoriteModel = modelEntries[0];
|
|
600100
|
-
const totalTokens = modelEntries.reduce((sum2, [,
|
|
600506
|
+
const totalTokens = modelEntries.reduce((sum2, [, usage23]) => sum2 + usage23.inputTokens + usage23.outputTokens, 0);
|
|
600101
600507
|
const factoid = import_react192.useMemo(() => generateFunFactoid(stats, totalTokens), [stats, totalTokens]);
|
|
600102
600508
|
const rangeDays = dateRange === "7d" ? 7 : dateRange === "30d" ? 30 : stats.totalDays;
|
|
600103
600509
|
let shotStatsData = null;
|
|
@@ -600647,8 +601053,8 @@ function _temp06(t0) {
|
|
|
600647
601053
|
return model;
|
|
600648
601054
|
}
|
|
600649
601055
|
function _temp914(sum2, t0) {
|
|
600650
|
-
const [,
|
|
600651
|
-
return sum2 +
|
|
601056
|
+
const [, usage23] = t0;
|
|
601057
|
+
return sum2 + usage23.inputTokens + usage23.outputTokens;
|
|
600652
601058
|
}
|
|
600653
601059
|
function _temp815(prev_0) {
|
|
600654
601060
|
return Math.max(prev_0 - 2, 0);
|
|
@@ -600662,10 +601068,10 @@ function ModelEntry(t0) {
|
|
|
600662
601068
|
const $3 = import_compiler_runtime268.c(21);
|
|
600663
601069
|
const {
|
|
600664
601070
|
model,
|
|
600665
|
-
usage:
|
|
601071
|
+
usage: usage23,
|
|
600666
601072
|
totalTokens
|
|
600667
601073
|
} = t0;
|
|
600668
|
-
const modelTokens =
|
|
601074
|
+
const modelTokens = usage23.inputTokens + usage23.outputTokens;
|
|
600669
601075
|
const t1 = modelTokens / totalTokens * 100;
|
|
600670
601076
|
let t2;
|
|
600671
601077
|
if ($3[0] !== t1) {
|
|
@@ -600728,17 +601134,17 @@ function ModelEntry(t0) {
|
|
|
600728
601134
|
t6 = $3[10];
|
|
600729
601135
|
}
|
|
600730
601136
|
let t7;
|
|
600731
|
-
if ($3[11] !==
|
|
600732
|
-
t7 = formatNumber(
|
|
600733
|
-
$3[11] =
|
|
601137
|
+
if ($3[11] !== usage23.inputTokens) {
|
|
601138
|
+
t7 = formatNumber(usage23.inputTokens);
|
|
601139
|
+
$3[11] = usage23.inputTokens;
|
|
600734
601140
|
$3[12] = t7;
|
|
600735
601141
|
} else {
|
|
600736
601142
|
t7 = $3[12];
|
|
600737
601143
|
}
|
|
600738
601144
|
let t8;
|
|
600739
|
-
if ($3[13] !==
|
|
600740
|
-
t8 = formatNumber(
|
|
600741
|
-
$3[13] =
|
|
601145
|
+
if ($3[13] !== usage23.outputTokens) {
|
|
601146
|
+
t8 = formatNumber(usage23.outputTokens);
|
|
601147
|
+
$3[13] = usage23.outputTokens;
|
|
600742
601148
|
$3[14] = t8;
|
|
600743
601149
|
} else {
|
|
600744
601150
|
t8 = $3[14];
|
|
@@ -600921,7 +601327,7 @@ function renderOverviewToAnsi(stats) {
|
|
|
600921
601327
|
}
|
|
600922
601328
|
const modelEntries = Object.entries(stats.modelUsage).sort(([, a2], [, b]) => b.inputTokens + b.outputTokens - (a2.inputTokens + a2.outputTokens));
|
|
600923
601329
|
const favoriteModel = modelEntries[0];
|
|
600924
|
-
const totalTokens = modelEntries.reduce((sum2, [,
|
|
601330
|
+
const totalTokens = modelEntries.reduce((sum2, [, usage23]) => sum2 + usage23.inputTokens + usage23.outputTokens, 0);
|
|
600925
601331
|
if (favoriteModel) {
|
|
600926
601332
|
lines.push(row("Favorite model", renderModelName(favoriteModel[0]), "Total tokens", formatNumber(totalTokens)));
|
|
600927
601333
|
}
|
|
@@ -600949,7 +601355,7 @@ function renderModelsToAnsi(stats) {
|
|
|
600949
601355
|
return lines;
|
|
600950
601356
|
}
|
|
600951
601357
|
const favoriteModel = modelEntries[0];
|
|
600952
|
-
const totalTokens = modelEntries.reduce((sum2, [,
|
|
601358
|
+
const totalTokens = modelEntries.reduce((sum2, [, usage23]) => sum2 + usage23.inputTokens + usage23.outputTokens, 0);
|
|
600953
601359
|
const chartOutput = generateTokenChart(stats.dailyModelTokens, modelEntries.map(([model]) => model), 80);
|
|
600954
601360
|
if (chartOutput) {
|
|
600955
601361
|
lines.push(source_default.bold("Tokens per Day"));
|
|
@@ -600962,11 +601368,11 @@ function renderModelsToAnsi(stats) {
|
|
|
600962
601368
|
lines.push(`${figures_default.star} Favorite: ${source_default.magenta.bold(renderModelName(favoriteModel?.[0] || ""))} \xB7 ${figures_default.circle} Total: ${source_default.magenta(formatNumber(totalTokens))} tokens`);
|
|
600963
601369
|
lines.push("");
|
|
600964
601370
|
const topModels = modelEntries.slice(0, 3);
|
|
600965
|
-
for (const [model,
|
|
600966
|
-
const modelTokens =
|
|
601371
|
+
for (const [model, usage23] of topModels) {
|
|
601372
|
+
const modelTokens = usage23.inputTokens + usage23.outputTokens;
|
|
600967
601373
|
const percentage = (modelTokens / totalTokens * 100).toFixed(1);
|
|
600968
601374
|
lines.push(`${figures_default.bullet} ${source_default.bold(renderModelName(model))} ${source_default.gray(`(${percentage}%)`)}`);
|
|
600969
|
-
lines.push(source_default.dim(` In: ${formatNumber(
|
|
601375
|
+
lines.push(source_default.dim(` In: ${formatNumber(usage23.inputTokens)} \xB7 Out: ${formatNumber(usage23.outputTokens)}`));
|
|
600970
601376
|
}
|
|
600971
601377
|
return lines;
|
|
600972
601378
|
}
|
|
@@ -601347,10 +601753,10 @@ function extractToolStats(log) {
|
|
|
601347
601753
|
if (msgTimestamp) {
|
|
601348
601754
|
lastAssistantTimestamp = msgTimestamp;
|
|
601349
601755
|
}
|
|
601350
|
-
const
|
|
601351
|
-
if (
|
|
601352
|
-
inputTokens +=
|
|
601353
|
-
outputTokens +=
|
|
601756
|
+
const usage23 = msg.message.usage;
|
|
601757
|
+
if (usage23) {
|
|
601758
|
+
inputTokens += usage23.input_tokens || 0;
|
|
601759
|
+
outputTokens += usage23.output_tokens || 0;
|
|
601354
601760
|
}
|
|
601355
601761
|
const content = msg.message.content;
|
|
601356
601762
|
if (Array.isArray(content)) {
|
|
@@ -602754,7 +603160,7 @@ function generateHtmlReport(data, insights) {
|
|
|
602754
603160
|
</html>`;
|
|
602755
603161
|
}
|
|
602756
603162
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
602757
|
-
const version3 = typeof MACRO !== "undefined" ? "1.
|
|
603163
|
+
const version3 = typeof MACRO !== "undefined" ? "1.29.1" : "unknown";
|
|
602758
603164
|
const remote_hosts_collected = remoteStats?.hosts.filter((h2) => h2.sessionCount > 0).map((h2) => h2.name);
|
|
602759
603165
|
const facets_summary = {
|
|
602760
603166
|
total: facets.size,
|
|
@@ -607032,7 +607438,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
607032
607438
|
init_settings2();
|
|
607033
607439
|
init_slowOperations();
|
|
607034
607440
|
init_uuid();
|
|
607035
|
-
VERSION5 = typeof MACRO !== "undefined" ? "1.
|
|
607441
|
+
VERSION5 = typeof MACRO !== "undefined" ? "1.29.1" : "unknown";
|
|
607036
607442
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
607037
607443
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
607038
607444
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -608237,7 +608643,7 @@ var init_filesystem = __esm(() => {
|
|
|
608237
608643
|
});
|
|
608238
608644
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
608239
608645
|
const nonce = randomBytes18(16).toString("hex");
|
|
608240
|
-
return join200(getURTempDir(), "bundled-skills", "1.
|
|
608646
|
+
return join200(getURTempDir(), "bundled-skills", "1.29.1", nonce);
|
|
608241
608647
|
});
|
|
608242
608648
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
608243
608649
|
});
|
|
@@ -613908,12 +614314,17 @@ The following MCP servers have provided instructions for how to use their tools
|
|
|
613908
614314
|
|
|
613909
614315
|
${instructionBlocks}`;
|
|
613910
614316
|
}
|
|
614317
|
+
function describeModelAndProvider(modelId) {
|
|
614318
|
+
const marketingName = getMarketingNameForModel(modelId);
|
|
614319
|
+
const base2 = marketingName ? `You are powered by the model named ${marketingName}. The exact model ID is ${modelId}.` : `You are powered by the model ${modelId}.`;
|
|
614320
|
+
const runtime = getProviderRuntimeInfo();
|
|
614321
|
+
return `${base2} You are running through the ${runtime.providerLabel} provider (${runtime.accessTypeLabel}; runtime backend ${runtime.runtimeBackend}).`;
|
|
614322
|
+
}
|
|
613911
614323
|
async function computeEnvInfo(modelId, additionalWorkingDirectories) {
|
|
613912
614324
|
const [isGit, unameSR] = await Promise.all([getIsGit(), getUnameSR()]);
|
|
613913
614325
|
let modelDescription = "";
|
|
613914
614326
|
if (process.env.USER_TYPE === "ant" && isUndercover()) {} else {
|
|
613915
|
-
|
|
613916
|
-
modelDescription = marketingName ? `You are powered by the model named ${marketingName}. The exact model ID is ${modelId}.` : `You are powered by the model ${modelId}.`;
|
|
614327
|
+
modelDescription = describeModelAndProvider(modelId);
|
|
613917
614328
|
}
|
|
613918
614329
|
const additionalDirsInfo = additionalWorkingDirectories && additionalWorkingDirectories.length > 0 ? `Additional working directories: ${additionalWorkingDirectories.join(", ")}
|
|
613919
614330
|
` : "";
|
|
@@ -613935,8 +614346,7 @@ async function computeSimpleEnvInfo(modelId, additionalWorkingDirectories) {
|
|
|
613935
614346
|
const [isGit, unameSR] = await Promise.all([getIsGit(), getUnameSR()]);
|
|
613936
614347
|
let modelDescription = null;
|
|
613937
614348
|
if (process.env.USER_TYPE === "ant" && isUndercover()) {} else {
|
|
613938
|
-
|
|
613939
|
-
modelDescription = marketingName ? `You are powered by the model named ${marketingName}. The exact model ID is ${modelId}.` : `You are powered by the model ${modelId}.`;
|
|
614349
|
+
modelDescription = describeModelAndProvider(modelId);
|
|
613940
614350
|
}
|
|
613941
614351
|
const cutoff = getKnowledgeCutoff(modelId);
|
|
613942
614352
|
const knowledgeCutoffMessage = cutoff ? `Assistant knowledge cutoff is ${cutoff}.` : null;
|
|
@@ -614058,6 +614468,7 @@ var init_prompts4 = __esm(() => {
|
|
|
614058
614468
|
init_model();
|
|
614059
614469
|
init_antModels();
|
|
614060
614470
|
init_providers();
|
|
614471
|
+
init_providerRegistry();
|
|
614061
614472
|
init_commands3();
|
|
614062
614473
|
init_outputStyles();
|
|
614063
614474
|
init_prompt();
|
|
@@ -614529,7 +614940,7 @@ function computeFingerprint(messageText2, version3) {
|
|
|
614529
614940
|
}
|
|
614530
614941
|
function computeFingerprintFromMessages(messages) {
|
|
614531
614942
|
const firstMessageText = extractFirstMessageText(messages);
|
|
614532
|
-
return computeFingerprint(firstMessageText, "1.
|
|
614943
|
+
return computeFingerprint(firstMessageText, "1.29.1");
|
|
614533
614944
|
}
|
|
614534
614945
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
614535
614946
|
var init_fingerprint = () => {};
|
|
@@ -615357,7 +615768,7 @@ ${deferredToolList}
|
|
|
615357
615768
|
let ttftMs = 0;
|
|
615358
615769
|
let partialMessage = undefined;
|
|
615359
615770
|
const contentBlocks = [];
|
|
615360
|
-
let
|
|
615771
|
+
let usage23 = EMPTY_USAGE2;
|
|
615361
615772
|
let costUSD = 0;
|
|
615362
615773
|
let stopReason = null;
|
|
615363
615774
|
let didFallBackToNonStreaming = false;
|
|
@@ -615449,7 +615860,7 @@ ${deferredToolList}
|
|
|
615449
615860
|
ttftMs = 0;
|
|
615450
615861
|
partialMessage = undefined;
|
|
615451
615862
|
contentBlocks.length = 0;
|
|
615452
|
-
|
|
615863
|
+
usage23 = EMPTY_USAGE2;
|
|
615453
615864
|
stopReason = null;
|
|
615454
615865
|
isAdvisorInProgress = false;
|
|
615455
615866
|
const streamWatchdogEnabled = isEnvTruthy(process.env.UR_ENABLE_STREAM_WATCHDOG);
|
|
@@ -615501,7 +615912,7 @@ ${deferredToolList}
|
|
|
615501
615912
|
case "message_start": {
|
|
615502
615913
|
partialMessage = part.message;
|
|
615503
615914
|
ttftMs = Date.now() - start;
|
|
615504
|
-
|
|
615915
|
+
usage23 = updateUsage(usage23, part.message?.usage);
|
|
615505
615916
|
if (process.env.USER_TYPE === "ant" && "research" in part.message) {
|
|
615506
615917
|
research2 = part.message.research;
|
|
615507
615918
|
}
|
|
@@ -615659,7 +616070,7 @@ ${deferredToolList}
|
|
|
615659
616070
|
break;
|
|
615660
616071
|
}
|
|
615661
616072
|
case "message_delta": {
|
|
615662
|
-
|
|
616073
|
+
usage23 = updateUsage(usage23, part.usage);
|
|
615663
616074
|
if (process.env.USER_TYPE === "ant" && "research" in part) {
|
|
615664
616075
|
research2 = part.research;
|
|
615665
616076
|
for (const msg of newMessages) {
|
|
@@ -615669,11 +616080,11 @@ ${deferredToolList}
|
|
|
615669
616080
|
stopReason = part.delta.stop_reason;
|
|
615670
616081
|
const lastMsg = newMessages.at(-1);
|
|
615671
616082
|
if (lastMsg) {
|
|
615672
|
-
lastMsg.message.usage =
|
|
616083
|
+
lastMsg.message.usage = usage23;
|
|
615673
616084
|
lastMsg.message.stop_reason = stopReason;
|
|
615674
616085
|
}
|
|
615675
|
-
const costUSDForPart = calculateUSDCost(resolvedModel,
|
|
615676
|
-
costUSD += addToTotalSessionCost(costUSDForPart,
|
|
616086
|
+
const costUSDForPart = calculateUSDCost(resolvedModel, usage23);
|
|
616087
|
+
costUSD += addToTotalSessionCost(costUSDForPart, usage23, options2.model);
|
|
615677
616088
|
const refusalMessage = getErrorMessageIfRefusal(part.delta.stop_reason, options2.model);
|
|
615678
616089
|
if (refusalMessage) {
|
|
615679
616090
|
yield refusalMessage;
|
|
@@ -615691,7 +616102,7 @@ ${deferredToolList}
|
|
|
615691
616102
|
if (stopReason === "model_context_window_exceeded") {
|
|
615692
616103
|
logEvent("tengu_context_window_exceeded", {
|
|
615693
616104
|
max_tokens: maxOutputTokens,
|
|
615694
|
-
output_tokens:
|
|
616105
|
+
output_tokens: usage23.output_tokens
|
|
615695
616106
|
});
|
|
615696
616107
|
yield createAssistantAPIErrorMessage({
|
|
615697
616108
|
content: `${API_ERROR_MESSAGE_PREFIX}: The model has reached its context window limit.`,
|
|
@@ -615981,7 +616392,7 @@ ${deferredToolList}
|
|
|
615981
616392
|
releaseStreamResources();
|
|
615982
616393
|
if (fallbackMessage) {
|
|
615983
616394
|
const fallbackUsage = fallbackMessage.message.usage;
|
|
615984
|
-
|
|
616395
|
+
usage23 = updateUsage(EMPTY_USAGE2, fallbackUsage);
|
|
615985
616396
|
stopReason = fallbackMessage.message.stop_reason;
|
|
615986
616397
|
const fallbackCost = calculateUSDCost(resolvedModel, fallbackUsage);
|
|
615987
616398
|
costUSD += addToTotalSessionCost(fallbackCost, fallbackUsage, options2.model);
|
|
@@ -615997,7 +616408,7 @@ ${deferredToolList}
|
|
|
615997
616408
|
logAPISuccessAndDuration({
|
|
615998
616409
|
model: newMessages[0]?.message.model ?? partialMessage?.model ?? options2.model,
|
|
615999
616410
|
preNormalizedModel: options2.model,
|
|
616000
|
-
usage:
|
|
616411
|
+
usage: usage23,
|
|
616001
616412
|
start,
|
|
616002
616413
|
startIncludingRetries,
|
|
616003
616414
|
attempt: attemptNumber,
|
|
@@ -616034,29 +616445,29 @@ function cleanupStream(stream4) {
|
|
|
616034
616445
|
}
|
|
616035
616446
|
} catch {}
|
|
616036
616447
|
}
|
|
616037
|
-
function updateUsage(
|
|
616448
|
+
function updateUsage(usage23, partUsageRaw) {
|
|
616038
616449
|
if (!partUsageRaw) {
|
|
616039
|
-
return { ...
|
|
616450
|
+
return { ...usage23 };
|
|
616040
616451
|
}
|
|
616041
616452
|
const partUsage = partUsageRaw;
|
|
616042
616453
|
return {
|
|
616043
|
-
input_tokens: partUsage.input_tokens !== null && partUsage.input_tokens > 0 ? partUsage.input_tokens :
|
|
616044
|
-
cache_creation_input_tokens: partUsage.cache_creation_input_tokens !== null && partUsage.cache_creation_input_tokens > 0 ? partUsage.cache_creation_input_tokens :
|
|
616045
|
-
cache_read_input_tokens: partUsage.cache_read_input_tokens !== null && partUsage.cache_read_input_tokens > 0 ? partUsage.cache_read_input_tokens :
|
|
616046
|
-
output_tokens: partUsage.output_tokens ??
|
|
616454
|
+
input_tokens: partUsage.input_tokens !== null && partUsage.input_tokens > 0 ? partUsage.input_tokens : usage23.input_tokens,
|
|
616455
|
+
cache_creation_input_tokens: partUsage.cache_creation_input_tokens !== null && partUsage.cache_creation_input_tokens > 0 ? partUsage.cache_creation_input_tokens : usage23.cache_creation_input_tokens,
|
|
616456
|
+
cache_read_input_tokens: partUsage.cache_read_input_tokens !== null && partUsage.cache_read_input_tokens > 0 ? partUsage.cache_read_input_tokens : usage23.cache_read_input_tokens,
|
|
616457
|
+
output_tokens: partUsage.output_tokens ?? usage23.output_tokens,
|
|
616047
616458
|
server_tool_use: {
|
|
616048
|
-
web_search_requests: partUsage.server_tool_use?.web_search_requests ??
|
|
616049
|
-
web_fetch_requests: partUsage.server_tool_use?.web_fetch_requests ??
|
|
616459
|
+
web_search_requests: partUsage.server_tool_use?.web_search_requests ?? usage23.server_tool_use.web_search_requests,
|
|
616460
|
+
web_fetch_requests: partUsage.server_tool_use?.web_fetch_requests ?? usage23.server_tool_use.web_fetch_requests
|
|
616050
616461
|
},
|
|
616051
|
-
service_tier:
|
|
616462
|
+
service_tier: usage23.service_tier,
|
|
616052
616463
|
cache_creation: {
|
|
616053
|
-
ephemeral_1h_input_tokens: partUsage.cache_creation?.ephemeral_1h_input_tokens ??
|
|
616054
|
-
ephemeral_5m_input_tokens: partUsage.cache_creation?.ephemeral_5m_input_tokens ??
|
|
616464
|
+
ephemeral_1h_input_tokens: partUsage.cache_creation?.ephemeral_1h_input_tokens ?? usage23.cache_creation.ephemeral_1h_input_tokens,
|
|
616465
|
+
ephemeral_5m_input_tokens: partUsage.cache_creation?.ephemeral_5m_input_tokens ?? usage23.cache_creation.ephemeral_5m_input_tokens
|
|
616055
616466
|
},
|
|
616056
616467
|
...{},
|
|
616057
|
-
inference_geo:
|
|
616058
|
-
iterations: partUsage.iterations ??
|
|
616059
|
-
speed: partUsage.speed ??
|
|
616468
|
+
inference_geo: usage23.inference_geo,
|
|
616469
|
+
iterations: partUsage.iterations ?? usage23.iterations,
|
|
616470
|
+
speed: partUsage.speed ?? usage23.speed
|
|
616060
616471
|
};
|
|
616061
616472
|
}
|
|
616062
616473
|
function accumulateUsage(totalUsage, messageUsage) {
|
|
@@ -616396,7 +616807,7 @@ async function sideQuery(opts) {
|
|
|
616396
616807
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
616397
616808
|
}
|
|
616398
616809
|
const messageText2 = extractFirstUserMessageText(messages);
|
|
616399
|
-
const fingerprint = computeFingerprint(messageText2, "1.
|
|
616810
|
+
const fingerprint = computeFingerprint(messageText2, "1.29.1");
|
|
616400
616811
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
616401
616812
|
const systemBlocks = [
|
|
616402
616813
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -621133,7 +621544,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
621133
621544
|
slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
|
|
621134
621545
|
apiKeySource: getURHQApiKeyWithSource().source,
|
|
621135
621546
|
betas: getSdkBetas(),
|
|
621136
|
-
ur_version: "1.
|
|
621547
|
+
ur_version: "1.29.1",
|
|
621137
621548
|
output_style: outputStyle2,
|
|
621138
621549
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
621139
621550
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill2) => skill2.name),
|
|
@@ -622062,7 +622473,7 @@ function UserMessageOption(t0) {
|
|
|
622062
622473
|
T0 = ThemedText;
|
|
622063
622474
|
t1 = color3;
|
|
622064
622475
|
t2 = dimColor;
|
|
622065
|
-
t3 = paddingRight ?
|
|
622476
|
+
t3 = paddingRight ? truncate2(messageText2, columns - paddingRight, true) : messageText2.slice(0, 500).split(`
|
|
622066
622477
|
`).slice(0, 4).join(`
|
|
622067
622478
|
`);
|
|
622068
622479
|
}
|
|
@@ -629462,7 +629873,7 @@ function ExitPlanModePermissionRequest({
|
|
|
629462
629873
|
const ultraplanSessionUrl = useAppState((s) => s.ultraplanSessionUrl);
|
|
629463
629874
|
const ultraplanLaunching = useAppState((s) => s.ultraplanLaunching);
|
|
629464
629875
|
const showUltraplan = false;
|
|
629465
|
-
const
|
|
629876
|
+
const usage23 = toolUseConfirm.assistantMessage.message.usage;
|
|
629466
629877
|
const {
|
|
629467
629878
|
mode: mode2,
|
|
629468
629879
|
isAutoModeAvailable,
|
|
@@ -629471,11 +629882,11 @@ function ExitPlanModePermissionRequest({
|
|
|
629471
629882
|
const options2 = import_react215.useMemo(() => buildPlanApprovalOptions({
|
|
629472
629883
|
showClearContext,
|
|
629473
629884
|
showUltraplan,
|
|
629474
|
-
usedPercent: showClearContext ? getContextUsedPercent(
|
|
629885
|
+
usedPercent: showClearContext ? getContextUsedPercent(usage23, mode2) : null,
|
|
629475
629886
|
isAutoModeAvailable,
|
|
629476
629887
|
isBypassPermissionsModeAvailable,
|
|
629477
629888
|
onFeedbackChange: setPlanFeedback
|
|
629478
|
-
}), [showClearContext, showUltraplan,
|
|
629889
|
+
}), [showClearContext, showUltraplan, usage23, mode2, isAutoModeAvailable, isBypassPermissionsModeAvailable]);
|
|
629479
629890
|
function onImagePaste(base64Image, mediaType, filename, dimensions, _sourcePath) {
|
|
629480
629891
|
const pasteId = nextPasteIdRef.current++;
|
|
629481
629892
|
const newContent = {
|
|
@@ -630069,8 +630480,8 @@ function buildPlanApprovalOptions({
|
|
|
630069
630480
|
});
|
|
630070
630481
|
return options2;
|
|
630071
630482
|
}
|
|
630072
|
-
function getContextUsedPercent(
|
|
630073
|
-
if (!
|
|
630483
|
+
function getContextUsedPercent(usage23, permissionMode) {
|
|
630484
|
+
if (!usage23)
|
|
630074
630485
|
return null;
|
|
630075
630486
|
const runtimeModel = getRuntimeMainLoopModel({
|
|
630076
630487
|
permissionMode,
|
|
@@ -630081,9 +630492,9 @@ function getContextUsedPercent(usage22, permissionMode) {
|
|
|
630081
630492
|
const {
|
|
630082
630493
|
used
|
|
630083
630494
|
} = calculateContextPercentages({
|
|
630084
|
-
input_tokens:
|
|
630085
|
-
cache_creation_input_tokens:
|
|
630086
|
-
cache_read_input_tokens:
|
|
630495
|
+
input_tokens: usage23.input_tokens,
|
|
630496
|
+
cache_creation_input_tokens: usage23.cache_creation_input_tokens ?? 0,
|
|
630497
|
+
cache_read_input_tokens: usage23.cache_read_input_tokens ?? 0
|
|
630087
630498
|
}, contextWindowSize);
|
|
630088
630499
|
return used;
|
|
630089
630500
|
}
|
|
@@ -635761,7 +636172,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
635761
636172
|
function getSemverPart(version3) {
|
|
635762
636173
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
635763
636174
|
}
|
|
635764
|
-
function useUpdateNotification(updatedVersion, initialVersion = "1.
|
|
636175
|
+
function useUpdateNotification(updatedVersion, initialVersion = "1.29.1") {
|
|
635765
636176
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react226.useState(() => getSemverPart(initialVersion));
|
|
635766
636177
|
if (!updatedVersion) {
|
|
635767
636178
|
return null;
|
|
@@ -635810,7 +636221,7 @@ function AutoUpdater({
|
|
|
635810
636221
|
return;
|
|
635811
636222
|
}
|
|
635812
636223
|
if (false) {}
|
|
635813
|
-
const currentVersion = "1.
|
|
636224
|
+
const currentVersion = "1.29.1";
|
|
635814
636225
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
635815
636226
|
let latestVersion = await getLatestVersion(channel);
|
|
635816
636227
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -636039,12 +636450,12 @@ function NativeAutoUpdater({
|
|
|
636039
636450
|
logEvent("tengu_native_auto_updater_start", {});
|
|
636040
636451
|
try {
|
|
636041
636452
|
const maxVersion = await getMaxVersion();
|
|
636042
|
-
if (maxVersion && gt("1.
|
|
636453
|
+
if (maxVersion && gt("1.29.1", maxVersion)) {
|
|
636043
636454
|
const msg = await getMaxVersionMessage();
|
|
636044
636455
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
636045
636456
|
}
|
|
636046
636457
|
const result = await installLatest(channel);
|
|
636047
|
-
const currentVersion = "1.
|
|
636458
|
+
const currentVersion = "1.29.1";
|
|
636048
636459
|
const latencyMs = Date.now() - startTime;
|
|
636049
636460
|
if (result.lockFailed) {
|
|
636050
636461
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -636181,17 +636592,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
636181
636592
|
const maxVersion = await getMaxVersion();
|
|
636182
636593
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
636183
636594
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
636184
|
-
if (gte("1.
|
|
636185
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.
|
|
636595
|
+
if (gte("1.29.1", maxVersion)) {
|
|
636596
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.29.1"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
636186
636597
|
setUpdateAvailable(false);
|
|
636187
636598
|
return;
|
|
636188
636599
|
}
|
|
636189
636600
|
latest = maxVersion;
|
|
636190
636601
|
}
|
|
636191
|
-
const hasUpdate = latest && !gte("1.
|
|
636602
|
+
const hasUpdate = latest && !gte("1.29.1", latest) && !shouldSkipVersion(latest);
|
|
636192
636603
|
setUpdateAvailable(!!hasUpdate);
|
|
636193
636604
|
if (hasUpdate) {
|
|
636194
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.
|
|
636605
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.29.1"} -> ${latest}`);
|
|
636195
636606
|
}
|
|
636196
636607
|
};
|
|
636197
636608
|
$3[0] = t1;
|
|
@@ -636225,7 +636636,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
636225
636636
|
wrap: "truncate",
|
|
636226
636637
|
children: [
|
|
636227
636638
|
"currentVersion: ",
|
|
636228
|
-
"1.
|
|
636639
|
+
"1.29.1"
|
|
636229
636640
|
]
|
|
636230
636641
|
}, undefined, true, undefined, this);
|
|
636231
636642
|
$3[3] = verbose;
|
|
@@ -639886,8 +640297,8 @@ function generateCommandSuggestions(input, commands) {
|
|
|
639886
640297
|
const withMeta = searchResults.map((r) => {
|
|
639887
640298
|
const name = r.item.commandName.toLowerCase();
|
|
639888
640299
|
const aliases = r.item.aliasKey?.map((alias2) => alias2.toLowerCase()) ?? [];
|
|
639889
|
-
const
|
|
639890
|
-
return { r, name, aliases, usage:
|
|
640300
|
+
const usage23 = r.item.command.type === "prompt" ? getSkillUsageScore(getCommandName(r.item.command)) : 0;
|
|
640301
|
+
return { r, name, aliases, usage: usage23 };
|
|
639891
640302
|
});
|
|
639892
640303
|
const sortedResults = withMeta.sort((a2, b) => {
|
|
639893
640304
|
const aName = a2.name;
|
|
@@ -648682,7 +649093,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
648682
649093
|
project_dir: getOriginalCwd(),
|
|
648683
649094
|
added_dirs: addedDirs
|
|
648684
649095
|
},
|
|
648685
|
-
version: "1.
|
|
649096
|
+
version: "1.29.1",
|
|
648686
649097
|
output_style: {
|
|
648687
649098
|
name: outputStyleName
|
|
648688
649099
|
},
|
|
@@ -648765,7 +649176,7 @@ function StatusLineInner({
|
|
|
648765
649176
|
const taskValues = Object.values(tasks2);
|
|
648766
649177
|
const taskRunningCount = taskValues.filter((task2) => task2.status === "running" || task2.status === "pending").length;
|
|
648767
649178
|
const defaultStatusLineText = buildDefaultStatusBar({
|
|
648768
|
-
version: "1.
|
|
649179
|
+
version: "1.29.1",
|
|
648769
649180
|
providerLabel: providerRuntime.providerLabel,
|
|
648770
649181
|
authMode: providerRuntime.authLabel,
|
|
648771
649182
|
model: providerRuntime.model ?? renderModelName(mainLoopModel),
|
|
@@ -660253,7 +660664,7 @@ async function submitTranscriptShare(messages, trigger2, appearanceId) {
|
|
|
660253
660664
|
} catch {}
|
|
660254
660665
|
const data = {
|
|
660255
660666
|
trigger: trigger2,
|
|
660256
|
-
version: "1.
|
|
660667
|
+
version: "1.29.1",
|
|
660257
660668
|
platform: process.platform,
|
|
660258
660669
|
transcript,
|
|
660259
660670
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -672137,7 +672548,7 @@ function WelcomeV2() {
|
|
|
672137
672548
|
dimColor: true,
|
|
672138
672549
|
children: [
|
|
672139
672550
|
"v",
|
|
672140
|
-
"1.
|
|
672551
|
+
"1.29.1"
|
|
672141
672552
|
]
|
|
672142
672553
|
}, undefined, true, undefined, this)
|
|
672143
672554
|
]
|
|
@@ -673397,7 +673808,7 @@ function completeOnboarding() {
|
|
|
673397
673808
|
saveGlobalConfig((current) => ({
|
|
673398
673809
|
...current,
|
|
673399
673810
|
hasCompletedOnboarding: true,
|
|
673400
|
-
lastOnboardingVersion: "1.
|
|
673811
|
+
lastOnboardingVersion: "1.29.1"
|
|
673401
673812
|
}));
|
|
673402
673813
|
}
|
|
673403
673814
|
function showDialog(root2, renderer) {
|
|
@@ -678501,7 +678912,7 @@ function appendToLog(path24, message) {
|
|
|
678501
678912
|
cwd: getFsImplementation().cwd(),
|
|
678502
678913
|
userType: process.env.USER_TYPE,
|
|
678503
678914
|
sessionId: getSessionId(),
|
|
678504
|
-
version: "1.
|
|
678915
|
+
version: "1.29.1"
|
|
678505
678916
|
};
|
|
678506
678917
|
getLogWriter(path24).write(messageWithTimestamp);
|
|
678507
678918
|
}
|
|
@@ -678780,13 +679191,13 @@ var init_sessionMemory = __esm(() => {
|
|
|
678780
679191
|
overrides: { readFileState: setupContext.readFileState }
|
|
678781
679192
|
});
|
|
678782
679193
|
const lastMessage = messages[messages.length - 1];
|
|
678783
|
-
const
|
|
679194
|
+
const usage23 = lastMessage ? getTokenUsage(lastMessage) : undefined;
|
|
678784
679195
|
const config3 = getSessionMemoryConfig();
|
|
678785
679196
|
logEvent("tengu_session_memory_extraction", {
|
|
678786
|
-
input_tokens:
|
|
678787
|
-
output_tokens:
|
|
678788
|
-
cache_read_input_tokens:
|
|
678789
|
-
cache_creation_input_tokens:
|
|
679197
|
+
input_tokens: usage23?.input_tokens,
|
|
679198
|
+
output_tokens: usage23?.output_tokens,
|
|
679199
|
+
cache_read_input_tokens: usage23?.cache_read_input_tokens ?? undefined,
|
|
679200
|
+
cache_creation_input_tokens: usage23?.cache_creation_input_tokens ?? undefined,
|
|
678790
679201
|
config_min_message_tokens_to_init: config3.minimumMessageTokensToInit,
|
|
678791
679202
|
config_min_tokens_between_update: config3.minimumTokensBetweenUpdate,
|
|
678792
679203
|
config_tool_calls_between_updates: config3.toolCallsBetweenUpdates
|
|
@@ -682595,8 +683006,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
682595
683006
|
}
|
|
682596
683007
|
async function checkEnvLessBridgeMinVersion() {
|
|
682597
683008
|
const cfg = await getEnvLessBridgeConfig();
|
|
682598
|
-
if (cfg.min_version && lt("1.
|
|
682599
|
-
return `Your version of UR (${"1.
|
|
683009
|
+
if (cfg.min_version && lt("1.29.1", cfg.min_version)) {
|
|
683010
|
+
return `Your version of UR (${"1.29.1"}) is too old for Remote Control.
|
|
682600
683011
|
Version ${cfg.min_version} or higher is required. Run \`ur update\` to update.`;
|
|
682601
683012
|
}
|
|
682602
683013
|
return null;
|
|
@@ -683070,7 +683481,7 @@ async function initBridgeCore(params) {
|
|
|
683070
683481
|
const rawApi = createBridgeApiClient({
|
|
683071
683482
|
baseUrl,
|
|
683072
683483
|
getAccessToken,
|
|
683073
|
-
runnerVersion: "1.
|
|
683484
|
+
runnerVersion: "1.29.1",
|
|
683074
683485
|
onDebug: logForDebugging,
|
|
683075
683486
|
onAuth401,
|
|
683076
683487
|
getTrustedDeviceToken
|
|
@@ -688752,7 +689163,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
|
|
|
688752
689163
|
setCwd(cwd3);
|
|
688753
689164
|
const server2 = new Server({
|
|
688754
689165
|
name: "ur/tengu",
|
|
688755
|
-
version: "1.
|
|
689166
|
+
version: "1.29.1"
|
|
688756
689167
|
}, {
|
|
688757
689168
|
capabilities: {
|
|
688758
689169
|
tools: {}
|
|
@@ -690565,7 +690976,7 @@ async function update() {
|
|
|
690565
690976
|
logEvent("tengu_update_check", {});
|
|
690566
690977
|
const diagnostic = await getDoctorDiagnostic();
|
|
690567
690978
|
const result = await checkUpgradeStatus({
|
|
690568
|
-
currentVersion: "1.
|
|
690979
|
+
currentVersion: "1.29.1",
|
|
690569
690980
|
packageName: UR_AGENT_PACKAGE_NAME,
|
|
690570
690981
|
installationType: diagnostic.installationType,
|
|
690571
690982
|
latestVersion: () => getLatestNpmPackageVersion(UR_AGENT_PACKAGE_NAME)
|
|
@@ -691811,7 +692222,7 @@ ${customInstructions}` : customInstructions;
|
|
|
691811
692222
|
}
|
|
691812
692223
|
}
|
|
691813
692224
|
logForDiagnosticsNoPII("info", "started", {
|
|
691814
|
-
version: "1.
|
|
692225
|
+
version: "1.29.1",
|
|
691815
692226
|
is_native_binary: isInBundledMode()
|
|
691816
692227
|
});
|
|
691817
692228
|
registerCleanup(async () => {
|
|
@@ -692597,7 +693008,7 @@ Usage: ur --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
692597
693008
|
pendingHookMessages
|
|
692598
693009
|
}, renderAndRun);
|
|
692599
693010
|
}
|
|
692600
|
-
}).version("1.
|
|
693011
|
+
}).version("1.29.1 (UR-AGENT)", "-v, --version", "Output the version number");
|
|
692601
693012
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
692602
693013
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
692603
693014
|
if (canUserConfigureAdvisor()) {
|
|
@@ -693476,7 +693887,7 @@ if (false) {}
|
|
|
693476
693887
|
async function main2() {
|
|
693477
693888
|
const args = process.argv.slice(2);
|
|
693478
693889
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
693479
|
-
console.log(`${"1.
|
|
693890
|
+
console.log(`${"1.29.1"} (UR-AGENT)`);
|
|
693480
693891
|
return;
|
|
693481
693892
|
}
|
|
693482
693893
|
if (args[0] === "a2a" && args[1] === "serve" && !args.includes("--help") && !args.includes("-h")) {
|