ur-agent 1.30.5 → 1.30.6
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 +8 -0
- package/README.md +15 -11
- package/dist/cli.js +1263 -1501
- package/docs/AGENT_FEATURES.md +1 -1
- package/docs/USAGE.md +11 -7
- package/docs/providers.md +6 -5
- package/documentation/app.js +4 -4
- package/documentation/index.html +5 -5
- package/extensions/vscode-ur-inline-diffs/package.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11389,32 +11389,15 @@ function isRunningOnHomespace() {
|
|
|
11389
11389
|
function isInProtectedNamespace() {
|
|
11390
11390
|
return false;
|
|
11391
11391
|
}
|
|
11392
|
-
function getVertexRegionForModel(
|
|
11393
|
-
if (model) {
|
|
11394
|
-
const match = VERTEX_REGION_OVERRIDES.find(([prefix]) => model.startsWith(prefix));
|
|
11395
|
-
if (match) {
|
|
11396
|
-
return process.env[match[1]] || getDefaultVertexRegion();
|
|
11397
|
-
}
|
|
11398
|
-
}
|
|
11392
|
+
function getVertexRegionForModel(_model) {
|
|
11399
11393
|
return getDefaultVertexRegion();
|
|
11400
11394
|
}
|
|
11401
|
-
var getURConfigHomeDir
|
|
11395
|
+
var getURConfigHomeDir;
|
|
11402
11396
|
var init_envUtils = __esm(() => {
|
|
11403
11397
|
init_memoize();
|
|
11404
11398
|
getURConfigHomeDir = memoize_default(() => {
|
|
11405
11399
|
return (process.env.UR_CONFIG_DIR ?? join(homedir2(), ".ur")).normalize("NFC");
|
|
11406
11400
|
}, () => process.env.UR_CONFIG_DIR);
|
|
11407
|
-
VERTEX_REGION_OVERRIDES = [
|
|
11408
|
-
["ur-modelH-4-5", "VERTEX_REGION_UR_MODELH_4_5"],
|
|
11409
|
-
["ur-3-5-modelH", "VERTEX_REGION_UR_3_5_MODELH"],
|
|
11410
|
-
["ur-3-5-modelS", "VERTEX_REGION_UR_3_5_MODELS"],
|
|
11411
|
-
["ur-3-7-modelS", "VERTEX_REGION_UR_3_7_MODELS"],
|
|
11412
|
-
["ur-modelO-4-1", "VERTEX_REGION_UR_4_1_MODELO"],
|
|
11413
|
-
["ur-modelO-4", "VERTEX_REGION_UR_4_0_MODELO"],
|
|
11414
|
-
["ur-modelS-4-6", "VERTEX_REGION_UR_4_6_MODELS"],
|
|
11415
|
-
["ur-modelS-4-5", "VERTEX_REGION_UR_4_5_MODELS"],
|
|
11416
|
-
["ur-modelS-4", "VERTEX_REGION_UR_4_0_MODELS"]
|
|
11417
|
-
];
|
|
11418
11401
|
});
|
|
11419
11402
|
|
|
11420
11403
|
// src/utils/process.ts
|
|
@@ -51123,59 +51106,59 @@ var init_configs = __esm(() => {
|
|
|
51123
51106
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51124
51107
|
};
|
|
51125
51108
|
UR_MODELH_4_5_CONFIG = {
|
|
51126
|
-
firstParty: "
|
|
51127
|
-
bedrock: "
|
|
51128
|
-
vertex: "
|
|
51129
|
-
foundry: "
|
|
51109
|
+
firstParty: "modelH",
|
|
51110
|
+
bedrock: "modelH",
|
|
51111
|
+
vertex: "modelH",
|
|
51112
|
+
foundry: "modelH",
|
|
51130
51113
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51131
51114
|
};
|
|
51132
51115
|
UR_MODELS_4_CONFIG = {
|
|
51133
|
-
firstParty: "
|
|
51134
|
-
bedrock: "
|
|
51135
|
-
vertex: "
|
|
51136
|
-
foundry: "
|
|
51116
|
+
firstParty: "modelS",
|
|
51117
|
+
bedrock: "modelS",
|
|
51118
|
+
vertex: "modelS",
|
|
51119
|
+
foundry: "modelS",
|
|
51137
51120
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51138
51121
|
};
|
|
51139
51122
|
UR_MODELS_4_5_CONFIG = {
|
|
51140
|
-
firstParty: "
|
|
51141
|
-
bedrock: "
|
|
51142
|
-
vertex: "
|
|
51143
|
-
foundry: "
|
|
51123
|
+
firstParty: "modelS",
|
|
51124
|
+
bedrock: "modelS",
|
|
51125
|
+
vertex: "modelS",
|
|
51126
|
+
foundry: "modelS",
|
|
51144
51127
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51145
51128
|
};
|
|
51146
51129
|
UR_MODELO_4_CONFIG = {
|
|
51147
|
-
firstParty: "
|
|
51148
|
-
bedrock: "
|
|
51149
|
-
vertex: "
|
|
51150
|
-
foundry: "
|
|
51130
|
+
firstParty: "modelO",
|
|
51131
|
+
bedrock: "modelO",
|
|
51132
|
+
vertex: "modelO",
|
|
51133
|
+
foundry: "modelO",
|
|
51151
51134
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51152
51135
|
};
|
|
51153
51136
|
UR_MODELO_4_1_CONFIG = {
|
|
51154
|
-
firstParty: "
|
|
51155
|
-
bedrock: "
|
|
51156
|
-
vertex: "
|
|
51157
|
-
foundry: "
|
|
51137
|
+
firstParty: "modelO",
|
|
51138
|
+
bedrock: "modelO",
|
|
51139
|
+
vertex: "modelO",
|
|
51140
|
+
foundry: "modelO",
|
|
51158
51141
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51159
51142
|
};
|
|
51160
51143
|
UR_MODELO_4_5_CONFIG = {
|
|
51161
|
-
firstParty: "
|
|
51162
|
-
bedrock: "
|
|
51163
|
-
vertex: "
|
|
51164
|
-
foundry: "
|
|
51144
|
+
firstParty: "modelO",
|
|
51145
|
+
bedrock: "modelO",
|
|
51146
|
+
vertex: "modelO",
|
|
51147
|
+
foundry: "modelO",
|
|
51165
51148
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51166
51149
|
};
|
|
51167
51150
|
UR_MODELO_4_6_CONFIG = {
|
|
51168
|
-
firstParty: "
|
|
51169
|
-
bedrock: "
|
|
51170
|
-
vertex: "
|
|
51171
|
-
foundry: "
|
|
51151
|
+
firstParty: "modelO",
|
|
51152
|
+
bedrock: "modelO",
|
|
51153
|
+
vertex: "modelO",
|
|
51154
|
+
foundry: "modelO",
|
|
51172
51155
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51173
51156
|
};
|
|
51174
51157
|
UR_MODELS_4_6_CONFIG = {
|
|
51175
|
-
firstParty: "
|
|
51176
|
-
bedrock: "
|
|
51177
|
-
vertex: "
|
|
51178
|
-
foundry: "
|
|
51158
|
+
firstParty: "modelS",
|
|
51159
|
+
bedrock: "modelS",
|
|
51160
|
+
vertex: "modelS",
|
|
51161
|
+
foundry: "modelS",
|
|
51179
51162
|
ollama: DEFAULT_OLLAMA_MODEL
|
|
51180
51163
|
};
|
|
51181
51164
|
ALL_MODEL_CONFIGS = {
|
|
@@ -51298,6 +51281,8 @@ function getProviderRuntimeInfo(settings = getInitialSettings()) {
|
|
|
51298
51281
|
function getProviderRuntimeBackend(providerId) {
|
|
51299
51282
|
const provider = resolveProviderId(providerId);
|
|
51300
51283
|
switch (provider) {
|
|
51284
|
+
case "subscription":
|
|
51285
|
+
return "subscription:unconfigured";
|
|
51301
51286
|
case "ollama":
|
|
51302
51287
|
return "ollama";
|
|
51303
51288
|
case "lmstudio":
|
|
@@ -51354,6 +51339,8 @@ function getProviderAccessTypeLabel(provider) {
|
|
|
51354
51339
|
}
|
|
51355
51340
|
function credentialTypeLabel(type) {
|
|
51356
51341
|
switch (type) {
|
|
51342
|
+
case "subscription-login":
|
|
51343
|
+
return "subscription login";
|
|
51357
51344
|
case "cli-login":
|
|
51358
51345
|
return "subscription login";
|
|
51359
51346
|
case "api-key":
|
|
@@ -51377,6 +51364,9 @@ function getProviderRuntimeBlockReason(providerId, env4 = process.env) {
|
|
|
51377
51364
|
return `Unknown provider "${providerId}". Run: ur provider list`;
|
|
51378
51365
|
}
|
|
51379
51366
|
const definition = getProviderDefinition(provider);
|
|
51367
|
+
if (provider === "subscription") {
|
|
51368
|
+
return `Provider "subscription" represents subscription login, but no independent subscription runtime is configured. UR will not fake subscription models or call provider apps by default. Choose a local, server, or API provider with /model.`;
|
|
51369
|
+
}
|
|
51380
51370
|
if (definition.runtimeKind !== "external-app") {
|
|
51381
51371
|
return null;
|
|
51382
51372
|
}
|
|
@@ -51636,6 +51626,15 @@ async function checkEndpoint(definition, settings, adapters, result) {
|
|
|
51636
51626
|
}
|
|
51637
51627
|
}
|
|
51638
51628
|
async function checkSubscriptionProvider(definition, settings, adapters, result) {
|
|
51629
|
+
if (definition.credentialType === "subscription-login") {
|
|
51630
|
+
result.checks.push({
|
|
51631
|
+
name: "subscription_runtime",
|
|
51632
|
+
status: "fail",
|
|
51633
|
+
message: "No independent subscription runtime is configured."
|
|
51634
|
+
});
|
|
51635
|
+
addFailure(result, "subscription runtime unavailable", "Run /model and choose a connected local, server, or API provider.");
|
|
51636
|
+
return;
|
|
51637
|
+
}
|
|
51639
51638
|
const commandPath = await resolveCommand(definition, settings, adapters);
|
|
51640
51639
|
if (!commandPath) {
|
|
51641
51640
|
const commands = definition.commandCandidates?.join(", ") ?? definition.id;
|
|
@@ -51805,7 +51804,7 @@ function getConnectionStatusFromDoctorResult(result) {
|
|
|
51805
51804
|
if (result.failureReason?.includes("CLI missing") || result.failureReason?.includes("not found")) {
|
|
51806
51805
|
return "missing";
|
|
51807
51806
|
}
|
|
51808
|
-
if (result.failureReason?.includes("not logged in") || result.failureReason?.includes("not authenticated") || result.failureReason?.includes("API key missing") || result.failureReason?.includes("endpoint") || result.failureReason?.includes("HTTP")) {
|
|
51807
|
+
if (result.failureReason?.includes("not logged in") || result.failureReason?.includes("not authenticated") || result.failureReason?.includes("subscription runtime unavailable") || result.failureReason?.includes("API key missing") || result.failureReason?.includes("endpoint") || result.failureReason?.includes("HTTP")) {
|
|
51809
51808
|
return "unavailable";
|
|
51810
51809
|
}
|
|
51811
51810
|
return "unknown";
|
|
@@ -51825,6 +51824,9 @@ function formatProviderStatusLabel(status, provider, checks3) {
|
|
|
51825
51824
|
if (provider.credentialType === "cli-login") {
|
|
51826
51825
|
return "subscription login connected";
|
|
51827
51826
|
}
|
|
51827
|
+
if (provider.credentialType === "subscription-login") {
|
|
51828
|
+
return "subscription connected";
|
|
51829
|
+
}
|
|
51828
51830
|
return "connected";
|
|
51829
51831
|
case "missing":
|
|
51830
51832
|
if (provider.commandCandidates) {
|
|
@@ -52342,6 +52344,7 @@ var init_providerRegistry = __esm(() => {
|
|
|
52342
52344
|
init_which();
|
|
52343
52345
|
PROVIDER_IDS = [
|
|
52344
52346
|
"ollama",
|
|
52347
|
+
"subscription",
|
|
52345
52348
|
"lmstudio",
|
|
52346
52349
|
"llama.cpp",
|
|
52347
52350
|
"vllm",
|
|
@@ -52357,6 +52360,21 @@ var init_providerRegistry = __esm(() => {
|
|
|
52357
52360
|
];
|
|
52358
52361
|
LOCALHOST_RE = /^(https?:\/\/)?(localhost|127\.0\.0\.1|\[::1\]|::1)(:\d+)?(\/|$)/i;
|
|
52359
52362
|
PROVIDERS = {
|
|
52363
|
+
subscription: {
|
|
52364
|
+
id: "subscription",
|
|
52365
|
+
displayName: "Subscription",
|
|
52366
|
+
statusBarName: "Subscription",
|
|
52367
|
+
accessType: "subscription",
|
|
52368
|
+
credentialType: "subscription-login",
|
|
52369
|
+
modelDiscoveryType: "static",
|
|
52370
|
+
statusCheck: "subscription-login",
|
|
52371
|
+
listModels: "static",
|
|
52372
|
+
validateModel: "static-list",
|
|
52373
|
+
runtimeKind: "ur-native",
|
|
52374
|
+
authMode: "subscription",
|
|
52375
|
+
legalPath: "independent subscription runtime only",
|
|
52376
|
+
accessPathLabel: "subscription login; no external provider app bridge"
|
|
52377
|
+
},
|
|
52360
52378
|
"codex-cli": {
|
|
52361
52379
|
id: "codex-cli",
|
|
52362
52380
|
displayName: "Codex CLI",
|
|
@@ -52588,6 +52606,10 @@ var init_providerRegistry = __esm(() => {
|
|
|
52588
52606
|
}
|
|
52589
52607
|
};
|
|
52590
52608
|
PROVIDER_ALIAS_ENTRIES = [
|
|
52609
|
+
{
|
|
52610
|
+
canonical: "subscription",
|
|
52611
|
+
aliases: ["subscriptions", "subscription login"]
|
|
52612
|
+
},
|
|
52591
52613
|
{
|
|
52592
52614
|
canonical: "codex-cli",
|
|
52593
52615
|
aliases: ["chatgpt", "codex", "codex cli", "openai codex", "chatgpt codex"]
|
|
@@ -52647,6 +52669,7 @@ var init_providerRegistry = __esm(() => {
|
|
|
52647
52669
|
...entry.aliases.map((alias) => [normalizeProviderInput(alias), entry.canonical])
|
|
52648
52670
|
]));
|
|
52649
52671
|
PROVIDER_FAMILIES = {
|
|
52672
|
+
subscription: "subscription",
|
|
52650
52673
|
"anthropic-api": "anthropic",
|
|
52651
52674
|
"claude-code-cli": "anthropic",
|
|
52652
52675
|
"openai-api": "openai",
|
|
@@ -52662,6 +52685,7 @@ var init_providerRegistry = __esm(() => {
|
|
|
52662
52685
|
ollama: "ollama"
|
|
52663
52686
|
};
|
|
52664
52687
|
PROVIDER_MODELS = {
|
|
52688
|
+
subscription: [],
|
|
52665
52689
|
"codex-cli": [
|
|
52666
52690
|
{ id: "codex/gpt-5.5", displayName: "GPT-5.5 (Codex CLI)", description: "Subscription model through official Codex CLI login", isDefault: true },
|
|
52667
52691
|
{ id: "codex/gpt-5.4", displayName: "GPT-5.4 (Codex CLI)", description: "Subscription model through official Codex CLI login" },
|
|
@@ -53678,666 +53702,6 @@ var init_antModels = __esm(() => {
|
|
|
53678
53702
|
init_growthbook();
|
|
53679
53703
|
});
|
|
53680
53704
|
|
|
53681
|
-
// src/utils/fastMode.ts
|
|
53682
|
-
function isFastModeEnabled() {
|
|
53683
|
-
return !isEnvTruthy(process.env.UR_CODE_DISABLE_FAST_MODE);
|
|
53684
|
-
}
|
|
53685
|
-
function isFastModeAvailable() {
|
|
53686
|
-
if (!isFastModeEnabled()) {
|
|
53687
|
-
return false;
|
|
53688
|
-
}
|
|
53689
|
-
return getFastModeUnavailableReason() === null;
|
|
53690
|
-
}
|
|
53691
|
-
function getDisabledReasonMessage(disabledReason, authType) {
|
|
53692
|
-
switch (disabledReason) {
|
|
53693
|
-
case "free":
|
|
53694
|
-
return authType === "oauth" ? "Fast mode requires a paid subscription" : "Fast mode unavailable during evaluation. Please purchase credits.";
|
|
53695
|
-
case "preference":
|
|
53696
|
-
return "Fast mode has been disabled by your organization";
|
|
53697
|
-
case "extra_usage_disabled":
|
|
53698
|
-
return "Fast mode requires extra usage billing \xB7 /extra-usage to enable";
|
|
53699
|
-
case "network_error":
|
|
53700
|
-
return "Fast mode unavailable due to network connectivity issues";
|
|
53701
|
-
case "unknown":
|
|
53702
|
-
return "Fast mode is currently unavailable";
|
|
53703
|
-
}
|
|
53704
|
-
}
|
|
53705
|
-
function getFastModeUnavailableReason() {
|
|
53706
|
-
if (!isFastModeEnabled()) {
|
|
53707
|
-
return "Fast mode is not available";
|
|
53708
|
-
}
|
|
53709
|
-
const statigReason = getFeatureValue_CACHED_MAY_BE_STALE("tengu_penguins_off", null);
|
|
53710
|
-
if (statigReason !== null) {
|
|
53711
|
-
logForDebugging(`Fast mode unavailable: ${statigReason}`);
|
|
53712
|
-
return statigReason;
|
|
53713
|
-
}
|
|
53714
|
-
if (!isInBundledMode() && getFeatureValue_CACHED_MAY_BE_STALE("tengu_marble_sandcastle", false)) {
|
|
53715
|
-
return "Fast mode requires the native binary \xB7 Install from: https://ur.com/product/ur";
|
|
53716
|
-
}
|
|
53717
|
-
if (getIsNonInteractiveSession() && preferThirdPartyAuthentication() && !getKairosActive()) {
|
|
53718
|
-
const flagFastMode = getSettingsForSource("flagSettings")?.fastMode;
|
|
53719
|
-
if (!flagFastMode) {
|
|
53720
|
-
const reason = "Fast mode is not available in the Agent SDK";
|
|
53721
|
-
logForDebugging(`Fast mode unavailable: ${reason}`);
|
|
53722
|
-
return reason;
|
|
53723
|
-
}
|
|
53724
|
-
}
|
|
53725
|
-
if (getAPIProvider() !== "firstParty") {
|
|
53726
|
-
const reason = "Fast mode is not available on Bedrock, Vertex, or Foundry";
|
|
53727
|
-
logForDebugging(`Fast mode unavailable: ${reason}`);
|
|
53728
|
-
return reason;
|
|
53729
|
-
}
|
|
53730
|
-
if (orgStatus.status === "disabled") {
|
|
53731
|
-
if (orgStatus.reason === "network_error" || orgStatus.reason === "unknown") {
|
|
53732
|
-
if (isEnvTruthy(process.env.UR_CODE_SKIP_FAST_MODE_NETWORK_ERRORS)) {
|
|
53733
|
-
return null;
|
|
53734
|
-
}
|
|
53735
|
-
}
|
|
53736
|
-
const authType = getURAIOAuthTokens() !== null ? "oauth" : "api-key";
|
|
53737
|
-
const reason = getDisabledReasonMessage(orgStatus.reason, authType);
|
|
53738
|
-
logForDebugging(`Fast mode unavailable: ${reason}`);
|
|
53739
|
-
return reason;
|
|
53740
|
-
}
|
|
53741
|
-
return null;
|
|
53742
|
-
}
|
|
53743
|
-
function getFastModeModel() {
|
|
53744
|
-
return "modelO" + (ismodelO1mMergeEnabled() ? "[1m]" : "");
|
|
53745
|
-
}
|
|
53746
|
-
function getInitialFastModeSetting(model) {
|
|
53747
|
-
if (!isFastModeEnabled()) {
|
|
53748
|
-
return false;
|
|
53749
|
-
}
|
|
53750
|
-
if (!isFastModeAvailable()) {
|
|
53751
|
-
return false;
|
|
53752
|
-
}
|
|
53753
|
-
if (!isFastModeSupportedByModel(model)) {
|
|
53754
|
-
return false;
|
|
53755
|
-
}
|
|
53756
|
-
const settings = getInitialSettings();
|
|
53757
|
-
if (settings.fastModePerSessionOptIn) {
|
|
53758
|
-
return false;
|
|
53759
|
-
}
|
|
53760
|
-
return settings.fastMode === true;
|
|
53761
|
-
}
|
|
53762
|
-
function isFastModeSupportedByModel(modelSetting) {
|
|
53763
|
-
if (!isFastModeEnabled()) {
|
|
53764
|
-
return false;
|
|
53765
|
-
}
|
|
53766
|
-
const model = modelSetting ?? getDefaultMainLoopModelSetting();
|
|
53767
|
-
const parsedModel = parseUserSpecifiedModel(model);
|
|
53768
|
-
return parsedModel.toLowerCase().includes("modelO-4-6");
|
|
53769
|
-
}
|
|
53770
|
-
function getFastModeRuntimeState() {
|
|
53771
|
-
if (runtimeState.status === "cooldown" && Date.now() >= runtimeState.resetAt) {
|
|
53772
|
-
if (isFastModeEnabled() && !hasLoggedCooldownExpiry) {
|
|
53773
|
-
logForDebugging("Fast mode cooldown expired, re-enabling fast mode");
|
|
53774
|
-
hasLoggedCooldownExpiry = true;
|
|
53775
|
-
cooldownExpired.emit();
|
|
53776
|
-
}
|
|
53777
|
-
runtimeState = { status: "active" };
|
|
53778
|
-
}
|
|
53779
|
-
return runtimeState;
|
|
53780
|
-
}
|
|
53781
|
-
function triggerFastModeCooldown(resetTimestamp, reason) {
|
|
53782
|
-
if (!isFastModeEnabled()) {
|
|
53783
|
-
return;
|
|
53784
|
-
}
|
|
53785
|
-
runtimeState = { status: "cooldown", resetAt: resetTimestamp, reason };
|
|
53786
|
-
hasLoggedCooldownExpiry = false;
|
|
53787
|
-
const cooldownDurationMs = resetTimestamp - Date.now();
|
|
53788
|
-
logForDebugging(`Fast mode cooldown triggered (${reason}), duration ${Math.round(cooldownDurationMs / 1000)}s`);
|
|
53789
|
-
logEvent("tengu_fast_mode_fallback_triggered", {
|
|
53790
|
-
cooldown_duration_ms: cooldownDurationMs,
|
|
53791
|
-
cooldown_reason: reason
|
|
53792
|
-
});
|
|
53793
|
-
cooldownTriggered.emit(resetTimestamp, reason);
|
|
53794
|
-
}
|
|
53795
|
-
function clearFastModeCooldown() {
|
|
53796
|
-
runtimeState = { status: "active" };
|
|
53797
|
-
}
|
|
53798
|
-
function handleFastModeRejectedByAPI() {
|
|
53799
|
-
if (orgStatus.status === "disabled") {
|
|
53800
|
-
return;
|
|
53801
|
-
}
|
|
53802
|
-
orgStatus = { status: "disabled", reason: "preference" };
|
|
53803
|
-
updateSettingsForSource("userSettings", { fastMode: undefined });
|
|
53804
|
-
saveGlobalConfig((current) => ({
|
|
53805
|
-
...current,
|
|
53806
|
-
penguinModeOrgEnabled: false
|
|
53807
|
-
}));
|
|
53808
|
-
orgFastModeChange.emit(false);
|
|
53809
|
-
}
|
|
53810
|
-
function getOverageDisabledMessage(reason) {
|
|
53811
|
-
switch (reason) {
|
|
53812
|
-
case "out_of_credits":
|
|
53813
|
-
return "Fast mode disabled \xB7 extra usage credits exhausted";
|
|
53814
|
-
case "org_level_disabled":
|
|
53815
|
-
case "org_service_level_disabled":
|
|
53816
|
-
return "Fast mode disabled \xB7 extra usage disabled by your organization";
|
|
53817
|
-
case "org_level_disabled_until":
|
|
53818
|
-
return "Fast mode disabled \xB7 extra usage spending cap reached";
|
|
53819
|
-
case "member_level_disabled":
|
|
53820
|
-
return "Fast mode disabled \xB7 extra usage disabled for your account";
|
|
53821
|
-
case "seat_tier_level_disabled":
|
|
53822
|
-
case "seat_tier_zero_credit_limit":
|
|
53823
|
-
case "member_zero_credit_limit":
|
|
53824
|
-
return "Fast mode disabled \xB7 extra usage not available for your plan";
|
|
53825
|
-
case "overage_not_provisioned":
|
|
53826
|
-
case "no_limits_configured":
|
|
53827
|
-
return "Fast mode requires extra usage billing \xB7 /extra-usage to enable";
|
|
53828
|
-
default:
|
|
53829
|
-
return "Fast mode disabled \xB7 extra usage not available";
|
|
53830
|
-
}
|
|
53831
|
-
}
|
|
53832
|
-
function isOutOfCreditsReason(reason) {
|
|
53833
|
-
return reason === "org_level_disabled_until" || reason === "out_of_credits";
|
|
53834
|
-
}
|
|
53835
|
-
function handleFastModeOverageRejection(reason) {
|
|
53836
|
-
const message = getOverageDisabledMessage(reason);
|
|
53837
|
-
logForDebugging(`Fast mode overage rejection: ${reason ?? "unknown"} \u2014 ${message}`);
|
|
53838
|
-
logEvent("tengu_fast_mode_overage_rejected", {
|
|
53839
|
-
overage_disabled_reason: reason ?? "unknown"
|
|
53840
|
-
});
|
|
53841
|
-
if (!isOutOfCreditsReason(reason)) {
|
|
53842
|
-
updateSettingsForSource("userSettings", { fastMode: undefined });
|
|
53843
|
-
saveGlobalConfig((current) => ({
|
|
53844
|
-
...current,
|
|
53845
|
-
penguinModeOrgEnabled: false
|
|
53846
|
-
}));
|
|
53847
|
-
}
|
|
53848
|
-
overageRejection.emit(message);
|
|
53849
|
-
}
|
|
53850
|
-
function isFastModeCooldown() {
|
|
53851
|
-
return getFastModeRuntimeState().status === "cooldown";
|
|
53852
|
-
}
|
|
53853
|
-
function getFastModeState(model, fastModeUserEnabled) {
|
|
53854
|
-
const enabled = isFastModeEnabled() && isFastModeAvailable() && !!fastModeUserEnabled && isFastModeSupportedByModel(model);
|
|
53855
|
-
if (enabled && isFastModeCooldown()) {
|
|
53856
|
-
return "cooldown";
|
|
53857
|
-
}
|
|
53858
|
-
if (enabled) {
|
|
53859
|
-
return "on";
|
|
53860
|
-
}
|
|
53861
|
-
return "off";
|
|
53862
|
-
}
|
|
53863
|
-
async function fetchFastModeStatus(auth) {
|
|
53864
|
-
const endpoint = `${getOauthConfig().BASE_API_URL}/api/ur_penguin_mode`;
|
|
53865
|
-
const headers = "accessToken" in auth ? {
|
|
53866
|
-
Authorization: `Bearer ${auth.accessToken}`,
|
|
53867
|
-
"urhq-beta": OAUTH_BETA_HEADER
|
|
53868
|
-
} : { "x-api-key": auth.apiKey };
|
|
53869
|
-
const response = await axios_default.get(endpoint, { headers });
|
|
53870
|
-
return response.data;
|
|
53871
|
-
}
|
|
53872
|
-
function resolveFastModeStatusFromCache() {
|
|
53873
|
-
if (!isFastModeEnabled()) {
|
|
53874
|
-
return;
|
|
53875
|
-
}
|
|
53876
|
-
if (orgStatus.status !== "pending") {
|
|
53877
|
-
return;
|
|
53878
|
-
}
|
|
53879
|
-
const isAnt = process.env.USER_TYPE === "ant";
|
|
53880
|
-
const cachedEnabled = getGlobalConfig().penguinModeOrgEnabled === true;
|
|
53881
|
-
orgStatus = isAnt || cachedEnabled ? { status: "enabled" } : { status: "disabled", reason: "unknown" };
|
|
53882
|
-
}
|
|
53883
|
-
async function prefetchFastModeStatus() {
|
|
53884
|
-
if (isEssentialTrafficOnly()) {
|
|
53885
|
-
return;
|
|
53886
|
-
}
|
|
53887
|
-
if (!isFastModeEnabled()) {
|
|
53888
|
-
return;
|
|
53889
|
-
}
|
|
53890
|
-
if (inflightPrefetch) {
|
|
53891
|
-
logForDebugging("Fast mode prefetch in progress, returning in-flight promise");
|
|
53892
|
-
return inflightPrefetch;
|
|
53893
|
-
}
|
|
53894
|
-
const apiKey = getURHQApiKey();
|
|
53895
|
-
const hasUsableOAuth = getURAIOAuthTokens()?.accessToken && hasProfileScope();
|
|
53896
|
-
if (!hasUsableOAuth && !apiKey) {
|
|
53897
|
-
const isAnt = process.env.USER_TYPE === "ant";
|
|
53898
|
-
const cachedEnabled = getGlobalConfig().penguinModeOrgEnabled === true;
|
|
53899
|
-
orgStatus = isAnt || cachedEnabled ? { status: "enabled" } : { status: "disabled", reason: "preference" };
|
|
53900
|
-
return;
|
|
53901
|
-
}
|
|
53902
|
-
const now2 = Date.now();
|
|
53903
|
-
if (now2 - lastPrefetchAt < PREFETCH_MIN_INTERVAL_MS) {
|
|
53904
|
-
logForDebugging("Skipping fast mode prefetch, fetched recently");
|
|
53905
|
-
return;
|
|
53906
|
-
}
|
|
53907
|
-
lastPrefetchAt = now2;
|
|
53908
|
-
const fetchWithCurrentAuth = async () => {
|
|
53909
|
-
const currentTokens = getURAIOAuthTokens();
|
|
53910
|
-
const auth = currentTokens?.accessToken && hasProfileScope() ? { accessToken: currentTokens.accessToken } : apiKey ? { apiKey } : null;
|
|
53911
|
-
if (!auth) {
|
|
53912
|
-
throw new Error("No auth available");
|
|
53913
|
-
}
|
|
53914
|
-
return fetchFastModeStatus(auth);
|
|
53915
|
-
};
|
|
53916
|
-
async function doFetch() {
|
|
53917
|
-
try {
|
|
53918
|
-
let status;
|
|
53919
|
-
try {
|
|
53920
|
-
status = await fetchWithCurrentAuth();
|
|
53921
|
-
} catch (err) {
|
|
53922
|
-
const isAuthError = axios_default.isAxiosError(err) && (err.response?.status === 401 || err.response?.status === 403 && typeof err.response?.data === "string" && err.response.data.includes("OAuth token has been revoked"));
|
|
53923
|
-
if (isAuthError) {
|
|
53924
|
-
const failedAccessToken = getURAIOAuthTokens()?.accessToken;
|
|
53925
|
-
if (failedAccessToken) {
|
|
53926
|
-
await handleOAuth401Error(failedAccessToken);
|
|
53927
|
-
status = await fetchWithCurrentAuth();
|
|
53928
|
-
} else {
|
|
53929
|
-
throw err;
|
|
53930
|
-
}
|
|
53931
|
-
} else {
|
|
53932
|
-
throw err;
|
|
53933
|
-
}
|
|
53934
|
-
}
|
|
53935
|
-
const previousEnabled = orgStatus.status !== "pending" ? orgStatus.status === "enabled" : getGlobalConfig().penguinModeOrgEnabled;
|
|
53936
|
-
orgStatus = status.enabled ? { status: "enabled" } : {
|
|
53937
|
-
status: "disabled",
|
|
53938
|
-
reason: status.disabled_reason ?? "preference"
|
|
53939
|
-
};
|
|
53940
|
-
if (previousEnabled !== status.enabled) {
|
|
53941
|
-
if (!status.enabled) {
|
|
53942
|
-
updateSettingsForSource("userSettings", { fastMode: undefined });
|
|
53943
|
-
}
|
|
53944
|
-
saveGlobalConfig((current) => ({
|
|
53945
|
-
...current,
|
|
53946
|
-
penguinModeOrgEnabled: status.enabled
|
|
53947
|
-
}));
|
|
53948
|
-
orgFastModeChange.emit(status.enabled);
|
|
53949
|
-
}
|
|
53950
|
-
logForDebugging(`Org fast mode: ${status.enabled ? "enabled" : `disabled (${status.disabled_reason ?? "preference"})`}`);
|
|
53951
|
-
} catch (err) {
|
|
53952
|
-
const isAnt = process.env.USER_TYPE === "ant";
|
|
53953
|
-
const cachedEnabled = getGlobalConfig().penguinModeOrgEnabled === true;
|
|
53954
|
-
orgStatus = isAnt || cachedEnabled ? { status: "enabled" } : { status: "disabled", reason: "network_error" };
|
|
53955
|
-
logForDebugging(`Failed to fetch org fast mode status, defaulting to ${orgStatus.status === "enabled" ? "enabled (cached)" : "disabled (network_error)"}: ${err}`, { level: "error" });
|
|
53956
|
-
logEvent("tengu_org_penguin_mode_fetch_failed", {});
|
|
53957
|
-
} finally {
|
|
53958
|
-
inflightPrefetch = null;
|
|
53959
|
-
}
|
|
53960
|
-
}
|
|
53961
|
-
inflightPrefetch = doFetch();
|
|
53962
|
-
return inflightPrefetch;
|
|
53963
|
-
}
|
|
53964
|
-
var FAST_MODE_MODEL_DISPLAY = "modelO 4.6", runtimeState, hasLoggedCooldownExpiry = false, cooldownTriggered, cooldownExpired, onCooldownTriggered, onCooldownExpired, overageRejection, onFastModeOverageRejection, orgStatus, orgFastModeChange, onOrgFastModeChanged, PREFETCH_MIN_INTERVAL_MS = 30000, lastPrefetchAt = 0, inflightPrefetch = null;
|
|
53965
|
-
var init_fastMode = __esm(() => {
|
|
53966
|
-
init_axios2();
|
|
53967
|
-
init_oauth();
|
|
53968
|
-
init_growthbook();
|
|
53969
|
-
init_state();
|
|
53970
|
-
init_analytics();
|
|
53971
|
-
init_auth();
|
|
53972
|
-
init_config();
|
|
53973
|
-
init_debug();
|
|
53974
|
-
init_envUtils();
|
|
53975
|
-
init_model();
|
|
53976
|
-
init_providers();
|
|
53977
|
-
init_settings2();
|
|
53978
|
-
runtimeState = { status: "active" };
|
|
53979
|
-
cooldownTriggered = createSignal();
|
|
53980
|
-
cooldownExpired = createSignal();
|
|
53981
|
-
onCooldownTriggered = cooldownTriggered.subscribe;
|
|
53982
|
-
onCooldownExpired = cooldownExpired.subscribe;
|
|
53983
|
-
overageRejection = createSignal();
|
|
53984
|
-
onFastModeOverageRejection = overageRejection.subscribe;
|
|
53985
|
-
orgStatus = { status: "pending" };
|
|
53986
|
-
orgFastModeChange = createSignal();
|
|
53987
|
-
onOrgFastModeChanged = orgFastModeChange.subscribe;
|
|
53988
|
-
});
|
|
53989
|
-
|
|
53990
|
-
// src/utils/modelCost.ts
|
|
53991
|
-
function getmodelO46CostTier(fastMode) {
|
|
53992
|
-
if (isFastModeEnabled() && fastMode) {
|
|
53993
|
-
return COST_TIER_30_150;
|
|
53994
|
-
}
|
|
53995
|
-
return COST_TIER_5_25;
|
|
53996
|
-
}
|
|
53997
|
-
function tokensToUSDCost(modelCosts, usage) {
|
|
53998
|
-
return usage.input_tokens / 1e6 * modelCosts.inputTokens + usage.output_tokens / 1e6 * modelCosts.outputTokens + (usage.cache_read_input_tokens ?? 0) / 1e6 * modelCosts.promptCacheReadTokens + (usage.cache_creation_input_tokens ?? 0) / 1e6 * modelCosts.promptCacheWriteTokens + (usage.server_tool_use?.web_search_requests ?? 0) * modelCosts.webSearchRequests;
|
|
53999
|
-
}
|
|
54000
|
-
function getModelCosts(model, usage) {
|
|
54001
|
-
const shortName = getCanonicalName(model);
|
|
54002
|
-
if (shortName === firstPartyNameToCanonical(UR_MODELO_4_6_CONFIG.firstParty)) {
|
|
54003
|
-
const isFastMode = usage.speed === "fast";
|
|
54004
|
-
return getmodelO46CostTier(isFastMode);
|
|
54005
|
-
}
|
|
54006
|
-
const costs = MODEL_COSTS[shortName];
|
|
54007
|
-
if (!costs) {
|
|
54008
|
-
trackUnknownModelCost(model, shortName);
|
|
54009
|
-
return MODEL_COSTS[getCanonicalName(getDefaultMainLoopModelSetting())] ?? DEFAULT_UNKNOWN_MODEL_COST;
|
|
54010
|
-
}
|
|
54011
|
-
return costs;
|
|
54012
|
-
}
|
|
54013
|
-
function trackUnknownModelCost(model, shortName) {
|
|
54014
|
-
logEvent("tengu_unknown_model_cost", {
|
|
54015
|
-
model,
|
|
54016
|
-
shortName
|
|
54017
|
-
});
|
|
54018
|
-
setHasUnknownModelCost();
|
|
54019
|
-
}
|
|
54020
|
-
function calculateUSDCost(resolvedModel, usage) {
|
|
54021
|
-
if (getAPIProvider() === "ollama") {
|
|
54022
|
-
return 0;
|
|
54023
|
-
}
|
|
54024
|
-
const modelCosts = getModelCosts(resolvedModel, usage);
|
|
54025
|
-
return tokensToUSDCost(modelCosts, usage);
|
|
54026
|
-
}
|
|
54027
|
-
function formatPrice(price) {
|
|
54028
|
-
if (Number.isInteger(price)) {
|
|
54029
|
-
return `$${price}`;
|
|
54030
|
-
}
|
|
54031
|
-
return `$${price.toFixed(2)}`;
|
|
54032
|
-
}
|
|
54033
|
-
function formatModelPricing(costs) {
|
|
54034
|
-
return `${formatPrice(costs.inputTokens)}/${formatPrice(costs.outputTokens)} per Mtok`;
|
|
54035
|
-
}
|
|
54036
|
-
var COST_TIER_3_15, COST_TIER_15_75, COST_TIER_5_25, COST_TIER_30_150, COST_MODELH_35, COST_MODELH_45, DEFAULT_UNKNOWN_MODEL_COST, MODEL_COSTS;
|
|
54037
|
-
var init_modelCost = __esm(() => {
|
|
54038
|
-
init_analytics();
|
|
54039
|
-
init_state();
|
|
54040
|
-
init_fastMode();
|
|
54041
|
-
init_configs();
|
|
54042
|
-
init_model();
|
|
54043
|
-
init_providers();
|
|
54044
|
-
COST_TIER_3_15 = {
|
|
54045
|
-
inputTokens: 3,
|
|
54046
|
-
outputTokens: 15,
|
|
54047
|
-
promptCacheWriteTokens: 3.75,
|
|
54048
|
-
promptCacheReadTokens: 0.3,
|
|
54049
|
-
webSearchRequests: 0.01
|
|
54050
|
-
};
|
|
54051
|
-
COST_TIER_15_75 = {
|
|
54052
|
-
inputTokens: 15,
|
|
54053
|
-
outputTokens: 75,
|
|
54054
|
-
promptCacheWriteTokens: 18.75,
|
|
54055
|
-
promptCacheReadTokens: 1.5,
|
|
54056
|
-
webSearchRequests: 0.01
|
|
54057
|
-
};
|
|
54058
|
-
COST_TIER_5_25 = {
|
|
54059
|
-
inputTokens: 5,
|
|
54060
|
-
outputTokens: 25,
|
|
54061
|
-
promptCacheWriteTokens: 6.25,
|
|
54062
|
-
promptCacheReadTokens: 0.5,
|
|
54063
|
-
webSearchRequests: 0.01
|
|
54064
|
-
};
|
|
54065
|
-
COST_TIER_30_150 = {
|
|
54066
|
-
inputTokens: 30,
|
|
54067
|
-
outputTokens: 150,
|
|
54068
|
-
promptCacheWriteTokens: 37.5,
|
|
54069
|
-
promptCacheReadTokens: 3,
|
|
54070
|
-
webSearchRequests: 0.01
|
|
54071
|
-
};
|
|
54072
|
-
COST_MODELH_35 = {
|
|
54073
|
-
inputTokens: 0.8,
|
|
54074
|
-
outputTokens: 4,
|
|
54075
|
-
promptCacheWriteTokens: 1,
|
|
54076
|
-
promptCacheReadTokens: 0.08,
|
|
54077
|
-
webSearchRequests: 0.01
|
|
54078
|
-
};
|
|
54079
|
-
COST_MODELH_45 = {
|
|
54080
|
-
inputTokens: 1,
|
|
54081
|
-
outputTokens: 5,
|
|
54082
|
-
promptCacheWriteTokens: 1.25,
|
|
54083
|
-
promptCacheReadTokens: 0.1,
|
|
54084
|
-
webSearchRequests: 0.01
|
|
54085
|
-
};
|
|
54086
|
-
DEFAULT_UNKNOWN_MODEL_COST = COST_TIER_5_25;
|
|
54087
|
-
MODEL_COSTS = {
|
|
54088
|
-
[firstPartyNameToCanonical(UR_3_5_MODELH_CONFIG.firstParty)]: COST_MODELH_35,
|
|
54089
|
-
[firstPartyNameToCanonical(UR_MODELH_4_5_CONFIG.firstParty)]: COST_MODELH_45,
|
|
54090
|
-
[firstPartyNameToCanonical(UR_3_5_V2_MODELS_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
54091
|
-
[firstPartyNameToCanonical(UR_3_7_MODELS_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
54092
|
-
[firstPartyNameToCanonical(UR_MODELS_4_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
54093
|
-
[firstPartyNameToCanonical(UR_MODELS_4_5_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
54094
|
-
[firstPartyNameToCanonical(UR_MODELS_4_6_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
54095
|
-
[firstPartyNameToCanonical(UR_MODELO_4_CONFIG.firstParty)]: COST_TIER_15_75,
|
|
54096
|
-
[firstPartyNameToCanonical(UR_MODELO_4_1_CONFIG.firstParty)]: COST_TIER_15_75,
|
|
54097
|
-
[firstPartyNameToCanonical(UR_MODELO_4_5_CONFIG.firstParty)]: COST_TIER_5_25,
|
|
54098
|
-
[firstPartyNameToCanonical(UR_MODELO_4_6_CONFIG.firstParty)]: COST_TIER_5_25
|
|
54099
|
-
};
|
|
54100
|
-
});
|
|
54101
|
-
|
|
54102
|
-
// src/constants/figures.ts
|
|
54103
|
-
var BLACK_CIRCLE, UR_HOUSE = "\u2302", UP_ARROW = "\u2191", DOWN_ARROW = "\u2193", LIGHTNING_BOLT = "\u21AF", EFFORT_LOW = "\u25CB", EFFORT_MEDIUM = "\u25D0", EFFORT_HIGH = "\u25CF", EFFORT_MAX = "\u25C9", PAUSE_ICON = "\u23F8", REFRESH_ARROW = "\u21BB", DIAMOND_OPEN = "\u25C7", DIAMOND_FILLED = "\u25C6", REFERENCE_MARK = "\u203B", BLOCKQUOTE_BAR = "\u258E", BRIDGE_READY_INDICATOR = "\xB7\u2714\uFE0E\xB7", BRIDGE_FAILED_INDICATOR = "\xD7";
|
|
54104
|
-
var init_figures2 = __esm(() => {
|
|
54105
|
-
BLACK_CIRCLE = process.platform === "darwin" ? "\u23FA" : "\u25CF";
|
|
54106
|
-
});
|
|
54107
|
-
|
|
54108
|
-
// src/utils/model/aliases.ts
|
|
54109
|
-
function isModelAlias(modelInput) {
|
|
54110
|
-
return MODEL_ALIASES.includes(modelInput);
|
|
54111
|
-
}
|
|
54112
|
-
function isModelFamilyAlias(model) {
|
|
54113
|
-
return MODEL_FAMILY_ALIASES.includes(model);
|
|
54114
|
-
}
|
|
54115
|
-
var MODEL_ALIASES, MODEL_FAMILY_ALIASES;
|
|
54116
|
-
var init_aliases = __esm(() => {
|
|
54117
|
-
MODEL_ALIASES = [
|
|
54118
|
-
"modelS",
|
|
54119
|
-
"modelO",
|
|
54120
|
-
"modelH",
|
|
54121
|
-
"best",
|
|
54122
|
-
"modelS[1m]",
|
|
54123
|
-
"modelO[1m]",
|
|
54124
|
-
"modelOplan"
|
|
54125
|
-
];
|
|
54126
|
-
MODEL_FAMILY_ALIASES = ["modelS", "modelO", "modelH"];
|
|
54127
|
-
});
|
|
54128
|
-
|
|
54129
|
-
// src/utils/model/modelAllowlist.ts
|
|
54130
|
-
function modelBelongsToFamily(model, family) {
|
|
54131
|
-
if (model.includes(family)) {
|
|
54132
|
-
return true;
|
|
54133
|
-
}
|
|
54134
|
-
if (isModelAlias(model)) {
|
|
54135
|
-
const resolved = parseUserSpecifiedModel(model).toLowerCase();
|
|
54136
|
-
return resolved.includes(family);
|
|
54137
|
-
}
|
|
54138
|
-
return false;
|
|
54139
|
-
}
|
|
54140
|
-
function prefixMatchesModel(modelName, prefix) {
|
|
54141
|
-
if (!modelName.startsWith(prefix)) {
|
|
54142
|
-
return false;
|
|
54143
|
-
}
|
|
54144
|
-
return modelName.length === prefix.length || modelName[prefix.length] === "-";
|
|
54145
|
-
}
|
|
54146
|
-
function modelMatchesVersionPrefix(model, entry) {
|
|
54147
|
-
const resolvedModel = isModelAlias(model) ? parseUserSpecifiedModel(model).toLowerCase() : model;
|
|
54148
|
-
if (prefixMatchesModel(resolvedModel, entry)) {
|
|
54149
|
-
return true;
|
|
54150
|
-
}
|
|
54151
|
-
if (!entry.startsWith("ur-") && prefixMatchesModel(resolvedModel, `ur-${entry}`)) {
|
|
54152
|
-
return true;
|
|
54153
|
-
}
|
|
54154
|
-
return false;
|
|
54155
|
-
}
|
|
54156
|
-
function familyHasSpecificEntries(family, allowlist) {
|
|
54157
|
-
for (const entry of allowlist) {
|
|
54158
|
-
if (isModelFamilyAlias(entry)) {
|
|
54159
|
-
continue;
|
|
54160
|
-
}
|
|
54161
|
-
const idx = entry.indexOf(family);
|
|
54162
|
-
if (idx === -1) {
|
|
54163
|
-
continue;
|
|
54164
|
-
}
|
|
54165
|
-
const afterFamily = idx + family.length;
|
|
54166
|
-
if (afterFamily === entry.length || entry[afterFamily] === "-") {
|
|
54167
|
-
return true;
|
|
54168
|
-
}
|
|
54169
|
-
}
|
|
54170
|
-
return false;
|
|
54171
|
-
}
|
|
54172
|
-
function isModelAllowed(model) {
|
|
54173
|
-
if (getAPIProvider() === "ollama") {
|
|
54174
|
-
return true;
|
|
54175
|
-
}
|
|
54176
|
-
const settings = getSettings_DEPRECATED() || {};
|
|
54177
|
-
const { availableModels } = settings;
|
|
54178
|
-
if (!availableModels) {
|
|
54179
|
-
return true;
|
|
54180
|
-
}
|
|
54181
|
-
if (availableModels.length === 0) {
|
|
54182
|
-
return false;
|
|
54183
|
-
}
|
|
54184
|
-
const resolvedModel = resolveOverriddenModel(model);
|
|
54185
|
-
const normalizedModel = resolvedModel.trim().toLowerCase();
|
|
54186
|
-
const normalizedAllowlist = availableModels.map((m) => m.trim().toLowerCase());
|
|
54187
|
-
if (normalizedAllowlist.includes(normalizedModel)) {
|
|
54188
|
-
if (!isModelFamilyAlias(normalizedModel) || !familyHasSpecificEntries(normalizedModel, normalizedAllowlist)) {
|
|
54189
|
-
return true;
|
|
54190
|
-
}
|
|
54191
|
-
}
|
|
54192
|
-
for (const entry of normalizedAllowlist) {
|
|
54193
|
-
if (isModelFamilyAlias(entry) && !familyHasSpecificEntries(entry, normalizedAllowlist) && modelBelongsToFamily(normalizedModel, entry)) {
|
|
54194
|
-
return true;
|
|
54195
|
-
}
|
|
54196
|
-
}
|
|
54197
|
-
if (isModelAlias(normalizedModel)) {
|
|
54198
|
-
const resolved = parseUserSpecifiedModel(normalizedModel).toLowerCase();
|
|
54199
|
-
if (normalizedAllowlist.includes(resolved)) {
|
|
54200
|
-
return true;
|
|
54201
|
-
}
|
|
54202
|
-
}
|
|
54203
|
-
for (const entry of normalizedAllowlist) {
|
|
54204
|
-
if (!isModelFamilyAlias(entry) && isModelAlias(entry)) {
|
|
54205
|
-
const resolved = parseUserSpecifiedModel(entry).toLowerCase();
|
|
54206
|
-
if (resolved === normalizedModel) {
|
|
54207
|
-
return true;
|
|
54208
|
-
}
|
|
54209
|
-
}
|
|
54210
|
-
}
|
|
54211
|
-
for (const entry of normalizedAllowlist) {
|
|
54212
|
-
if (!isModelFamilyAlias(entry) && !isModelAlias(entry)) {
|
|
54213
|
-
if (modelMatchesVersionPrefix(normalizedModel, entry)) {
|
|
54214
|
-
return true;
|
|
54215
|
-
}
|
|
54216
|
-
}
|
|
54217
|
-
}
|
|
54218
|
-
return false;
|
|
54219
|
-
}
|
|
54220
|
-
var init_modelAllowlist = __esm(() => {
|
|
54221
|
-
init_settings2();
|
|
54222
|
-
init_aliases();
|
|
54223
|
-
init_model();
|
|
54224
|
-
init_modelStrings();
|
|
54225
|
-
init_providers();
|
|
54226
|
-
});
|
|
54227
|
-
|
|
54228
|
-
// src/utils/stringUtils.ts
|
|
54229
|
-
function escapeRegExp(str) {
|
|
54230
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
54231
|
-
}
|
|
54232
|
-
function capitalize(str) {
|
|
54233
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
54234
|
-
}
|
|
54235
|
-
function plural(n2, word, pluralWord = word + "s") {
|
|
54236
|
-
return n2 === 1 ? word : pluralWord;
|
|
54237
|
-
}
|
|
54238
|
-
function firstLineOf(s) {
|
|
54239
|
-
const nl = s.indexOf(`
|
|
54240
|
-
`);
|
|
54241
|
-
return nl === -1 ? s : s.slice(0, nl);
|
|
54242
|
-
}
|
|
54243
|
-
function countCharInString(str, char, start = 0) {
|
|
54244
|
-
let count3 = 0;
|
|
54245
|
-
let i2 = str.indexOf(char, start);
|
|
54246
|
-
while (i2 !== -1) {
|
|
54247
|
-
count3++;
|
|
54248
|
-
i2 = str.indexOf(char, i2 + 1);
|
|
54249
|
-
}
|
|
54250
|
-
return count3;
|
|
54251
|
-
}
|
|
54252
|
-
function normalizeFullWidthDigits(input) {
|
|
54253
|
-
return input.replace(/[\uFF10-\uFF19]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) - 65248));
|
|
54254
|
-
}
|
|
54255
|
-
function normalizeFullWidthSpace(input) {
|
|
54256
|
-
return input.replace(/\u3000/g, " ");
|
|
54257
|
-
}
|
|
54258
|
-
function safeJoinLines(lines, delimiter = ",", maxSize = MAX_STRING_LENGTH) {
|
|
54259
|
-
const truncationMarker = "...[truncated]";
|
|
54260
|
-
let result = "";
|
|
54261
|
-
for (const line of lines) {
|
|
54262
|
-
const delimiterToAdd = result ? delimiter : "";
|
|
54263
|
-
const fullAddition = delimiterToAdd + line;
|
|
54264
|
-
if (result.length + fullAddition.length <= maxSize) {
|
|
54265
|
-
result += fullAddition;
|
|
54266
|
-
} else {
|
|
54267
|
-
const remainingSpace = maxSize - result.length - delimiterToAdd.length - truncationMarker.length;
|
|
54268
|
-
if (remainingSpace > 0) {
|
|
54269
|
-
result += delimiterToAdd + line.slice(0, remainingSpace) + truncationMarker;
|
|
54270
|
-
} else {
|
|
54271
|
-
result += truncationMarker;
|
|
54272
|
-
}
|
|
54273
|
-
return result;
|
|
54274
|
-
}
|
|
54275
|
-
}
|
|
54276
|
-
return result;
|
|
54277
|
-
}
|
|
54278
|
-
|
|
54279
|
-
class EndTruncatingAccumulator {
|
|
54280
|
-
maxSize;
|
|
54281
|
-
content = "";
|
|
54282
|
-
isTruncated = false;
|
|
54283
|
-
totalBytesReceived = 0;
|
|
54284
|
-
constructor(maxSize = MAX_STRING_LENGTH) {
|
|
54285
|
-
this.maxSize = maxSize;
|
|
54286
|
-
}
|
|
54287
|
-
append(data) {
|
|
54288
|
-
const str = typeof data === "string" ? data : data.toString();
|
|
54289
|
-
this.totalBytesReceived += str.length;
|
|
54290
|
-
if (this.isTruncated && this.content.length >= this.maxSize) {
|
|
54291
|
-
return;
|
|
54292
|
-
}
|
|
54293
|
-
if (this.content.length + str.length > this.maxSize) {
|
|
54294
|
-
const remainingSpace = this.maxSize - this.content.length;
|
|
54295
|
-
if (remainingSpace > 0) {
|
|
54296
|
-
this.content += str.slice(0, remainingSpace);
|
|
54297
|
-
}
|
|
54298
|
-
this.isTruncated = true;
|
|
54299
|
-
} else {
|
|
54300
|
-
this.content += str;
|
|
54301
|
-
}
|
|
54302
|
-
}
|
|
54303
|
-
toString() {
|
|
54304
|
-
if (!this.isTruncated) {
|
|
54305
|
-
return this.content;
|
|
54306
|
-
}
|
|
54307
|
-
const truncatedBytes = this.totalBytesReceived - this.maxSize;
|
|
54308
|
-
const truncatedKB = Math.round(truncatedBytes / 1024);
|
|
54309
|
-
return this.content + `
|
|
54310
|
-
... [output truncated - ${truncatedKB}KB removed]`;
|
|
54311
|
-
}
|
|
54312
|
-
clear() {
|
|
54313
|
-
this.content = "";
|
|
54314
|
-
this.isTruncated = false;
|
|
54315
|
-
this.totalBytesReceived = 0;
|
|
54316
|
-
}
|
|
54317
|
-
get length() {
|
|
54318
|
-
return this.content.length;
|
|
54319
|
-
}
|
|
54320
|
-
get truncated() {
|
|
54321
|
-
return this.isTruncated;
|
|
54322
|
-
}
|
|
54323
|
-
get totalBytes() {
|
|
54324
|
-
return this.totalBytesReceived;
|
|
54325
|
-
}
|
|
54326
|
-
}
|
|
54327
|
-
function truncateToLines(text, maxLines) {
|
|
54328
|
-
const lines = text.split(`
|
|
54329
|
-
`);
|
|
54330
|
-
if (lines.length <= maxLines) {
|
|
54331
|
-
return text;
|
|
54332
|
-
}
|
|
54333
|
-
return lines.slice(0, maxLines).join(`
|
|
54334
|
-
`) + "\u2026";
|
|
54335
|
-
}
|
|
54336
|
-
var MAX_STRING_LENGTH;
|
|
54337
|
-
var init_stringUtils = __esm(() => {
|
|
54338
|
-
MAX_STRING_LENGTH = 2 ** 25;
|
|
54339
|
-
});
|
|
54340
|
-
|
|
54341
53705
|
// src/utils/model/ollamaRouter.ts
|
|
54342
53706
|
function parseModelParamsB(name) {
|
|
54343
53707
|
const lower = name.toLowerCase();
|
|
@@ -54567,472 +53931,6 @@ var init_ollamaModels = __esm(() => {
|
|
|
54567
53931
|
cachedOllamaModelNames = [];
|
|
54568
53932
|
});
|
|
54569
53933
|
|
|
54570
|
-
// src/utils/model/model.ts
|
|
54571
|
-
var exports_model = {};
|
|
54572
|
-
__export(exports_model, {
|
|
54573
|
-
resolveSkillModelOverride: () => resolveSkillModelOverride,
|
|
54574
|
-
renderModelSetting: () => renderModelSetting,
|
|
54575
|
-
renderModelName: () => renderModelName,
|
|
54576
|
-
renderDefaultModelSetting: () => renderDefaultModelSetting,
|
|
54577
|
-
parseUserSpecifiedModel: () => parseUserSpecifiedModel,
|
|
54578
|
-
normalizeModelStringForAPI: () => normalizeModelStringForAPI,
|
|
54579
|
-
modelDisplayString: () => modelDisplayString,
|
|
54580
|
-
ismodelO1mMergeEnabled: () => ismodelO1mMergeEnabled,
|
|
54581
|
-
isNonCustommodelOModel: () => isNonCustommodelOModel,
|
|
54582
|
-
isLegacyModelRemapEnabled: () => isLegacyModelRemapEnabled,
|
|
54583
|
-
getmodelO46PricingSuffix: () => getmodelO46PricingSuffix,
|
|
54584
|
-
getUserSpecifiedModelSetting: () => getUserSpecifiedModelSetting,
|
|
54585
|
-
getURAiUserDefaultModelDescription: () => getURAiUserDefaultModelDescription,
|
|
54586
|
-
getSmallFastModel: () => getSmallFastModel,
|
|
54587
|
-
getRuntimeMainLoopModel: () => getRuntimeMainLoopModel,
|
|
54588
|
-
getPublicModelName: () => getPublicModelName,
|
|
54589
|
-
getPublicModelDisplayName: () => getPublicModelDisplayName,
|
|
54590
|
-
getMarketingNameForModel: () => getMarketingNameForModel,
|
|
54591
|
-
getMainLoopModel: () => getMainLoopModel,
|
|
54592
|
-
getDefaultmodelSModel: () => getDefaultmodelSModel,
|
|
54593
|
-
getDefaultmodelOModel: () => getDefaultmodelOModel,
|
|
54594
|
-
getDefaultmodelHModel: () => getDefaultmodelHModel,
|
|
54595
|
-
getDefaultOllamaModel: () => getDefaultOllamaModel,
|
|
54596
|
-
getDefaultMainLoopModelSetting: () => getDefaultMainLoopModelSetting,
|
|
54597
|
-
getDefaultMainLoopModel: () => getDefaultMainLoopModel,
|
|
54598
|
-
getCanonicalName: () => getCanonicalName,
|
|
54599
|
-
getBestModel: () => getBestModel,
|
|
54600
|
-
firstPartyNameToCanonical: () => firstPartyNameToCanonical,
|
|
54601
|
-
__resetOllamaRouteMemoForTests: () => __resetOllamaRouteMemoForTests
|
|
54602
|
-
});
|
|
54603
|
-
function __resetOllamaRouteMemoForTests() {
|
|
54604
|
-
memoizedRoutedDefaultModel = undefined;
|
|
54605
|
-
memoizedRoutedFastModel = undefined;
|
|
54606
|
-
}
|
|
54607
|
-
function getDefaultOllamaModel() {
|
|
54608
|
-
if (process.env.OLLAMA_MODEL) {
|
|
54609
|
-
return process.env.OLLAMA_MODEL;
|
|
54610
|
-
}
|
|
54611
|
-
if (isOllamaAutoRouteEnabled()) {
|
|
54612
|
-
if (memoizedRoutedDefaultModel)
|
|
54613
|
-
return memoizedRoutedDefaultModel;
|
|
54614
|
-
const routed = pickBestCoderModel(getCachedOllamaModelNames());
|
|
54615
|
-
if (routed) {
|
|
54616
|
-
memoizedRoutedDefaultModel = routed;
|
|
54617
|
-
return routed;
|
|
54618
|
-
}
|
|
54619
|
-
}
|
|
54620
|
-
return DEFAULT_OLLAMA_MODEL2;
|
|
54621
|
-
}
|
|
54622
|
-
function getSmallFastModel() {
|
|
54623
|
-
if (getAPIProvider() === "ollama") {
|
|
54624
|
-
if (process.env.OLLAMA_SMALL_FAST_MODEL) {
|
|
54625
|
-
return process.env.OLLAMA_SMALL_FAST_MODEL;
|
|
54626
|
-
}
|
|
54627
|
-
if (isOllamaAutoRouteEnabled()) {
|
|
54628
|
-
if (memoizedRoutedFastModel)
|
|
54629
|
-
return memoizedRoutedFastModel;
|
|
54630
|
-
const routed = pickSmallFastModel(getCachedOllamaModelNames());
|
|
54631
|
-
if (routed) {
|
|
54632
|
-
memoizedRoutedFastModel = routed;
|
|
54633
|
-
return routed;
|
|
54634
|
-
}
|
|
54635
|
-
}
|
|
54636
|
-
return getDefaultOllamaModel();
|
|
54637
|
-
}
|
|
54638
|
-
return process.env.URHQ_SMALL_FAST_MODEL || getDefaultmodelHModel();
|
|
54639
|
-
}
|
|
54640
|
-
function isNonCustommodelOModel(model) {
|
|
54641
|
-
return model === getModelStrings2().modelO40 || model === getModelStrings2().modelO41 || model === getModelStrings2().modelO45 || model === getModelStrings2().modelO46;
|
|
54642
|
-
}
|
|
54643
|
-
function getUserSpecifiedModelSetting() {
|
|
54644
|
-
let specifiedModel;
|
|
54645
|
-
const modelOverride = getMainLoopModelOverride();
|
|
54646
|
-
if (modelOverride !== undefined) {
|
|
54647
|
-
specifiedModel = modelOverride;
|
|
54648
|
-
} else {
|
|
54649
|
-
const settings = getSettings_DEPRECATED() || {};
|
|
54650
|
-
specifiedModel = process.env.URHQ_MODEL || settings.model || undefined;
|
|
54651
|
-
}
|
|
54652
|
-
if (specifiedModel && !isModelAllowed(specifiedModel)) {
|
|
54653
|
-
return;
|
|
54654
|
-
}
|
|
54655
|
-
return specifiedModel;
|
|
54656
|
-
}
|
|
54657
|
-
function getMainLoopModel() {
|
|
54658
|
-
const model = getUserSpecifiedModelSetting();
|
|
54659
|
-
if (model !== undefined && model !== null) {
|
|
54660
|
-
return parseUserSpecifiedModel(model);
|
|
54661
|
-
}
|
|
54662
|
-
return getDefaultMainLoopModel();
|
|
54663
|
-
}
|
|
54664
|
-
function getBestModel() {
|
|
54665
|
-
return getDefaultmodelOModel();
|
|
54666
|
-
}
|
|
54667
|
-
function getDefaultmodelOModel() {
|
|
54668
|
-
if (getAPIProvider() === "ollama") {
|
|
54669
|
-
return getDefaultOllamaModel();
|
|
54670
|
-
}
|
|
54671
|
-
if (process.env.URHQ_DEFAULT_MODELO_MODEL) {
|
|
54672
|
-
return process.env.URHQ_DEFAULT_MODELO_MODEL;
|
|
54673
|
-
}
|
|
54674
|
-
if (getAPIProvider() !== "firstParty") {
|
|
54675
|
-
return getModelStrings2().modelO46;
|
|
54676
|
-
}
|
|
54677
|
-
return getModelStrings2().modelO46;
|
|
54678
|
-
}
|
|
54679
|
-
function getDefaultmodelSModel() {
|
|
54680
|
-
if (getAPIProvider() === "ollama") {
|
|
54681
|
-
return getDefaultOllamaModel();
|
|
54682
|
-
}
|
|
54683
|
-
if (process.env.URHQ_DEFAULT_MODELS_MODEL) {
|
|
54684
|
-
return process.env.URHQ_DEFAULT_MODELS_MODEL;
|
|
54685
|
-
}
|
|
54686
|
-
if (getAPIProvider() !== "firstParty") {
|
|
54687
|
-
return getModelStrings2().modelS45;
|
|
54688
|
-
}
|
|
54689
|
-
return getModelStrings2().modelS46;
|
|
54690
|
-
}
|
|
54691
|
-
function getDefaultmodelHModel() {
|
|
54692
|
-
if (getAPIProvider() === "ollama") {
|
|
54693
|
-
return process.env.OLLAMA_SMALL_FAST_MODEL || getDefaultOllamaModel();
|
|
54694
|
-
}
|
|
54695
|
-
if (process.env.URHQ_DEFAULT_MODELH_MODEL) {
|
|
54696
|
-
return process.env.URHQ_DEFAULT_MODELH_MODEL;
|
|
54697
|
-
}
|
|
54698
|
-
return getModelStrings2().modelH45;
|
|
54699
|
-
}
|
|
54700
|
-
function getRuntimeMainLoopModel(params) {
|
|
54701
|
-
const { permissionMode, mainLoopModel, exceeds200kTokens = false } = params;
|
|
54702
|
-
if (getUserSpecifiedModelSetting() === "modelOplan" && permissionMode === "plan" && !exceeds200kTokens) {
|
|
54703
|
-
return getDefaultmodelOModel();
|
|
54704
|
-
}
|
|
54705
|
-
if (getUserSpecifiedModelSetting() === "modelH" && permissionMode === "plan") {
|
|
54706
|
-
return getDefaultmodelSModel();
|
|
54707
|
-
}
|
|
54708
|
-
return mainLoopModel;
|
|
54709
|
-
}
|
|
54710
|
-
function getDefaultMainLoopModelSetting() {
|
|
54711
|
-
const settings = getSettings_DEPRECATED() || {};
|
|
54712
|
-
const activeProvider = getActiveProviderSettings(settings).active ?? "ollama";
|
|
54713
|
-
if (activeProvider !== "ollama") {
|
|
54714
|
-
const providerDefault = getDefaultModelForProvider(activeProvider);
|
|
54715
|
-
if (providerDefault) {
|
|
54716
|
-
return providerDefault;
|
|
54717
|
-
}
|
|
54718
|
-
}
|
|
54719
|
-
if (getAPIProvider() === "ollama") {
|
|
54720
|
-
return getDefaultOllamaModel();
|
|
54721
|
-
}
|
|
54722
|
-
if (process.env.USER_TYPE === "ant") {
|
|
54723
|
-
return getAntModelOverrideConfig2()?.defaultModel ?? getDefaultmodelOModel() + "[1m]";
|
|
54724
|
-
}
|
|
54725
|
-
if (isMaxSubscriber()) {
|
|
54726
|
-
return getDefaultmodelOModel() + (ismodelO1mMergeEnabled() ? "[1m]" : "");
|
|
54727
|
-
}
|
|
54728
|
-
if (isTeamPremiumSubscriber()) {
|
|
54729
|
-
return getDefaultmodelOModel() + (ismodelO1mMergeEnabled() ? "[1m]" : "");
|
|
54730
|
-
}
|
|
54731
|
-
return getDefaultmodelSModel();
|
|
54732
|
-
}
|
|
54733
|
-
function getDefaultMainLoopModel() {
|
|
54734
|
-
return parseUserSpecifiedModel(getDefaultMainLoopModelSetting());
|
|
54735
|
-
}
|
|
54736
|
-
function firstPartyNameToCanonical(name) {
|
|
54737
|
-
name = name.toLowerCase();
|
|
54738
|
-
if (name.includes("ur-modelO-4-6")) {
|
|
54739
|
-
return "ur-modelO-4-6";
|
|
54740
|
-
}
|
|
54741
|
-
if (name.includes("ur-modelO-4-5")) {
|
|
54742
|
-
return "ur-modelO-4-5";
|
|
54743
|
-
}
|
|
54744
|
-
if (name.includes("ur-modelO-4-1")) {
|
|
54745
|
-
return "ur-modelO-4-1";
|
|
54746
|
-
}
|
|
54747
|
-
if (name.includes("ur-modelO-4")) {
|
|
54748
|
-
return "ur-modelO-4";
|
|
54749
|
-
}
|
|
54750
|
-
if (name.includes("ur-modelS-4-6")) {
|
|
54751
|
-
return "ur-modelS-4-6";
|
|
54752
|
-
}
|
|
54753
|
-
if (name.includes("ur-modelS-4-5")) {
|
|
54754
|
-
return "ur-modelS-4-5";
|
|
54755
|
-
}
|
|
54756
|
-
if (name.includes("ur-modelS-4")) {
|
|
54757
|
-
return "ur-modelS-4";
|
|
54758
|
-
}
|
|
54759
|
-
if (name.includes("ur-modelH-4-5")) {
|
|
54760
|
-
return "ur-modelH-4-5";
|
|
54761
|
-
}
|
|
54762
|
-
if (name.includes("ur-3-7-modelS")) {
|
|
54763
|
-
return "ur-3-7-modelS";
|
|
54764
|
-
}
|
|
54765
|
-
if (name.includes("ur-3-5-modelS")) {
|
|
54766
|
-
return "ur-3-5-modelS";
|
|
54767
|
-
}
|
|
54768
|
-
if (name.includes("ur-3-5-modelH")) {
|
|
54769
|
-
return "ur-3-5-modelH";
|
|
54770
|
-
}
|
|
54771
|
-
if (name.includes("ur-3-modelO")) {
|
|
54772
|
-
return "ur-3-modelO";
|
|
54773
|
-
}
|
|
54774
|
-
if (name.includes("ur-3-modelS")) {
|
|
54775
|
-
return "ur-3-modelS";
|
|
54776
|
-
}
|
|
54777
|
-
if (name.includes("ur-3-modelH")) {
|
|
54778
|
-
return "ur-3-modelH";
|
|
54779
|
-
}
|
|
54780
|
-
const match = name.match(/(ur-(\d+-\d+-)?\w+)/);
|
|
54781
|
-
if (match && match[1]) {
|
|
54782
|
-
return match[1];
|
|
54783
|
-
}
|
|
54784
|
-
return name;
|
|
54785
|
-
}
|
|
54786
|
-
function getCanonicalName(fullModelName) {
|
|
54787
|
-
return firstPartyNameToCanonical(resolveOverriddenModel(fullModelName));
|
|
54788
|
-
}
|
|
54789
|
-
function getURAiUserDefaultModelDescription(fastMode = false) {
|
|
54790
|
-
if (isMaxSubscriber() || isTeamPremiumSubscriber()) {
|
|
54791
|
-
if (ismodelO1mMergeEnabled()) {
|
|
54792
|
-
return `modelO 4.6 with 1M context \xB7 Most capable for complex work${fastMode ? getmodelO46PricingSuffix(true) : ""}`;
|
|
54793
|
-
}
|
|
54794
|
-
return `modelO 4.6 \xB7 Most capable for complex work${fastMode ? getmodelO46PricingSuffix(true) : ""}`;
|
|
54795
|
-
}
|
|
54796
|
-
return "modelS 4.6 \xB7 Best for everyday tasks";
|
|
54797
|
-
}
|
|
54798
|
-
function renderDefaultModelSetting(setting) {
|
|
54799
|
-
if (setting === "modelOplan") {
|
|
54800
|
-
return "modelO 4.6 in plan mode, else modelS 4.6";
|
|
54801
|
-
}
|
|
54802
|
-
return renderModelName(parseUserSpecifiedModel(setting));
|
|
54803
|
-
}
|
|
54804
|
-
function getmodelO46PricingSuffix(fastMode) {
|
|
54805
|
-
if (getAPIProvider() !== "firstParty")
|
|
54806
|
-
return "";
|
|
54807
|
-
const pricing = formatModelPricing(getmodelO46CostTier(fastMode));
|
|
54808
|
-
const fastModeIndicator = fastMode ? ` (${LIGHTNING_BOLT})` : "";
|
|
54809
|
-
return ` \xB7${fastModeIndicator} ${pricing}`;
|
|
54810
|
-
}
|
|
54811
|
-
function ismodelO1mMergeEnabled() {
|
|
54812
|
-
if (is1mContextDisabled() || isProSubscriber() || getAPIProvider() !== "firstParty") {
|
|
54813
|
-
return false;
|
|
54814
|
-
}
|
|
54815
|
-
if (isURAISubscriber2() && getSubscriptionType() === null) {
|
|
54816
|
-
return false;
|
|
54817
|
-
}
|
|
54818
|
-
return true;
|
|
54819
|
-
}
|
|
54820
|
-
function renderModelSetting(setting) {
|
|
54821
|
-
if (setting === "modelOplan") {
|
|
54822
|
-
return "modelO Plan";
|
|
54823
|
-
}
|
|
54824
|
-
if (isModelAlias(setting)) {
|
|
54825
|
-
return capitalize(setting);
|
|
54826
|
-
}
|
|
54827
|
-
return renderModelName(setting);
|
|
54828
|
-
}
|
|
54829
|
-
function getPublicModelDisplayName(model) {
|
|
54830
|
-
if (getAPIProvider() === "ollama") {
|
|
54831
|
-
return null;
|
|
54832
|
-
}
|
|
54833
|
-
switch (model) {
|
|
54834
|
-
case getModelStrings2().modelO46:
|
|
54835
|
-
return "modelO 4.6";
|
|
54836
|
-
case getModelStrings2().modelO46 + "[1m]":
|
|
54837
|
-
return "modelO 4.6 (1M context)";
|
|
54838
|
-
case getModelStrings2().modelO45:
|
|
54839
|
-
return "modelO 4.5";
|
|
54840
|
-
case getModelStrings2().modelO41:
|
|
54841
|
-
return "modelO 4.1";
|
|
54842
|
-
case getModelStrings2().modelO40:
|
|
54843
|
-
return "modelO 4";
|
|
54844
|
-
case getModelStrings2().modelS46 + "[1m]":
|
|
54845
|
-
return "modelS 4.6 (1M context)";
|
|
54846
|
-
case getModelStrings2().modelS46:
|
|
54847
|
-
return "modelS 4.6";
|
|
54848
|
-
case getModelStrings2().modelS45 + "[1m]":
|
|
54849
|
-
return "modelS 4.5 (1M context)";
|
|
54850
|
-
case getModelStrings2().modelS45:
|
|
54851
|
-
return "modelS 4.5";
|
|
54852
|
-
case getModelStrings2().modelS40:
|
|
54853
|
-
return "modelS 4";
|
|
54854
|
-
case getModelStrings2().modelS40 + "[1m]":
|
|
54855
|
-
return "modelS 4 (1M context)";
|
|
54856
|
-
case getModelStrings2().modelS37:
|
|
54857
|
-
return "modelS 3.7";
|
|
54858
|
-
case getModelStrings2().modelS35:
|
|
54859
|
-
return "modelS 3.5";
|
|
54860
|
-
case getModelStrings2().modelH45:
|
|
54861
|
-
return "modelH 4.5";
|
|
54862
|
-
case getModelStrings2().modelH35:
|
|
54863
|
-
return "modelH 3.5";
|
|
54864
|
-
default:
|
|
54865
|
-
return null;
|
|
54866
|
-
}
|
|
54867
|
-
}
|
|
54868
|
-
function maskModelCodename(baseName) {
|
|
54869
|
-
const [codename = "", ...rest] = baseName.split("-");
|
|
54870
|
-
const masked = codename.slice(0, 3) + "*".repeat(Math.max(0, codename.length - 3));
|
|
54871
|
-
return [masked, ...rest].join("-");
|
|
54872
|
-
}
|
|
54873
|
-
function renderModelName(model) {
|
|
54874
|
-
const publicName = getPublicModelDisplayName(model);
|
|
54875
|
-
if (publicName) {
|
|
54876
|
-
return publicName;
|
|
54877
|
-
}
|
|
54878
|
-
if (process.env.USER_TYPE === "ant") {
|
|
54879
|
-
const resolved = parseUserSpecifiedModel(model);
|
|
54880
|
-
const antModel = resolveAntModel2(model);
|
|
54881
|
-
if (antModel) {
|
|
54882
|
-
const baseName = antModel.model.replace(/\[1m\]$/i, "");
|
|
54883
|
-
const masked = maskModelCodename(baseName);
|
|
54884
|
-
const suffix = has1mContext(resolved) ? "[1m]" : "";
|
|
54885
|
-
return masked + suffix;
|
|
54886
|
-
}
|
|
54887
|
-
if (resolved !== model) {
|
|
54888
|
-
return `${model} (${resolved})`;
|
|
54889
|
-
}
|
|
54890
|
-
return resolved;
|
|
54891
|
-
}
|
|
54892
|
-
return model;
|
|
54893
|
-
}
|
|
54894
|
-
function getPublicModelName(model) {
|
|
54895
|
-
if (getAPIProvider() === "ollama") {
|
|
54896
|
-
return `Ollama (${model})`;
|
|
54897
|
-
}
|
|
54898
|
-
const publicName = getPublicModelDisplayName(model);
|
|
54899
|
-
if (publicName) {
|
|
54900
|
-
return `UR ${publicName}`;
|
|
54901
|
-
}
|
|
54902
|
-
return `UR (${model})`;
|
|
54903
|
-
}
|
|
54904
|
-
function parseUserSpecifiedModel(modelInput) {
|
|
54905
|
-
const modelInputTrimmed = modelInput.trim();
|
|
54906
|
-
const normalizedModel = modelInputTrimmed.toLowerCase();
|
|
54907
|
-
const has1mTag = has1mContext(normalizedModel);
|
|
54908
|
-
const modelString = has1mTag ? normalizedModel.replace(/\[1m]$/i, "").trim() : normalizedModel;
|
|
54909
|
-
switch (modelString) {
|
|
54910
|
-
case "modeloplan":
|
|
54911
|
-
return getDefaultmodelSModel() + (has1mTag ? "[1m]" : "");
|
|
54912
|
-
case "models":
|
|
54913
|
-
return getDefaultmodelSModel() + (has1mTag ? "[1m]" : "");
|
|
54914
|
-
case "modelh":
|
|
54915
|
-
return getDefaultmodelHModel() + (has1mTag ? "[1m]" : "");
|
|
54916
|
-
case "modelo":
|
|
54917
|
-
return getDefaultmodelOModel() + (has1mTag ? "[1m]" : "");
|
|
54918
|
-
case "best":
|
|
54919
|
-
return getBestModel();
|
|
54920
|
-
default:
|
|
54921
|
-
}
|
|
54922
|
-
if (getAPIProvider() === "firstParty" && isLegacymodelOFirstParty(modelString) && isLegacyModelRemapEnabled()) {
|
|
54923
|
-
return getDefaultmodelOModel() + (has1mTag ? "[1m]" : "");
|
|
54924
|
-
}
|
|
54925
|
-
if (process.env.USER_TYPE === "ant") {
|
|
54926
|
-
const has1mAntTag = has1mContext(normalizedModel);
|
|
54927
|
-
const baseAntModel = normalizedModel.replace(/\[1m]$/i, "").trim();
|
|
54928
|
-
const antModel = resolveAntModel2(baseAntModel);
|
|
54929
|
-
if (antModel) {
|
|
54930
|
-
const suffix = has1mAntTag ? "[1m]" : "";
|
|
54931
|
-
return antModel.model + suffix;
|
|
54932
|
-
}
|
|
54933
|
-
}
|
|
54934
|
-
if (has1mTag) {
|
|
54935
|
-
return modelInputTrimmed.replace(/\[1m\]$/i, "").trim() + "[1m]";
|
|
54936
|
-
}
|
|
54937
|
-
return modelInputTrimmed;
|
|
54938
|
-
}
|
|
54939
|
-
function resolveSkillModelOverride(skillModel, currentModel) {
|
|
54940
|
-
if (has1mContext(skillModel) || !has1mContext(currentModel)) {
|
|
54941
|
-
return skillModel;
|
|
54942
|
-
}
|
|
54943
|
-
if (modelSupports1M(parseUserSpecifiedModel(skillModel))) {
|
|
54944
|
-
return skillModel + "[1m]";
|
|
54945
|
-
}
|
|
54946
|
-
return skillModel;
|
|
54947
|
-
}
|
|
54948
|
-
function isLegacymodelOFirstParty(model) {
|
|
54949
|
-
return LEGACY_MODELO_FIRSTPARTY.includes(model);
|
|
54950
|
-
}
|
|
54951
|
-
function isLegacyModelRemapEnabled() {
|
|
54952
|
-
return !isEnvTruthy(process.env.UR_CODE_DISABLE_LEGACY_MODEL_REMAP);
|
|
54953
|
-
}
|
|
54954
|
-
function modelDisplayString(model) {
|
|
54955
|
-
if (model === null) {
|
|
54956
|
-
if (process.env.USER_TYPE === "ant") {
|
|
54957
|
-
return `Default for Ants (${renderDefaultModelSetting(getDefaultMainLoopModelSetting())})`;
|
|
54958
|
-
} else if (isURAISubscriber2()) {
|
|
54959
|
-
return `Default (${getURAiUserDefaultModelDescription()})`;
|
|
54960
|
-
}
|
|
54961
|
-
return `Default (${getDefaultMainLoopModel()})`;
|
|
54962
|
-
}
|
|
54963
|
-
const resolvedModel = parseUserSpecifiedModel(model);
|
|
54964
|
-
return model === resolvedModel ? resolvedModel : `${model} (${resolvedModel})`;
|
|
54965
|
-
}
|
|
54966
|
-
function getMarketingNameForModel(modelId) {
|
|
54967
|
-
if (getAPIProvider() === "foundry" || getAPIProvider() === "ollama") {
|
|
54968
|
-
return;
|
|
54969
|
-
}
|
|
54970
|
-
const has1m = modelId.toLowerCase().includes("[1m]");
|
|
54971
|
-
const canonical = getCanonicalName(modelId);
|
|
54972
|
-
if (canonical.includes("ur-modelO-4-6")) {
|
|
54973
|
-
return has1m ? "modelO 4.6 (with 1M context)" : "modelO 4.6";
|
|
54974
|
-
}
|
|
54975
|
-
if (canonical.includes("ur-modelO-4-5")) {
|
|
54976
|
-
return "modelO 4.5";
|
|
54977
|
-
}
|
|
54978
|
-
if (canonical.includes("ur-modelO-4-1")) {
|
|
54979
|
-
return "modelO 4.1";
|
|
54980
|
-
}
|
|
54981
|
-
if (canonical.includes("ur-modelO-4")) {
|
|
54982
|
-
return "modelO 4";
|
|
54983
|
-
}
|
|
54984
|
-
if (canonical.includes("ur-modelS-4-6")) {
|
|
54985
|
-
return has1m ? "modelS 4.6 (with 1M context)" : "modelS 4.6";
|
|
54986
|
-
}
|
|
54987
|
-
if (canonical.includes("ur-modelS-4-5")) {
|
|
54988
|
-
return has1m ? "modelS 4.5 (with 1M context)" : "modelS 4.5";
|
|
54989
|
-
}
|
|
54990
|
-
if (canonical.includes("ur-modelS-4")) {
|
|
54991
|
-
return has1m ? "modelS 4 (with 1M context)" : "modelS 4";
|
|
54992
|
-
}
|
|
54993
|
-
if (canonical.includes("ur-3-7-modelS")) {
|
|
54994
|
-
return "UR 3.7 modelS";
|
|
54995
|
-
}
|
|
54996
|
-
if (canonical.includes("ur-3-5-modelS")) {
|
|
54997
|
-
return "UR 3.5 modelS";
|
|
54998
|
-
}
|
|
54999
|
-
if (canonical.includes("ur-modelH-4-5")) {
|
|
55000
|
-
return "modelH 4.5";
|
|
55001
|
-
}
|
|
55002
|
-
if (canonical.includes("ur-3-5-modelH")) {
|
|
55003
|
-
return "UR 3.5 modelH";
|
|
55004
|
-
}
|
|
55005
|
-
return;
|
|
55006
|
-
}
|
|
55007
|
-
function normalizeModelStringForAPI(model) {
|
|
55008
|
-
return model.replace(/\[(1|2)m\]/gi, "");
|
|
55009
|
-
}
|
|
55010
|
-
var DEFAULT_OLLAMA_MODEL2 = "qwen3-coder:480b-cloud", memoizedRoutedDefaultModel, memoizedRoutedFastModel, LEGACY_MODELO_FIRSTPARTY;
|
|
55011
|
-
var init_model = __esm(() => {
|
|
55012
|
-
init_state();
|
|
55013
|
-
init_auth();
|
|
55014
|
-
init_context();
|
|
55015
|
-
init_envUtils();
|
|
55016
|
-
init_modelStrings();
|
|
55017
|
-
init_modelCost();
|
|
55018
|
-
init_settings2();
|
|
55019
|
-
init_providers();
|
|
55020
|
-
init_figures2();
|
|
55021
|
-
init_modelAllowlist();
|
|
55022
|
-
init_aliases();
|
|
55023
|
-
init_stringUtils();
|
|
55024
|
-
init_antModels();
|
|
55025
|
-
init_ollamaModels();
|
|
55026
|
-
init_ollamaRouter();
|
|
55027
|
-
init_providerRegistry();
|
|
55028
|
-
LEGACY_MODELO_FIRSTPARTY = [
|
|
55029
|
-
"ur-modelO-4-20250514",
|
|
55030
|
-
"ur-modelO-4-1-20250805",
|
|
55031
|
-
"ur-modelO-4-0",
|
|
55032
|
-
"ur-modelO-4-1"
|
|
55033
|
-
];
|
|
55034
|
-
});
|
|
55035
|
-
|
|
55036
53934
|
// src/utils/model/ollamaTuning.ts
|
|
55037
53935
|
function computeOllamaNumCtx(input) {
|
|
55038
53936
|
const {
|
|
@@ -57038,7 +55936,7 @@ function messagesToPrompt(params) {
|
|
|
57038
55936
|
const text = contentToText2(message.content);
|
|
57039
55937
|
if (!text)
|
|
57040
55938
|
continue;
|
|
57041
|
-
parts.push(label ? `${
|
|
55939
|
+
parts.push(label ? `${capitalize(message.role)}: ${text}` : text);
|
|
57042
55940
|
}
|
|
57043
55941
|
return parts.join(`
|
|
57044
55942
|
|
|
@@ -57085,7 +55983,7 @@ function contentToText2(content) {
|
|
|
57085
55983
|
}).join(`
|
|
57086
55984
|
`);
|
|
57087
55985
|
}
|
|
57088
|
-
function
|
|
55986
|
+
function capitalize(value) {
|
|
57089
55987
|
return value ? value[0].toUpperCase() + value.slice(1) : value;
|
|
57090
55988
|
}
|
|
57091
55989
|
function estimateTokens(text) {
|
|
@@ -57792,8 +56690,8 @@ function modelSupports1M(model) {
|
|
|
57792
56690
|
if (getAPIProvider() === "ollama") {
|
|
57793
56691
|
return false;
|
|
57794
56692
|
}
|
|
57795
|
-
const
|
|
57796
|
-
return
|
|
56693
|
+
const cap = getModelCapability(model);
|
|
56694
|
+
return Boolean(cap?.max_input_tokens && cap.max_input_tokens >= 1e6);
|
|
57797
56695
|
}
|
|
57798
56696
|
function getContextWindowForModel(model, betas, apiProvider = getAPIProvider()) {
|
|
57799
56697
|
if (apiProvider === "ollama") {
|
|
@@ -57843,10 +56741,7 @@ function getmodelS1mExpTreatmentEnabled(model) {
|
|
|
57843
56741
|
if (has1mContext(model)) {
|
|
57844
56742
|
return false;
|
|
57845
56743
|
}
|
|
57846
|
-
|
|
57847
|
-
return false;
|
|
57848
|
-
}
|
|
57849
|
-
return getGlobalConfig().clientDataCache?.["coral_reef_modelS"] === "true";
|
|
56744
|
+
return false;
|
|
57850
56745
|
}
|
|
57851
56746
|
function calculateContextPercentages(currentUsage, contextWindowSize) {
|
|
57852
56747
|
if (!currentUsage) {
|
|
@@ -57861,8 +56756,8 @@ function calculateContextPercentages(currentUsage, contextWindowSize) {
|
|
|
57861
56756
|
};
|
|
57862
56757
|
}
|
|
57863
56758
|
function getModelMaxOutputTokens(model) {
|
|
57864
|
-
let defaultTokens;
|
|
57865
|
-
let upperLimit;
|
|
56759
|
+
let defaultTokens = MAX_OUTPUT_TOKENS_DEFAULT;
|
|
56760
|
+
let upperLimit = MAX_OUTPUT_TOKENS_UPPER_LIMIT;
|
|
57866
56761
|
if (process.env.USER_TYPE === "ant") {
|
|
57867
56762
|
const antModel = resolveAntModel2(model.toLowerCase());
|
|
57868
56763
|
if (antModel) {
|
|
@@ -57871,38 +56766,6 @@ function getModelMaxOutputTokens(model) {
|
|
|
57871
56766
|
return { default: defaultTokens, upperLimit };
|
|
57872
56767
|
}
|
|
57873
56768
|
}
|
|
57874
|
-
const m = getCanonicalName(model);
|
|
57875
|
-
if (m.includes("modelO-4-6")) {
|
|
57876
|
-
defaultTokens = 64000;
|
|
57877
|
-
upperLimit = 128000;
|
|
57878
|
-
} else if (m.includes("modelS-4-6")) {
|
|
57879
|
-
defaultTokens = 32000;
|
|
57880
|
-
upperLimit = 128000;
|
|
57881
|
-
} else if (m.includes("modelO-4-5") || m.includes("modelS-4") || m.includes("modelH-4")) {
|
|
57882
|
-
defaultTokens = 32000;
|
|
57883
|
-
upperLimit = 64000;
|
|
57884
|
-
} else if (m.includes("modelO-4-1") || m.includes("modelO-4")) {
|
|
57885
|
-
defaultTokens = 32000;
|
|
57886
|
-
upperLimit = 32000;
|
|
57887
|
-
} else if (m.includes("ur-3-modelO")) {
|
|
57888
|
-
defaultTokens = 4096;
|
|
57889
|
-
upperLimit = 4096;
|
|
57890
|
-
} else if (m.includes("ur-3-modelS")) {
|
|
57891
|
-
defaultTokens = 8192;
|
|
57892
|
-
upperLimit = 8192;
|
|
57893
|
-
} else if (m.includes("ur-3-modelH")) {
|
|
57894
|
-
defaultTokens = 4096;
|
|
57895
|
-
upperLimit = 4096;
|
|
57896
|
-
} else if (m.includes("3-5-modelS") || m.includes("3-5-modelH")) {
|
|
57897
|
-
defaultTokens = 8192;
|
|
57898
|
-
upperLimit = 8192;
|
|
57899
|
-
} else if (m.includes("3-7-modelS")) {
|
|
57900
|
-
defaultTokens = 32000;
|
|
57901
|
-
upperLimit = 64000;
|
|
57902
|
-
} else {
|
|
57903
|
-
defaultTokens = MAX_OUTPUT_TOKENS_DEFAULT;
|
|
57904
|
-
upperLimit = MAX_OUTPUT_TOKENS_UPPER_LIMIT;
|
|
57905
|
-
}
|
|
57906
56769
|
const cap = getModelCapability(model);
|
|
57907
56770
|
if (cap?.max_tokens && cap.max_tokens >= 4096) {
|
|
57908
56771
|
upperLimit = cap.max_tokens;
|
|
@@ -57916,15 +56779,1061 @@ function getMaxThinkingTokensForModel(model) {
|
|
|
57916
56779
|
var MODEL_CONTEXT_WINDOW_DEFAULT = 200000, COMPACT_MAX_OUTPUT_TOKENS = 20000, MAX_OUTPUT_TOKENS_DEFAULT = 32000, MAX_OUTPUT_TOKENS_UPPER_LIMIT = 64000, CAPPED_DEFAULT_MAX_TOKENS = 8000, ESCALATED_MAX_TOKENS = 64000;
|
|
57917
56780
|
var init_context = __esm(() => {
|
|
57918
56781
|
init_betas();
|
|
57919
|
-
init_config();
|
|
57920
56782
|
init_envUtils();
|
|
57921
56783
|
init_antModels();
|
|
57922
|
-
init_model();
|
|
57923
56784
|
init_modelCapabilities();
|
|
57924
56785
|
init_ollamaModels();
|
|
57925
56786
|
init_providers();
|
|
57926
56787
|
});
|
|
57927
56788
|
|
|
56789
|
+
// src/utils/fastMode.ts
|
|
56790
|
+
function isFastModeEnabled() {
|
|
56791
|
+
return !isEnvTruthy(process.env.UR_CODE_DISABLE_FAST_MODE);
|
|
56792
|
+
}
|
|
56793
|
+
function isFastModeAvailable() {
|
|
56794
|
+
if (!isFastModeEnabled()) {
|
|
56795
|
+
return false;
|
|
56796
|
+
}
|
|
56797
|
+
return getFastModeUnavailableReason() === null;
|
|
56798
|
+
}
|
|
56799
|
+
function getDisabledReasonMessage(disabledReason, authType) {
|
|
56800
|
+
switch (disabledReason) {
|
|
56801
|
+
case "free":
|
|
56802
|
+
return authType === "oauth" ? "Fast mode requires a paid subscription" : "Fast mode unavailable during evaluation. Please purchase credits.";
|
|
56803
|
+
case "preference":
|
|
56804
|
+
return "Fast mode has been disabled by your organization";
|
|
56805
|
+
case "extra_usage_disabled":
|
|
56806
|
+
return "Fast mode requires extra usage billing \xB7 /extra-usage to enable";
|
|
56807
|
+
case "network_error":
|
|
56808
|
+
return "Fast mode unavailable due to network connectivity issues";
|
|
56809
|
+
case "unknown":
|
|
56810
|
+
return "Fast mode is currently unavailable";
|
|
56811
|
+
}
|
|
56812
|
+
}
|
|
56813
|
+
function getFastModeUnavailableReason() {
|
|
56814
|
+
if (!isFastModeEnabled()) {
|
|
56815
|
+
return "Fast mode is not available";
|
|
56816
|
+
}
|
|
56817
|
+
const statigReason = getFeatureValue_CACHED_MAY_BE_STALE("tengu_penguins_off", null);
|
|
56818
|
+
if (statigReason !== null) {
|
|
56819
|
+
logForDebugging(`Fast mode unavailable: ${statigReason}`);
|
|
56820
|
+
return statigReason;
|
|
56821
|
+
}
|
|
56822
|
+
if (!isInBundledMode() && getFeatureValue_CACHED_MAY_BE_STALE("tengu_marble_sandcastle", false)) {
|
|
56823
|
+
return "Fast mode requires the native binary \xB7 Install from: https://ur.com/product/ur";
|
|
56824
|
+
}
|
|
56825
|
+
if (getIsNonInteractiveSession() && preferThirdPartyAuthentication() && !getKairosActive()) {
|
|
56826
|
+
const flagFastMode = getSettingsForSource("flagSettings")?.fastMode;
|
|
56827
|
+
if (!flagFastMode) {
|
|
56828
|
+
const reason = "Fast mode is not available in the Agent SDK";
|
|
56829
|
+
logForDebugging(`Fast mode unavailable: ${reason}`);
|
|
56830
|
+
return reason;
|
|
56831
|
+
}
|
|
56832
|
+
}
|
|
56833
|
+
if (getAPIProvider() !== "firstParty") {
|
|
56834
|
+
const reason = "Fast mode is not available on Bedrock, Vertex, or Foundry";
|
|
56835
|
+
logForDebugging(`Fast mode unavailable: ${reason}`);
|
|
56836
|
+
return reason;
|
|
56837
|
+
}
|
|
56838
|
+
if (orgStatus.status === "disabled") {
|
|
56839
|
+
if (orgStatus.reason === "network_error" || orgStatus.reason === "unknown") {
|
|
56840
|
+
if (isEnvTruthy(process.env.UR_CODE_SKIP_FAST_MODE_NETWORK_ERRORS)) {
|
|
56841
|
+
return null;
|
|
56842
|
+
}
|
|
56843
|
+
}
|
|
56844
|
+
const authType = getURAIOAuthTokens() !== null ? "oauth" : "api-key";
|
|
56845
|
+
const reason = getDisabledReasonMessage(orgStatus.reason, authType);
|
|
56846
|
+
logForDebugging(`Fast mode unavailable: ${reason}`);
|
|
56847
|
+
return reason;
|
|
56848
|
+
}
|
|
56849
|
+
return null;
|
|
56850
|
+
}
|
|
56851
|
+
function getFastModeModel() {
|
|
56852
|
+
return "modelO" + (ismodelO1mMergeEnabled() ? "[1m]" : "");
|
|
56853
|
+
}
|
|
56854
|
+
function getInitialFastModeSetting(model) {
|
|
56855
|
+
if (!isFastModeEnabled()) {
|
|
56856
|
+
return false;
|
|
56857
|
+
}
|
|
56858
|
+
if (!isFastModeAvailable()) {
|
|
56859
|
+
return false;
|
|
56860
|
+
}
|
|
56861
|
+
if (!isFastModeSupportedByModel(model)) {
|
|
56862
|
+
return false;
|
|
56863
|
+
}
|
|
56864
|
+
const settings = getInitialSettings();
|
|
56865
|
+
if (settings.fastModePerSessionOptIn) {
|
|
56866
|
+
return false;
|
|
56867
|
+
}
|
|
56868
|
+
return settings.fastMode === true;
|
|
56869
|
+
}
|
|
56870
|
+
function isFastModeSupportedByModel(modelSetting) {
|
|
56871
|
+
if (!isFastModeEnabled()) {
|
|
56872
|
+
return false;
|
|
56873
|
+
}
|
|
56874
|
+
return false;
|
|
56875
|
+
}
|
|
56876
|
+
function getFastModeRuntimeState() {
|
|
56877
|
+
if (runtimeState.status === "cooldown" && Date.now() >= runtimeState.resetAt) {
|
|
56878
|
+
if (isFastModeEnabled() && !hasLoggedCooldownExpiry) {
|
|
56879
|
+
logForDebugging("Fast mode cooldown expired, re-enabling fast mode");
|
|
56880
|
+
hasLoggedCooldownExpiry = true;
|
|
56881
|
+
cooldownExpired.emit();
|
|
56882
|
+
}
|
|
56883
|
+
runtimeState = { status: "active" };
|
|
56884
|
+
}
|
|
56885
|
+
return runtimeState;
|
|
56886
|
+
}
|
|
56887
|
+
function triggerFastModeCooldown(resetTimestamp, reason) {
|
|
56888
|
+
if (!isFastModeEnabled()) {
|
|
56889
|
+
return;
|
|
56890
|
+
}
|
|
56891
|
+
runtimeState = { status: "cooldown", resetAt: resetTimestamp, reason };
|
|
56892
|
+
hasLoggedCooldownExpiry = false;
|
|
56893
|
+
const cooldownDurationMs = resetTimestamp - Date.now();
|
|
56894
|
+
logForDebugging(`Fast mode cooldown triggered (${reason}), duration ${Math.round(cooldownDurationMs / 1000)}s`);
|
|
56895
|
+
logEvent("tengu_fast_mode_fallback_triggered", {
|
|
56896
|
+
cooldown_duration_ms: cooldownDurationMs,
|
|
56897
|
+
cooldown_reason: reason
|
|
56898
|
+
});
|
|
56899
|
+
cooldownTriggered.emit(resetTimestamp, reason);
|
|
56900
|
+
}
|
|
56901
|
+
function clearFastModeCooldown() {
|
|
56902
|
+
runtimeState = { status: "active" };
|
|
56903
|
+
}
|
|
56904
|
+
function handleFastModeRejectedByAPI() {
|
|
56905
|
+
if (orgStatus.status === "disabled") {
|
|
56906
|
+
return;
|
|
56907
|
+
}
|
|
56908
|
+
orgStatus = { status: "disabled", reason: "preference" };
|
|
56909
|
+
updateSettingsForSource("userSettings", { fastMode: undefined });
|
|
56910
|
+
saveGlobalConfig((current) => ({
|
|
56911
|
+
...current,
|
|
56912
|
+
penguinModeOrgEnabled: false
|
|
56913
|
+
}));
|
|
56914
|
+
orgFastModeChange.emit(false);
|
|
56915
|
+
}
|
|
56916
|
+
function getOverageDisabledMessage(reason) {
|
|
56917
|
+
switch (reason) {
|
|
56918
|
+
case "out_of_credits":
|
|
56919
|
+
return "Fast mode disabled \xB7 extra usage credits exhausted";
|
|
56920
|
+
case "org_level_disabled":
|
|
56921
|
+
case "org_service_level_disabled":
|
|
56922
|
+
return "Fast mode disabled \xB7 extra usage disabled by your organization";
|
|
56923
|
+
case "org_level_disabled_until":
|
|
56924
|
+
return "Fast mode disabled \xB7 extra usage spending cap reached";
|
|
56925
|
+
case "member_level_disabled":
|
|
56926
|
+
return "Fast mode disabled \xB7 extra usage disabled for your account";
|
|
56927
|
+
case "seat_tier_level_disabled":
|
|
56928
|
+
case "seat_tier_zero_credit_limit":
|
|
56929
|
+
case "member_zero_credit_limit":
|
|
56930
|
+
return "Fast mode disabled \xB7 extra usage not available for your plan";
|
|
56931
|
+
case "overage_not_provisioned":
|
|
56932
|
+
case "no_limits_configured":
|
|
56933
|
+
return "Fast mode requires extra usage billing \xB7 /extra-usage to enable";
|
|
56934
|
+
default:
|
|
56935
|
+
return "Fast mode disabled \xB7 extra usage not available";
|
|
56936
|
+
}
|
|
56937
|
+
}
|
|
56938
|
+
function isOutOfCreditsReason(reason) {
|
|
56939
|
+
return reason === "org_level_disabled_until" || reason === "out_of_credits";
|
|
56940
|
+
}
|
|
56941
|
+
function handleFastModeOverageRejection(reason) {
|
|
56942
|
+
const message = getOverageDisabledMessage(reason);
|
|
56943
|
+
logForDebugging(`Fast mode overage rejection: ${reason ?? "unknown"} \u2014 ${message}`);
|
|
56944
|
+
logEvent("tengu_fast_mode_overage_rejected", {
|
|
56945
|
+
overage_disabled_reason: reason ?? "unknown"
|
|
56946
|
+
});
|
|
56947
|
+
if (!isOutOfCreditsReason(reason)) {
|
|
56948
|
+
updateSettingsForSource("userSettings", { fastMode: undefined });
|
|
56949
|
+
saveGlobalConfig((current) => ({
|
|
56950
|
+
...current,
|
|
56951
|
+
penguinModeOrgEnabled: false
|
|
56952
|
+
}));
|
|
56953
|
+
}
|
|
56954
|
+
overageRejection.emit(message);
|
|
56955
|
+
}
|
|
56956
|
+
function isFastModeCooldown() {
|
|
56957
|
+
return getFastModeRuntimeState().status === "cooldown";
|
|
56958
|
+
}
|
|
56959
|
+
function getFastModeState(model, fastModeUserEnabled) {
|
|
56960
|
+
const enabled = isFastModeEnabled() && isFastModeAvailable() && !!fastModeUserEnabled && isFastModeSupportedByModel(model);
|
|
56961
|
+
if (enabled && isFastModeCooldown()) {
|
|
56962
|
+
return "cooldown";
|
|
56963
|
+
}
|
|
56964
|
+
if (enabled) {
|
|
56965
|
+
return "on";
|
|
56966
|
+
}
|
|
56967
|
+
return "off";
|
|
56968
|
+
}
|
|
56969
|
+
async function fetchFastModeStatus(auth) {
|
|
56970
|
+
const endpoint = `${getOauthConfig().BASE_API_URL}/api/ur_penguin_mode`;
|
|
56971
|
+
const headers = "accessToken" in auth ? {
|
|
56972
|
+
Authorization: `Bearer ${auth.accessToken}`,
|
|
56973
|
+
"urhq-beta": OAUTH_BETA_HEADER
|
|
56974
|
+
} : { "x-api-key": auth.apiKey };
|
|
56975
|
+
const response = await axios_default.get(endpoint, { headers });
|
|
56976
|
+
return response.data;
|
|
56977
|
+
}
|
|
56978
|
+
function resolveFastModeStatusFromCache() {
|
|
56979
|
+
if (!isFastModeEnabled()) {
|
|
56980
|
+
return;
|
|
56981
|
+
}
|
|
56982
|
+
if (orgStatus.status !== "pending") {
|
|
56983
|
+
return;
|
|
56984
|
+
}
|
|
56985
|
+
const isAnt = process.env.USER_TYPE === "ant";
|
|
56986
|
+
const cachedEnabled = getGlobalConfig().penguinModeOrgEnabled === true;
|
|
56987
|
+
orgStatus = isAnt || cachedEnabled ? { status: "enabled" } : { status: "disabled", reason: "unknown" };
|
|
56988
|
+
}
|
|
56989
|
+
async function prefetchFastModeStatus() {
|
|
56990
|
+
if (isEssentialTrafficOnly()) {
|
|
56991
|
+
return;
|
|
56992
|
+
}
|
|
56993
|
+
if (!isFastModeEnabled()) {
|
|
56994
|
+
return;
|
|
56995
|
+
}
|
|
56996
|
+
if (inflightPrefetch) {
|
|
56997
|
+
logForDebugging("Fast mode prefetch in progress, returning in-flight promise");
|
|
56998
|
+
return inflightPrefetch;
|
|
56999
|
+
}
|
|
57000
|
+
const apiKey = getURHQApiKey();
|
|
57001
|
+
const hasUsableOAuth = getURAIOAuthTokens()?.accessToken && hasProfileScope();
|
|
57002
|
+
if (!hasUsableOAuth && !apiKey) {
|
|
57003
|
+
const isAnt = process.env.USER_TYPE === "ant";
|
|
57004
|
+
const cachedEnabled = getGlobalConfig().penguinModeOrgEnabled === true;
|
|
57005
|
+
orgStatus = isAnt || cachedEnabled ? { status: "enabled" } : { status: "disabled", reason: "preference" };
|
|
57006
|
+
return;
|
|
57007
|
+
}
|
|
57008
|
+
const now2 = Date.now();
|
|
57009
|
+
if (now2 - lastPrefetchAt < PREFETCH_MIN_INTERVAL_MS) {
|
|
57010
|
+
logForDebugging("Skipping fast mode prefetch, fetched recently");
|
|
57011
|
+
return;
|
|
57012
|
+
}
|
|
57013
|
+
lastPrefetchAt = now2;
|
|
57014
|
+
const fetchWithCurrentAuth = async () => {
|
|
57015
|
+
const currentTokens = getURAIOAuthTokens();
|
|
57016
|
+
const auth = currentTokens?.accessToken && hasProfileScope() ? { accessToken: currentTokens.accessToken } : apiKey ? { apiKey } : null;
|
|
57017
|
+
if (!auth) {
|
|
57018
|
+
throw new Error("No auth available");
|
|
57019
|
+
}
|
|
57020
|
+
return fetchFastModeStatus(auth);
|
|
57021
|
+
};
|
|
57022
|
+
async function doFetch() {
|
|
57023
|
+
try {
|
|
57024
|
+
let status;
|
|
57025
|
+
try {
|
|
57026
|
+
status = await fetchWithCurrentAuth();
|
|
57027
|
+
} catch (err) {
|
|
57028
|
+
const isAuthError = axios_default.isAxiosError(err) && (err.response?.status === 401 || err.response?.status === 403 && typeof err.response?.data === "string" && err.response.data.includes("OAuth token has been revoked"));
|
|
57029
|
+
if (isAuthError) {
|
|
57030
|
+
const failedAccessToken = getURAIOAuthTokens()?.accessToken;
|
|
57031
|
+
if (failedAccessToken) {
|
|
57032
|
+
await handleOAuth401Error(failedAccessToken);
|
|
57033
|
+
status = await fetchWithCurrentAuth();
|
|
57034
|
+
} else {
|
|
57035
|
+
throw err;
|
|
57036
|
+
}
|
|
57037
|
+
} else {
|
|
57038
|
+
throw err;
|
|
57039
|
+
}
|
|
57040
|
+
}
|
|
57041
|
+
const previousEnabled = orgStatus.status !== "pending" ? orgStatus.status === "enabled" : getGlobalConfig().penguinModeOrgEnabled;
|
|
57042
|
+
orgStatus = status.enabled ? { status: "enabled" } : {
|
|
57043
|
+
status: "disabled",
|
|
57044
|
+
reason: status.disabled_reason ?? "preference"
|
|
57045
|
+
};
|
|
57046
|
+
if (previousEnabled !== status.enabled) {
|
|
57047
|
+
if (!status.enabled) {
|
|
57048
|
+
updateSettingsForSource("userSettings", { fastMode: undefined });
|
|
57049
|
+
}
|
|
57050
|
+
saveGlobalConfig((current) => ({
|
|
57051
|
+
...current,
|
|
57052
|
+
penguinModeOrgEnabled: status.enabled
|
|
57053
|
+
}));
|
|
57054
|
+
orgFastModeChange.emit(status.enabled);
|
|
57055
|
+
}
|
|
57056
|
+
logForDebugging(`Org fast mode: ${status.enabled ? "enabled" : `disabled (${status.disabled_reason ?? "preference"})`}`);
|
|
57057
|
+
} catch (err) {
|
|
57058
|
+
const isAnt = process.env.USER_TYPE === "ant";
|
|
57059
|
+
const cachedEnabled = getGlobalConfig().penguinModeOrgEnabled === true;
|
|
57060
|
+
orgStatus = isAnt || cachedEnabled ? { status: "enabled" } : { status: "disabled", reason: "network_error" };
|
|
57061
|
+
logForDebugging(`Failed to fetch org fast mode status, defaulting to ${orgStatus.status === "enabled" ? "enabled (cached)" : "disabled (network_error)"}: ${err}`, { level: "error" });
|
|
57062
|
+
logEvent("tengu_org_penguin_mode_fetch_failed", {});
|
|
57063
|
+
} finally {
|
|
57064
|
+
inflightPrefetch = null;
|
|
57065
|
+
}
|
|
57066
|
+
}
|
|
57067
|
+
inflightPrefetch = doFetch();
|
|
57068
|
+
return inflightPrefetch;
|
|
57069
|
+
}
|
|
57070
|
+
var FAST_MODE_MODEL_DISPLAY = "modelO 4.6", runtimeState, hasLoggedCooldownExpiry = false, cooldownTriggered, cooldownExpired, onCooldownTriggered, onCooldownExpired, overageRejection, onFastModeOverageRejection, orgStatus, orgFastModeChange, onOrgFastModeChanged, PREFETCH_MIN_INTERVAL_MS = 30000, lastPrefetchAt = 0, inflightPrefetch = null;
|
|
57071
|
+
var init_fastMode = __esm(() => {
|
|
57072
|
+
init_axios2();
|
|
57073
|
+
init_oauth();
|
|
57074
|
+
init_growthbook();
|
|
57075
|
+
init_state();
|
|
57076
|
+
init_analytics();
|
|
57077
|
+
init_auth();
|
|
57078
|
+
init_config();
|
|
57079
|
+
init_debug();
|
|
57080
|
+
init_envUtils();
|
|
57081
|
+
init_model();
|
|
57082
|
+
init_providers();
|
|
57083
|
+
init_settings2();
|
|
57084
|
+
runtimeState = { status: "active" };
|
|
57085
|
+
cooldownTriggered = createSignal();
|
|
57086
|
+
cooldownExpired = createSignal();
|
|
57087
|
+
onCooldownTriggered = cooldownTriggered.subscribe;
|
|
57088
|
+
onCooldownExpired = cooldownExpired.subscribe;
|
|
57089
|
+
overageRejection = createSignal();
|
|
57090
|
+
onFastModeOverageRejection = overageRejection.subscribe;
|
|
57091
|
+
orgStatus = { status: "pending" };
|
|
57092
|
+
orgFastModeChange = createSignal();
|
|
57093
|
+
onOrgFastModeChanged = orgFastModeChange.subscribe;
|
|
57094
|
+
});
|
|
57095
|
+
|
|
57096
|
+
// src/utils/modelCost.ts
|
|
57097
|
+
function getmodelO46CostTier(fastMode) {
|
|
57098
|
+
if (isFastModeEnabled() && fastMode) {
|
|
57099
|
+
return COST_TIER_30_150;
|
|
57100
|
+
}
|
|
57101
|
+
return COST_TIER_5_25;
|
|
57102
|
+
}
|
|
57103
|
+
function tokensToUSDCost(modelCosts, usage) {
|
|
57104
|
+
return usage.input_tokens / 1e6 * modelCosts.inputTokens + usage.output_tokens / 1e6 * modelCosts.outputTokens + (usage.cache_read_input_tokens ?? 0) / 1e6 * modelCosts.promptCacheReadTokens + (usage.cache_creation_input_tokens ?? 0) / 1e6 * modelCosts.promptCacheWriteTokens + (usage.server_tool_use?.web_search_requests ?? 0) * modelCosts.webSearchRequests;
|
|
57105
|
+
}
|
|
57106
|
+
function getModelCosts(model, usage) {
|
|
57107
|
+
const shortName = getCanonicalName(model);
|
|
57108
|
+
if (shortName === firstPartyNameToCanonical(UR_MODELO_4_6_CONFIG.firstParty)) {
|
|
57109
|
+
const isFastMode = usage.speed === "fast";
|
|
57110
|
+
return getmodelO46CostTier(isFastMode);
|
|
57111
|
+
}
|
|
57112
|
+
const costs = MODEL_COSTS[shortName];
|
|
57113
|
+
if (!costs) {
|
|
57114
|
+
trackUnknownModelCost(model, shortName);
|
|
57115
|
+
return MODEL_COSTS[getCanonicalName(getDefaultMainLoopModelSetting())] ?? DEFAULT_UNKNOWN_MODEL_COST;
|
|
57116
|
+
}
|
|
57117
|
+
return costs;
|
|
57118
|
+
}
|
|
57119
|
+
function trackUnknownModelCost(model, shortName) {
|
|
57120
|
+
logEvent("tengu_unknown_model_cost", {
|
|
57121
|
+
model,
|
|
57122
|
+
shortName
|
|
57123
|
+
});
|
|
57124
|
+
setHasUnknownModelCost();
|
|
57125
|
+
}
|
|
57126
|
+
function calculateUSDCost(resolvedModel, usage) {
|
|
57127
|
+
if (getAPIProvider() === "ollama") {
|
|
57128
|
+
return 0;
|
|
57129
|
+
}
|
|
57130
|
+
const modelCosts = getModelCosts(resolvedModel, usage);
|
|
57131
|
+
return tokensToUSDCost(modelCosts, usage);
|
|
57132
|
+
}
|
|
57133
|
+
function formatPrice(price) {
|
|
57134
|
+
if (Number.isInteger(price)) {
|
|
57135
|
+
return `$${price}`;
|
|
57136
|
+
}
|
|
57137
|
+
return `$${price.toFixed(2)}`;
|
|
57138
|
+
}
|
|
57139
|
+
function formatModelPricing(costs) {
|
|
57140
|
+
return `${formatPrice(costs.inputTokens)}/${formatPrice(costs.outputTokens)} per Mtok`;
|
|
57141
|
+
}
|
|
57142
|
+
var COST_TIER_3_15, COST_TIER_15_75, COST_TIER_5_25, COST_TIER_30_150, COST_MODELH_35, COST_MODELH_45, DEFAULT_UNKNOWN_MODEL_COST, MODEL_COSTS;
|
|
57143
|
+
var init_modelCost = __esm(() => {
|
|
57144
|
+
init_analytics();
|
|
57145
|
+
init_state();
|
|
57146
|
+
init_fastMode();
|
|
57147
|
+
init_configs();
|
|
57148
|
+
init_model();
|
|
57149
|
+
init_providers();
|
|
57150
|
+
COST_TIER_3_15 = {
|
|
57151
|
+
inputTokens: 3,
|
|
57152
|
+
outputTokens: 15,
|
|
57153
|
+
promptCacheWriteTokens: 3.75,
|
|
57154
|
+
promptCacheReadTokens: 0.3,
|
|
57155
|
+
webSearchRequests: 0.01
|
|
57156
|
+
};
|
|
57157
|
+
COST_TIER_15_75 = {
|
|
57158
|
+
inputTokens: 15,
|
|
57159
|
+
outputTokens: 75,
|
|
57160
|
+
promptCacheWriteTokens: 18.75,
|
|
57161
|
+
promptCacheReadTokens: 1.5,
|
|
57162
|
+
webSearchRequests: 0.01
|
|
57163
|
+
};
|
|
57164
|
+
COST_TIER_5_25 = {
|
|
57165
|
+
inputTokens: 5,
|
|
57166
|
+
outputTokens: 25,
|
|
57167
|
+
promptCacheWriteTokens: 6.25,
|
|
57168
|
+
promptCacheReadTokens: 0.5,
|
|
57169
|
+
webSearchRequests: 0.01
|
|
57170
|
+
};
|
|
57171
|
+
COST_TIER_30_150 = {
|
|
57172
|
+
inputTokens: 30,
|
|
57173
|
+
outputTokens: 150,
|
|
57174
|
+
promptCacheWriteTokens: 37.5,
|
|
57175
|
+
promptCacheReadTokens: 3,
|
|
57176
|
+
webSearchRequests: 0.01
|
|
57177
|
+
};
|
|
57178
|
+
COST_MODELH_35 = {
|
|
57179
|
+
inputTokens: 0.8,
|
|
57180
|
+
outputTokens: 4,
|
|
57181
|
+
promptCacheWriteTokens: 1,
|
|
57182
|
+
promptCacheReadTokens: 0.08,
|
|
57183
|
+
webSearchRequests: 0.01
|
|
57184
|
+
};
|
|
57185
|
+
COST_MODELH_45 = {
|
|
57186
|
+
inputTokens: 1,
|
|
57187
|
+
outputTokens: 5,
|
|
57188
|
+
promptCacheWriteTokens: 1.25,
|
|
57189
|
+
promptCacheReadTokens: 0.1,
|
|
57190
|
+
webSearchRequests: 0.01
|
|
57191
|
+
};
|
|
57192
|
+
DEFAULT_UNKNOWN_MODEL_COST = COST_TIER_5_25;
|
|
57193
|
+
MODEL_COSTS = {
|
|
57194
|
+
[firstPartyNameToCanonical(UR_3_5_MODELH_CONFIG.firstParty)]: COST_MODELH_35,
|
|
57195
|
+
[firstPartyNameToCanonical(UR_MODELH_4_5_CONFIG.firstParty)]: COST_MODELH_45,
|
|
57196
|
+
[firstPartyNameToCanonical(UR_3_5_V2_MODELS_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
57197
|
+
[firstPartyNameToCanonical(UR_3_7_MODELS_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
57198
|
+
[firstPartyNameToCanonical(UR_MODELS_4_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
57199
|
+
[firstPartyNameToCanonical(UR_MODELS_4_5_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
57200
|
+
[firstPartyNameToCanonical(UR_MODELS_4_6_CONFIG.firstParty)]: COST_TIER_3_15,
|
|
57201
|
+
[firstPartyNameToCanonical(UR_MODELO_4_CONFIG.firstParty)]: COST_TIER_15_75,
|
|
57202
|
+
[firstPartyNameToCanonical(UR_MODELO_4_1_CONFIG.firstParty)]: COST_TIER_15_75,
|
|
57203
|
+
[firstPartyNameToCanonical(UR_MODELO_4_5_CONFIG.firstParty)]: COST_TIER_5_25,
|
|
57204
|
+
[firstPartyNameToCanonical(UR_MODELO_4_6_CONFIG.firstParty)]: COST_TIER_5_25
|
|
57205
|
+
};
|
|
57206
|
+
});
|
|
57207
|
+
|
|
57208
|
+
// src/constants/figures.ts
|
|
57209
|
+
var BLACK_CIRCLE, UR_HOUSE = "\u2302", UP_ARROW = "\u2191", DOWN_ARROW = "\u2193", LIGHTNING_BOLT = "\u21AF", EFFORT_LOW = "\u25CB", EFFORT_MEDIUM = "\u25D0", EFFORT_HIGH = "\u25CF", EFFORT_MAX = "\u25C9", PAUSE_ICON = "\u23F8", REFRESH_ARROW = "\u21BB", DIAMOND_OPEN = "\u25C7", DIAMOND_FILLED = "\u25C6", REFERENCE_MARK = "\u203B", BLOCKQUOTE_BAR = "\u258E", BRIDGE_READY_INDICATOR = "\xB7\u2714\uFE0E\xB7", BRIDGE_FAILED_INDICATOR = "\xD7";
|
|
57210
|
+
var init_figures2 = __esm(() => {
|
|
57211
|
+
BLACK_CIRCLE = process.platform === "darwin" ? "\u23FA" : "\u25CF";
|
|
57212
|
+
});
|
|
57213
|
+
|
|
57214
|
+
// src/utils/model/aliases.ts
|
|
57215
|
+
function isModelAlias(modelInput) {
|
|
57216
|
+
return MODEL_ALIASES.includes(modelInput);
|
|
57217
|
+
}
|
|
57218
|
+
function isModelFamilyAlias(model) {
|
|
57219
|
+
return MODEL_FAMILY_ALIASES.includes(model);
|
|
57220
|
+
}
|
|
57221
|
+
var MODEL_ALIASES, MODEL_FAMILY_ALIASES;
|
|
57222
|
+
var init_aliases = __esm(() => {
|
|
57223
|
+
MODEL_ALIASES = [
|
|
57224
|
+
"modelS",
|
|
57225
|
+
"modelO",
|
|
57226
|
+
"modelH",
|
|
57227
|
+
"best",
|
|
57228
|
+
"modelS[1m]",
|
|
57229
|
+
"modelO[1m]",
|
|
57230
|
+
"modelOplan"
|
|
57231
|
+
];
|
|
57232
|
+
MODEL_FAMILY_ALIASES = ["modelS", "modelO", "modelH"];
|
|
57233
|
+
});
|
|
57234
|
+
|
|
57235
|
+
// src/utils/model/modelAllowlist.ts
|
|
57236
|
+
function modelBelongsToFamily(model, family) {
|
|
57237
|
+
if (model.includes(family)) {
|
|
57238
|
+
return true;
|
|
57239
|
+
}
|
|
57240
|
+
if (isModelAlias(model)) {
|
|
57241
|
+
const resolved = parseUserSpecifiedModel(model).toLowerCase();
|
|
57242
|
+
return resolved.includes(family);
|
|
57243
|
+
}
|
|
57244
|
+
return false;
|
|
57245
|
+
}
|
|
57246
|
+
function prefixMatchesModel(modelName, prefix) {
|
|
57247
|
+
if (!modelName.startsWith(prefix)) {
|
|
57248
|
+
return false;
|
|
57249
|
+
}
|
|
57250
|
+
return modelName.length === prefix.length || modelName[prefix.length] === "-";
|
|
57251
|
+
}
|
|
57252
|
+
function modelMatchesVersionPrefix(model, entry) {
|
|
57253
|
+
const resolvedModel = isModelAlias(model) ? parseUserSpecifiedModel(model).toLowerCase() : model;
|
|
57254
|
+
if (prefixMatchesModel(resolvedModel, entry)) {
|
|
57255
|
+
return true;
|
|
57256
|
+
}
|
|
57257
|
+
if (!entry.startsWith("ur-") && prefixMatchesModel(resolvedModel, `ur-${entry}`)) {
|
|
57258
|
+
return true;
|
|
57259
|
+
}
|
|
57260
|
+
return false;
|
|
57261
|
+
}
|
|
57262
|
+
function familyHasSpecificEntries(family, allowlist) {
|
|
57263
|
+
for (const entry of allowlist) {
|
|
57264
|
+
if (isModelFamilyAlias(entry)) {
|
|
57265
|
+
continue;
|
|
57266
|
+
}
|
|
57267
|
+
const idx = entry.indexOf(family);
|
|
57268
|
+
if (idx === -1) {
|
|
57269
|
+
continue;
|
|
57270
|
+
}
|
|
57271
|
+
const afterFamily = idx + family.length;
|
|
57272
|
+
if (afterFamily === entry.length || entry[afterFamily] === "-") {
|
|
57273
|
+
return true;
|
|
57274
|
+
}
|
|
57275
|
+
}
|
|
57276
|
+
return false;
|
|
57277
|
+
}
|
|
57278
|
+
function isModelAllowed(model) {
|
|
57279
|
+
if (getAPIProvider() === "ollama") {
|
|
57280
|
+
return true;
|
|
57281
|
+
}
|
|
57282
|
+
const settings = getSettings_DEPRECATED() || {};
|
|
57283
|
+
const { availableModels } = settings;
|
|
57284
|
+
if (!availableModels) {
|
|
57285
|
+
return true;
|
|
57286
|
+
}
|
|
57287
|
+
if (availableModels.length === 0) {
|
|
57288
|
+
return false;
|
|
57289
|
+
}
|
|
57290
|
+
const resolvedModel = resolveOverriddenModel(model);
|
|
57291
|
+
const normalizedModel = resolvedModel.trim().toLowerCase();
|
|
57292
|
+
const normalizedAllowlist = availableModels.map((m) => m.trim().toLowerCase());
|
|
57293
|
+
if (normalizedAllowlist.includes(normalizedModel)) {
|
|
57294
|
+
if (!isModelFamilyAlias(normalizedModel) || !familyHasSpecificEntries(normalizedModel, normalizedAllowlist)) {
|
|
57295
|
+
return true;
|
|
57296
|
+
}
|
|
57297
|
+
}
|
|
57298
|
+
for (const entry of normalizedAllowlist) {
|
|
57299
|
+
if (isModelFamilyAlias(entry) && !familyHasSpecificEntries(entry, normalizedAllowlist) && modelBelongsToFamily(normalizedModel, entry)) {
|
|
57300
|
+
return true;
|
|
57301
|
+
}
|
|
57302
|
+
}
|
|
57303
|
+
if (isModelAlias(normalizedModel)) {
|
|
57304
|
+
const resolved = parseUserSpecifiedModel(normalizedModel).toLowerCase();
|
|
57305
|
+
if (normalizedAllowlist.includes(resolved)) {
|
|
57306
|
+
return true;
|
|
57307
|
+
}
|
|
57308
|
+
}
|
|
57309
|
+
for (const entry of normalizedAllowlist) {
|
|
57310
|
+
if (!isModelFamilyAlias(entry) && isModelAlias(entry)) {
|
|
57311
|
+
const resolved = parseUserSpecifiedModel(entry).toLowerCase();
|
|
57312
|
+
if (resolved === normalizedModel) {
|
|
57313
|
+
return true;
|
|
57314
|
+
}
|
|
57315
|
+
}
|
|
57316
|
+
}
|
|
57317
|
+
for (const entry of normalizedAllowlist) {
|
|
57318
|
+
if (!isModelFamilyAlias(entry) && !isModelAlias(entry)) {
|
|
57319
|
+
if (modelMatchesVersionPrefix(normalizedModel, entry)) {
|
|
57320
|
+
return true;
|
|
57321
|
+
}
|
|
57322
|
+
}
|
|
57323
|
+
}
|
|
57324
|
+
return false;
|
|
57325
|
+
}
|
|
57326
|
+
var init_modelAllowlist = __esm(() => {
|
|
57327
|
+
init_settings2();
|
|
57328
|
+
init_aliases();
|
|
57329
|
+
init_model();
|
|
57330
|
+
init_modelStrings();
|
|
57331
|
+
init_providers();
|
|
57332
|
+
});
|
|
57333
|
+
|
|
57334
|
+
// src/utils/stringUtils.ts
|
|
57335
|
+
function escapeRegExp(str) {
|
|
57336
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
57337
|
+
}
|
|
57338
|
+
function capitalize2(str) {
|
|
57339
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
57340
|
+
}
|
|
57341
|
+
function plural(n2, word, pluralWord = word + "s") {
|
|
57342
|
+
return n2 === 1 ? word : pluralWord;
|
|
57343
|
+
}
|
|
57344
|
+
function firstLineOf(s) {
|
|
57345
|
+
const nl = s.indexOf(`
|
|
57346
|
+
`);
|
|
57347
|
+
return nl === -1 ? s : s.slice(0, nl);
|
|
57348
|
+
}
|
|
57349
|
+
function countCharInString(str, char, start = 0) {
|
|
57350
|
+
let count3 = 0;
|
|
57351
|
+
let i2 = str.indexOf(char, start);
|
|
57352
|
+
while (i2 !== -1) {
|
|
57353
|
+
count3++;
|
|
57354
|
+
i2 = str.indexOf(char, i2 + 1);
|
|
57355
|
+
}
|
|
57356
|
+
return count3;
|
|
57357
|
+
}
|
|
57358
|
+
function normalizeFullWidthDigits(input) {
|
|
57359
|
+
return input.replace(/[\uFF10-\uFF19]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) - 65248));
|
|
57360
|
+
}
|
|
57361
|
+
function normalizeFullWidthSpace(input) {
|
|
57362
|
+
return input.replace(/\u3000/g, " ");
|
|
57363
|
+
}
|
|
57364
|
+
function safeJoinLines(lines, delimiter = ",", maxSize = MAX_STRING_LENGTH) {
|
|
57365
|
+
const truncationMarker = "...[truncated]";
|
|
57366
|
+
let result = "";
|
|
57367
|
+
for (const line of lines) {
|
|
57368
|
+
const delimiterToAdd = result ? delimiter : "";
|
|
57369
|
+
const fullAddition = delimiterToAdd + line;
|
|
57370
|
+
if (result.length + fullAddition.length <= maxSize) {
|
|
57371
|
+
result += fullAddition;
|
|
57372
|
+
} else {
|
|
57373
|
+
const remainingSpace = maxSize - result.length - delimiterToAdd.length - truncationMarker.length;
|
|
57374
|
+
if (remainingSpace > 0) {
|
|
57375
|
+
result += delimiterToAdd + line.slice(0, remainingSpace) + truncationMarker;
|
|
57376
|
+
} else {
|
|
57377
|
+
result += truncationMarker;
|
|
57378
|
+
}
|
|
57379
|
+
return result;
|
|
57380
|
+
}
|
|
57381
|
+
}
|
|
57382
|
+
return result;
|
|
57383
|
+
}
|
|
57384
|
+
|
|
57385
|
+
class EndTruncatingAccumulator {
|
|
57386
|
+
maxSize;
|
|
57387
|
+
content = "";
|
|
57388
|
+
isTruncated = false;
|
|
57389
|
+
totalBytesReceived = 0;
|
|
57390
|
+
constructor(maxSize = MAX_STRING_LENGTH) {
|
|
57391
|
+
this.maxSize = maxSize;
|
|
57392
|
+
}
|
|
57393
|
+
append(data) {
|
|
57394
|
+
const str = typeof data === "string" ? data : data.toString();
|
|
57395
|
+
this.totalBytesReceived += str.length;
|
|
57396
|
+
if (this.isTruncated && this.content.length >= this.maxSize) {
|
|
57397
|
+
return;
|
|
57398
|
+
}
|
|
57399
|
+
if (this.content.length + str.length > this.maxSize) {
|
|
57400
|
+
const remainingSpace = this.maxSize - this.content.length;
|
|
57401
|
+
if (remainingSpace > 0) {
|
|
57402
|
+
this.content += str.slice(0, remainingSpace);
|
|
57403
|
+
}
|
|
57404
|
+
this.isTruncated = true;
|
|
57405
|
+
} else {
|
|
57406
|
+
this.content += str;
|
|
57407
|
+
}
|
|
57408
|
+
}
|
|
57409
|
+
toString() {
|
|
57410
|
+
if (!this.isTruncated) {
|
|
57411
|
+
return this.content;
|
|
57412
|
+
}
|
|
57413
|
+
const truncatedBytes = this.totalBytesReceived - this.maxSize;
|
|
57414
|
+
const truncatedKB = Math.round(truncatedBytes / 1024);
|
|
57415
|
+
return this.content + `
|
|
57416
|
+
... [output truncated - ${truncatedKB}KB removed]`;
|
|
57417
|
+
}
|
|
57418
|
+
clear() {
|
|
57419
|
+
this.content = "";
|
|
57420
|
+
this.isTruncated = false;
|
|
57421
|
+
this.totalBytesReceived = 0;
|
|
57422
|
+
}
|
|
57423
|
+
get length() {
|
|
57424
|
+
return this.content.length;
|
|
57425
|
+
}
|
|
57426
|
+
get truncated() {
|
|
57427
|
+
return this.isTruncated;
|
|
57428
|
+
}
|
|
57429
|
+
get totalBytes() {
|
|
57430
|
+
return this.totalBytesReceived;
|
|
57431
|
+
}
|
|
57432
|
+
}
|
|
57433
|
+
function truncateToLines(text, maxLines) {
|
|
57434
|
+
const lines = text.split(`
|
|
57435
|
+
`);
|
|
57436
|
+
if (lines.length <= maxLines) {
|
|
57437
|
+
return text;
|
|
57438
|
+
}
|
|
57439
|
+
return lines.slice(0, maxLines).join(`
|
|
57440
|
+
`) + "\u2026";
|
|
57441
|
+
}
|
|
57442
|
+
var MAX_STRING_LENGTH;
|
|
57443
|
+
var init_stringUtils = __esm(() => {
|
|
57444
|
+
MAX_STRING_LENGTH = 2 ** 25;
|
|
57445
|
+
});
|
|
57446
|
+
|
|
57447
|
+
// src/utils/model/model.ts
|
|
57448
|
+
var exports_model = {};
|
|
57449
|
+
__export(exports_model, {
|
|
57450
|
+
resolveSkillModelOverride: () => resolveSkillModelOverride,
|
|
57451
|
+
renderModelSetting: () => renderModelSetting,
|
|
57452
|
+
renderModelName: () => renderModelName,
|
|
57453
|
+
renderDefaultModelSetting: () => renderDefaultModelSetting,
|
|
57454
|
+
parseUserSpecifiedModel: () => parseUserSpecifiedModel,
|
|
57455
|
+
normalizeModelStringForAPI: () => normalizeModelStringForAPI,
|
|
57456
|
+
modelDisplayString: () => modelDisplayString,
|
|
57457
|
+
ismodelO1mMergeEnabled: () => ismodelO1mMergeEnabled,
|
|
57458
|
+
isNonCustommodelOModel: () => isNonCustommodelOModel,
|
|
57459
|
+
isLegacyModelRemapEnabled: () => isLegacyModelRemapEnabled,
|
|
57460
|
+
getmodelO46PricingSuffix: () => getmodelO46PricingSuffix,
|
|
57461
|
+
getUserSpecifiedModelSetting: () => getUserSpecifiedModelSetting,
|
|
57462
|
+
getURAiUserDefaultModelDescription: () => getURAiUserDefaultModelDescription,
|
|
57463
|
+
getSmallFastModel: () => getSmallFastModel,
|
|
57464
|
+
getRuntimeMainLoopModel: () => getRuntimeMainLoopModel,
|
|
57465
|
+
getPublicModelName: () => getPublicModelName,
|
|
57466
|
+
getPublicModelDisplayName: () => getPublicModelDisplayName,
|
|
57467
|
+
getMarketingNameForModel: () => getMarketingNameForModel,
|
|
57468
|
+
getMainLoopModel: () => getMainLoopModel,
|
|
57469
|
+
getDefaultmodelSModel: () => getDefaultmodelSModel,
|
|
57470
|
+
getDefaultmodelOModel: () => getDefaultmodelOModel,
|
|
57471
|
+
getDefaultmodelHModel: () => getDefaultmodelHModel,
|
|
57472
|
+
getDefaultOllamaModel: () => getDefaultOllamaModel,
|
|
57473
|
+
getDefaultMainLoopModelSetting: () => getDefaultMainLoopModelSetting,
|
|
57474
|
+
getDefaultMainLoopModel: () => getDefaultMainLoopModel,
|
|
57475
|
+
getCanonicalName: () => getCanonicalName,
|
|
57476
|
+
getBestModel: () => getBestModel,
|
|
57477
|
+
firstPartyNameToCanonical: () => firstPartyNameToCanonical,
|
|
57478
|
+
__resetOllamaRouteMemoForTests: () => __resetOllamaRouteMemoForTests
|
|
57479
|
+
});
|
|
57480
|
+
function __resetOllamaRouteMemoForTests() {
|
|
57481
|
+
memoizedRoutedDefaultModel = undefined;
|
|
57482
|
+
memoizedRoutedFastModel = undefined;
|
|
57483
|
+
}
|
|
57484
|
+
function getDefaultOllamaModel() {
|
|
57485
|
+
if (process.env.OLLAMA_MODEL) {
|
|
57486
|
+
return process.env.OLLAMA_MODEL;
|
|
57487
|
+
}
|
|
57488
|
+
if (isOllamaAutoRouteEnabled()) {
|
|
57489
|
+
if (memoizedRoutedDefaultModel)
|
|
57490
|
+
return memoizedRoutedDefaultModel;
|
|
57491
|
+
const routed = pickBestCoderModel(getCachedOllamaModelNames());
|
|
57492
|
+
if (routed) {
|
|
57493
|
+
memoizedRoutedDefaultModel = routed;
|
|
57494
|
+
return routed;
|
|
57495
|
+
}
|
|
57496
|
+
}
|
|
57497
|
+
return DEFAULT_OLLAMA_MODEL2;
|
|
57498
|
+
}
|
|
57499
|
+
function getSmallFastModel() {
|
|
57500
|
+
if (getAPIProvider() === "ollama") {
|
|
57501
|
+
if (process.env.OLLAMA_SMALL_FAST_MODEL) {
|
|
57502
|
+
return process.env.OLLAMA_SMALL_FAST_MODEL;
|
|
57503
|
+
}
|
|
57504
|
+
if (isOllamaAutoRouteEnabled()) {
|
|
57505
|
+
if (memoizedRoutedFastModel)
|
|
57506
|
+
return memoizedRoutedFastModel;
|
|
57507
|
+
const routed = pickSmallFastModel(getCachedOllamaModelNames());
|
|
57508
|
+
if (routed) {
|
|
57509
|
+
memoizedRoutedFastModel = routed;
|
|
57510
|
+
return routed;
|
|
57511
|
+
}
|
|
57512
|
+
}
|
|
57513
|
+
return getDefaultOllamaModel();
|
|
57514
|
+
}
|
|
57515
|
+
return process.env.URHQ_SMALL_FAST_MODEL || getDefaultmodelHModel();
|
|
57516
|
+
}
|
|
57517
|
+
function isNonCustommodelOModel(model) {
|
|
57518
|
+
return model === getModelStrings2().modelO40 || model === getModelStrings2().modelO41 || model === getModelStrings2().modelO45 || model === getModelStrings2().modelO46;
|
|
57519
|
+
}
|
|
57520
|
+
function getUserSpecifiedModelSetting() {
|
|
57521
|
+
let specifiedModel;
|
|
57522
|
+
const modelOverride = getMainLoopModelOverride();
|
|
57523
|
+
if (modelOverride !== undefined) {
|
|
57524
|
+
specifiedModel = modelOverride;
|
|
57525
|
+
} else {
|
|
57526
|
+
const settings = getSettings_DEPRECATED() || {};
|
|
57527
|
+
specifiedModel = process.env.URHQ_MODEL || settings.model || undefined;
|
|
57528
|
+
}
|
|
57529
|
+
if (specifiedModel && !isModelAllowed(specifiedModel)) {
|
|
57530
|
+
return;
|
|
57531
|
+
}
|
|
57532
|
+
return specifiedModel;
|
|
57533
|
+
}
|
|
57534
|
+
function getMainLoopModel() {
|
|
57535
|
+
const model = getUserSpecifiedModelSetting();
|
|
57536
|
+
if (model !== undefined && model !== null) {
|
|
57537
|
+
return parseUserSpecifiedModel(model);
|
|
57538
|
+
}
|
|
57539
|
+
return getDefaultMainLoopModel();
|
|
57540
|
+
}
|
|
57541
|
+
function getBestModel() {
|
|
57542
|
+
return getDefaultmodelOModel();
|
|
57543
|
+
}
|
|
57544
|
+
function getDefaultmodelOModel() {
|
|
57545
|
+
if (getAPIProvider() === "ollama") {
|
|
57546
|
+
return getDefaultOllamaModel();
|
|
57547
|
+
}
|
|
57548
|
+
if (process.env.URHQ_DEFAULT_MODELO_MODEL) {
|
|
57549
|
+
return process.env.URHQ_DEFAULT_MODELO_MODEL;
|
|
57550
|
+
}
|
|
57551
|
+
if (getAPIProvider() !== "firstParty") {
|
|
57552
|
+
return getModelStrings2().modelO46;
|
|
57553
|
+
}
|
|
57554
|
+
return getModelStrings2().modelO46;
|
|
57555
|
+
}
|
|
57556
|
+
function getDefaultmodelSModel() {
|
|
57557
|
+
if (getAPIProvider() === "ollama") {
|
|
57558
|
+
return getDefaultOllamaModel();
|
|
57559
|
+
}
|
|
57560
|
+
if (process.env.URHQ_DEFAULT_MODELS_MODEL) {
|
|
57561
|
+
return process.env.URHQ_DEFAULT_MODELS_MODEL;
|
|
57562
|
+
}
|
|
57563
|
+
if (getAPIProvider() !== "firstParty") {
|
|
57564
|
+
return getModelStrings2().modelS45;
|
|
57565
|
+
}
|
|
57566
|
+
return getModelStrings2().modelS46;
|
|
57567
|
+
}
|
|
57568
|
+
function getDefaultmodelHModel() {
|
|
57569
|
+
if (getAPIProvider() === "ollama") {
|
|
57570
|
+
return process.env.OLLAMA_SMALL_FAST_MODEL || getDefaultOllamaModel();
|
|
57571
|
+
}
|
|
57572
|
+
if (process.env.URHQ_DEFAULT_MODELH_MODEL) {
|
|
57573
|
+
return process.env.URHQ_DEFAULT_MODELH_MODEL;
|
|
57574
|
+
}
|
|
57575
|
+
return getModelStrings2().modelH45;
|
|
57576
|
+
}
|
|
57577
|
+
function getRuntimeMainLoopModel(params) {
|
|
57578
|
+
const { permissionMode, mainLoopModel, exceeds200kTokens = false } = params;
|
|
57579
|
+
if (getUserSpecifiedModelSetting() === "modelOplan" && permissionMode === "plan" && !exceeds200kTokens) {
|
|
57580
|
+
return getDefaultmodelOModel();
|
|
57581
|
+
}
|
|
57582
|
+
if (getUserSpecifiedModelSetting() === "modelH" && permissionMode === "plan") {
|
|
57583
|
+
return getDefaultmodelSModel();
|
|
57584
|
+
}
|
|
57585
|
+
return mainLoopModel;
|
|
57586
|
+
}
|
|
57587
|
+
function getDefaultMainLoopModelSetting() {
|
|
57588
|
+
const settings = getSettings_DEPRECATED() || {};
|
|
57589
|
+
const activeProvider = getActiveProviderSettings(settings).active ?? "ollama";
|
|
57590
|
+
if (activeProvider !== "ollama") {
|
|
57591
|
+
const providerDefault = getDefaultModelForProvider(activeProvider);
|
|
57592
|
+
if (providerDefault) {
|
|
57593
|
+
return providerDefault;
|
|
57594
|
+
}
|
|
57595
|
+
}
|
|
57596
|
+
if (getAPIProvider() === "ollama") {
|
|
57597
|
+
return getDefaultOllamaModel();
|
|
57598
|
+
}
|
|
57599
|
+
if (process.env.USER_TYPE === "ant") {
|
|
57600
|
+
return getAntModelOverrideConfig2()?.defaultModel ?? getDefaultmodelOModel() + "[1m]";
|
|
57601
|
+
}
|
|
57602
|
+
if (isMaxSubscriber()) {
|
|
57603
|
+
return getDefaultmodelOModel() + (ismodelO1mMergeEnabled() ? "[1m]" : "");
|
|
57604
|
+
}
|
|
57605
|
+
if (isTeamPremiumSubscriber()) {
|
|
57606
|
+
return getDefaultmodelOModel() + (ismodelO1mMergeEnabled() ? "[1m]" : "");
|
|
57607
|
+
}
|
|
57608
|
+
return getDefaultmodelSModel();
|
|
57609
|
+
}
|
|
57610
|
+
function getDefaultMainLoopModel() {
|
|
57611
|
+
return parseUserSpecifiedModel(getDefaultMainLoopModelSetting());
|
|
57612
|
+
}
|
|
57613
|
+
function firstPartyNameToCanonical(name) {
|
|
57614
|
+
return name.toLowerCase();
|
|
57615
|
+
}
|
|
57616
|
+
function getCanonicalName(fullModelName) {
|
|
57617
|
+
return firstPartyNameToCanonical(resolveOverriddenModel(fullModelName));
|
|
57618
|
+
}
|
|
57619
|
+
function getURAiUserDefaultModelDescription(fastMode = false) {
|
|
57620
|
+
if (isMaxSubscriber() || isTeamPremiumSubscriber()) {
|
|
57621
|
+
if (ismodelO1mMergeEnabled()) {
|
|
57622
|
+
return `modelO 4.6 with 1M context \xB7 Most capable for complex work${fastMode ? getmodelO46PricingSuffix(true) : ""}`;
|
|
57623
|
+
}
|
|
57624
|
+
return `modelO 4.6 \xB7 Most capable for complex work${fastMode ? getmodelO46PricingSuffix(true) : ""}`;
|
|
57625
|
+
}
|
|
57626
|
+
return "modelS 4.6 \xB7 Best for everyday tasks";
|
|
57627
|
+
}
|
|
57628
|
+
function renderDefaultModelSetting(setting) {
|
|
57629
|
+
if (setting === "modelOplan") {
|
|
57630
|
+
return "modelO 4.6 in plan mode, else modelS 4.6";
|
|
57631
|
+
}
|
|
57632
|
+
return renderModelName(parseUserSpecifiedModel(setting));
|
|
57633
|
+
}
|
|
57634
|
+
function getmodelO46PricingSuffix(fastMode) {
|
|
57635
|
+
if (getAPIProvider() !== "firstParty")
|
|
57636
|
+
return "";
|
|
57637
|
+
const pricing = formatModelPricing(getmodelO46CostTier(fastMode));
|
|
57638
|
+
const fastModeIndicator = fastMode ? ` (${LIGHTNING_BOLT})` : "";
|
|
57639
|
+
return ` \xB7${fastModeIndicator} ${pricing}`;
|
|
57640
|
+
}
|
|
57641
|
+
function ismodelO1mMergeEnabled() {
|
|
57642
|
+
if (is1mContextDisabled() || isProSubscriber() || getAPIProvider() !== "firstParty") {
|
|
57643
|
+
return false;
|
|
57644
|
+
}
|
|
57645
|
+
if (isURAISubscriber2() && getSubscriptionType() === null) {
|
|
57646
|
+
return false;
|
|
57647
|
+
}
|
|
57648
|
+
return true;
|
|
57649
|
+
}
|
|
57650
|
+
function renderModelSetting(setting) {
|
|
57651
|
+
if (setting === "modelOplan") {
|
|
57652
|
+
return "modelO Plan";
|
|
57653
|
+
}
|
|
57654
|
+
if (isModelAlias(setting)) {
|
|
57655
|
+
return capitalize2(setting);
|
|
57656
|
+
}
|
|
57657
|
+
return renderModelName(setting);
|
|
57658
|
+
}
|
|
57659
|
+
function getPublicModelDisplayName(model) {
|
|
57660
|
+
if (getAPIProvider() === "ollama") {
|
|
57661
|
+
return null;
|
|
57662
|
+
}
|
|
57663
|
+
switch (model) {
|
|
57664
|
+
case getModelStrings2().modelO46:
|
|
57665
|
+
return "modelO 4.6";
|
|
57666
|
+
case getModelStrings2().modelO46 + "[1m]":
|
|
57667
|
+
return "modelO 4.6 (1M context)";
|
|
57668
|
+
case getModelStrings2().modelO45:
|
|
57669
|
+
return "modelO 4.5";
|
|
57670
|
+
case getModelStrings2().modelO41:
|
|
57671
|
+
return "modelO 4.1";
|
|
57672
|
+
case getModelStrings2().modelO40:
|
|
57673
|
+
return "modelO 4";
|
|
57674
|
+
case getModelStrings2().modelS46 + "[1m]":
|
|
57675
|
+
return "modelS 4.6 (1M context)";
|
|
57676
|
+
case getModelStrings2().modelS46:
|
|
57677
|
+
return "modelS 4.6";
|
|
57678
|
+
case getModelStrings2().modelS45 + "[1m]":
|
|
57679
|
+
return "modelS 4.5 (1M context)";
|
|
57680
|
+
case getModelStrings2().modelS45:
|
|
57681
|
+
return "modelS 4.5";
|
|
57682
|
+
case getModelStrings2().modelS40:
|
|
57683
|
+
return "modelS 4";
|
|
57684
|
+
case getModelStrings2().modelS40 + "[1m]":
|
|
57685
|
+
return "modelS 4 (1M context)";
|
|
57686
|
+
case getModelStrings2().modelS37:
|
|
57687
|
+
return "modelS 3.7";
|
|
57688
|
+
case getModelStrings2().modelS35:
|
|
57689
|
+
return "modelS 3.5";
|
|
57690
|
+
case getModelStrings2().modelH45:
|
|
57691
|
+
return "modelH 4.5";
|
|
57692
|
+
case getModelStrings2().modelH35:
|
|
57693
|
+
return "modelH 3.5";
|
|
57694
|
+
default:
|
|
57695
|
+
return null;
|
|
57696
|
+
}
|
|
57697
|
+
}
|
|
57698
|
+
function maskModelCodename(baseName) {
|
|
57699
|
+
const [codename = "", ...rest] = baseName.split("-");
|
|
57700
|
+
const masked = codename.slice(0, 3) + "*".repeat(Math.max(0, codename.length - 3));
|
|
57701
|
+
return [masked, ...rest].join("-");
|
|
57702
|
+
}
|
|
57703
|
+
function renderModelName(model) {
|
|
57704
|
+
const publicName = getPublicModelDisplayName(model);
|
|
57705
|
+
if (publicName) {
|
|
57706
|
+
return publicName;
|
|
57707
|
+
}
|
|
57708
|
+
if (process.env.USER_TYPE === "ant") {
|
|
57709
|
+
const resolved = parseUserSpecifiedModel(model);
|
|
57710
|
+
const antModel = resolveAntModel2(model);
|
|
57711
|
+
if (antModel) {
|
|
57712
|
+
const baseName = antModel.model.replace(/\[1m\]$/i, "");
|
|
57713
|
+
const masked = maskModelCodename(baseName);
|
|
57714
|
+
const suffix = has1mContext(resolved) ? "[1m]" : "";
|
|
57715
|
+
return masked + suffix;
|
|
57716
|
+
}
|
|
57717
|
+
if (resolved !== model) {
|
|
57718
|
+
return `${model} (${resolved})`;
|
|
57719
|
+
}
|
|
57720
|
+
return resolved;
|
|
57721
|
+
}
|
|
57722
|
+
return model;
|
|
57723
|
+
}
|
|
57724
|
+
function getPublicModelName(model) {
|
|
57725
|
+
if (getAPIProvider() === "ollama") {
|
|
57726
|
+
return `Ollama (${model})`;
|
|
57727
|
+
}
|
|
57728
|
+
const publicName = getPublicModelDisplayName(model);
|
|
57729
|
+
if (publicName) {
|
|
57730
|
+
return `UR ${publicName}`;
|
|
57731
|
+
}
|
|
57732
|
+
return `UR (${model})`;
|
|
57733
|
+
}
|
|
57734
|
+
function parseUserSpecifiedModel(modelInput) {
|
|
57735
|
+
const modelInputTrimmed = modelInput.trim();
|
|
57736
|
+
const normalizedModel = modelInputTrimmed.toLowerCase();
|
|
57737
|
+
const has1mTag = has1mContext(normalizedModel);
|
|
57738
|
+
const modelString = has1mTag ? normalizedModel.replace(/\[1m]$/i, "").trim() : normalizedModel;
|
|
57739
|
+
switch (modelString) {
|
|
57740
|
+
case "modeloplan":
|
|
57741
|
+
return getDefaultmodelSModel() + (has1mTag ? "[1m]" : "");
|
|
57742
|
+
case "models":
|
|
57743
|
+
return getDefaultmodelSModel() + (has1mTag ? "[1m]" : "");
|
|
57744
|
+
case "modelh":
|
|
57745
|
+
return getDefaultmodelHModel() + (has1mTag ? "[1m]" : "");
|
|
57746
|
+
case "modelo":
|
|
57747
|
+
return getDefaultmodelOModel() + (has1mTag ? "[1m]" : "");
|
|
57748
|
+
case "best":
|
|
57749
|
+
return getBestModel();
|
|
57750
|
+
default:
|
|
57751
|
+
}
|
|
57752
|
+
if (getAPIProvider() === "firstParty" && isLegacymodelOFirstParty(modelString) && isLegacyModelRemapEnabled()) {
|
|
57753
|
+
return getDefaultmodelOModel() + (has1mTag ? "[1m]" : "");
|
|
57754
|
+
}
|
|
57755
|
+
if (process.env.USER_TYPE === "ant") {
|
|
57756
|
+
const has1mAntTag = has1mContext(normalizedModel);
|
|
57757
|
+
const baseAntModel = normalizedModel.replace(/\[1m]$/i, "").trim();
|
|
57758
|
+
const antModel = resolveAntModel2(baseAntModel);
|
|
57759
|
+
if (antModel) {
|
|
57760
|
+
const suffix = has1mAntTag ? "[1m]" : "";
|
|
57761
|
+
return antModel.model + suffix;
|
|
57762
|
+
}
|
|
57763
|
+
}
|
|
57764
|
+
if (has1mTag) {
|
|
57765
|
+
return modelInputTrimmed.replace(/\[1m\]$/i, "").trim() + "[1m]";
|
|
57766
|
+
}
|
|
57767
|
+
return modelInputTrimmed;
|
|
57768
|
+
}
|
|
57769
|
+
function resolveSkillModelOverride(skillModel, currentModel) {
|
|
57770
|
+
if (has1mContext(skillModel) || !has1mContext(currentModel)) {
|
|
57771
|
+
return skillModel;
|
|
57772
|
+
}
|
|
57773
|
+
if (modelSupports1M(parseUserSpecifiedModel(skillModel))) {
|
|
57774
|
+
return skillModel + "[1m]";
|
|
57775
|
+
}
|
|
57776
|
+
return skillModel;
|
|
57777
|
+
}
|
|
57778
|
+
function isLegacymodelOFirstParty(model) {
|
|
57779
|
+
return LEGACY_MODELO_FIRSTPARTY.includes(model);
|
|
57780
|
+
}
|
|
57781
|
+
function isLegacyModelRemapEnabled() {
|
|
57782
|
+
return !isEnvTruthy(process.env.UR_CODE_DISABLE_LEGACY_MODEL_REMAP);
|
|
57783
|
+
}
|
|
57784
|
+
function modelDisplayString(model) {
|
|
57785
|
+
if (model === null) {
|
|
57786
|
+
if (process.env.USER_TYPE === "ant") {
|
|
57787
|
+
return `Default for Ants (${renderDefaultModelSetting(getDefaultMainLoopModelSetting())})`;
|
|
57788
|
+
} else if (isURAISubscriber2()) {
|
|
57789
|
+
return `Default (${getURAiUserDefaultModelDescription()})`;
|
|
57790
|
+
}
|
|
57791
|
+
return `Default (${getDefaultMainLoopModel()})`;
|
|
57792
|
+
}
|
|
57793
|
+
const resolvedModel = parseUserSpecifiedModel(model);
|
|
57794
|
+
return model === resolvedModel ? resolvedModel : `${model} (${resolvedModel})`;
|
|
57795
|
+
}
|
|
57796
|
+
function getMarketingNameForModel(modelId) {
|
|
57797
|
+
if (getAPIProvider() === "foundry" || getAPIProvider() === "ollama") {
|
|
57798
|
+
return;
|
|
57799
|
+
}
|
|
57800
|
+
const has1m = modelId.toLowerCase().includes("[1m]");
|
|
57801
|
+
const canonical = getCanonicalName(modelId);
|
|
57802
|
+
if (canonical === "modelo") {
|
|
57803
|
+
return has1m ? "modelO (with 1M context)" : "modelO";
|
|
57804
|
+
}
|
|
57805
|
+
if (canonical === "models") {
|
|
57806
|
+
return has1m ? "modelS (with 1M context)" : "modelS";
|
|
57807
|
+
}
|
|
57808
|
+
if (canonical === "modelh") {
|
|
57809
|
+
return "modelH";
|
|
57810
|
+
}
|
|
57811
|
+
return;
|
|
57812
|
+
}
|
|
57813
|
+
function normalizeModelStringForAPI(model) {
|
|
57814
|
+
return model.replace(/\[(1|2)m\]/gi, "");
|
|
57815
|
+
}
|
|
57816
|
+
var DEFAULT_OLLAMA_MODEL2 = "qwen3-coder:480b-cloud", memoizedRoutedDefaultModel, memoizedRoutedFastModel, LEGACY_MODELO_FIRSTPARTY;
|
|
57817
|
+
var init_model = __esm(() => {
|
|
57818
|
+
init_state();
|
|
57819
|
+
init_auth();
|
|
57820
|
+
init_context();
|
|
57821
|
+
init_envUtils();
|
|
57822
|
+
init_modelStrings();
|
|
57823
|
+
init_modelCost();
|
|
57824
|
+
init_settings2();
|
|
57825
|
+
init_providers();
|
|
57826
|
+
init_figures2();
|
|
57827
|
+
init_modelAllowlist();
|
|
57828
|
+
init_aliases();
|
|
57829
|
+
init_stringUtils();
|
|
57830
|
+
init_antModels();
|
|
57831
|
+
init_ollamaModels();
|
|
57832
|
+
init_ollamaRouter();
|
|
57833
|
+
init_providerRegistry();
|
|
57834
|
+
LEGACY_MODELO_FIRSTPARTY = [];
|
|
57835
|
+
});
|
|
57836
|
+
|
|
57928
57837
|
// src/utils/model/modelSupportOverrides.ts
|
|
57929
57838
|
var TIERS, get3PModelCapabilityOverride;
|
|
57930
57839
|
var init_modelSupportOverrides = __esm(() => {
|
|
@@ -58003,35 +57912,29 @@ function modelSupportsISP(model) {
|
|
|
58003
57912
|
return true;
|
|
58004
57913
|
}
|
|
58005
57914
|
if (provider === "firstParty") {
|
|
58006
|
-
return
|
|
57915
|
+
return true;
|
|
58007
57916
|
}
|
|
58008
|
-
return
|
|
57917
|
+
return false;
|
|
58009
57918
|
}
|
|
58010
|
-
function vertexModelSupportsWebSearch(
|
|
58011
|
-
|
|
58012
|
-
return canonical.includes("ur-modelO-4") || canonical.includes("ur-modelS-4") || canonical.includes("ur-modelH-4");
|
|
57919
|
+
function vertexModelSupportsWebSearch(_model) {
|
|
57920
|
+
return false;
|
|
58013
57921
|
}
|
|
58014
57922
|
function modelSupportsContextManagement(model) {
|
|
58015
57923
|
if (getAPIProvider() === "ollama") {
|
|
58016
57924
|
return false;
|
|
58017
57925
|
}
|
|
58018
|
-
const canonical = getCanonicalName(model);
|
|
58019
57926
|
const provider = getAPIProvider();
|
|
58020
57927
|
if (provider === "foundry") {
|
|
58021
57928
|
return true;
|
|
58022
57929
|
}
|
|
58023
57930
|
if (provider === "firstParty") {
|
|
58024
|
-
return
|
|
57931
|
+
return true;
|
|
58025
57932
|
}
|
|
58026
|
-
return
|
|
57933
|
+
return false;
|
|
58027
57934
|
}
|
|
58028
57935
|
function modelSupportsStructuredOutputs(model) {
|
|
58029
|
-
const canonical = getCanonicalName(model);
|
|
58030
57936
|
const provider = getAPIProvider();
|
|
58031
|
-
|
|
58032
|
-
return false;
|
|
58033
|
-
}
|
|
58034
|
-
return canonical.includes("ur-modelS-4-6") || canonical.includes("ur-modelS-4-5") || canonical.includes("ur-modelO-4-1") || canonical.includes("ur-modelO-4-5") || canonical.includes("ur-modelO-4-6") || canonical.includes("ur-modelH-4-5");
|
|
57937
|
+
return provider === "firstParty" || provider === "foundry";
|
|
58035
57938
|
}
|
|
58036
57939
|
function modelSupportsAutoMode(model) {
|
|
58037
57940
|
if (false) {}
|
|
@@ -69408,7 +69311,7 @@ var init_auth = __esm(() => {
|
|
|
69408
69311
|
|
|
69409
69312
|
// src/utils/userAgent.ts
|
|
69410
69313
|
function getURCodeUserAgent() {
|
|
69411
|
-
return `ur/${"1.30.
|
|
69314
|
+
return `ur/${"1.30.6"}`;
|
|
69412
69315
|
}
|
|
69413
69316
|
|
|
69414
69317
|
// src/utils/workloadContext.ts
|
|
@@ -69430,7 +69333,7 @@ function getUserAgent() {
|
|
|
69430
69333
|
const clientApp = process.env.UR_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}` : "";
|
|
69431
69334
|
const workload = getWorkload();
|
|
69432
69335
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
69433
|
-
return `ur-cli/${"1.30.
|
|
69336
|
+
return `ur-cli/${"1.30.6"} (${process.env.USER_TYPE}, ${process.env.UR_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
69434
69337
|
}
|
|
69435
69338
|
function getMCPUserAgent() {
|
|
69436
69339
|
const parts = [];
|
|
@@ -69444,7 +69347,7 @@ function getMCPUserAgent() {
|
|
|
69444
69347
|
parts.push(`client-app/${process.env.UR_AGENT_SDK_CLIENT_APP}`);
|
|
69445
69348
|
}
|
|
69446
69349
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
69447
|
-
return `ur/${"1.30.
|
|
69350
|
+
return `ur/${"1.30.6"}${suffix}`;
|
|
69448
69351
|
}
|
|
69449
69352
|
function getWebFetchUserAgent() {
|
|
69450
69353
|
return `UR-User (${getURCodeUserAgent()})`;
|
|
@@ -69582,7 +69485,7 @@ var init_user = __esm(() => {
|
|
|
69582
69485
|
deviceId,
|
|
69583
69486
|
sessionId: getSessionId(),
|
|
69584
69487
|
email: getEmail(),
|
|
69585
|
-
appVersion: "1.30.
|
|
69488
|
+
appVersion: "1.30.6",
|
|
69586
69489
|
platform: getHostPlatformForAnalytics(),
|
|
69587
69490
|
organizationUuid,
|
|
69588
69491
|
accountUuid,
|
|
@@ -76099,7 +76002,7 @@ var init_metadata = __esm(() => {
|
|
|
76099
76002
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
76100
76003
|
WHITESPACE_REGEX = /\s+/;
|
|
76101
76004
|
getVersionBase = memoize_default(() => {
|
|
76102
|
-
const match = "1.30.
|
|
76005
|
+
const match = "1.30.6".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
76103
76006
|
return match ? match[0] : undefined;
|
|
76104
76007
|
});
|
|
76105
76008
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -76139,7 +76042,7 @@ var init_metadata = __esm(() => {
|
|
|
76139
76042
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
76140
76043
|
isURCodeAction: isEnvTruthy(process.env.UR_CODE_ACTION),
|
|
76141
76044
|
isURAiAuth: isURAISubscriber2(),
|
|
76142
|
-
version: "1.30.
|
|
76045
|
+
version: "1.30.6",
|
|
76143
76046
|
versionBase: getVersionBase(),
|
|
76144
76047
|
buildTime: "",
|
|
76145
76048
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
@@ -76809,7 +76712,7 @@ function initialize1PEventLogging() {
|
|
|
76809
76712
|
const platform2 = getPlatform();
|
|
76810
76713
|
const attributes = {
|
|
76811
76714
|
[import_semantic_conventions4.ATTR_SERVICE_NAME]: "ur",
|
|
76812
|
-
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.30.
|
|
76715
|
+
[import_semantic_conventions4.ATTR_SERVICE_VERSION]: "1.30.6"
|
|
76813
76716
|
};
|
|
76814
76717
|
if (platform2 === "wsl") {
|
|
76815
76718
|
const wslVersion = getWslVersion();
|
|
@@ -76836,7 +76739,7 @@ function initialize1PEventLogging() {
|
|
|
76836
76739
|
})
|
|
76837
76740
|
]
|
|
76838
76741
|
});
|
|
76839
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.30.
|
|
76742
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.urhq.ur.events", "1.30.6");
|
|
76840
76743
|
}
|
|
76841
76744
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
76842
76745
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -78256,7 +78159,7 @@ function buildHookSchemas() {
|
|
|
78256
78159
|
prompt: exports_external.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),
|
|
78257
78160
|
if: IfConditionSchema(),
|
|
78258
78161
|
timeout: exports_external.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),
|
|
78259
|
-
model: exports_external.string().optional().describe(
|
|
78162
|
+
model: exports_external.string().optional().describe("Provider-scoped model to use for this prompt hook. If not specified, uses the active provider/model selection."),
|
|
78260
78163
|
statusMessage: exports_external.string().optional().describe("Custom status message to display in spinner while hook runs"),
|
|
78261
78164
|
once: exports_external.boolean().optional().describe("If true, hook runs once and is removed after execution")
|
|
78262
78165
|
});
|
|
@@ -78275,7 +78178,7 @@ function buildHookSchemas() {
|
|
|
78275
78178
|
prompt: exports_external.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),
|
|
78276
78179
|
if: IfConditionSchema(),
|
|
78277
78180
|
timeout: exports_external.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),
|
|
78278
|
-
model: exports_external.string().optional().describe(
|
|
78181
|
+
model: exports_external.string().optional().describe("Provider-scoped model to use for this agent hook. If not specified, uses the active provider/model selection."),
|
|
78279
78182
|
statusMessage: exports_external.string().optional().describe("Custom status message to display in spinner while hook runs"),
|
|
78280
78183
|
once: exports_external.boolean().optional().describe("If true, hook runs once and is removed after execution")
|
|
78281
78184
|
});
|
|
@@ -79148,7 +79051,7 @@ function validatePermissionRule(rule) {
|
|
|
79148
79051
|
return {
|
|
79149
79052
|
valid: false,
|
|
79150
79053
|
error: "Tool names must start with uppercase",
|
|
79151
|
-
suggestion: `Use "${
|
|
79054
|
+
suggestion: `Use "${capitalize2(String(parsed.toolName))}"`
|
|
79152
79055
|
};
|
|
79153
79056
|
}
|
|
79154
79057
|
const customValidation = getCustomValidation(parsed.toolName);
|
|
@@ -79361,8 +79264,8 @@ var init_types2 = __esm(() => {
|
|
|
79361
79264
|
fallback: exports_external.union([exports_external.enum(PROVIDER_SETTING_IDS), exports_external.literal("disabled")]).optional().describe("Optional fallback provider; UR asks before using it"),
|
|
79362
79265
|
preferences: exports_external.record(exports_external.string(), NonSecretPreferenceSchema).optional().describe("Non-secret provider preferences only")
|
|
79363
79266
|
}).optional().describe("Legal provider configuration; credentials must stay in environment variables or official CLIs"),
|
|
79364
|
-
availableModels: exports_external.array(exports_external.string()).optional().describe("Allowlist of models that users can select. " +
|
|
79365
|
-
modelOverrides: exports_external.record(exports_external.string(), exports_external.string()).optional().describe(
|
|
79267
|
+
availableModels: exports_external.array(exports_external.string()).optional().describe("Allowlist of models that users can select. " + "Accepts exact provider-scoped model IDs and provider-specific aliases. " + "If undefined, all models are available. If empty array, only the default model is available. " + "Typically set in managed settings by enterprise administrators."),
|
|
79268
|
+
modelOverrides: exports_external.record(exports_external.string(), exports_external.string()).optional().describe("Override mapping from an existing model ID to a provider-specific " + "model ID. Typically set in managed settings by " + "enterprise administrators."),
|
|
79366
79269
|
enableAllProjectMcpServers: exports_external.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),
|
|
79367
79270
|
enabledMcpjsonServers: exports_external.array(exports_external.string()).optional().describe("List of approved MCP servers from .mcp.json"),
|
|
79368
79271
|
disabledMcpjsonServers: exports_external.array(exports_external.string()).optional().describe("List of rejected MCP servers from .mcp.json"),
|
|
@@ -82133,7 +82036,7 @@ function formatAgentTrendReport(report = buildAgentTrendReport()) {
|
|
|
82133
82036
|
function formatA2AAgentCard(options = {}, pretty = true) {
|
|
82134
82037
|
return JSON.stringify(buildA2AAgentCard(options), null, pretty ? 2 : 0);
|
|
82135
82038
|
}
|
|
82136
|
-
var urVersion = "1.30.
|
|
82039
|
+
var urVersion = "1.30.6", coverage, priorityRoadmap;
|
|
82137
82040
|
var init_trends = __esm(() => {
|
|
82138
82041
|
coverage = [
|
|
82139
82042
|
{
|
|
@@ -84126,7 +84029,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
84126
84029
|
if (!isAttributionHeaderEnabled()) {
|
|
84127
84030
|
return "";
|
|
84128
84031
|
}
|
|
84129
|
-
const version2 = `${"1.30.
|
|
84032
|
+
const version2 = `${"1.30.6"}.${fingerprint}`;
|
|
84130
84033
|
const entrypoint = process.env.UR_CODE_ENTRYPOINT ?? "unknown";
|
|
84131
84034
|
const cch = "";
|
|
84132
84035
|
const workload = getWorkload();
|
|
@@ -127373,27 +127276,19 @@ function modelSupportsThinking(model) {
|
|
|
127373
127276
|
return true;
|
|
127374
127277
|
}
|
|
127375
127278
|
}
|
|
127376
|
-
const canonical = getCanonicalName(model);
|
|
127377
127279
|
if (provider === "foundry" || provider === "firstParty") {
|
|
127378
|
-
return
|
|
127280
|
+
return true;
|
|
127379
127281
|
}
|
|
127380
|
-
return
|
|
127282
|
+
return false;
|
|
127381
127283
|
}
|
|
127382
127284
|
function modelSupportsAdaptiveThinking(model) {
|
|
127383
127285
|
const supported3P = get3PModelCapabilityOverride(model, "adaptive_thinking");
|
|
127384
127286
|
if (supported3P !== undefined) {
|
|
127385
127287
|
return supported3P;
|
|
127386
127288
|
}
|
|
127387
|
-
const canonical = getCanonicalName(model);
|
|
127388
127289
|
if (getAPIProvider() === "ollama") {
|
|
127389
127290
|
return false;
|
|
127390
127291
|
}
|
|
127391
|
-
if (canonical.includes("modelO-4-6") || canonical.includes("modelS-4-6")) {
|
|
127392
|
-
return true;
|
|
127393
|
-
}
|
|
127394
|
-
if (canonical.includes("modelO") || canonical.includes("modelS") || canonical.includes("modelH")) {
|
|
127395
|
-
return false;
|
|
127396
|
-
}
|
|
127397
127292
|
const provider = getAPIProvider();
|
|
127398
127293
|
return provider === "firstParty" || provider === "foundry";
|
|
127399
127294
|
}
|
|
@@ -127411,7 +127306,6 @@ var RAINBOW_COLORS, RAINBOW_SHIMMER_COLORS;
|
|
|
127411
127306
|
var init_thinking = __esm(() => {
|
|
127412
127307
|
init_growthbook();
|
|
127413
127308
|
init_antModels();
|
|
127414
|
-
init_model();
|
|
127415
127309
|
init_modelSupportOverrides();
|
|
127416
127310
|
init_providers();
|
|
127417
127311
|
init_settings2();
|
|
@@ -127437,7 +127331,6 @@ var init_thinking = __esm(() => {
|
|
|
127437
127331
|
|
|
127438
127332
|
// src/utils/effort.ts
|
|
127439
127333
|
function modelSupportsEffort(model) {
|
|
127440
|
-
const m = model.toLowerCase();
|
|
127441
127334
|
if (isEnvTruthy(process.env.UR_CODE_ALWAYS_ENABLE_EFFORT)) {
|
|
127442
127335
|
return true;
|
|
127443
127336
|
}
|
|
@@ -127445,12 +127338,6 @@ function modelSupportsEffort(model) {
|
|
|
127445
127338
|
if (supported3P !== undefined) {
|
|
127446
127339
|
return supported3P;
|
|
127447
127340
|
}
|
|
127448
|
-
if (m.includes("modelO-4-6") || m.includes("modelS-4-6")) {
|
|
127449
|
-
return true;
|
|
127450
|
-
}
|
|
127451
|
-
if (m.includes("modelH") || m.includes("modelS") || m.includes("modelO")) {
|
|
127452
|
-
return false;
|
|
127453
|
-
}
|
|
127454
127341
|
return getAPIProvider() === "firstParty";
|
|
127455
127342
|
}
|
|
127456
127343
|
function modelSupportsMaxEffort(model) {
|
|
@@ -127458,9 +127345,6 @@ function modelSupportsMaxEffort(model) {
|
|
|
127458
127345
|
if (supported3P !== undefined) {
|
|
127459
127346
|
return supported3P;
|
|
127460
127347
|
}
|
|
127461
|
-
if (model.toLowerCase().includes("modelO-4-6")) {
|
|
127462
|
-
return true;
|
|
127463
|
-
}
|
|
127464
127348
|
if (process.env.USER_TYPE === "ant" && resolveAntModel(model)) {
|
|
127465
127349
|
return true;
|
|
127466
127350
|
}
|
|
@@ -127593,7 +127477,7 @@ function getDefaultEffortForModel(model) {
|
|
|
127593
127477
|
}
|
|
127594
127478
|
return;
|
|
127595
127479
|
}
|
|
127596
|
-
if (model
|
|
127480
|
+
if (modelSupportsEffort(model)) {
|
|
127597
127481
|
if (isProSubscriber()) {
|
|
127598
127482
|
return "medium";
|
|
127599
127483
|
}
|
|
@@ -191799,7 +191683,7 @@ function getTelemetryAttributes() {
|
|
|
191799
191683
|
attributes["session.id"] = sessionId;
|
|
191800
191684
|
}
|
|
191801
191685
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
191802
|
-
attributes["app.version"] = "1.30.
|
|
191686
|
+
attributes["app.version"] = "1.30.6";
|
|
191803
191687
|
}
|
|
191804
191688
|
const oauthAccount = getOauthAccountInfo();
|
|
191805
191689
|
if (oauthAccount) {
|
|
@@ -195059,27 +194943,7 @@ function sanitizeSurfaceKey(surfaceKey) {
|
|
|
195059
194943
|
return `${surface}/${sanitizedModel}`;
|
|
195060
194944
|
}
|
|
195061
194945
|
function sanitizeModelName(shortName) {
|
|
195062
|
-
|
|
195063
|
-
return "ur-modelO-4-6";
|
|
195064
|
-
if (shortName.includes("modelO-4-5"))
|
|
195065
|
-
return "ur-modelO-4-5";
|
|
195066
|
-
if (shortName.includes("modelO-4-1"))
|
|
195067
|
-
return "ur-modelO-4-1";
|
|
195068
|
-
if (shortName.includes("modelO-4"))
|
|
195069
|
-
return "ur-modelO-4";
|
|
195070
|
-
if (shortName.includes("modelS-4-6"))
|
|
195071
|
-
return "ur-modelS-4-6";
|
|
195072
|
-
if (shortName.includes("modelS-4-5"))
|
|
195073
|
-
return "ur-modelS-4-5";
|
|
195074
|
-
if (shortName.includes("modelS-4"))
|
|
195075
|
-
return "ur-modelS-4";
|
|
195076
|
-
if (shortName.includes("modelS-3-7"))
|
|
195077
|
-
return "ur-modelS-3-7";
|
|
195078
|
-
if (shortName.includes("modelH-4-5"))
|
|
195079
|
-
return "ur-modelH-4-5";
|
|
195080
|
-
if (shortName.includes("modelH-3-5"))
|
|
195081
|
-
return "ur-modelH-3-5";
|
|
195082
|
-
return "ur";
|
|
194946
|
+
return shortName.replace(/[^a-zA-Z0-9._:/-]/g, "").slice(0, 80) || "provider-model";
|
|
195083
194947
|
}
|
|
195084
194948
|
function getClientSurface() {
|
|
195085
194949
|
return process.env.UR_CODE_ENTRYPOINT ?? "cli";
|
|
@@ -227204,7 +227068,7 @@ function getInstallationEnv() {
|
|
|
227204
227068
|
return;
|
|
227205
227069
|
}
|
|
227206
227070
|
function getURCodeVersion() {
|
|
227207
|
-
return "1.30.
|
|
227071
|
+
return "1.30.6";
|
|
227208
227072
|
}
|
|
227209
227073
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
227210
227074
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -230043,7 +229907,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
230043
229907
|
const client2 = new Client({
|
|
230044
229908
|
name: "ur",
|
|
230045
229909
|
title: "UR",
|
|
230046
|
-
version: "1.30.
|
|
229910
|
+
version: "1.30.6",
|
|
230047
229911
|
description: "UR-AGENT autonomous engineering workflow engine",
|
|
230048
229912
|
websiteUrl: PRODUCT_URL
|
|
230049
229913
|
}, {
|
|
@@ -230397,7 +230261,7 @@ var init_client5 = __esm(() => {
|
|
|
230397
230261
|
const client2 = new Client({
|
|
230398
230262
|
name: "ur",
|
|
230399
230263
|
title: "UR",
|
|
230400
|
-
version: "1.30.
|
|
230264
|
+
version: "1.30.6",
|
|
230401
230265
|
description: "UR-AGENT autonomous engineering workflow engine",
|
|
230402
230266
|
websiteUrl: PRODUCT_URL
|
|
230403
230267
|
}, {
|
|
@@ -231508,7 +231372,7 @@ function getAgentModelDisplay(model) {
|
|
|
231508
231372
|
return "Inherit from parent (default)";
|
|
231509
231373
|
if (model === "inherit")
|
|
231510
231374
|
return "Inherit from parent";
|
|
231511
|
-
return
|
|
231375
|
+
return capitalize2(model);
|
|
231512
231376
|
}
|
|
231513
231377
|
function getAgentModelOptions() {
|
|
231514
231378
|
return [
|
|
@@ -233412,13 +233276,11 @@ function getExperimentAdvisorModels() {
|
|
|
233412
233276
|
const config2 = getAdvisorConfig();
|
|
233413
233277
|
return isAdvisorEnabled() && !canUserConfigureAdvisor() && config2.baseModel && config2.advisorModel ? { baseModel: config2.baseModel, advisorModel: config2.advisorModel } : undefined;
|
|
233414
233278
|
}
|
|
233415
|
-
function modelSupportsAdvisor(
|
|
233416
|
-
|
|
233417
|
-
return m.includes("modelO-4-6") || m.includes("modelS-4-6") || process.env.USER_TYPE === "ant";
|
|
233279
|
+
function modelSupportsAdvisor(_model) {
|
|
233280
|
+
return process.env.USER_TYPE === "ant" || shouldIncludeFirstPartyOnlyBetas();
|
|
233418
233281
|
}
|
|
233419
|
-
function isValidAdvisorModel(
|
|
233420
|
-
|
|
233421
|
-
return m.includes("modelO-4-6") || m.includes("modelS-4-6") || process.env.USER_TYPE === "ant";
|
|
233282
|
+
function isValidAdvisorModel(_model) {
|
|
233283
|
+
return process.env.USER_TYPE === "ant" || shouldIncludeFirstPartyOnlyBetas();
|
|
233422
233284
|
}
|
|
233423
233285
|
function getInitialAdvisorSetting() {
|
|
233424
233286
|
if (!isAdvisorEnabled()) {
|
|
@@ -240213,9 +240075,9 @@ async function assertMinVersion() {
|
|
|
240213
240075
|
if (false) {}
|
|
240214
240076
|
try {
|
|
240215
240077
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
240216
|
-
if (versionConfig.minVersion && lt("1.30.
|
|
240078
|
+
if (versionConfig.minVersion && lt("1.30.6", versionConfig.minVersion)) {
|
|
240217
240079
|
console.error(`
|
|
240218
|
-
It looks like your version of UR (${"1.30.
|
|
240080
|
+
It looks like your version of UR (${"1.30.6"}) needs an update.
|
|
240219
240081
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
240220
240082
|
|
|
240221
240083
|
To update, please run:
|
|
@@ -240431,7 +240293,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
240431
240293
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
240432
240294
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
240433
240295
|
pid: process.pid,
|
|
240434
|
-
currentVersion: "1.30.
|
|
240296
|
+
currentVersion: "1.30.6"
|
|
240435
240297
|
});
|
|
240436
240298
|
return "in_progress";
|
|
240437
240299
|
}
|
|
@@ -240440,7 +240302,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
240440
240302
|
if (!env2.isRunningWithBun() && env2.isNpmFromWindowsPath()) {
|
|
240441
240303
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
240442
240304
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
240443
|
-
currentVersion: "1.30.
|
|
240305
|
+
currentVersion: "1.30.6"
|
|
240444
240306
|
});
|
|
240445
240307
|
console.error(`
|
|
240446
240308
|
Error: Windows NPM detected in WSL
|
|
@@ -240975,7 +240837,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
240975
240837
|
}
|
|
240976
240838
|
async function getDoctorDiagnostic() {
|
|
240977
240839
|
const installationType = await getCurrentInstallationType();
|
|
240978
|
-
const version2 = typeof MACRO !== "undefined" ? "1.30.
|
|
240840
|
+
const version2 = typeof MACRO !== "undefined" ? "1.30.6" : "unknown";
|
|
240979
240841
|
const installationPath = await getInstallationPath();
|
|
240980
240842
|
const invokedBinary = getInvokedBinary();
|
|
240981
240843
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -241910,8 +241772,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
241910
241772
|
const maxVersion = await getMaxVersion();
|
|
241911
241773
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
241912
241774
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
241913
|
-
if (gte("1.30.
|
|
241914
|
-
logForDebugging(`Native installer: current version ${"1.30.
|
|
241775
|
+
if (gte("1.30.6", maxVersion)) {
|
|
241776
|
+
logForDebugging(`Native installer: current version ${"1.30.6"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
241915
241777
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
241916
241778
|
latency_ms: Date.now() - startTime,
|
|
241917
241779
|
max_version: maxVersion,
|
|
@@ -241922,7 +241784,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
241922
241784
|
version2 = maxVersion;
|
|
241923
241785
|
}
|
|
241924
241786
|
}
|
|
241925
|
-
if (!forceReinstall && version2 === "1.30.
|
|
241787
|
+
if (!forceReinstall && version2 === "1.30.6" && await versionIsAvailable(version2) && await isPossibleURBinary(executablePath)) {
|
|
241926
241788
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
241927
241789
|
logEvent("tengu_native_update_complete", {
|
|
241928
241790
|
latency_ms: Date.now() - startTime,
|
|
@@ -246592,7 +246454,7 @@ var init_coreSchemas = __esm(() => {
|
|
|
246592
246454
|
tools: exports_external.array(exports_external.string()).optional().describe("Array of allowed tool names. If omitted, inherits all tools from parent"),
|
|
246593
246455
|
disallowedTools: exports_external.array(exports_external.string()).optional().describe("Array of tool names to explicitly disallow for this agent"),
|
|
246594
246456
|
prompt: exports_external.string().describe("The agent's system prompt"),
|
|
246595
|
-
model: exports_external.string().optional().describe("
|
|
246457
|
+
model: exports_external.string().optional().describe("Provider-scoped model ID. If omitted or 'inherit', uses the active provider/model selection."),
|
|
246596
246458
|
mcpServers: exports_external.array(AgentMcpServerSpecSchema2()).optional(),
|
|
246597
246459
|
criticalSystemReminder_EXPERIMENTAL: exports_external.string().optional().describe("Experimental: Critical reminder added to system prompt"),
|
|
246598
246460
|
skills: exports_external.array(exports_external.string()).optional().describe("Array of skill names to preload into the agent context"),
|
|
@@ -294633,8 +294495,7 @@ var init_WebSearchTool = __esm(() => {
|
|
|
294633
294495
|
return true;
|
|
294634
294496
|
}
|
|
294635
294497
|
if (provider === "vertex") {
|
|
294636
|
-
|
|
294637
|
-
return supportsWebSearch;
|
|
294498
|
+
return false;
|
|
294638
294499
|
}
|
|
294639
294500
|
if (provider === "foundry") {
|
|
294640
294501
|
return true;
|
|
@@ -299517,19 +299378,19 @@ function getModelOptionsBase(fastMode = false) {
|
|
|
299517
299378
|
}
|
|
299518
299379
|
function getModelFamilyInfo(model) {
|
|
299519
299380
|
const canonical = getCanonicalName(model);
|
|
299520
|
-
if (canonical.includes("
|
|
299381
|
+
if (canonical.includes("models")) {
|
|
299521
299382
|
const currentName = getMarketingNameForModel(getDefaultmodelSModel());
|
|
299522
299383
|
if (currentName) {
|
|
299523
299384
|
return { alias: "modelS", currentVersionName: currentName };
|
|
299524
299385
|
}
|
|
299525
299386
|
}
|
|
299526
|
-
if (canonical.includes("
|
|
299387
|
+
if (canonical.includes("modelo")) {
|
|
299527
299388
|
const currentName = getMarketingNameForModel(getDefaultmodelOModel());
|
|
299528
299389
|
if (currentName) {
|
|
299529
299390
|
return { alias: "modelO", currentVersionName: currentName };
|
|
299530
299391
|
}
|
|
299531
299392
|
}
|
|
299532
|
-
if (canonical.includes("
|
|
299393
|
+
if (canonical.includes("modelh")) {
|
|
299533
299394
|
const currentName = getMarketingNameForModel(getDefaultmodelHModel());
|
|
299534
299395
|
if (currentName) {
|
|
299535
299396
|
return { alias: "modelH", currentVersionName: currentName };
|
|
@@ -299740,16 +299601,6 @@ function get3PFallbackSuggestion(model) {
|
|
|
299740
299601
|
if (getAPIProvider() === "firstParty") {
|
|
299741
299602
|
return;
|
|
299742
299603
|
}
|
|
299743
|
-
const lowerModel = model.toLowerCase();
|
|
299744
|
-
if (lowerModel.includes("modelO-4-6") || lowerModel.includes("modelO_4_6")) {
|
|
299745
|
-
return getModelStrings2().modelO41;
|
|
299746
|
-
}
|
|
299747
|
-
if (lowerModel.includes("modelS-4-6") || lowerModel.includes("modelS_4_6")) {
|
|
299748
|
-
return getModelStrings2().modelS45;
|
|
299749
|
-
}
|
|
299750
|
-
if (lowerModel.includes("modelS-4-5") || lowerModel.includes("modelS_4_5")) {
|
|
299751
|
-
return getModelStrings2().modelS40;
|
|
299752
|
-
}
|
|
299753
299604
|
return;
|
|
299754
299605
|
}
|
|
299755
299606
|
var validModelCache;
|
|
@@ -299759,7 +299610,6 @@ var init_validateModel = __esm(() => {
|
|
|
299759
299610
|
init_providers();
|
|
299760
299611
|
init_sideQuery();
|
|
299761
299612
|
init_urhq_sdk();
|
|
299762
|
-
init_modelStrings();
|
|
299763
299613
|
validModelCache = new Map;
|
|
299764
299614
|
});
|
|
299765
299615
|
|
|
@@ -307190,7 +307040,7 @@ information. Do not blow your cover.
|
|
|
307190
307040
|
|
|
307191
307041
|
NEVER include in commit messages or PR descriptions:
|
|
307192
307042
|
- Internal model codenames (animal names like Capybara, Tengu, etc.)
|
|
307193
|
-
- Unreleased model version numbers
|
|
307043
|
+
- Unreleased model version numbers
|
|
307194
307044
|
- Internal repo or project names (e.g., ur-cli-internal, urhqs/\u2026)
|
|
307195
307045
|
- Internal tooling, Slack channels, or short links (e.g., go/cc, #ur-\u2026)
|
|
307196
307046
|
- The phrase "UR" or any mention that you are an AI
|
|
@@ -307207,9 +307057,9 @@ GOOD:
|
|
|
307207
307057
|
|
|
307208
307058
|
BAD (never write these):
|
|
307209
307059
|
- "Fix bug found while testing with UR Capybara"
|
|
307210
|
-
- "1-shotted by
|
|
307060
|
+
- "1-shotted by internal-model-id"
|
|
307211
307061
|
- "Generated with UR"
|
|
307212
|
-
- "Co-Authored-By: UR
|
|
307062
|
+
- "Co-Authored-By: UR internal model <\u2026>"
|
|
307213
307063
|
`;
|
|
307214
307064
|
}
|
|
307215
307065
|
return "";
|
|
@@ -318612,7 +318462,7 @@ async function isToolSearchEnabled(model, tools, getToolPermissionContext, agent
|
|
|
318612
318462
|
});
|
|
318613
318463
|
}
|
|
318614
318464
|
if (!modelSupportsToolReference(model)) {
|
|
318615
|
-
logForDebugging(`Tool search disabled for model '${model}': model does not support tool_reference blocks. ` + `This feature is only available on
|
|
318465
|
+
logForDebugging(`Tool search disabled for model '${model}': model does not support tool_reference blocks. ` + `This feature is only available on provider models that support tool_reference blocks.`);
|
|
318616
318466
|
logModeDecision(false, "standard", "model_unsupported");
|
|
318617
318467
|
return false;
|
|
318618
318468
|
}
|
|
@@ -320419,7 +320269,7 @@ var init_FileReadTool = __esm(() => {
|
|
|
320419
320269
|
}
|
|
320420
320270
|
}
|
|
320421
320271
|
});
|
|
320422
|
-
MITIGATION_EXEMPT_MODELS = new Set
|
|
320272
|
+
MITIGATION_EXEMPT_MODELS = new Set;
|
|
320423
320273
|
memoryFileMtimes = new WeakMap;
|
|
320424
320274
|
});
|
|
320425
320275
|
|
|
@@ -331466,7 +331316,7 @@ Run /share and post the JSON file to ${"https://github.com/Maitham16/UR/issues"}
|
|
|
331466
331316
|
}
|
|
331467
331317
|
if (isURAISubscriber2() && error40 instanceof APIError && error40.status === 400 && error40.message.toLowerCase().includes("invalid model name") && (isNonCustommodelOModel(model) || model === "modelO")) {
|
|
331468
331318
|
return createAssistantAPIErrorMessage({
|
|
331469
|
-
content: "
|
|
331319
|
+
content: "The selected model is not available with the current plan. Run /model and choose a valid model for the active provider.",
|
|
331470
331320
|
error: "invalid_request"
|
|
331471
331321
|
});
|
|
331472
331322
|
}
|
|
@@ -331564,16 +331414,6 @@ function get3PModelFallbackSuggestion(model) {
|
|
|
331564
331414
|
if (getAPIProvider() === "firstParty") {
|
|
331565
331415
|
return;
|
|
331566
331416
|
}
|
|
331567
|
-
const m = model.toLowerCase();
|
|
331568
|
-
if (m.includes("modelO-4-6") || m.includes("modelO_4_6")) {
|
|
331569
|
-
return getModelStrings2().modelO41;
|
|
331570
|
-
}
|
|
331571
|
-
if (m.includes("modelS-4-6") || m.includes("modelS_4_6")) {
|
|
331572
|
-
return getModelStrings2().modelS45;
|
|
331573
|
-
}
|
|
331574
|
-
if (m.includes("modelS-4-5") || m.includes("modelS_4_5")) {
|
|
331575
|
-
return getModelStrings2().modelS40;
|
|
331576
|
-
}
|
|
331577
331417
|
return;
|
|
331578
331418
|
}
|
|
331579
331419
|
function classifyAPIError(error40) {
|
|
@@ -331677,7 +331517,7 @@ function getErrorMessageIfRefusal(stopReason, model) {
|
|
|
331677
331517
|
}
|
|
331678
331518
|
logEvent("tengu_refusal_api_response", {});
|
|
331679
331519
|
const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}: UR is unable to respond to this request. Try rephrasing the request or attempting a different approach.` : `${API_ERROR_MESSAGE_PREFIX}: UR is unable to respond to this request. Please double press esc to edit your last message or start a new session for UR to assist with a different task.`;
|
|
331680
|
-
const modelSuggestion =
|
|
331520
|
+
const modelSuggestion = getIsNonInteractiveSession() ? "" : " If you are seeing this refusal repeatedly, run /model and choose another valid model for the active provider.";
|
|
331681
331521
|
return createAssistantAPIErrorMessage({
|
|
331682
331522
|
content: baseMessage + modelSuggestion,
|
|
331683
331523
|
error: "invalid_request"
|
|
@@ -331690,7 +331530,6 @@ var init_errors6 = __esm(() => {
|
|
|
331690
331530
|
init_auth();
|
|
331691
331531
|
init_messages();
|
|
331692
331532
|
init_model();
|
|
331693
|
-
init_modelStrings();
|
|
331694
331533
|
init_providers();
|
|
331695
331534
|
init_state();
|
|
331696
331535
|
init_apiLimits();
|
|
@@ -338849,7 +338688,7 @@ function Feedback({
|
|
|
338849
338688
|
platform: env2.platform,
|
|
338850
338689
|
gitRepo: envInfo.isGit,
|
|
338851
338690
|
terminal: env2.terminal,
|
|
338852
|
-
version: "1.30.
|
|
338691
|
+
version: "1.30.6",
|
|
338853
338692
|
transcript: normalizeMessagesForAPI(messages),
|
|
338854
338693
|
errors: sanitizedErrors,
|
|
338855
338694
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -339041,7 +338880,7 @@ function Feedback({
|
|
|
339041
338880
|
", ",
|
|
339042
338881
|
env2.terminal,
|
|
339043
338882
|
", v",
|
|
339044
|
-
"1.30.
|
|
338883
|
+
"1.30.6"
|
|
339045
338884
|
]
|
|
339046
338885
|
}, undefined, true, undefined, this)
|
|
339047
338886
|
]
|
|
@@ -339147,7 +338986,7 @@ ${sanitizedDescription}
|
|
|
339147
338986
|
` + `**Environment Info**
|
|
339148
338987
|
` + `- Platform: ${env2.platform}
|
|
339149
338988
|
` + `- Terminal: ${env2.terminal}
|
|
339150
|
-
` + `- Version: ${"1.30.
|
|
338989
|
+
` + `- Version: ${"1.30.6"}
|
|
339151
338990
|
` + `- Feedback ID: ${feedbackId}
|
|
339152
338991
|
` + `
|
|
339153
338992
|
**Errors**
|
|
@@ -342258,7 +342097,7 @@ function buildPrimarySection() {
|
|
|
342258
342097
|
}, undefined, false, undefined, this);
|
|
342259
342098
|
return [{
|
|
342260
342099
|
label: "Version",
|
|
342261
|
-
value: "1.30.
|
|
342100
|
+
value: "1.30.6"
|
|
342262
342101
|
}, {
|
|
342263
342102
|
label: "Session name",
|
|
342264
342103
|
value: nameValue
|
|
@@ -343236,7 +343075,7 @@ function ModelPicker({
|
|
|
343236
343075
|
}, undefined, false, undefined, this),
|
|
343237
343076
|
/* @__PURE__ */ jsx_dev_runtime172.jsxDEV(ThemedText, {
|
|
343238
343077
|
dimColor: true,
|
|
343239
|
-
children: headerText ?? "Switch between
|
|
343078
|
+
children: headerText ?? "Switch between models for the active provider. Applies to this session and future UR sessions. For other provider-scoped model names, specify with --model."
|
|
343240
343079
|
}, undefined, false, undefined, this),
|
|
343241
343080
|
sessionModel && /* @__PURE__ */ jsx_dev_runtime172.jsxDEV(ThemedText, {
|
|
343242
343081
|
dimColor: true,
|
|
@@ -343438,11 +343277,11 @@ function isBilledAsExtraUsage(model, isFastMode, ismodelO1mMerged) {
|
|
|
343438
343277
|
if (model === null || !has1mContext(model))
|
|
343439
343278
|
return false;
|
|
343440
343279
|
const m = model.toLowerCase().replace(/\[1m\]$/, "").trim();
|
|
343441
|
-
const
|
|
343442
|
-
const
|
|
343443
|
-
if (
|
|
343280
|
+
const ismodelO = m === "modelo";
|
|
343281
|
+
const ismodelS = m === "models";
|
|
343282
|
+
if (ismodelO && ismodelO1mMerged)
|
|
343444
343283
|
return false;
|
|
343445
|
-
return
|
|
343284
|
+
return ismodelO || ismodelS;
|
|
343446
343285
|
}
|
|
343447
343286
|
var init_extraUsage = __esm(() => {
|
|
343448
343287
|
init_auth();
|
|
@@ -345558,7 +345397,7 @@ function Config({
|
|
|
345558
345397
|
}
|
|
345559
345398
|
}, undefined, false, undefined, this)
|
|
345560
345399
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime177.jsxDEV(ChannelDowngradeDialog, {
|
|
345561
|
-
currentVersion: "1.30.
|
|
345400
|
+
currentVersion: "1.30.6",
|
|
345562
345401
|
onChoice: (choice) => {
|
|
345563
345402
|
setShowSubmenu(null);
|
|
345564
345403
|
setTabsHidden(false);
|
|
@@ -345570,7 +345409,7 @@ function Config({
|
|
|
345570
345409
|
autoUpdatesChannel: "stable"
|
|
345571
345410
|
};
|
|
345572
345411
|
if (choice === "stay") {
|
|
345573
|
-
newSettings.minimumVersion = "1.30.
|
|
345412
|
+
newSettings.minimumVersion = "1.30.6";
|
|
345574
345413
|
}
|
|
345575
345414
|
updateSettingsForSource("userSettings", newSettings);
|
|
345576
345415
|
setSettingsData((prev_27) => ({
|
|
@@ -351075,7 +350914,7 @@ function Doctor(t0) {
|
|
|
351075
350914
|
upperLimit: TASK_MAX_OUTPUT_UPPER_LIMIT
|
|
351076
350915
|
}, {
|
|
351077
350916
|
name: "UR_CODE_MAX_OUTPUT_TOKENS",
|
|
351078
|
-
...getModelMaxOutputTokens("
|
|
350917
|
+
...getModelMaxOutputTokens("active-provider-model")
|
|
351079
350918
|
}];
|
|
351080
350919
|
t4 = envVars.map(_temp84).filter(_temp93);
|
|
351081
350920
|
$3[5] = t4;
|
|
@@ -353640,7 +353479,7 @@ function HelpV2(t0) {
|
|
|
353640
353479
|
let t6;
|
|
353641
353480
|
if ($3[31] !== tabs) {
|
|
353642
353481
|
t6 = /* @__PURE__ */ jsx_dev_runtime204.jsxDEV(Tabs, {
|
|
353643
|
-
title: `UR v${"1.30.
|
|
353482
|
+
title: `UR v${"1.30.6"}`,
|
|
353644
353483
|
color: "professionalBlue",
|
|
353645
353484
|
defaultTab: "general",
|
|
353646
353485
|
children: tabs
|
|
@@ -354386,7 +354225,7 @@ function buildToolUseContext(tools, readFileStateCache) {
|
|
|
354386
354225
|
async function handleInitialize(options2) {
|
|
354387
354226
|
return {
|
|
354388
354227
|
name: "ur-agent",
|
|
354389
|
-
version: "1.30.
|
|
354228
|
+
version: "1.30.6",
|
|
354390
354229
|
protocolVersion: "0.1.0",
|
|
354391
354230
|
workspaceRoot: options2.cwd,
|
|
354392
354231
|
capabilities: {
|
|
@@ -359614,7 +359453,7 @@ function MCPAgentServerMenu({
|
|
|
359614
359453
|
authAbortControllerRef.current = null;
|
|
359615
359454
|
}
|
|
359616
359455
|
}, [agentServer, onComplete]);
|
|
359617
|
-
const capitalizedServerName =
|
|
359456
|
+
const capitalizedServerName = capitalize2(String(agentServer.name));
|
|
359618
359457
|
if (isAuthenticating) {
|
|
359619
359458
|
return /* @__PURE__ */ jsx_dev_runtime221.jsxDEV(ThemedBox_default, {
|
|
359620
359459
|
flexDirection: "column",
|
|
@@ -361843,7 +361682,7 @@ function MCPRemoteServerMenu({
|
|
|
361843
361682
|
}
|
|
361844
361683
|
}
|
|
361845
361684
|
});
|
|
361846
|
-
const capitalizedServerName =
|
|
361685
|
+
const capitalizedServerName = capitalize2(String(server2.name));
|
|
361847
361686
|
const serverCommandsCount = filterMcpPromptsByServer(mcp.commands, server2.name).length;
|
|
361848
361687
|
const toggleMcpServer = useMcpToggleEnabled();
|
|
361849
361688
|
const handleURAIAuth = import_react128.default.useCallback(async () => {
|
|
@@ -362627,7 +362466,7 @@ function MCPStdioServerMenu({
|
|
|
362627
362466
|
onComplete(`Failed to ${action2} MCP server '${server2.name}': ${errorMessage2(err2)}`);
|
|
362628
362467
|
}
|
|
362629
362468
|
}, [server2.client.type, server2.name, toggleMcpServer, onCancel, onComplete]);
|
|
362630
|
-
const capitalizedServerName =
|
|
362469
|
+
const capitalizedServerName = capitalize2(String(server2.name));
|
|
362631
362470
|
const serverCommandsCount = filterMcpPromptsByServer(mcp.commands, server2.name).length;
|
|
362632
362471
|
const menuOptions = [];
|
|
362633
362472
|
if (server2.client.type !== "disabled" && serverToolsCount > 0) {
|
|
@@ -374510,7 +374349,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
374510
374349
|
return [];
|
|
374511
374350
|
}
|
|
374512
374351
|
}
|
|
374513
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.30.
|
|
374352
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.30.6") {
|
|
374514
374353
|
if (process.env.USER_TYPE === "ant") {
|
|
374515
374354
|
const changelog = "";
|
|
374516
374355
|
if (changelog) {
|
|
@@ -374537,7 +374376,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.30.5")
|
|
|
374537
374376
|
releaseNotes
|
|
374538
374377
|
};
|
|
374539
374378
|
}
|
|
374540
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.30.
|
|
374379
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.30.6") {
|
|
374541
374380
|
if (process.env.USER_TYPE === "ant") {
|
|
374542
374381
|
const changelog = "";
|
|
374543
374382
|
if (changelog) {
|
|
@@ -375707,7 +375546,7 @@ function getRecentActivitySync() {
|
|
|
375707
375546
|
return cachedActivity;
|
|
375708
375547
|
}
|
|
375709
375548
|
function getLogoDisplayData() {
|
|
375710
|
-
const version2 = process.env.DEMO_VERSION ?? "1.30.
|
|
375549
|
+
const version2 = process.env.DEMO_VERSION ?? "1.30.6";
|
|
375711
375550
|
const serverUrl = getDirectConnectServerUrl();
|
|
375712
375551
|
const displayPath = process.env.DEMO_VERSION ? "/code/ur" : getDisplayPath(getCwd2());
|
|
375713
375552
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -376496,7 +376335,7 @@ function LogoV2() {
|
|
|
376496
376335
|
if ($3[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
376497
376336
|
t2 = () => {
|
|
376498
376337
|
const currentConfig = getGlobalConfig();
|
|
376499
|
-
if (currentConfig.lastReleaseNotesSeen === "1.30.
|
|
376338
|
+
if (currentConfig.lastReleaseNotesSeen === "1.30.6") {
|
|
376500
376339
|
return;
|
|
376501
376340
|
}
|
|
376502
376341
|
saveGlobalConfig(_temp326);
|
|
@@ -377181,12 +377020,12 @@ function LogoV2() {
|
|
|
377181
377020
|
return t41;
|
|
377182
377021
|
}
|
|
377183
377022
|
function _temp326(current) {
|
|
377184
|
-
if (current.lastReleaseNotesSeen === "1.30.
|
|
377023
|
+
if (current.lastReleaseNotesSeen === "1.30.6") {
|
|
377185
377024
|
return current;
|
|
377186
377025
|
}
|
|
377187
377026
|
return {
|
|
377188
377027
|
...current,
|
|
377189
|
-
lastReleaseNotesSeen: "1.30.
|
|
377028
|
+
lastReleaseNotesSeen: "1.30.6"
|
|
377190
377029
|
};
|
|
377191
377030
|
}
|
|
377192
377031
|
function _temp243(s_0) {
|
|
@@ -587308,7 +587147,7 @@ function ColorPicker(t0) {
|
|
|
587308
587147
|
}, undefined, false, undefined, this),
|
|
587309
587148
|
/* @__PURE__ */ jsx_dev_runtime309.jsxDEV(ThemedText, {
|
|
587310
587149
|
bold: isSelected,
|
|
587311
|
-
children:
|
|
587150
|
+
children: capitalize2(option22)
|
|
587312
587151
|
}, undefined, false, undefined, this)
|
|
587313
587152
|
]
|
|
587314
587153
|
}, undefined, true, undefined, this)
|
|
@@ -592901,7 +592740,7 @@ async function captureMemoryDiagnostics(trigger2, dumpNumber = 0) {
|
|
|
592901
592740
|
smapsRollup,
|
|
592902
592741
|
platform: process.platform,
|
|
592903
592742
|
nodeVersion: process.version,
|
|
592904
|
-
ccVersion: "1.30.
|
|
592743
|
+
ccVersion: "1.30.6"
|
|
592905
592744
|
};
|
|
592906
592745
|
}
|
|
592907
592746
|
async function performHeapDump(trigger2 = "manual", dumpNumber = 0) {
|
|
@@ -593487,7 +593326,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
593487
593326
|
var call136 = async () => {
|
|
593488
593327
|
return {
|
|
593489
593328
|
type: "text",
|
|
593490
|
-
value: "1.30.
|
|
593329
|
+
value: "1.30.6"
|
|
593491
593330
|
};
|
|
593492
593331
|
}, version2, version_default;
|
|
593493
593332
|
var init_version = __esm(() => {
|
|
@@ -596986,13 +596825,13 @@ function SetModelAndClose({
|
|
|
596986
596825
|
return;
|
|
596987
596826
|
}
|
|
596988
596827
|
if (model && ismodelO1mUnavailable(model)) {
|
|
596989
|
-
onDone(`
|
|
596828
|
+
onDone(`The selected 1M-context model is not available for your account. Choose another model with /model.`, {
|
|
596990
596829
|
display: "system"
|
|
596991
596830
|
});
|
|
596992
596831
|
return;
|
|
596993
596832
|
}
|
|
596994
596833
|
if (model && ismodelS1mUnavailable(model)) {
|
|
596995
|
-
onDone(`
|
|
596834
|
+
onDone(`The selected 1M-context model is not available for your account. Choose another model with /model.`, {
|
|
596996
596835
|
display: "system"
|
|
596997
596836
|
});
|
|
596998
596837
|
return;
|
|
@@ -597066,11 +596905,11 @@ function SetModelAndClose({
|
|
|
597066
596905
|
}
|
|
597067
596906
|
function ismodelO1mUnavailable(model) {
|
|
597068
596907
|
const m = model.toLowerCase();
|
|
597069
|
-
return !checkmodelO1mAccess() && !ismodelO1mMergeEnabled() && m.includes("
|
|
596908
|
+
return !checkmodelO1mAccess() && !ismodelO1mMergeEnabled() && m.includes("modelo") && m.includes("[1m]");
|
|
597070
596909
|
}
|
|
597071
596910
|
function ismodelS1mUnavailable(model) {
|
|
597072
596911
|
const m = model.toLowerCase();
|
|
597073
|
-
return !checkmodelS1mAccess() &&
|
|
596912
|
+
return !checkmodelS1mAccess() && m.includes("models") && m.includes("[1m]");
|
|
597074
596913
|
}
|
|
597075
596914
|
function ShowModelAndClose(t0) {
|
|
597076
596915
|
const {
|
|
@@ -603440,7 +603279,7 @@ function generateHtmlReport(data, insights) {
|
|
|
603440
603279
|
</html>`;
|
|
603441
603280
|
}
|
|
603442
603281
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
603443
|
-
const version3 = typeof MACRO !== "undefined" ? "1.30.
|
|
603282
|
+
const version3 = typeof MACRO !== "undefined" ? "1.30.6" : "unknown";
|
|
603444
603283
|
const remote_hosts_collected = remoteStats?.hosts.filter((h2) => h2.sessionCount > 0).map((h2) => h2.name);
|
|
603445
603284
|
const facets_summary = {
|
|
603446
603285
|
total: facets.size,
|
|
@@ -607718,7 +607557,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
607718
607557
|
init_settings2();
|
|
607719
607558
|
init_slowOperations();
|
|
607720
607559
|
init_uuid();
|
|
607721
|
-
VERSION5 = typeof MACRO !== "undefined" ? "1.30.
|
|
607560
|
+
VERSION5 = typeof MACRO !== "undefined" ? "1.30.6" : "unknown";
|
|
607722
607561
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
607723
607562
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
607724
607563
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -608923,7 +608762,7 @@ var init_filesystem = __esm(() => {
|
|
|
608923
608762
|
});
|
|
608924
608763
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
608925
608764
|
const nonce = randomBytes18(16).toString("hex");
|
|
608926
|
-
return join200(getURTempDir(), "bundled-skills", "1.30.
|
|
608765
|
+
return join200(getURTempDir(), "bundled-skills", "1.30.6", nonce);
|
|
608927
608766
|
});
|
|
608928
608767
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
608929
608768
|
});
|
|
@@ -614644,9 +614483,9 @@ async function computeSimpleEnvInfo(modelId, additionalWorkingDirectories) {
|
|
|
614644
614483
|
`OS Version: ${unameSR}`,
|
|
614645
614484
|
modelDescription,
|
|
614646
614485
|
knowledgeCutoffMessage,
|
|
614647
|
-
includeURProductInfo ? `
|
|
614486
|
+
includeURProductInfo ? `UR uses the provider and model selected in /model. Do not invent UR-specific model IDs; choose models from the active provider's model list.` : null,
|
|
614648
614487
|
includeURProductInfo ? `UR is available as a CLI in the terminal, desktop app (Mac/Windows), web app (ur.ai/code), and IDE extensions (VS Code, JetBrains).` : null,
|
|
614649
|
-
includeURProductInfo ? `Fast mode for UR
|
|
614488
|
+
includeURProductInfo ? `Fast mode for UR keeps the selected provider/model and requests faster output when that backend supports it. It can be toggled with /fast.` : null
|
|
614650
614489
|
].filter((item) => item !== null);
|
|
614651
614490
|
return [
|
|
614652
614491
|
`# Environment`,
|
|
@@ -614657,17 +614496,14 @@ async function computeSimpleEnvInfo(modelId, additionalWorkingDirectories) {
|
|
|
614657
614496
|
}
|
|
614658
614497
|
function getKnowledgeCutoff(modelId) {
|
|
614659
614498
|
const canonical = getCanonicalName(modelId);
|
|
614660
|
-
if (canonical.includes("
|
|
614661
|
-
return "
|
|
614662
|
-
|
|
614663
|
-
return "
|
|
614664
|
-
|
|
614665
|
-
return "
|
|
614666
|
-
|
|
614667
|
-
return "
|
|
614668
|
-
} else if (canonical.includes("ur-modelO-4") || canonical.includes("ur-modelS-4")) {
|
|
614669
|
-
return "January 2025";
|
|
614670
|
-
}
|
|
614499
|
+
if (canonical.includes("gpt-5"))
|
|
614500
|
+
return "2025";
|
|
614501
|
+
if (canonical.includes("gpt-4"))
|
|
614502
|
+
return "2024";
|
|
614503
|
+
if (canonical.includes("claude"))
|
|
614504
|
+
return "2025";
|
|
614505
|
+
if (canonical.includes("gemini"))
|
|
614506
|
+
return "2025";
|
|
614671
614507
|
return null;
|
|
614672
614508
|
}
|
|
614673
614509
|
function getShellInfoLine() {
|
|
@@ -614733,7 +614569,7 @@ function getFunctionResultClearingSection(model) {
|
|
|
614733
614569
|
|
|
614734
614570
|
Old tool results will be automatically cleared from context to free up space. The ${config3.keepRecent} most recent results are always kept.`;
|
|
614735
614571
|
}
|
|
614736
|
-
var getCachedMCConfigForFRC = null, DISCOVER_SKILLS_TOOL_NAME = null, SYSTEM_PROMPT_DYNAMIC_BOUNDARY = "__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__",
|
|
614572
|
+
var getCachedMCConfigForFRC = null, DISCOVER_SKILLS_TOOL_NAME = null, SYSTEM_PROMPT_DYNAMIC_BOUNDARY = "__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__", DEFAULT_AGENT_PROMPT = `You are an agent for Ur. Given the user's message, you should use the tools available to complete the task. Complete the task fully\u2014don't gold-plate, but don't leave it half-done. When you complete the task, respond with a concise report covering what was done and any key findings \u2014 the caller will relay this to the user, so it only needs the essentials.`, SUMMARIZE_TOOL_RESULTS_SECTION = `When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.`;
|
|
614737
614573
|
var init_prompts4 = __esm(() => {
|
|
614738
614574
|
init_env();
|
|
614739
614575
|
init_git();
|
|
@@ -614769,11 +614605,6 @@ var init_prompts4 = __esm(() => {
|
|
|
614769
614605
|
init_memdir();
|
|
614770
614606
|
init_undercover();
|
|
614771
614607
|
init_mcpInstructionsDelta();
|
|
614772
|
-
UR_4_5_OR_4_6_MODEL_IDS = {
|
|
614773
|
-
modelO: "ur-modelO-4-6",
|
|
614774
|
-
modelS: "ur-modelS-4-6",
|
|
614775
|
-
modelH: "ur-modelH-4-5-20251001"
|
|
614776
|
-
};
|
|
614777
614608
|
});
|
|
614778
614609
|
|
|
614779
614610
|
// src/utils/api.ts
|
|
@@ -615220,7 +615051,7 @@ function computeFingerprint(messageText2, version3) {
|
|
|
615220
615051
|
}
|
|
615221
615052
|
function computeFingerprintFromMessages(messages) {
|
|
615222
615053
|
const firstMessageText = extractFirstMessageText(messages);
|
|
615223
|
-
return computeFingerprint(firstMessageText, "1.30.
|
|
615054
|
+
return computeFingerprint(firstMessageText, "1.30.6");
|
|
615224
615055
|
}
|
|
615225
615056
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
615226
615057
|
var init_fingerprint = () => {};
|
|
@@ -617087,7 +616918,7 @@ async function sideQuery(opts) {
|
|
|
617087
616918
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
617088
616919
|
}
|
|
617089
616920
|
const messageText2 = extractFirstUserMessageText(messages);
|
|
617090
|
-
const fingerprint = computeFingerprint(messageText2, "1.30.
|
|
616921
|
+
const fingerprint = computeFingerprint(messageText2, "1.30.6");
|
|
617091
616922
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
617092
616923
|
const systemBlocks = [
|
|
617093
616924
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -621824,7 +621655,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
621824
621655
|
slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
|
|
621825
621656
|
apiKeySource: getURHQApiKeyWithSource().source,
|
|
621826
621657
|
betas: getSdkBetas(),
|
|
621827
|
-
ur_version: "1.30.
|
|
621658
|
+
ur_version: "1.30.6",
|
|
621828
621659
|
output_style: outputStyle2,
|
|
621829
621660
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
621830
621661
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill2) => skill2.name),
|
|
@@ -636452,7 +636283,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
636452
636283
|
function getSemverPart(version3) {
|
|
636453
636284
|
return `${import_semver13.major(version3, { loose: true })}.${import_semver13.minor(version3, { loose: true })}.${import_semver13.patch(version3, { loose: true })}`;
|
|
636454
636285
|
}
|
|
636455
|
-
function useUpdateNotification(updatedVersion, initialVersion = "1.30.
|
|
636286
|
+
function useUpdateNotification(updatedVersion, initialVersion = "1.30.6") {
|
|
636456
636287
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react226.useState(() => getSemverPart(initialVersion));
|
|
636457
636288
|
if (!updatedVersion) {
|
|
636458
636289
|
return null;
|
|
@@ -636501,7 +636332,7 @@ function AutoUpdater({
|
|
|
636501
636332
|
return;
|
|
636502
636333
|
}
|
|
636503
636334
|
if (false) {}
|
|
636504
|
-
const currentVersion = "1.30.
|
|
636335
|
+
const currentVersion = "1.30.6";
|
|
636505
636336
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
636506
636337
|
let latestVersion = await getLatestVersion(channel);
|
|
636507
636338
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -636730,12 +636561,12 @@ function NativeAutoUpdater({
|
|
|
636730
636561
|
logEvent("tengu_native_auto_updater_start", {});
|
|
636731
636562
|
try {
|
|
636732
636563
|
const maxVersion = await getMaxVersion();
|
|
636733
|
-
if (maxVersion && gt("1.30.
|
|
636564
|
+
if (maxVersion && gt("1.30.6", maxVersion)) {
|
|
636734
636565
|
const msg = await getMaxVersionMessage();
|
|
636735
636566
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
636736
636567
|
}
|
|
636737
636568
|
const result = await installLatest(channel);
|
|
636738
|
-
const currentVersion = "1.30.
|
|
636569
|
+
const currentVersion = "1.30.6";
|
|
636739
636570
|
const latencyMs = Date.now() - startTime;
|
|
636740
636571
|
if (result.lockFailed) {
|
|
636741
636572
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -636872,17 +636703,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
636872
636703
|
const maxVersion = await getMaxVersion();
|
|
636873
636704
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
636874
636705
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
636875
|
-
if (gte("1.30.
|
|
636876
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.30.
|
|
636706
|
+
if (gte("1.30.6", maxVersion)) {
|
|
636707
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.30.6"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
636877
636708
|
setUpdateAvailable(false);
|
|
636878
636709
|
return;
|
|
636879
636710
|
}
|
|
636880
636711
|
latest = maxVersion;
|
|
636881
636712
|
}
|
|
636882
|
-
const hasUpdate = latest && !gte("1.30.
|
|
636713
|
+
const hasUpdate = latest && !gte("1.30.6", latest) && !shouldSkipVersion(latest);
|
|
636883
636714
|
setUpdateAvailable(!!hasUpdate);
|
|
636884
636715
|
if (hasUpdate) {
|
|
636885
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.30.
|
|
636716
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.30.6"} -> ${latest}`);
|
|
636886
636717
|
}
|
|
636887
636718
|
};
|
|
636888
636719
|
$3[0] = t1;
|
|
@@ -636916,7 +636747,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
636916
636747
|
wrap: "truncate",
|
|
636917
636748
|
children: [
|
|
636918
636749
|
"currentVersion: ",
|
|
636919
|
-
"1.30.
|
|
636750
|
+
"1.30.6"
|
|
636920
636751
|
]
|
|
636921
636752
|
}, undefined, true, undefined, this);
|
|
636922
636753
|
$3[3] = verbose;
|
|
@@ -649367,7 +649198,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
649367
649198
|
project_dir: getOriginalCwd(),
|
|
649368
649199
|
added_dirs: addedDirs
|
|
649369
649200
|
},
|
|
649370
|
-
version: "1.30.
|
|
649201
|
+
version: "1.30.6",
|
|
649371
649202
|
output_style: {
|
|
649372
649203
|
name: outputStyleName
|
|
649373
649204
|
},
|
|
@@ -649450,7 +649281,7 @@ function StatusLineInner({
|
|
|
649450
649281
|
const taskValues = Object.values(tasks2);
|
|
649451
649282
|
const taskRunningCount = taskValues.filter((task2) => task2.status === "running" || task2.status === "pending").length;
|
|
649452
649283
|
const defaultStatusLineText = buildDefaultStatusBar({
|
|
649453
|
-
version: "1.30.
|
|
649284
|
+
version: "1.30.6",
|
|
649454
649285
|
providerLabel: providerRuntime.providerLabel,
|
|
649455
649286
|
authMode: providerRuntime.authLabel,
|
|
649456
649287
|
model: providerRuntime.model ?? renderModelName(mainLoopModel),
|
|
@@ -660778,7 +660609,7 @@ function EffortOptionLabel(t0) {
|
|
|
660778
660609
|
}
|
|
660779
660610
|
function shouldShowEffortCallout(model) {
|
|
660780
660611
|
const parsed = parseUserSpecifiedModel(model);
|
|
660781
|
-
if (!parsed.toLowerCase().includes("
|
|
660612
|
+
if (!parsed.toLowerCase().includes("modelo")) {
|
|
660782
660613
|
return false;
|
|
660783
660614
|
}
|
|
660784
660615
|
const config3 = getGlobalConfig();
|
|
@@ -660938,7 +660769,7 @@ async function submitTranscriptShare(messages, trigger2, appearanceId) {
|
|
|
660938
660769
|
} catch {}
|
|
660939
660770
|
const data = {
|
|
660940
660771
|
trigger: trigger2,
|
|
660941
|
-
version: "1.30.
|
|
660772
|
+
version: "1.30.6",
|
|
660942
660773
|
platform: process.platform,
|
|
660943
660774
|
transcript,
|
|
660944
660775
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -663199,7 +663030,7 @@ var init_tipRegistry = __esm(() => {
|
|
|
663199
663030
|
},
|
|
663200
663031
|
{
|
|
663201
663032
|
id: "modelOplan-mode-reminder",
|
|
663202
|
-
content: async () => `Your default model setting is
|
|
663033
|
+
content: async () => `Your default model setting is plan mode. Press ${getShortcutDisplay("chat:cycleMode", "Chat", "shift+tab")} twice to activate Plan Mode.`,
|
|
663203
663034
|
cooldownSessions: 2,
|
|
663204
663035
|
async isRelevant() {
|
|
663205
663036
|
if (process.env.USER_TYPE === "ant")
|
|
@@ -666937,8 +666768,8 @@ var init_useModelMigrationNotifications = __esm(() => {
|
|
|
666937
666768
|
if (!recent(c4.modelS45To46MigrationTimestamp))
|
|
666938
666769
|
return;
|
|
666939
666770
|
return {
|
|
666940
|
-
key: "
|
|
666941
|
-
text: "Model updated
|
|
666771
|
+
key: "model-alias-update",
|
|
666772
|
+
text: "Model setting updated",
|
|
666942
666773
|
color: "suggestion",
|
|
666943
666774
|
priority: "high",
|
|
666944
666775
|
timeoutMs: 3000
|
|
@@ -666951,7 +666782,7 @@ var init_useModelMigrationNotifications = __esm(() => {
|
|
|
666951
666782
|
return;
|
|
666952
666783
|
return {
|
|
666953
666784
|
key: "modelO-pro-update",
|
|
666954
|
-
text: isLegacyRemap ? "Model updated
|
|
666785
|
+
text: isLegacyRemap ? "Model setting updated \xB7 Set UR_CODE_DISABLE_LEGACY_MODEL_REMAP=1 to opt out" : "Model setting updated",
|
|
666955
666786
|
color: "suggestion",
|
|
666956
666787
|
priority: "high",
|
|
666957
666788
|
timeoutMs: isLegacyRemap ? 8000 : 3000
|
|
@@ -672822,7 +672653,7 @@ function WelcomeV2() {
|
|
|
672822
672653
|
dimColor: true,
|
|
672823
672654
|
children: [
|
|
672824
672655
|
"v",
|
|
672825
|
-
"1.30.
|
|
672656
|
+
"1.30.6"
|
|
672826
672657
|
]
|
|
672827
672658
|
}, undefined, true, undefined, this)
|
|
672828
672659
|
]
|
|
@@ -674082,7 +673913,7 @@ function completeOnboarding() {
|
|
|
674082
673913
|
saveGlobalConfig((current) => ({
|
|
674083
673914
|
...current,
|
|
674084
673915
|
hasCompletedOnboarding: true,
|
|
674085
|
-
lastOnboardingVersion: "1.30.
|
|
673916
|
+
lastOnboardingVersion: "1.30.6"
|
|
674086
673917
|
}));
|
|
674087
673918
|
}
|
|
674088
673919
|
function showDialog(root2, renderer) {
|
|
@@ -678936,32 +678767,8 @@ var init_migrateFennecTomodelO = __esm(() => {
|
|
|
678936
678767
|
|
|
678937
678768
|
// src/migrations/migrateLegacymodelOToCurrent.ts
|
|
678938
678769
|
function migrateLegacymodelOToCurrent() {
|
|
678939
|
-
|
|
678940
|
-
return;
|
|
678941
|
-
}
|
|
678942
|
-
if (!isLegacyModelRemapEnabled()) {
|
|
678943
|
-
return;
|
|
678944
|
-
}
|
|
678945
|
-
const model = getSettingsForSource("userSettings")?.model;
|
|
678946
|
-
if (model !== "ur-modelO-4-20250514" && model !== "ur-modelO-4-1-20250805" && model !== "ur-modelO-4-0" && model !== "ur-modelO-4-1") {
|
|
678947
|
-
return;
|
|
678948
|
-
}
|
|
678949
|
-
updateSettingsForSource("userSettings", { model: "modelO" });
|
|
678950
|
-
saveGlobalConfig((current) => ({
|
|
678951
|
-
...current,
|
|
678952
|
-
legacymodelOMigrationTimestamp: Date.now()
|
|
678953
|
-
}));
|
|
678954
|
-
logEvent("tengu_legacy_modelO_migration", {
|
|
678955
|
-
from_model: model
|
|
678956
|
-
});
|
|
678770
|
+
return;
|
|
678957
678771
|
}
|
|
678958
|
-
var init_migrateLegacymodelOToCurrent = __esm(() => {
|
|
678959
|
-
init_analytics();
|
|
678960
|
-
init_config();
|
|
678961
|
-
init_model();
|
|
678962
|
-
init_providers();
|
|
678963
|
-
init_settings2();
|
|
678964
|
-
});
|
|
678965
678772
|
|
|
678966
678773
|
// src/migrations/migratemodelOTomodelO1m.ts
|
|
678967
678774
|
function migratemodelOTomodelO1m() {
|
|
@@ -679006,62 +678813,19 @@ function migratemodelS1mTomodelS45() {
|
|
|
679006
678813
|
if (config3.modelS1m45MigrationComplete) {
|
|
679007
678814
|
return;
|
|
679008
678815
|
}
|
|
679009
|
-
const model = getSettingsForSource("userSettings")?.model;
|
|
679010
|
-
if (model === "modelS[1m]") {
|
|
679011
|
-
updateSettingsForSource("userSettings", {
|
|
679012
|
-
model: "modelS-4-5-20250929[1m]"
|
|
679013
|
-
});
|
|
679014
|
-
}
|
|
679015
|
-
const override = getMainLoopModelOverride();
|
|
679016
|
-
if (override === "modelS[1m]") {
|
|
679017
|
-
setMainLoopModelOverride("modelS-4-5-20250929[1m]");
|
|
679018
|
-
}
|
|
679019
678816
|
saveGlobalConfig((current) => ({
|
|
679020
678817
|
...current,
|
|
679021
678818
|
modelS1m45MigrationComplete: true
|
|
679022
678819
|
}));
|
|
679023
678820
|
}
|
|
679024
678821
|
var init_migratemodelS1mTomodelS45 = __esm(() => {
|
|
679025
|
-
init_state();
|
|
679026
678822
|
init_config();
|
|
679027
|
-
init_settings2();
|
|
679028
678823
|
});
|
|
679029
678824
|
|
|
679030
678825
|
// src/migrations/migratemodelS45TomodelS46.ts
|
|
679031
678826
|
function migratemodelS45TomodelS46() {
|
|
679032
|
-
|
|
679033
|
-
return;
|
|
679034
|
-
}
|
|
679035
|
-
if (!isProSubscriber() && !isMaxSubscriber() && !isTeamPremiumSubscriber()) {
|
|
679036
|
-
return;
|
|
679037
|
-
}
|
|
679038
|
-
const model = getSettingsForSource("userSettings")?.model;
|
|
679039
|
-
if (model !== "ur-modelS-4-5-20250929" && model !== "ur-modelS-4-5-20250929[1m]" && model !== "modelS-4-5-20250929" && model !== "modelS-4-5-20250929[1m]") {
|
|
679040
|
-
return;
|
|
679041
|
-
}
|
|
679042
|
-
const has1m = model.endsWith("[1m]");
|
|
679043
|
-
updateSettingsForSource("userSettings", {
|
|
679044
|
-
model: has1m ? "modelS[1m]" : "modelS"
|
|
679045
|
-
});
|
|
679046
|
-
const config3 = getGlobalConfig();
|
|
679047
|
-
if (config3.numStartups > 1) {
|
|
679048
|
-
saveGlobalConfig((current) => ({
|
|
679049
|
-
...current,
|
|
679050
|
-
modelS45To46MigrationTimestamp: Date.now()
|
|
679051
|
-
}));
|
|
679052
|
-
}
|
|
679053
|
-
logEvent("tengu_modelS45_to_46_migration", {
|
|
679054
|
-
from_model: model,
|
|
679055
|
-
has_1m: has1m
|
|
679056
|
-
});
|
|
678827
|
+
return;
|
|
679057
678828
|
}
|
|
679058
|
-
var init_migratemodelS45TomodelS46 = __esm(() => {
|
|
679059
|
-
init_analytics();
|
|
679060
|
-
init_auth();
|
|
679061
|
-
init_config();
|
|
679062
|
-
init_providers();
|
|
679063
|
-
init_settings2();
|
|
679064
|
-
});
|
|
679065
678829
|
|
|
679066
678830
|
// src/migrations/resetAutoModeOptInForDefaultOffer.ts
|
|
679067
678831
|
var init_resetAutoModeOptInForDefaultOffer = __esm(() => {
|
|
@@ -679186,7 +678950,7 @@ function appendToLog(path24, message) {
|
|
|
679186
678950
|
cwd: getFsImplementation().cwd(),
|
|
679187
678951
|
userType: process.env.USER_TYPE,
|
|
679188
678952
|
sessionId: getSessionId(),
|
|
679189
|
-
version: "1.30.
|
|
678953
|
+
version: "1.30.6"
|
|
679190
678954
|
};
|
|
679191
678955
|
getLogWriter(path24).write(messageWithTimestamp);
|
|
679192
678956
|
}
|
|
@@ -683280,8 +683044,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
683280
683044
|
}
|
|
683281
683045
|
async function checkEnvLessBridgeMinVersion() {
|
|
683282
683046
|
const cfg = await getEnvLessBridgeConfig();
|
|
683283
|
-
if (cfg.min_version && lt("1.30.
|
|
683284
|
-
return `Your version of UR (${"1.30.
|
|
683047
|
+
if (cfg.min_version && lt("1.30.6", cfg.min_version)) {
|
|
683048
|
+
return `Your version of UR (${"1.30.6"}) is too old for Remote Control.
|
|
683285
683049
|
Version ${cfg.min_version} or higher is required. Run \`ur update\` to update.`;
|
|
683286
683050
|
}
|
|
683287
683051
|
return null;
|
|
@@ -683755,7 +683519,7 @@ async function initBridgeCore(params) {
|
|
|
683755
683519
|
const rawApi = createBridgeApiClient({
|
|
683756
683520
|
baseUrl,
|
|
683757
683521
|
getAccessToken,
|
|
683758
|
-
runnerVersion: "1.30.
|
|
683522
|
+
runnerVersion: "1.30.6",
|
|
683759
683523
|
onDebug: logForDebugging,
|
|
683760
683524
|
onAuth401,
|
|
683761
683525
|
getTrustedDeviceToken
|
|
@@ -689437,7 +689201,7 @@ async function startMCPServer(cwd3, debug2, verbose) {
|
|
|
689437
689201
|
setCwd(cwd3);
|
|
689438
689202
|
const server2 = new Server({
|
|
689439
689203
|
name: "ur/tengu",
|
|
689440
|
-
version: "1.30.
|
|
689204
|
+
version: "1.30.6"
|
|
689441
689205
|
}, {
|
|
689442
689206
|
capabilities: {
|
|
689443
689207
|
tools: {}
|
|
@@ -691414,7 +691178,7 @@ async function update() {
|
|
|
691414
691178
|
logEvent("tengu_update_check", {});
|
|
691415
691179
|
const diagnostic = await getDoctorDiagnostic();
|
|
691416
691180
|
const result = await checkUpgradeStatus({
|
|
691417
|
-
currentVersion: "1.30.
|
|
691181
|
+
currentVersion: "1.30.6",
|
|
691418
691182
|
packageName: UR_AGENT_PACKAGE_NAME,
|
|
691419
691183
|
installationType: diagnostic.installationType,
|
|
691420
691184
|
latestVersion: () => getLatestNpmPackageVersion(UR_AGENT_PACKAGE_NAME)
|
|
@@ -692660,7 +692424,7 @@ ${customInstructions}` : customInstructions;
|
|
|
692660
692424
|
}
|
|
692661
692425
|
}
|
|
692662
692426
|
logForDiagnosticsNoPII("info", "started", {
|
|
692663
|
-
version: "1.30.
|
|
692427
|
+
version: "1.30.6",
|
|
692664
692428
|
is_native_binary: isInBundledMode()
|
|
692665
692429
|
});
|
|
692666
692430
|
registerCleanup(async () => {
|
|
@@ -693446,7 +693210,7 @@ Usage: ur --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
693446
693210
|
pendingHookMessages
|
|
693447
693211
|
}, renderAndRun);
|
|
693448
693212
|
}
|
|
693449
|
-
}).version("1.30.
|
|
693213
|
+
}).version("1.30.6 (UR-AGENT)", "-v, --version", "Output the version number");
|
|
693450
693214
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
693451
693215
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
693452
693216
|
if (canUserConfigureAdvisor()) {
|
|
@@ -694286,11 +694050,9 @@ var init_main3 = __esm(() => {
|
|
|
694286
694050
|
init_migrateBypassPermissionsAcceptedToSettings();
|
|
694287
694051
|
init_migrateEnableAllProjectMcpServersToSettings();
|
|
694288
694052
|
init_migrateFennecTomodelO();
|
|
694289
|
-
init_migrateLegacymodelOToCurrent();
|
|
694290
694053
|
init_migratemodelOTomodelO1m();
|
|
694291
694054
|
init_migrateReplBridgeEnabledToRemoteControlAtStartup();
|
|
694292
694055
|
init_migratemodelS1mTomodelS45();
|
|
694293
|
-
init_migratemodelS45TomodelS46();
|
|
694294
694056
|
init_resetAutoModeOptInForDefaultOffer();
|
|
694295
694057
|
init_resetProTomodelODefault();
|
|
694296
694058
|
init_RemoteSessionManager();
|
|
@@ -694331,7 +694093,7 @@ if (false) {}
|
|
|
694331
694093
|
async function main2() {
|
|
694332
694094
|
const args = process.argv.slice(2);
|
|
694333
694095
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
694334
|
-
console.log(`${"1.30.
|
|
694096
|
+
console.log(`${"1.30.6"} (UR-AGENT)`);
|
|
694335
694097
|
return;
|
|
694336
694098
|
}
|
|
694337
694099
|
if (args[0] === "a2a" && args[1] === "serve" && !args.includes("--help") && !args.includes("-h")) {
|