@mcowger/oh-my-pi-plexus 1.12.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extension.js +54 -34
- package/package.json +1 -1
package/dist/extension.js
CHANGED
|
@@ -16023,20 +16023,12 @@ var init_devin2 = __esm(() => {
|
|
|
16023
16023
|
DEVIN_IMAGE_BLIND_UIDS = new Set(["swe-1-6", "swe-1-6-fast"]);
|
|
16024
16024
|
});
|
|
16025
16025
|
|
|
16026
|
-
// ../plexus-models/src/suppress.ts
|
|
16027
|
-
function parseSuppressionPatterns(raw) {
|
|
16028
|
-
if (!raw)
|
|
16029
|
-
return [];
|
|
16030
|
-
const items = Array.isArray(raw) ? raw : raw.split(/[\n,;]+/);
|
|
16031
|
-
return items.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
16032
|
-
}
|
|
16033
|
-
function getEnvSuppressedModels() {
|
|
16034
|
-
const env = typeof process !== "undefined" && process?.env ? process.env : {};
|
|
16035
|
-
const raw = env.PLEXUS_SUPPRESS_MODELS ?? env.PLEXUS_EXCLUDE_MODELS;
|
|
16036
|
-
return parseSuppressionPatterns(raw);
|
|
16037
|
-
}
|
|
16038
16026
|
// ../plexus-models/src/convert.ts
|
|
16039
|
-
var REASONING_PARAMS = new Set([
|
|
16027
|
+
var REASONING_PARAMS = new Set([
|
|
16028
|
+
"reasoning",
|
|
16029
|
+
"include_reasoning",
|
|
16030
|
+
"reasoning_effort"
|
|
16031
|
+
]);
|
|
16040
16032
|
var NON_CHAT_PATTERN = /(?:^|[\W_])(?:embed(?:ding|dings)?|transcri(?:be[ds]?|ptions?)|whisper|speech[\W_]*to[\W_]*text|stt|text[\W_]*to[\W_]*speech|tts|image(?:[\W_]*(?:gen(?:eration)?|\d+))?|diffusion|dall[\W_]*e|stable[\W_]*diffusion|sdxl|dream)(?:$|[\W_])/i;
|
|
16041
16033
|
var API_DIALECT_MAP = {
|
|
16042
16034
|
chat_completions: "openai-completions",
|
|
@@ -16091,13 +16083,13 @@ function parsePrice(raw) {
|
|
|
16091
16083
|
if (raw === undefined)
|
|
16092
16084
|
return 0;
|
|
16093
16085
|
const n = parseFloat(raw);
|
|
16094
|
-
return isFinite(n) && n >= 0 ? n : 0;
|
|
16086
|
+
return Number.isFinite(n) && n >= 0 ? n : 0;
|
|
16095
16087
|
}
|
|
16096
16088
|
function resolveContextWindow(model) {
|
|
16097
16089
|
const v = model.context_length ?? model.top_provider?.context_length ?? null;
|
|
16098
16090
|
return v != null && v > 0 ? v : 8192;
|
|
16099
16091
|
}
|
|
16100
|
-
function resolveMaxTokens(model
|
|
16092
|
+
function resolveMaxTokens(model) {
|
|
16101
16093
|
const v = model.top_provider?.max_completion_tokens ?? null;
|
|
16102
16094
|
if (v == null || v < 100) {
|
|
16103
16095
|
return 32768;
|
|
@@ -16111,13 +16103,15 @@ function resolvePricingTiers(model) {
|
|
|
16111
16103
|
const tiers = pricing.tiers.flatMap((tier) => {
|
|
16112
16104
|
if (!Number.isFinite(tier.input_tokens_above) || tier.input_tokens_above < 0)
|
|
16113
16105
|
return [];
|
|
16114
|
-
return [
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16106
|
+
return [
|
|
16107
|
+
{
|
|
16108
|
+
inputTokensAbove: tier.input_tokens_above,
|
|
16109
|
+
input: parsePrice(tier.prompt ?? pricing.prompt),
|
|
16110
|
+
output: parsePrice(tier.completion ?? pricing.completion),
|
|
16111
|
+
cacheRead: parsePrice(tier.input_cache_read ?? pricing.input_cache_read),
|
|
16112
|
+
cacheWrite: parsePrice(tier.input_cache_write ?? pricing.input_cache_write)
|
|
16113
|
+
}
|
|
16114
|
+
];
|
|
16121
16115
|
});
|
|
16122
16116
|
return tiers.length > 0 ? tiers : undefined;
|
|
16123
16117
|
}
|
|
@@ -16125,7 +16119,7 @@ function convertToDescriptor(raw, baseUrl) {
|
|
|
16125
16119
|
const preferredApi = mapPreferredApi(raw.preferred_api);
|
|
16126
16120
|
const adjustedBaseUrl = adjustBaseUrl(baseUrl, preferredApi);
|
|
16127
16121
|
const contextWindow = resolveContextWindow(raw);
|
|
16128
|
-
const maxTokens = resolveMaxTokens(raw
|
|
16122
|
+
const maxTokens = resolveMaxTokens(raw);
|
|
16129
16123
|
const tiers = resolvePricingTiers(raw);
|
|
16130
16124
|
const descriptor = {
|
|
16131
16125
|
id: raw.id,
|
|
@@ -16179,7 +16173,7 @@ function isChatModel(model) {
|
|
|
16179
16173
|
const apiHints = Array.isArray(model.preferred_api) ? model.preferred_api.join(" ") : model.preferred_api ?? "";
|
|
16180
16174
|
return !NON_CHAT_PATTERN.test(`${model.id} ${model.name ?? ""} ${apiHints}`);
|
|
16181
16175
|
}
|
|
16182
|
-
function
|
|
16176
|
+
function parseSuppressionPatterns(input) {
|
|
16183
16177
|
if (!input)
|
|
16184
16178
|
return [];
|
|
16185
16179
|
const rawItems = Array.isArray(input) ? input : [input];
|
|
@@ -16198,9 +16192,9 @@ function parseSuppressionPatterns2(input) {
|
|
|
16198
16192
|
return patterns;
|
|
16199
16193
|
}
|
|
16200
16194
|
function isSuppressedModel(model, suppress) {
|
|
16201
|
-
if (!model
|
|
16195
|
+
if (!model?.id)
|
|
16202
16196
|
return false;
|
|
16203
|
-
const patterns =
|
|
16197
|
+
const patterns = parseSuppressionPatterns(suppress);
|
|
16204
16198
|
if (patterns.length === 0)
|
|
16205
16199
|
return false;
|
|
16206
16200
|
const idLower = model.id.toLowerCase();
|
|
@@ -16224,7 +16218,7 @@ function isSuppressedModel(model, suppress) {
|
|
|
16224
16218
|
if (pattern.includes("*") || pattern.includes("?")) {
|
|
16225
16219
|
try {
|
|
16226
16220
|
const escaped = patternLower.replace(/[.+^$()|[{}]\\]/g, "\\$&");
|
|
16227
|
-
const regexStr =
|
|
16221
|
+
const regexStr = `^${escaped.replace(/\*/g, ".*").replace(/\?/g, ".")}$`;
|
|
16228
16222
|
const globRe = new RegExp(regexStr, "i");
|
|
16229
16223
|
if (globRe.test(model.id) || model.name && globRe.test(model.name)) {
|
|
16230
16224
|
return true;
|
|
@@ -16337,6 +16331,18 @@ async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_F
|
|
|
16337
16331
|
clearTimeout(timer);
|
|
16338
16332
|
}
|
|
16339
16333
|
}
|
|
16334
|
+
// ../plexus-models/src/suppress.ts
|
|
16335
|
+
function parseSuppressionPatterns2(raw) {
|
|
16336
|
+
if (!raw)
|
|
16337
|
+
return [];
|
|
16338
|
+
const items = Array.isArray(raw) ? raw : raw.split(/[\n,;]+/);
|
|
16339
|
+
return items.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
16340
|
+
}
|
|
16341
|
+
function getEnvSuppressedModels() {
|
|
16342
|
+
const env = typeof process !== "undefined" && process?.env ? process.env : {};
|
|
16343
|
+
const raw = env.PLEXUS_SUPPRESS_MODELS ?? env.PLEXUS_EXCLUDE_MODELS;
|
|
16344
|
+
return parseSuppressionPatterns2(raw);
|
|
16345
|
+
}
|
|
16340
16346
|
// src/config.ts
|
|
16341
16347
|
import { existsSync, readFileSync } from "fs";
|
|
16342
16348
|
import { mkdir, writeFile } from "fs/promises";
|
|
@@ -16492,12 +16498,12 @@ function getBaseUrl() {
|
|
|
16492
16498
|
function getSuppressedModels() {
|
|
16493
16499
|
const config = getConfigSync();
|
|
16494
16500
|
const envSuppressed = getEnvSuppressedModels();
|
|
16495
|
-
const configSuppressed =
|
|
16501
|
+
const configSuppressed = parseSuppressionPatterns2(config.suppressModels ?? config.suppress);
|
|
16496
16502
|
return [...envSuppressed, ...configSuppressed];
|
|
16497
16503
|
}
|
|
16498
16504
|
|
|
16499
16505
|
// src/log.ts
|
|
16500
|
-
import { mkdir as mkdir2
|
|
16506
|
+
import { appendFile, mkdir as mkdir2 } from "fs/promises";
|
|
16501
16507
|
import { join as join2 } from "path";
|
|
16502
16508
|
import { getAgentDir as getAgentDir2 } from "@oh-my-pi/pi-utils";
|
|
16503
16509
|
var getCacheDir = () => join2(getAgentDir2(), "extensions", "plexus");
|
|
@@ -23181,7 +23187,11 @@ function descriptorToOhMyPiModel(descriptor) {
|
|
|
23181
23187
|
if (descriptor.preferredApi === "openai-completions") {
|
|
23182
23188
|
const heuristic = detectOpenAICompletionsCompat(descriptor.piProvider ?? descriptor.provider, descriptor.baseUrl);
|
|
23183
23189
|
const builtinCompat = builtinModel?.compat;
|
|
23184
|
-
compat = {
|
|
23190
|
+
compat = {
|
|
23191
|
+
...heuristic,
|
|
23192
|
+
...builtinCompat ?? {},
|
|
23193
|
+
...descriptor.piOptions ?? {}
|
|
23194
|
+
};
|
|
23185
23195
|
} else if (descriptor.piOptions) {
|
|
23186
23196
|
compat = descriptor.piOptions;
|
|
23187
23197
|
} else if (builtinModel?.compat) {
|
|
@@ -23212,10 +23222,12 @@ function hasToolCall(content) {
|
|
|
23212
23222
|
return Array.isArray(content) && content.some((block) => block?.type === "toolCall");
|
|
23213
23223
|
}
|
|
23214
23224
|
function normalizeProviderConnectionClosed(message, providerName) {
|
|
23215
|
-
if (
|
|
23225
|
+
if (message?.role !== "assistant" || message.provider !== providerName || message.stopReason !== "error" || typeof message.errorMessage !== "string" || message.errorMessage.startsWith(NORMALIZED_PREFIX) || hasToolCall(message.content) || !PROVIDER_CONNECTION_CLOSED_PATTERN.test(message.errorMessage)) {
|
|
23216
23226
|
return;
|
|
23217
23227
|
}
|
|
23218
|
-
log("retryable-error: retagged closed provider connection for retry", {
|
|
23228
|
+
log("retryable-error: retagged closed provider connection for retry", {
|
|
23229
|
+
model: message.model
|
|
23230
|
+
});
|
|
23219
23231
|
message.errorMessage = NORMALIZED_MESSAGE;
|
|
23220
23232
|
}
|
|
23221
23233
|
|
|
@@ -23264,8 +23276,16 @@ function plexusExtension(pi) {
|
|
|
23264
23276
|
description: "Plexus provider commands: refresh, status (setup: /login plexus)",
|
|
23265
23277
|
getArgumentCompletions: (prefix) => {
|
|
23266
23278
|
const subcommands = [
|
|
23267
|
-
{
|
|
23268
|
-
|
|
23279
|
+
{
|
|
23280
|
+
value: "refresh",
|
|
23281
|
+
label: "refresh",
|
|
23282
|
+
description: "Refresh Plexus models from the API"
|
|
23283
|
+
},
|
|
23284
|
+
{
|
|
23285
|
+
value: "status",
|
|
23286
|
+
label: "status",
|
|
23287
|
+
description: "Show Plexus configuration and catalog status"
|
|
23288
|
+
}
|
|
23269
23289
|
];
|
|
23270
23290
|
return prefix.includes(" ") ? null : subcommands.filter((command) => command.value.startsWith(prefix));
|
|
23271
23291
|
},
|