@eminent337/aery 0.1.113 → 0.1.114

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.
@@ -119,6 +119,8 @@ const API_KEY_PROVIDER_NAMES = {
119
119
  };
120
120
  const API_KEY_LOGIN_PROVIDER_BLOCKLIST = new Set(["amazon-bedrock", "llama.cpp", "lmstudio", "ollama"]);
121
121
  const CUSTOM_OPENAI_COMPATIBLE_PROVIDER_LABEL = "Custom OpenAI-compatible";
122
+ const AERY_GATEWAY_PROVIDER_ID = "__aery-gateway__";
123
+ const AERY_GATEWAY_BASE_URL = "https://api.aery.dev/v1";
122
124
  export function isApiKeyLoginProvider(providerId, oauthProviderIds, builtInProviderIds = new Set(getProviders())) {
123
125
  if (API_KEY_PROVIDER_NAMES[providerId])
124
126
  return true;
@@ -3690,6 +3692,11 @@ export class InteractiveMode {
3690
3692
  });
3691
3693
  }
3692
3694
  if (!authType || authType === "api_key") {
3695
+ options.push({
3696
+ id: AERY_GATEWAY_PROVIDER_ID,
3697
+ name: "Aery Gateway",
3698
+ authType: "api_key",
3699
+ });
3693
3700
  options.push({
3694
3701
  id: CUSTOM_OPENAI_COMPATIBLE_PROVIDER_ID,
3695
3702
  name: CUSTOM_OPENAI_COMPATIBLE_PROVIDER_LABEL,
@@ -3746,7 +3753,10 @@ export class InteractiveMode {
3746
3753
  if (!providerOption) {
3747
3754
  return;
3748
3755
  }
3749
- if (providerOption.id === CUSTOM_OPENAI_COMPATIBLE_PROVIDER_ID) {
3756
+ if (providerOption.id === AERY_GATEWAY_PROVIDER_ID) {
3757
+ await this.showAeryGatewayLoginDialog();
3758
+ }
3759
+ else if (providerOption.id === CUSTOM_OPENAI_COMPATIBLE_PROVIDER_ID) {
3750
3760
  await this.showCustomOpenAICompatibleLoginDialog();
3751
3761
  }
3752
3762
  else if (providerOption.authType === "oauth") {
@@ -3901,6 +3911,59 @@ export class InteractiveMode {
3901
3911
  }
3902
3912
  }
3903
3913
  }
3914
+ async showAeryGatewayLoginDialog() {
3915
+ const dialog = new LoginDialogComponent(this.ui, AERY_GATEWAY_PROVIDER_ID, (_success, _message) => { }, "Connect to Aery Gateway");
3916
+ this.editorContainer.clear();
3917
+ this.editorContainer.addChild(dialog);
3918
+ this.ui.setFocus(dialog);
3919
+ this.ui.requestRender();
3920
+ const restoreEditor = () => {
3921
+ this.editorContainer.clear();
3922
+ this.editorContainer.addChild(this.editor);
3923
+ this.ui.setFocus(this.editor);
3924
+ this.ui.requestRender();
3925
+ };
3926
+ try {
3927
+ const aeryKey = (await dialog.showPrompt("Enter your Aery key:", "aery_...")).trim();
3928
+ if (!aeryKey)
3929
+ throw new Error("Aery key cannot be empty.");
3930
+ const provider = (await dialog.showPrompt("Provider to route through (e.g. anthropic, openai, openrouter):", "anthropic")).trim();
3931
+ if (!provider)
3932
+ throw new Error("Provider cannot be empty.");
3933
+ const modelId = (await dialog.showPrompt("Model ID:", "claude-sonnet-4-5")).trim();
3934
+ if (!modelId)
3935
+ throw new Error("Model ID cannot be empty.");
3936
+ const baseUrl = `${AERY_GATEWAY_BASE_URL}/${provider}`;
3937
+ const saved = saveCustomOpenAICompatibleProvider({
3938
+ modelsPath: getModelsPath(),
3939
+ baseUrl,
3940
+ modelId,
3941
+ });
3942
+ this.session.modelRegistry.authStorage.set(saved.providerId, { type: "api_key", key: aeryKey });
3943
+ this.session.modelRegistry.refresh();
3944
+ restoreEditor();
3945
+ await this.updateAvailableProviderCount();
3946
+ this.footer.invalidate();
3947
+ this.updateEditorBorderColor();
3948
+ const model = this.session.modelRegistry.find(saved.providerId, saved.modelId);
3949
+ if (model) {
3950
+ try {
3951
+ await this.session.setModel(model);
3952
+ this.showStatus(`Connected to Aery Gateway → ${provider}/${modelId}.`);
3953
+ }
3954
+ catch {
3955
+ this.showStatus(`Aery Gateway configured. Use /model to select ${saved.providerId}/${modelId}.`);
3956
+ }
3957
+ }
3958
+ }
3959
+ catch (error) {
3960
+ restoreEditor();
3961
+ const errorMsg = error instanceof Error ? error.message : String(error);
3962
+ if (errorMsg !== "Login cancelled") {
3963
+ this.showError(`Failed to connect to Aery Gateway: ${errorMsg}`);
3964
+ }
3965
+ }
3966
+ }
3904
3967
  async showCustomOpenAICompatibleLoginDialog() {
3905
3968
  const previousModel = this.session.model;
3906
3969
  const dialog = new LoginDialogComponent(this.ui, CUSTOM_OPENAI_COMPATIBLE_PROVIDER_ID, (_success, _message) => { }, `Configure ${CUSTOM_OPENAI_COMPATIBLE_PROVIDER_LABEL}`);