@pencil-agent/nano-pencil 1.11.5 → 1.11.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.
@@ -7,7 +7,7 @@ const CUSTOM_PROVIDER_DEFINITIONS = {
7
7
  [CUSTOM_ANTHROPIC_PROVIDER]: {
8
8
  id: CUSTOM_ANTHROPIC_PROVIDER,
9
9
  label: "Anthropic-compatible",
10
- description: "Custom endpoint using the Anthropic Messages protocol.",
10
+ description: "Configure or edit an endpoint that speaks the Anthropic Messages API.",
11
11
  defaultBaseUrl: "https://api.anthropic.com/v1",
12
12
  api: "anthropic-messages",
13
13
  defaultInput: ["text", "image"],
@@ -15,7 +15,7 @@ const CUSTOM_PROVIDER_DEFINITIONS = {
15
15
  [CUSTOM_OPENAI_PROVIDER]: {
16
16
  id: CUSTOM_OPENAI_PROVIDER,
17
17
  label: "OpenAI-compatible",
18
- description: "Custom endpoint using OpenAI-compatible APIs.",
18
+ description: "Configure or edit an endpoint that speaks an OpenAI-compatible API.",
19
19
  defaultBaseUrl: "https://api.openai.com/v1",
20
20
  api: "openai-completions",
21
21
  defaultInput: ["text", "image"],
@@ -1923,6 +1923,10 @@ export class AgentSession {
1923
1923
  if (isContextOverflow(message, contextWindow))
1924
1924
  return false;
1925
1925
  const err = message.errorMessage;
1926
+ // Do not retry errors that require user intervention.
1927
+ if (/insufficient.?balance|insufficient.?quota|quota.?exceeded|credit.?balance|billing|payment required|invalid api key|incorrect api key|unauthorized|unauthenticated|authentication|forbidden|permission denied|access denied|model_not_found|model not found/i.test(err)) {
1928
+ return false;
1929
+ }
1926
1930
  // Match: overloaded_error, rate limit, 429, 500, 502, 503, 504, service unavailable, connection errors, fetch failed, terminated, retry delay exceeded
1927
1931
  return /overloaded|rate.?limit|too many requests|429|500|502|503|504|service.?unavailable|server error|internal error|connection.?error|connection.?refused|other side closed|fetch failed|upstream.?connect|reset before headers|terminated|retry delay/i.test(err);
1928
1932
  }
@@ -15,7 +15,9 @@ export class ProviderSelectorComponent extends Container {
15
15
  value: provider,
16
16
  label: customProvider?.label ?? provider,
17
17
  description: provider === currentProvider
18
- ? "(current)"
18
+ ? customProvider
19
+ ? "(current, press Enter to edit)"
20
+ : "(current)"
19
21
  : customProvider?.description,
20
22
  };
21
23
  });
@@ -3051,16 +3051,19 @@ export class InteractiveMode {
3051
3051
  saveCustomProtocolProviderApiKey(authStorage, provider, trimmedApiKey);
3052
3052
  }
3053
3053
  this.session.modelRegistry.refresh();
3054
- await this.refreshCurrentModelForProvider(provider);
3054
+ await this.refreshCurrentModelForProvider(provider, trimmedModelName);
3055
3055
  this.showStatus(`Saved ${definition.label} configuration`);
3056
3056
  return true;
3057
3057
  }
3058
- async refreshCurrentModelForProvider(provider) {
3058
+ async refreshCurrentModelForProvider(provider, preferredModelId) {
3059
3059
  const currentModel = this.session.model;
3060
3060
  if (!currentModel || currentModel.provider !== provider) {
3061
3061
  return;
3062
3062
  }
3063
- const updatedModel = this.session.modelRegistry.find(currentModel.provider, currentModel.id);
3063
+ const updatedModel = (preferredModelId
3064
+ ? this.session.modelRegistry.find(currentModel.provider, preferredModelId)
3065
+ : undefined) ??
3066
+ this.session.modelRegistry.find(currentModel.provider, currentModel.id);
3064
3067
  if (!updatedModel) {
3065
3068
  return;
3066
3069
  }
@@ -3094,7 +3097,9 @@ export class InteractiveMode {
3094
3097
  return;
3095
3098
  }
3096
3099
  try {
3097
- const configured = await this.configureCustomProtocolProvider(provider);
3100
+ const configured = await this.configureCustomProtocolProvider(provider, {
3101
+ force: true,
3102
+ });
3098
3103
  if (!configured) {
3099
3104
  this.showStatus("Configuration cancelled");
3100
3105
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pencil-agent/nano-pencil",
3
- "version": "1.11.5",
3
+ "version": "1.11.6",
4
4
  "description": "CLI writing agent with read, bash, edit, write tools and session management. Based on pi; supports DashScope Coding Plan. Soul enabled by default for AI personality evolution.",
5
5
  "type": "module",
6
6
  "bin": {