repoburg 1.3.316 → 1.3.317

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.
@@ -120666,10 +120666,19 @@ var EFFORT_LABELS = {
120666
120666
  max: "Max",
120667
120667
  ultra: "Ultra"
120668
120668
  };
120669
+ var MODEL_LIST_MAX_PAGES = 20;
120669
120670
  async function getModels() {
120670
120671
  try {
120671
- const result = await getSharedAppServer().request("model/list", {});
120672
- return (result.data ?? []).map((m) => ({
120672
+ const server = getSharedAppServer();
120673
+ const listed = [];
120674
+ let cursor = null;
120675
+ for (let page = 0; page < MODEL_LIST_MAX_PAGES; page++) {
120676
+ const result = await server.request("model/list", cursor ? { cursor } : {});
120677
+ listed.push(...result.data ?? []);
120678
+ cursor = result.nextCursor ?? null;
120679
+ if (!cursor) break;
120680
+ }
120681
+ return listed.filter((m) => !m.hidden).map((m) => ({
120673
120682
  slug: m.id,
120674
120683
  displayName: m.displayName,
120675
120684
  description: m.description,
@@ -121704,8 +121713,9 @@ var PromptQueue = class {
121704
121713
  var CLI_OVERRIDE = process.env.CLAUDE_BIN ? { pathToClaudeCodeExecutable: process.env.CLAUDE_BIN } : {};
121705
121714
  var sessionMap2 = /* @__PURE__ */ new Map();
121706
121715
  var titleGenerating2 = /* @__PURE__ */ new Set();
121707
- var cachedModels = null;
121708
- var cachedCommands = null;
121716
+ var MODELS_TTL_MS = 10 * 6e4;
121717
+ var catalog = null;
121718
+ var catalogLoad = null;
121709
121719
  var thinkingAccumulator = /* @__PURE__ */ new Map();
121710
121720
  var streamingMessageIds = /* @__PURE__ */ new Map();
121711
121721
  var widgetStreams = /* @__PURE__ */ new WeakMap();
@@ -123027,40 +123037,48 @@ async function stopTask2(sessionId, taskId) {
123027
123037
  if (!entry) return;
123028
123038
  await entry.query.stopTask(taskId);
123029
123039
  }
123030
- async function getModels2() {
123031
- if (cachedModels) return cachedModels;
123032
- try {
123033
- const q = query({
123034
- prompt: "",
123035
- options: {
123036
- cwd: process.cwd(),
123037
- permissionMode: "bypassPermissions",
123038
- allowDangerouslySkipPermissions: true,
123039
- ...CLI_OVERRIDE
123040
+ function loadCatalog() {
123041
+ catalogLoad ??= (async () => {
123042
+ try {
123043
+ const q = query({
123044
+ prompt: "",
123045
+ options: {
123046
+ cwd: process.cwd(),
123047
+ permissionMode: "bypassPermissions",
123048
+ allowDangerouslySkipPermissions: true,
123049
+ ...CLI_OVERRIDE
123050
+ }
123051
+ });
123052
+ const initResult = await q.initializationResult();
123053
+ q.close();
123054
+ const models = (initResult.models ?? []).map((m) => ({
123055
+ slug: m.value,
123056
+ displayName: m.displayName,
123057
+ description: m.description,
123058
+ defaultReasoning: m.supportedEffortLevels?.[0] ?? "medium",
123059
+ reasoningLevels: (m.supportedEffortLevels ?? []).map((e) => ({
123060
+ effort: e,
123061
+ label: EFFORT_LABELS2[e] ?? e
123062
+ }))
123063
+ }));
123064
+ if (models.length > 0) {
123065
+ catalog = { models, commands: mapSdkCommands(initResult.commands ?? []), at: Date.now() };
123040
123066
  }
123041
- });
123042
- const initResult = await q.initializationResult();
123043
- q.close();
123044
- cachedCommands = mapSdkCommands(initResult.commands ?? []);
123045
- cachedModels = (initResult.models ?? []).map((m) => ({
123046
- slug: m.value,
123047
- displayName: m.displayName,
123048
- description: m.description,
123049
- defaultReasoning: m.supportedEffortLevels?.[0] ?? "medium",
123050
- reasoningLevels: (m.supportedEffortLevels ?? []).map((e) => ({
123051
- effort: e,
123052
- label: EFFORT_LABELS2[e] ?? e
123053
- }))
123054
- }));
123055
- return cachedModels;
123056
- } catch {
123057
- return [];
123058
- }
123067
+ } catch {
123068
+ } finally {
123069
+ catalogLoad = null;
123070
+ }
123071
+ })();
123072
+ return catalogLoad;
123073
+ }
123074
+ async function getModels2() {
123075
+ if (!catalog) await loadCatalog();
123076
+ else if (Date.now() - catalog.at > MODELS_TTL_MS) void loadCatalog();
123077
+ return catalog?.models ?? [];
123059
123078
  }
123060
123079
  async function getCommands2() {
123061
- if (cachedCommands) return cachedCommands;
123062
- await getModels2();
123063
- return cachedCommands ?? [];
123080
+ if (!catalog) await loadCatalog();
123081
+ return catalog?.commands ?? [];
123064
123082
  }
123065
123083
  function mapSdkCommands(commands) {
123066
123084
  return commands.map((c) => ({
@@ -120679,10 +120679,19 @@ var EFFORT_LABELS = {
120679
120679
  max: "Max",
120680
120680
  ultra: "Ultra"
120681
120681
  };
120682
+ var MODEL_LIST_MAX_PAGES = 20;
120682
120683
  async function getModels() {
120683
120684
  try {
120684
- const result = await getSharedAppServer().request("model/list", {});
120685
- return (result.data ?? []).map((m) => ({
120685
+ const server = getSharedAppServer();
120686
+ const listed = [];
120687
+ let cursor = null;
120688
+ for (let page = 0; page < MODEL_LIST_MAX_PAGES; page++) {
120689
+ const result = await server.request("model/list", cursor ? { cursor } : {});
120690
+ listed.push(...result.data ?? []);
120691
+ cursor = result.nextCursor ?? null;
120692
+ if (!cursor) break;
120693
+ }
120694
+ return listed.filter((m) => !m.hidden).map((m) => ({
120686
120695
  slug: m.id,
120687
120696
  displayName: m.displayName,
120688
120697
  description: m.description,
@@ -121717,8 +121726,9 @@ var PromptQueue = class {
121717
121726
  var CLI_OVERRIDE = process.env.CLAUDE_BIN ? { pathToClaudeCodeExecutable: process.env.CLAUDE_BIN } : {};
121718
121727
  var sessionMap2 = /* @__PURE__ */ new Map();
121719
121728
  var titleGenerating2 = /* @__PURE__ */ new Set();
121720
- var cachedModels = null;
121721
- var cachedCommands = null;
121729
+ var MODELS_TTL_MS = 10 * 6e4;
121730
+ var catalog = null;
121731
+ var catalogLoad = null;
121722
121732
  var thinkingAccumulator = /* @__PURE__ */ new Map();
121723
121733
  var streamingMessageIds = /* @__PURE__ */ new Map();
121724
121734
  var widgetStreams = /* @__PURE__ */ new WeakMap();
@@ -123040,40 +123050,48 @@ async function stopTask2(sessionId, taskId) {
123040
123050
  if (!entry) return;
123041
123051
  await entry.query.stopTask(taskId);
123042
123052
  }
123043
- async function getModels2() {
123044
- if (cachedModels) return cachedModels;
123045
- try {
123046
- const q = query({
123047
- prompt: "",
123048
- options: {
123049
- cwd: process.cwd(),
123050
- permissionMode: "bypassPermissions",
123051
- allowDangerouslySkipPermissions: true,
123052
- ...CLI_OVERRIDE
123053
+ function loadCatalog() {
123054
+ catalogLoad ??= (async () => {
123055
+ try {
123056
+ const q = query({
123057
+ prompt: "",
123058
+ options: {
123059
+ cwd: process.cwd(),
123060
+ permissionMode: "bypassPermissions",
123061
+ allowDangerouslySkipPermissions: true,
123062
+ ...CLI_OVERRIDE
123063
+ }
123064
+ });
123065
+ const initResult = await q.initializationResult();
123066
+ q.close();
123067
+ const models = (initResult.models ?? []).map((m) => ({
123068
+ slug: m.value,
123069
+ displayName: m.displayName,
123070
+ description: m.description,
123071
+ defaultReasoning: m.supportedEffortLevels?.[0] ?? "medium",
123072
+ reasoningLevels: (m.supportedEffortLevels ?? []).map((e) => ({
123073
+ effort: e,
123074
+ label: EFFORT_LABELS2[e] ?? e
123075
+ }))
123076
+ }));
123077
+ if (models.length > 0) {
123078
+ catalog = { models, commands: mapSdkCommands(initResult.commands ?? []), at: Date.now() };
123053
123079
  }
123054
- });
123055
- const initResult = await q.initializationResult();
123056
- q.close();
123057
- cachedCommands = mapSdkCommands(initResult.commands ?? []);
123058
- cachedModels = (initResult.models ?? []).map((m) => ({
123059
- slug: m.value,
123060
- displayName: m.displayName,
123061
- description: m.description,
123062
- defaultReasoning: m.supportedEffortLevels?.[0] ?? "medium",
123063
- reasoningLevels: (m.supportedEffortLevels ?? []).map((e) => ({
123064
- effort: e,
123065
- label: EFFORT_LABELS2[e] ?? e
123066
- }))
123067
- }));
123068
- return cachedModels;
123069
- } catch {
123070
- return [];
123071
- }
123080
+ } catch {
123081
+ } finally {
123082
+ catalogLoad = null;
123083
+ }
123084
+ })();
123085
+ return catalogLoad;
123086
+ }
123087
+ async function getModels2() {
123088
+ if (!catalog) await loadCatalog();
123089
+ else if (Date.now() - catalog.at > MODELS_TTL_MS) void loadCatalog();
123090
+ return catalog?.models ?? [];
123072
123091
  }
123073
123092
  async function getCommands2() {
123074
- if (cachedCommands) return cachedCommands;
123075
- await getModels2();
123076
- return cachedCommands ?? [];
123093
+ if (!catalog) await loadCatalog();
123094
+ return catalog?.commands ?? [];
123077
123095
  }
123078
123096
  function mapSdkCommands(commands) {
123079
123097
  return commands.map((c) => ({
@@ -1,4 +1,4 @@
1
- var en=Object.defineProperty;var tn=(e,t,i)=>t in e?en(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Ye=(e,t,i)=>tn(e,typeof t!="symbol"?t+"":t,i);import{c as sn,b as rn,u as gi,r as lt,j as Ee,R as nn,X as on}from"./index-D315G0hv.js";/**
1
+ var en=Object.defineProperty;var tn=(e,t,i)=>t in e?en(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Ye=(e,t,i)=>tn(e,typeof t!="symbol"?t+"":t,i);import{c as sn,b as rn,u as gi,r as lt,j as Ee,R as nn,X as on}from"./index-Bb9z3drP.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.