neuralos 3.2.19 → 3.3.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.
Files changed (2) hide show
  1. package/bin/gybackend.cjs +29 -3
  2. package/package.json +2 -2
package/bin/gybackend.cjs CHANGED
@@ -258126,6 +258126,12 @@ function buildFailoverChain(primary, fallbacks) {
258126
258126
  async function withModelFailover(chain, operation, opts = {}) {
258127
258127
  const attempts = [];
258128
258128
  let lastError;
258129
+ if (chain.length === 0) {
258130
+ return {
258131
+ error: new Error("model failover chain is empty \u2014 no candidates to try"),
258132
+ attempts
258133
+ };
258134
+ }
258129
258135
  for (const candidate of chain) {
258130
258136
  const started = Date.now();
258131
258137
  try {
@@ -369591,6 +369597,22 @@ var AgentService_v2 = class {
369591
369597
  const actionModel = actionItem?.apiKey ? this.helpers.createChatModel(actionItem, 0.1, profile) : model;
369592
369598
  const thinkingModel = thinkingItem?.apiKey ? this.helpers.createChatModel(thinkingItem, 0.2, profile) : model;
369593
369599
  const compactionModel = compactionItem?.apiKey ? this.helpers.createChatModel(compactionItem, 0.2, profile) : thinkingItem?.apiKey ? thinkingModel : model;
369600
+ const fallbackModels = [];
369601
+ const seenFallbackIds = /* @__PURE__ */ new Set([profile.globalModelId]);
369602
+ for (const fallbackId of Array.isArray(profile.fallbackModels) ? profile.fallbackModels : []) {
369603
+ if (typeof fallbackId !== "string" || !fallbackId.trim()) continue;
369604
+ if (seenFallbackIds.has(fallbackId)) continue;
369605
+ const item = settings.models.items.find((m2) => m2.id === fallbackId);
369606
+ if (!item || !item.apiKey) {
369607
+ console.warn(
369608
+ "[AgentService_v2] Fallback model is invalid or has no API key \u2014 skipping:",
369609
+ { profileId, fallbackId }
369610
+ );
369611
+ continue;
369612
+ }
369613
+ seenFallbackIds.add(fallbackId);
369614
+ fallbackModels.push({ model: item.model, label: item.name ?? item.model });
369615
+ }
369594
369616
  const actionModelSupportsStructuredOutput = actionItem?.apiKey ? actionItem.supportsStructuredOutput === true : globalItem.supportsStructuredOutput === true;
369595
369617
  const actionModelSupportsObjectToolChoice = actionItem?.apiKey ? actionItem.supportsObjectToolChoice === true : globalItem.supportsObjectToolChoice === true;
369596
369618
  const thinkingModelSupportsStructuredOutput = thinkingItem?.apiKey ? thinkingItem.supportsStructuredOutput === true : globalItem.supportsStructuredOutput === true;
@@ -369611,6 +369633,7 @@ var AgentService_v2 = class {
369611
369633
  actionModel,
369612
369634
  thinkingModel,
369613
369635
  compactionModel,
369636
+ fallbackModels,
369614
369637
  actionModelSupportsStructuredOutput,
369615
369638
  actionModelSupportsObjectToolChoice,
369616
369639
  thinkingModelSupportsStructuredOutput,
@@ -370011,9 +370034,12 @@ var AgentService_v2 = class {
370011
370034
  if (!fallbackItem) {
370012
370035
  throw new Error(`fallback model "${candidate.model}" is not configured`);
370013
370036
  }
370014
- const fallbackBinding = this.getSessionModelBinding(sessionId);
370015
- const fallbackChat = this.helpers.createChatModel(fallbackItem, 0.7, fallbackBinding?.profile ?? null);
370016
- modelToUse = fallbackChat;
370037
+ const fallbackChat = this.helpers.createChatModel(
370038
+ fallbackItem,
370039
+ shouldUseThinkingModelOnThisPass ? 0.2 : 0.7,
370040
+ null
370041
+ );
370042
+ modelToUse = fallbackChat.bindTools([...builtInTools, ...mcpTools]);
370017
370043
  }
370018
370044
  return await invokeWithRetryAndSanitizedInput({
370019
370045
  helpers: this.helpers,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "neuralos",
3
- "version": "3.2.19",
4
- "description": "Headless AI-native backend for RTerm / neuralOS — v3.2.19: history search live-fixed (metadata-vs-store bridge, double-wrapped messages, cwd-based data dir). v3.2.18: history search, model failover, sub-agents, REST API, rate limiting, settings backup, idle timeout. 14 plugins, 61 plugin tools.",
3
+ "version": "3.3.0",
4
+ "description": "Headless AI-native backend for RTerm / neuralOS — v3.3.0: model failover now fully configurable (fallbackModels per profile + Settings UI + tools-bound fallbacks). v3.2.18-19: history search, REST API, rate limiting, sub-agents, settings backup, idle timeout. 14 plugins, 61 plugin tools.",
5
5
  "main": "bin/gybackend.cjs",
6
6
  "bin": { "gybackend": "bin/gybackend.cjs" },
7
7
  "license": "MIT",