zidane 5.0.4 → 5.0.5

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.
@@ -2620,6 +2620,79 @@ function buildMcpServers(opts) {
2620
2620
  return opts.discovered.filter((d) => allow.has(d.config.name)).map((d) => d.config);
2621
2621
  }
2622
2622
  //#endregion
2623
+ //#region src/chat/model-catalog.ts
2624
+ /**
2625
+ * Build the unified catalog from a list of available providers.
2626
+ *
2627
+ * Provider order is preserved (callers typically pass the picker order
2628
+ * — alphabetical, auth-detection order, etc.); model order inside each
2629
+ * provider matches whatever `modelsFor` returns. The current selection
2630
+ * (when set) is bubbled to the top of its provider's section so it
2631
+ * shows first without disturbing relative ordering elsewhere.
2632
+ *
2633
+ * `modelsFor` is injected (not imported from `./providers`) so the same
2634
+ * helper works with hosts that supply their own model resolver via
2635
+ * `ResolvedConfig.modelsFor`.
2636
+ */
2637
+ function buildModelCatalog(opts) {
2638
+ const entries = [];
2639
+ for (const provider of opts.providers) {
2640
+ const models = opts.modelsFor(provider.key);
2641
+ if (models.length === 0) continue;
2642
+ let ordered = models;
2643
+ if (opts.current?.providerKey === provider.key) {
2644
+ const idx = models.findIndex((m) => m.id === opts.current?.modelId);
2645
+ if (idx > 0) {
2646
+ const next = models.slice();
2647
+ const [active] = next.splice(idx, 1);
2648
+ next.unshift(active);
2649
+ ordered = next;
2650
+ }
2651
+ }
2652
+ for (const model of ordered) entries.push({
2653
+ providerKey: provider.key,
2654
+ providerLabel: provider.label,
2655
+ model,
2656
+ searchCorpus: buildSearchCorpus(provider, model)
2657
+ });
2658
+ }
2659
+ return entries;
2660
+ }
2661
+ /**
2662
+ * Filter `catalog` by a user query. Empty / whitespace-only queries
2663
+ * pass everything through unchanged (`O(1)` short-circuit). Multi-term
2664
+ * queries (space-separated) require EVERY term to appear somewhere in
2665
+ * the entry's search corpus — so `"claude opus"` matches `claude-opus-4`
2666
+ * regardless of how the words are interleaved with provider names.
2667
+ *
2668
+ * Match is case-insensitive (the corpus is pre-lowercased; the query
2669
+ * is lowercased once per call).
2670
+ */
2671
+ function filterModelCatalog(catalog, query) {
2672
+ const trimmed = query.trim().toLowerCase();
2673
+ if (!trimmed) return catalog.slice();
2674
+ const terms = trimmed.split(/\s+/);
2675
+ return catalog.filter((entry) => terms.every((t) => entry.searchCorpus.includes(t)));
2676
+ }
2677
+ /**
2678
+ * Find a catalog entry's index by its `{providerKey, modelId}` tuple.
2679
+ * Returns `-1` when not present. Useful when re-rendering the picker
2680
+ * (a query just narrowed the list, where did the selection land?).
2681
+ */
2682
+ function indexOfEntry(catalog, target) {
2683
+ if (!target) return -1;
2684
+ return catalog.findIndex((e) => e.providerKey === target.providerKey && e.model.id === target.modelId);
2685
+ }
2686
+ function buildSearchCorpus(provider, model) {
2687
+ return [
2688
+ provider.key,
2689
+ provider.label,
2690
+ model.id,
2691
+ model.name ?? "",
2692
+ model.provider ?? ""
2693
+ ].join(" ").toLowerCase();
2694
+ }
2695
+ //#endregion
2623
2696
  //#region src/chat/oauth.ts
2624
2697
  function supportsOAuth(descriptor) {
2625
2698
  return descriptor.oauthProvider !== void 0;
@@ -3601,6 +3674,6 @@ function countNeighbors(turnIds, turnId) {
3601
3674
  };
3602
3675
  }
3603
3676
  //#endregion
