@mcowger/pi-plexus 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -13
- package/dist/extension.js +1 -164
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,19 +139,6 @@ Inspect the effective URL, authentication availability, and catalog source witho
|
|
|
139
139
|
/plexus status
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
Choose the per-session service tier for eligible Plexus models:
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
/service-tier fast
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Tiers are `default` (aliases `off`, `none`), `fast` (alias `priority`), `flex`, and `ultrafast`; `/service-tier status` reports the active tier and whether the current model supports it. The tier is applied per API:
|
|
149
|
-
|
|
150
|
-
- **OpenAI Responses** models get a `service_tier` field. `priority` covers OpenAI's Fast-mode set (GPT-5 and newer, GPT-4.1+, GPT-4o, and o3/o4-mini); `flex` and `ultrafast` are limited to their documented models.
|
|
151
|
-
- **Anthropic Messages** models use Claude Fast mode (`speed: "fast"` plus the `anthropic-beta: fast-mode-2026-02-01` flag) for `priority`, on `claude-opus-5` and `claude-opus-4-8`; `flex` and `ultrafast` are unsupported. This is a first-party research-preview feature, so it only works when the upstream allows it.
|
|
152
|
-
|
|
153
|
-
The tier resets to `default` on every session start. `/plexus-service-tier` is an alias for the same command.
|
|
154
|
-
|
|
155
142
|
Select a Plexus model in `/model`. Save its startup default with the host's normal model-picker action; Plexus does not maintain a separate default-model setting.
|
|
156
143
|
|
|
157
144
|
Use `/login plexus` for setup and `/logout plexus` to remove stored credentials.
|
package/dist/extension.js
CHANGED
|
@@ -680,123 +680,6 @@ function normalizeMalformedFunctionCall(message, providerName) {
|
|
|
680
680
|
return { message: { ...message, errorMessage: NORMALIZED_MESSAGE } };
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
-
// src/service-tier.ts
|
|
684
|
-
var TIER_ALIASES = {
|
|
685
|
-
default: "default",
|
|
686
|
-
off: "default",
|
|
687
|
-
none: "default",
|
|
688
|
-
priority: "priority",
|
|
689
|
-
fast: "priority",
|
|
690
|
-
flex: "flex",
|
|
691
|
-
ultrafast: "ultrafast"
|
|
692
|
-
};
|
|
693
|
-
function parseServiceTierArg(input) {
|
|
694
|
-
return TIER_ALIASES[input.trim().toLowerCase()];
|
|
695
|
-
}
|
|
696
|
-
var OPENAI_RESPONSES_APIS = ["openai-responses", "openai-codex-responses"];
|
|
697
|
-
var GPT_VERSION = /^gpt-(\d+)(?:\.(\d+))?(?:-|$)/i;
|
|
698
|
-
var PRIORITY_EXTRA_FAMILIES = [/^gpt-4o(?=$|-)/i, /^o3(?=$|-)/i, /^o4-mini(?=$|-)/i];
|
|
699
|
-
function isPriorityEligible(modelId) {
|
|
700
|
-
const id = modelId.trim();
|
|
701
|
-
const match = GPT_VERSION.exec(id);
|
|
702
|
-
if (match) {
|
|
703
|
-
const major = Number(match[1]);
|
|
704
|
-
const minor = match[2] === undefined ? 0 : Number(match[2]);
|
|
705
|
-
return major >= 5 || major === 4 && minor >= 1;
|
|
706
|
-
}
|
|
707
|
-
return PRIORITY_EXTRA_FAMILIES.some((pattern) => pattern.test(id));
|
|
708
|
-
}
|
|
709
|
-
function isFlexEligible(modelId) {
|
|
710
|
-
const match = GPT_VERSION.exec(modelId.trim());
|
|
711
|
-
if (!match)
|
|
712
|
-
return false;
|
|
713
|
-
const major = Number(match[1]);
|
|
714
|
-
const minor = match[2] === undefined ? 0 : Number(match[2]);
|
|
715
|
-
return major > 5 || major === 5 && minor >= 5;
|
|
716
|
-
}
|
|
717
|
-
var ULTRAFAST_FAMILIES = [/^gpt-6(?:\.\d+)?-astra(?=$|-)/i, /^gpt-5\.6-sol(?=$|-)/i];
|
|
718
|
-
var OPENAI_RESPONSES_DIALECT = {
|
|
719
|
-
id: "openai-responses",
|
|
720
|
-
apis: OPENAI_RESPONSES_APIS,
|
|
721
|
-
tiers: ["priority", "flex", "ultrafast"],
|
|
722
|
-
supportsModel: isPriorityEligible,
|
|
723
|
-
supportsTier(modelId, tier) {
|
|
724
|
-
switch (tier) {
|
|
725
|
-
case "priority":
|
|
726
|
-
return isPriorityEligible(modelId);
|
|
727
|
-
case "flex":
|
|
728
|
-
return isFlexEligible(modelId);
|
|
729
|
-
case "ultrafast":
|
|
730
|
-
return ULTRAFAST_FAMILIES.some((pattern) => pattern.test(modelId));
|
|
731
|
-
}
|
|
732
|
-
},
|
|
733
|
-
inject(payload, _modelId, tier) {
|
|
734
|
-
return { ...payload, service_tier: tier };
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
var ANTHROPIC_MESSAGES_APIS = ["anthropic-messages"];
|
|
738
|
-
var ANTHROPIC_FAST_MODE_BETA = "fast-mode-2026-02-01";
|
|
739
|
-
var CLAUDE_FAST_FAMILIES = [/^claude-opus-5(?=$|-)/i, /^claude-opus-4-8(?=$|-)/i];
|
|
740
|
-
var ANTHROPIC_MESSAGES_DIALECT = {
|
|
741
|
-
id: "anthropic-messages",
|
|
742
|
-
apis: ANTHROPIC_MESSAGES_APIS,
|
|
743
|
-
tiers: ["priority"],
|
|
744
|
-
supportsModel(modelId) {
|
|
745
|
-
return /^claude-/i.test(modelId.trim());
|
|
746
|
-
},
|
|
747
|
-
supportsTier(modelId, tier) {
|
|
748
|
-
return tier === "priority" && CLAUDE_FAST_FAMILIES.some((pattern) => pattern.test(modelId.trim()));
|
|
749
|
-
},
|
|
750
|
-
inject(payload, _modelId, _tier) {
|
|
751
|
-
const existing = Array.isArray(payload.betas) ? payload.betas.filter((beta) => typeof beta === "string") : [];
|
|
752
|
-
const betas = existing.includes(ANTHROPIC_FAST_MODE_BETA) ? existing : [...existing, ANTHROPIC_FAST_MODE_BETA];
|
|
753
|
-
return { ...payload, speed: "fast", betas };
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
var SERVICE_TIER_DIALECTS = [
|
|
757
|
-
OPENAI_RESPONSES_DIALECT,
|
|
758
|
-
ANTHROPIC_MESSAGES_DIALECT
|
|
759
|
-
];
|
|
760
|
-
function dialectForApi(api, dialects = SERVICE_TIER_DIALECTS) {
|
|
761
|
-
if (!api)
|
|
762
|
-
return;
|
|
763
|
-
return dialects.find((dialect) => dialect.apis.includes(api));
|
|
764
|
-
}
|
|
765
|
-
function isTierSupportedByModel(model, tier, dialects = SERVICE_TIER_DIALECTS) {
|
|
766
|
-
if (tier === "default")
|
|
767
|
-
return true;
|
|
768
|
-
if (!model)
|
|
769
|
-
return false;
|
|
770
|
-
const dialect = dialectForApi(model.api, dialects);
|
|
771
|
-
if (!dialect || !dialect.supportsModel(model.id))
|
|
772
|
-
return false;
|
|
773
|
-
return dialect.supportsTier(model.id, tier);
|
|
774
|
-
}
|
|
775
|
-
function applyServiceTier(payload, model, tier, options) {
|
|
776
|
-
if (tier === "default" || !model || model.provider !== options.provider)
|
|
777
|
-
return payload;
|
|
778
|
-
const dialect = dialectForApi(model.api, options.dialects);
|
|
779
|
-
if (!dialect || !dialect.supportsModel(model.id) || !dialect.supportsTier(model.id, tier)) {
|
|
780
|
-
return payload;
|
|
781
|
-
}
|
|
782
|
-
if (!payload || typeof payload !== "object" || Array.isArray(payload))
|
|
783
|
-
return payload;
|
|
784
|
-
return dialect.inject(payload, model.id, tier);
|
|
785
|
-
}
|
|
786
|
-
var SERVICE_TIER_NOTIFICATION_TYPE = "plexus.serviceTier";
|
|
787
|
-
var SERVICE_TIER_COMMAND = "service-tier";
|
|
788
|
-
function buildServiceTierNotification(input) {
|
|
789
|
-
return JSON.stringify({
|
|
790
|
-
type: SERVICE_TIER_NOTIFICATION_TYPE,
|
|
791
|
-
command: SERVICE_TIER_COMMAND,
|
|
792
|
-
success: input.success,
|
|
793
|
-
tier: input.tier,
|
|
794
|
-
supported: input.supported,
|
|
795
|
-
provider: input.provider,
|
|
796
|
-
model: input.model
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
|
|
800
683
|
// src/extension.ts
|
|
801
684
|
var PROVIDER_NAME = "plexus";
|
|
802
685
|
var PLEXUS_CREDENTIAL_EXPIRES_AT = 253402300799000;
|
|
@@ -882,15 +765,10 @@ function plexusExtension(pi) {
|
|
|
882
765
|
const startupModels = (storedCatalog?.models ?? []).filter((model) => !isModelSuppressed({ id: model.id, name: model.name }, suppressPatterns));
|
|
883
766
|
currentModels = startupModels;
|
|
884
767
|
catalogSource = startupModels.length > 0 ? "host store" : "none";
|
|
885
|
-
let activeServiceTier = "default";
|
|
886
|
-
pi.on("session_start", () => {
|
|
887
|
-
activeServiceTier = "default";
|
|
888
|
-
});
|
|
889
768
|
pi.on("before_provider_request", (event, ctx) => {
|
|
890
769
|
if (ctx.model?.provider !== PROVIDER_NAME)
|
|
891
770
|
return;
|
|
892
|
-
const
|
|
893
|
-
const next = enforceMinimumOutputTokens(withTier);
|
|
771
|
+
const next = enforceMinimumOutputTokens(event.payload);
|
|
894
772
|
return next === event.payload ? undefined : next;
|
|
895
773
|
});
|
|
896
774
|
log("startup", {
|
|
@@ -940,47 +818,6 @@ function plexusExtension(pi) {
|
|
|
940
818
|
ctx.ui.notify(`Unknown sub-command: "${args}". Use /login plexus, /plexus refresh, or /plexus status.`, "warning");
|
|
941
819
|
}
|
|
942
820
|
});
|
|
943
|
-
const handleServiceTier = async (args, ctx) => {
|
|
944
|
-
const sub = args.trim().toLowerCase();
|
|
945
|
-
if (sub === "" || sub === "status") {
|
|
946
|
-
notifyServiceTier(ctx, activeServiceTier, true);
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
const tier = parseServiceTierArg(sub);
|
|
950
|
-
if (!tier) {
|
|
951
|
-
notifyServiceTier(ctx, activeServiceTier, false);
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
|
-
activeServiceTier = tier;
|
|
955
|
-
notifyServiceTier(ctx, tier, true);
|
|
956
|
-
};
|
|
957
|
-
const serviceTierCommand = {
|
|
958
|
-
description: "Set the per-session Plexus service tier: default, fast, flex, ultrafast, or status",
|
|
959
|
-
getArgumentCompletions: (prefix) => {
|
|
960
|
-
const tiers = [
|
|
961
|
-
{ value: "default", label: "default", description: "Use the provider's default tier" },
|
|
962
|
-
{ value: "fast", label: "fast", description: "Priority tier (alias: priority)" },
|
|
963
|
-
{ value: "flex", label: "flex", description: "Flex tier" },
|
|
964
|
-
{ value: "ultrafast", label: "ultrafast", description: "Ultrafast tier" },
|
|
965
|
-
{ value: "status", label: "status", description: "Show the current service tier" }
|
|
966
|
-
];
|
|
967
|
-
return tiers.filter((tier) => tier.value.startsWith(prefix.trim().toLowerCase()));
|
|
968
|
-
},
|
|
969
|
-
handler: handleServiceTier
|
|
970
|
-
};
|
|
971
|
-
pi.registerCommand("service-tier", serviceTierCommand);
|
|
972
|
-
pi.registerCommand("plexus-service-tier", serviceTierCommand);
|
|
973
|
-
}
|
|
974
|
-
function notifyServiceTier(ctx, tier, success) {
|
|
975
|
-
const model = ctx.model;
|
|
976
|
-
const supported = isTierSupportedByModel(model, tier);
|
|
977
|
-
ctx.ui.notify(buildServiceTierNotification({
|
|
978
|
-
tier,
|
|
979
|
-
success,
|
|
980
|
-
supported,
|
|
981
|
-
provider: model?.provider ?? PROVIDER_NAME,
|
|
982
|
-
model: model?.id ?? ""
|
|
983
|
-
}), !success || !supported ? "warning" : "info");
|
|
984
821
|
}
|
|
985
822
|
async function refreshPlexusModels(context) {
|
|
986
823
|
const baseUrl = getBaseUrl();
|