@ever-works/lm-studio-plugin 1.0.8 → 1.0.13

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.
package/README.md CHANGED
@@ -50,6 +50,10 @@ LM Studio exposes the same OpenAI-compatible `/v1` API as the other AI providers
50
50
  - **Temperature** — controls output variety; lower is more consistent (hidden, advanced).
51
51
  - **Max Tokens** — limits the length of each AI-generated response (hidden, advanced).
52
52
 
53
+ ## Models
54
+
55
+ There is no built-in default model. The picker lists whatever your LM Studio server has loaded (`GET /v1/models`), and accepts a custom model id. Existing saved selections stay as they are. As of 2026-11-05, see https://lmstudio.ai/models for the models LM Studio can download.
56
+
53
57
  ## Troubleshooting
54
58
 
55
59
  | Symptom | Likely cause | Fix |
@@ -74,7 +78,7 @@ pnpm --filter @ever-works/lm-studio-plugin test
74
78
  ## Documentation
75
79
 
76
80
  - [Ever Works documentation](https://docs.ever.works)
77
- - [Ever Works repository](https://github.com/ever-works/ever-works)
81
+ - [Ever Works repository](https://github.com/ever-co/ever-works)
78
82
  - [Plugin system](../../plugin/README.md)
79
83
  - [LM Studio homepage](https://lmstudio.ai)
80
84
 
package/dist/index.cjs CHANGED
@@ -20608,6 +20608,26 @@ var TokenUsageTracker = class extends base.BaseCallbackHandler {
20608
20608
  }
20609
20609
  };
20610
20610
  var REASONING_MODELS = [
20611
+ {
20612
+ pattern: /^gpt-6-astra|^gpt-6\.1-sol|^gpt-6\.\d+-[a-z]+-pro/,
20613
+ openai: { reasoning: { effort: "low" } },
20614
+ openrouter: { reasoning: { effort: "low" } }
20615
+ },
20616
+ {
20617
+ pattern: /^gpt-6/,
20618
+ openai: { reasoning: { effort: "none" } },
20619
+ openrouter: { reasoning: { effort: "none" } }
20620
+ },
20621
+ {
20622
+ pattern: /gpt-5\.[2-5]-pro/,
20623
+ openai: { reasoning: { effort: "medium" } },
20624
+ openrouter: { reasoning: { effort: "medium" } }
20625
+ },
20626
+ {
20627
+ pattern: /gpt-5\.[12]-codex/,
20628
+ openai: { reasoning: { effort: "low" } },
20629
+ openrouter: { reasoning: { effort: "low" } }
20630
+ },
20611
20631
  {
20612
20632
  pattern: /gpt-5\.[1-9]/,
20613
20633
  openai: { reasoning: { effort: "none" } },
@@ -20624,12 +20644,26 @@ var REASONING_MODELS = [
20624
20644
  openrouter: { reasoning: { effort: "minimal" } }
20625
20645
  },
20626
20646
  {
20627
- pattern: /gemini-[23]/,
20647
+ pattern: /gemini-(?:[4-9]|3\.[7-9])|gemini-(?:2\.5|3(?:\.\d+)?)-pro/,
20648
+ google: { reasoning_effort: "low" },
20649
+ openrouter: { reasoning: { effort: "low" } }
20650
+ },
20651
+ {
20652
+ pattern: /gemini-3/,
20653
+ google: { reasoning_effort: "minimal" },
20654
+ openrouter: { reasoning: { effort: "minimal" } }
20655
+ },
20656
+ {
20657
+ pattern: /gemini-2/,
20628
20658
  google: { reasoning_effort: "none" },
20629
20659
  openrouter: { reasoning: { effort: "none" } }
20630
20660
  },
20631
20661
  {
20632
- pattern: /claude-(sonnet|opus)-[4-9]|claude-3-[5-9]/,
20662
+ pattern: /claude-(?:opus|sonnet)-5[.-]5|claude-fable/,
20663
+ openrouter: { reasoning: { effort: "low" } }
20664
+ },
20665
+ {
20666
+ pattern: /claude-(sonnet|opus)-[4-9]|claude-haiku-[5-9]|claude-3-[5-9]/,
20633
20667
  openrouter: { reasoning: { effort: "none" } }
20634
20668
  },
20635
20669
  {
@@ -20638,7 +20672,7 @@ var REASONING_MODELS = [
20638
20672
  },
20639
20673
  {
20640
20674
  pattern: /gpt-oss/,
20641
- groq: { reasoning_effort: "low", reasoning_format: "hidden" }
20675
+ groq: { reasoning_effort: "low", include_reasoning: false }
20642
20676
  },
20643
20677
  {
20644
20678
  pattern: /qwen3/,
@@ -20984,13 +21018,38 @@ var AiOperations = class {
20984
21018
  content,
20985
21019
  ...hasToolCalls && { toolCalls }
20986
21020
  },
20987
- finishReason: hasToolCalls ? "tool_calls" : "stop"
21021
+ finishReason: hasToolCalls ? "tool_calls" : this.finishReasonOf(response)
20988
21022
  }
20989
21023
  ],
20990
21024
  usage: this.mapTokenUsage(tracker)
20991
21025
  };
20992
21026
  });
20993
21027
  }
21028
+ /**
21029
+ * The provider's own finish reason for a reply without tool calls.
21030
+ *
21031
+ * `length` matters most: a reasoning model spends its hidden reasoning from
21032
+ * the same `max_tokens` budget as its answer, and when the budget runs out
21033
+ * first the reply is `''` with `finish_reason: "length"`. Reporting `stop`
21034
+ * there told callers the model had simply answered nothing. OpenRouter's
21035
+ * `error` (the upstream failed mid-answer, so the text is partial) is
21036
+ * `null`: the reply did not finish normally, and this contract has no
21037
+ * `error` value. Anything else it has no value for stays `stop`, as it
21038
+ * always did.
21039
+ *
21040
+ * The metadata is read through a cast: `@ever-works/agent`'s Jest compiles
21041
+ * this source under its own tsconfig (`strictNullChecks: false`), where
21042
+ * `response_metadata` infers as `Partial<unknown>` and has no
21043
+ * `finish_reason`, so a direct property read fails every suite that loads it.
21044
+ */
21045
+ finishReasonOf(response) {
21046
+ const metadata = response.response_metadata;
21047
+ const raw = metadata?.finish_reason;
21048
+ if (raw === "length" || raw === "max_tokens") return "length";
21049
+ if (raw === "content_filter") return "content_filter";
21050
+ if (raw === "error") return null;
21051
+ return "stop";
21052
+ }
20994
21053
  /** Structured JSON output. Falls back to raw invoke + jsonrepair on failure. */
20995
21054
  async askJson(prompt, schema, configOverrides, options) {
20996
21055
  const config2 = this.mergeConfig(configOverrides);
@@ -21096,11 +21155,11 @@ var AiOperations = class {
21096
21155
  if (!model) {
21097
21156
  throw new Error("Embedding model must be specified in options or config");
21098
21157
  }
21099
- this.assertSafeBaseUrl(config2.baseURL);
21158
+ if (!config2.fetch) this.assertSafeBaseUrl(config2.baseURL);
21100
21159
  const embeddings = new openai.OpenAIEmbeddings({
21101
21160
  apiKey: config2.apiKey,
21102
21161
  model,
21103
- ...config2.baseURL && { configuration: { baseURL: config2.baseURL } }
21162
+ ...this.clientConfiguration(config2)
21104
21163
  });
21105
21164
  const inputs = Array.isArray(options.input) ? options.input : [options.input];
21106
21165
  const vectors = await embeddings.embedDocuments(inputs);
@@ -21118,12 +21177,11 @@ var AiOperations = class {
21118
21177
  throw new Error("baseURL is required to list models");
21119
21178
  }
21120
21179
  const modelsUrl = `${config2.baseURL.replace(/(?<!\/)\/+$/, "")}/models`;
21121
- const response = await safeFetchWithDnsPin(modelsUrl, {
21122
- headers: {
21123
- Authorization: `Bearer ${config2.apiKey}`,
21124
- "Content-Type": "application/json"
21125
- }
21126
- });
21180
+ const headers = {
21181
+ Authorization: `Bearer ${config2.apiKey}`,
21182
+ "Content-Type": "application/json"
21183
+ };
21184
+ const response = config2.fetch ? await config2.fetch(modelsUrl, { headers }) : await safeFetchWithDnsPin(modelsUrl, { headers });
21127
21185
  if (!response.ok) {
21128
21186
  throw new Error(`Failed to list models: ${response.status} ${response.statusText}`);
21129
21187
  }
@@ -21252,7 +21310,7 @@ var AiOperations = class {
21252
21310
  }
21253
21311
  }
21254
21312
  createChatModel(config2, model, options, skip) {
21255
- this.assertSafeBaseUrl(config2.baseURL);
21313
+ if (!config2.fetch) this.assertSafeBaseUrl(config2.baseURL);
21256
21314
  const modelKwargs = {};
21257
21315
  if (!skip?.has("reasoning")) {
21258
21316
  const reasoningConfig = getReasoningConfig(config2.providerType, model);
@@ -21267,10 +21325,18 @@ var AiOperations = class {
21267
21325
  model,
21268
21326
  temperature,
21269
21327
  maxTokens: options?.maxTokens ?? config2.maxTokens,
21270
- ...config2.baseURL && { configuration: { baseURL: config2.baseURL } },
21328
+ ...this.clientConfiguration(config2),
21271
21329
  ...Object.keys(modelKwargs).length > 0 && { modelKwargs }
21272
21330
  });
21273
21331
  }
21332
+ /** The OpenAI client options: the base URL, and the provider's own transport when it has one. */
21333
+ clientConfiguration(config2) {
21334
+ if (!config2.baseURL && !config2.fetch) return {};
21335
+ const configuration = {};
21336
+ if (config2.baseURL) configuration.baseURL = config2.baseURL;
21337
+ if (config2.fetch) configuration.fetch = config2.fetch;
21338
+ return { configuration };
21339
+ }
21274
21340
  /**
21275
21341
  * Generic retry: if the API rejects an unsupported parameter, rebuild
21276
21342
  * the model without it and retry, once per newly rejected parameter (a
@@ -21342,7 +21408,8 @@ var AiOperations = class {
21342
21408
  if (!(error62 instanceof Error)) return void 0;
21343
21409
  const msg = error62.message.toLowerCase();
21344
21410
  if (namesParam(msg, "temperature")) return "temperature";
21345
- if (namesParam(msg, "reasoning") || namesParam(msg, "reasoning_effort")) return "reasoning";
21411
+ if (namesParam(msg, "reasoning") || namesParam(msg, "reasoning_effort") || namesParam(msg, "reasoning_format") || namesParam(msg, "include_reasoning"))
21412
+ return "reasoning";
21346
21413
  if (msg.includes("json_schema") || msg.includes("response_format") || msg.includes("structured output"))
21347
21414
  return "structured_output";
21348
21415
  if (msg.includes("tool_choice")) return "tool_choice";
package/dist/index.js CHANGED
@@ -20584,6 +20584,26 @@ var TokenUsageTracker = class extends BaseCallbackHandler {
20584
20584
  }
20585
20585
  };
20586
20586
  var REASONING_MODELS = [
20587
+ {
20588
+ pattern: /^gpt-6-astra|^gpt-6\.1-sol|^gpt-6\.\d+-[a-z]+-pro/,
20589
+ openai: { reasoning: { effort: "low" } },
20590
+ openrouter: { reasoning: { effort: "low" } }
20591
+ },
20592
+ {
20593
+ pattern: /^gpt-6/,
20594
+ openai: { reasoning: { effort: "none" } },
20595
+ openrouter: { reasoning: { effort: "none" } }
20596
+ },
20597
+ {
20598
+ pattern: /gpt-5\.[2-5]-pro/,
20599
+ openai: { reasoning: { effort: "medium" } },
20600
+ openrouter: { reasoning: { effort: "medium" } }
20601
+ },
20602
+ {
20603
+ pattern: /gpt-5\.[12]-codex/,
20604
+ openai: { reasoning: { effort: "low" } },
20605
+ openrouter: { reasoning: { effort: "low" } }
20606
+ },
20587
20607
  {
20588
20608
  pattern: /gpt-5\.[1-9]/,
20589
20609
  openai: { reasoning: { effort: "none" } },
@@ -20600,12 +20620,26 @@ var REASONING_MODELS = [
20600
20620
  openrouter: { reasoning: { effort: "minimal" } }
20601
20621
  },
20602
20622
  {
20603
- pattern: /gemini-[23]/,
20623
+ pattern: /gemini-(?:[4-9]|3\.[7-9])|gemini-(?:2\.5|3(?:\.\d+)?)-pro/,
20624
+ google: { reasoning_effort: "low" },
20625
+ openrouter: { reasoning: { effort: "low" } }
20626
+ },
20627
+ {
20628
+ pattern: /gemini-3/,
20629
+ google: { reasoning_effort: "minimal" },
20630
+ openrouter: { reasoning: { effort: "minimal" } }
20631
+ },
20632
+ {
20633
+ pattern: /gemini-2/,
20604
20634
  google: { reasoning_effort: "none" },
20605
20635
  openrouter: { reasoning: { effort: "none" } }
20606
20636
  },
20607
20637
  {
20608
- pattern: /claude-(sonnet|opus)-[4-9]|claude-3-[5-9]/,
20638
+ pattern: /claude-(?:opus|sonnet)-5[.-]5|claude-fable/,
20639
+ openrouter: { reasoning: { effort: "low" } }
20640
+ },
20641
+ {
20642
+ pattern: /claude-(sonnet|opus)-[4-9]|claude-haiku-[5-9]|claude-3-[5-9]/,
20609
20643
  openrouter: { reasoning: { effort: "none" } }
20610
20644
  },
20611
20645
  {
@@ -20614,7 +20648,7 @@ var REASONING_MODELS = [
20614
20648
  },
20615
20649
  {
20616
20650
  pattern: /gpt-oss/,
20617
- groq: { reasoning_effort: "low", reasoning_format: "hidden" }
20651
+ groq: { reasoning_effort: "low", include_reasoning: false }
20618
20652
  },
20619
20653
  {
20620
20654
  pattern: /qwen3/,
@@ -20960,13 +20994,38 @@ var AiOperations = class {
20960
20994
  content,
20961
20995
  ...hasToolCalls && { toolCalls }
20962
20996
  },
20963
- finishReason: hasToolCalls ? "tool_calls" : "stop"
20997
+ finishReason: hasToolCalls ? "tool_calls" : this.finishReasonOf(response)
20964
20998
  }
20965
20999
  ],
20966
21000
  usage: this.mapTokenUsage(tracker)
20967
21001
  };
20968
21002
  });
20969
21003
  }
21004
+ /**
21005
+ * The provider's own finish reason for a reply without tool calls.
21006
+ *
21007
+ * `length` matters most: a reasoning model spends its hidden reasoning from
21008
+ * the same `max_tokens` budget as its answer, and when the budget runs out
21009
+ * first the reply is `''` with `finish_reason: "length"`. Reporting `stop`
21010
+ * there told callers the model had simply answered nothing. OpenRouter's
21011
+ * `error` (the upstream failed mid-answer, so the text is partial) is
21012
+ * `null`: the reply did not finish normally, and this contract has no
21013
+ * `error` value. Anything else it has no value for stays `stop`, as it
21014
+ * always did.
21015
+ *
21016
+ * The metadata is read through a cast: `@ever-works/agent`'s Jest compiles
21017
+ * this source under its own tsconfig (`strictNullChecks: false`), where
21018
+ * `response_metadata` infers as `Partial<unknown>` and has no
21019
+ * `finish_reason`, so a direct property read fails every suite that loads it.
21020
+ */
21021
+ finishReasonOf(response) {
21022
+ const metadata = response.response_metadata;
21023
+ const raw = metadata?.finish_reason;
21024
+ if (raw === "length" || raw === "max_tokens") return "length";
21025
+ if (raw === "content_filter") return "content_filter";
21026
+ if (raw === "error") return null;
21027
+ return "stop";
21028
+ }
20970
21029
  /** Structured JSON output. Falls back to raw invoke + jsonrepair on failure. */
20971
21030
  async askJson(prompt, schema, configOverrides, options) {
20972
21031
  const config2 = this.mergeConfig(configOverrides);
@@ -21072,11 +21131,11 @@ var AiOperations = class {
21072
21131
  if (!model) {
21073
21132
  throw new Error("Embedding model must be specified in options or config");
21074
21133
  }
21075
- this.assertSafeBaseUrl(config2.baseURL);
21134
+ if (!config2.fetch) this.assertSafeBaseUrl(config2.baseURL);
21076
21135
  const embeddings = new OpenAIEmbeddings({
21077
21136
  apiKey: config2.apiKey,
21078
21137
  model,
21079
- ...config2.baseURL && { configuration: { baseURL: config2.baseURL } }
21138
+ ...this.clientConfiguration(config2)
21080
21139
  });
21081
21140
  const inputs = Array.isArray(options.input) ? options.input : [options.input];
21082
21141
  const vectors = await embeddings.embedDocuments(inputs);
@@ -21094,12 +21153,11 @@ var AiOperations = class {
21094
21153
  throw new Error("baseURL is required to list models");
21095
21154
  }
21096
21155
  const modelsUrl = `${config2.baseURL.replace(/(?<!\/)\/+$/, "")}/models`;
21097
- const response = await safeFetchWithDnsPin(modelsUrl, {
21098
- headers: {
21099
- Authorization: `Bearer ${config2.apiKey}`,
21100
- "Content-Type": "application/json"
21101
- }
21102
- });
21156
+ const headers = {
21157
+ Authorization: `Bearer ${config2.apiKey}`,
21158
+ "Content-Type": "application/json"
21159
+ };
21160
+ const response = config2.fetch ? await config2.fetch(modelsUrl, { headers }) : await safeFetchWithDnsPin(modelsUrl, { headers });
21103
21161
  if (!response.ok) {
21104
21162
  throw new Error(`Failed to list models: ${response.status} ${response.statusText}`);
21105
21163
  }
@@ -21228,7 +21286,7 @@ var AiOperations = class {
21228
21286
  }
21229
21287
  }
21230
21288
  createChatModel(config2, model, options, skip) {
21231
- this.assertSafeBaseUrl(config2.baseURL);
21289
+ if (!config2.fetch) this.assertSafeBaseUrl(config2.baseURL);
21232
21290
  const modelKwargs = {};
21233
21291
  if (!skip?.has("reasoning")) {
21234
21292
  const reasoningConfig = getReasoningConfig(config2.providerType, model);
@@ -21243,10 +21301,18 @@ var AiOperations = class {
21243
21301
  model,
21244
21302
  temperature,
21245
21303
  maxTokens: options?.maxTokens ?? config2.maxTokens,
21246
- ...config2.baseURL && { configuration: { baseURL: config2.baseURL } },
21304
+ ...this.clientConfiguration(config2),
21247
21305
  ...Object.keys(modelKwargs).length > 0 && { modelKwargs }
21248
21306
  });
21249
21307
  }
21308
+ /** The OpenAI client options: the base URL, and the provider's own transport when it has one. */
21309
+ clientConfiguration(config2) {
21310
+ if (!config2.baseURL && !config2.fetch) return {};
21311
+ const configuration = {};
21312
+ if (config2.baseURL) configuration.baseURL = config2.baseURL;
21313
+ if (config2.fetch) configuration.fetch = config2.fetch;
21314
+ return { configuration };
21315
+ }
21250
21316
  /**
21251
21317
  * Generic retry: if the API rejects an unsupported parameter, rebuild
21252
21318
  * the model without it and retry, once per newly rejected parameter (a
@@ -21318,7 +21384,8 @@ var AiOperations = class {
21318
21384
  if (!(error62 instanceof Error)) return void 0;
21319
21385
  const msg = error62.message.toLowerCase();
21320
21386
  if (namesParam(msg, "temperature")) return "temperature";
21321
- if (namesParam(msg, "reasoning") || namesParam(msg, "reasoning_effort")) return "reasoning";
21387
+ if (namesParam(msg, "reasoning") || namesParam(msg, "reasoning_effort") || namesParam(msg, "reasoning_format") || namesParam(msg, "include_reasoning"))
21388
+ return "reasoning";
21322
21389
  if (msg.includes("json_schema") || msg.includes("response_format") || msg.includes("structured output"))
21323
21390
  return "structured_output";
21324
21391
  if (msg.includes("tool_choice")) return "tool_choice";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ever-works/lm-studio-plugin",
3
- "version": "1.0.8",
3
+ "version": "1.0.13",
4
4
  "description": "LM Studio AI provider plugin for Ever Works platform",
5
5
  "author": {
6
6
  "name": "Ever Co. LTD",
@@ -32,7 +32,7 @@
32
32
  "test:watch": "vitest"
33
33
  },
34
34
  "dependencies": {
35
- "@ever-works/plugin": "^1.2.16",
35
+ "@ever-works/plugin": "^1.2.28",
36
36
  "@langchain/openai": "^1.7.1",
37
37
  "@langchain/core": "^1.3.0"
38
38
  },
@@ -63,16 +63,16 @@
63
63
  },
64
64
  "repository": {
65
65
  "type": "git",
66
- "url": "git+https://github.com/ever-works/ever-works.git",
66
+ "url": "git+https://github.com/ever-co/ever-works.git",
67
67
  "directory": "packages/plugins/lm-studio"
68
68
  },
69
- "homepage": "https://github.com/ever-works/ever-works/tree/main/packages/plugins/lm-studio#readme",
69
+ "homepage": "https://github.com/ever-co/ever-works/tree/main/packages/plugins/lm-studio#readme",
70
70
  "bugs": {
71
- "url": "https://github.com/ever-works/ever-works/issues"
71
+ "url": "https://github.com/ever-co/ever-works/issues"
72
72
  },
73
73
  "everworksRelease": {
74
- "contentHash": "sha256:5c3d10e9008378530c243878297f2eff1e1de0d3e807566f39f06c9241d46a06",
75
- "commit": "89cee44a662034ea957b07ec5e1230ecf340b107",
76
- "source": "https://github.com/ever-works/ever-works/tree/89cee44a662034ea957b07ec5e1230ecf340b107/packages/plugins/lm-studio"
74
+ "contentHash": "sha256:0e6afe999d0b92423936e16aa186ea3107e8318dc2f72310128561de329b93d4",
75
+ "commit": "2288ff7e91562b0f079c365348ba08ab3a16f1dd",
76
+ "source": "https://github.com/ever-co/ever-works/tree/2288ff7e91562b0f079c365348ba08ab3a16f1dd/packages/plugins/lm-studio"
77
77
  }
78
78
  }