3604
- export { BUILTIN_THEMES as $, piIdOf as $t, readProjects as A, applyInsert as At, cleanTitle as B, removeProviderCredential as Bt, useSafeModeQueue as C, findGitRoot$1 as Ct, isOnSafelist as D, FILES_TRIGGER as Dt, getSafelist as E, uniqueSkillNamesFromReferences as Et, supportsOAuth as F, detectAuth as Ft, shortId as G, cerebrasDescriptor as Gt, ageString as H, writeCredentials as Ht, buildMcpServers as I, applyApiKeyEnv as It, DEFAULT_SETTINGS as J, getModelInfo as Jt, listProjectFiles as K, credKeyOf as Kt, defaultMcpsConfigPaths as L, credentialsPath as Lt, writeProjects as M, findActiveTrigger as Mt, splitPromptSegments as N, mergeReferences as Nt, matchesSafelistEntry as O, createFilesCompletionProvider as Ot, runOAuthLogin as P, useCompletion as Pt, useSettings as Q, openrouterDescriptor as Qt, discoverProjectMcps as R, readCredentials as Rt, useSafeModeActions as S, toolResultText as St, addToSafelist as T, createSkillsCompletionProvider as Tt, compactPath as U, BUILTIN_PROVIDERS as Ut, generateSessionTitle as V, setProviderCredential as Vt, fmtTokens as W, anthropicDescriptor as Wt, SETTINGS_TOGGLES as X, modelsForDescriptor as Xt, SETTINGS_CHOICES as Y, modelSupportsReasoning as Yt, SettingsProvider as Z, openaiDescriptor as Zt, discoverProjectSkills as _, saveState as _t, ThemeProvider as a, singleAgentRegistry as an, CATPPUCCIN_LATTE as at, writeSessionExport as b, titleFromTurns as bt, useSurfaces as c, ConfigProvider as ct, finalizeStreamingMarkdown as d, createStateStore as dt, BUILD_AGENT as en, DEFAULT_THEME as et, finalizeStreamingMarkdownForOwner as f, deriveSessionTitle as ft, defaultSkillScanPaths as g, loadState as gt, buildSkillsConfig as h, listSessionMeta as ht, turnAsText as i, resolveAgentId as in, CATPPUCCIN_FRAPPE as it, suggestSafelistEntry as j, collectReferences as jt, projectsFilePath as k, uniqueFilesFromReferences as kt, useSyntaxStyles as l, useConfig as lt, useStreamBuffer as m, lastContextSizeFromTurns as mt, deleteTurnSafely as n, DEFAULT_AGENT_ID as nn, resolveTheme as nt, useColors as o, CATPPUCCIN_MACCHIATO as ot, turnContextSize as p, eventsFromTurns as pt, useEnabledToggleSet as q, getContextWindow as qt, truncateTurnsAt as r, PLAN_AGENT as rn, VAPORWAVE_THEME as rt, useSelectStyle as s, CATPPUCCIN_MOCHA as st, countNeighbors as t, BUILTIN_AGENTS as tn, resolveChipColor as tt, useTheme as u, resolveConfig as ut, renderSession as v, selectableTurnIds as vt, IMPLICITLY_SAFE_TOOLS as w, SKILLS_TRIGGER as wt, SafeModeProvider as x, toolCallPreview as xt, resolveSessionExportTarget as y, stripSpawnTokensLine as yt, parseMcpsFile as z, readProviderCredential as zt };
3677
+ export { SETTINGS_TOGGLES as $, modelsForDescriptor as $t, readProjects as A, FILES_TRIGGER as At, defaultMcpsConfigPaths as B, credentialsPath as Bt, useSafeModeQueue as C, titleFromTurns as Ct, isOnSafelist as D, SKILLS_TRIGGER as Dt, getSafelist as E, findGitRoot$1 as Et, supportsOAuth as F, findActiveTrigger as Ft, ageString as G, writeCredentials as Gt, parseMcpsFile as H, readProviderCredential as Ht, buildModelCatalog as I, mergeReferences as It, shortId as J, cerebrasDescriptor as Jt, compactPath as K, BUILTIN_PROVIDERS as Kt, filterModelCatalog as L, useCompletion as Lt, writeProjects as M, uniqueFilesFromReferences as Mt, splitPromptSegments as N, applyInsert as Nt, matchesSafelistEntry as O, createSkillsCompletionProvider as Ot, runOAuthLogin as P, collectReferences as Pt, SETTINGS_CHOICES as Q, modelSupportsReasoning as Qt, indexOfEntry as R, detectAuth as Rt, useSafeModeActions as S, stripSpawnTokensLine as St, addToSafelist as T, toolResultText as Tt, cleanTitle as U, removeProviderCredential as Ut, discoverProjectMcps as V, readCredentials as Vt, generateSessionTitle as W, setProviderCredential as Wt, useEnabledToggleSet as X, getContextWindow as Xt, listProjectFiles as Y, credKeyOf as Yt, DEFAULT_SETTINGS as Z, getModelInfo as Zt, discoverProjectSkills as _, lastContextSizeFromTurns as _t, ThemeProvider as a, DEFAULT_AGENT_ID as an, resolveTheme as at, writeSessionExport as b, saveState as bt, useSurfaces as c, singleAgentRegistry as cn, CATPPUCCIN_LATTE as ct, finalizeStreamingMarkdown as d, ConfigProvider as dt, openaiDescriptor as en, SettingsProvider as et, finalizeStreamingMarkdownForOwner as f, useConfig as ft, defaultSkillScanPaths as g, eventsFromTurns as gt, buildSkillsConfig as h, deriveSessionTitle as ht, turnAsText as i, BUILTIN_AGENTS as in, resolveChipColor as it, suggestSafelistEntry as j, createFilesCompletionProvider as jt, projectsFilePath as k, uniqueSkillNamesFromReferences as kt, useSyntaxStyles as l, CATPPUCCIN_MACCHIATO as lt, useStreamBuffer as m, createStateStore as mt, deleteTurnSafely as n, piIdOf as nn, BUILTIN_THEMES as nt, useColors as o, PLAN_AGENT as on, VAPORWAVE_THEME as ot, turnContextSize as p, resolveConfig as pt, fmtTokens as q, anthropicDescriptor as qt, truncateTurnsAt as r, BUILD_AGENT as rn, DEFAULT_THEME as rt, useSelectStyle as s, resolveAgentId as sn, CATPPUCCIN_FRAPPE as st, countNeighbors as t, openrouterDescriptor as tn, useSettings as tt, useTheme as u, CATPPUCCIN_MOCHA as ut, renderSession as v, listSessionMeta as vt, IMPLICITLY_SAFE_TOOLS as w, toolCallPreview as wt, SafeModeProvider as x, selectableTurnIds as xt, resolveSessionExportTarget as y, loadState as yt, buildMcpServers as z, applyApiKeyEnv as zt };
3605
3678
 
3606
- //# sourceMappingURL=turn-operations-BF3hMNgo.js.map
3679
+ //# sourceMappingURL=turn-operations-DZ3TrljX.js.map