@nextclaw/server 0.6.10 → 0.6.11

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as NextclawCore from '@nextclaw/core';
2
- import { CronService, Config, ConfigActionExecuteRequest as ConfigActionExecuteRequest$1, ConfigActionExecuteResult as ConfigActionExecuteResult$1 } from '@nextclaw/core';
2
+ import { ThinkingLevel, CronService, Config, ConfigActionExecuteRequest as ConfigActionExecuteRequest$1, ConfigActionExecuteResult as ConfigActionExecuteResult$1 } from '@nextclaw/core';
3
3
  import { Hono } from 'hono';
4
4
 
5
5
  type ApiError = {
@@ -26,6 +26,10 @@ type ProviderConfigView = {
26
26
  extraHeaders?: Record<string, string> | null;
27
27
  wireApi?: "auto" | "chat" | "responses" | null;
28
28
  models?: string[];
29
+ modelThinking?: Record<string, {
30
+ supported: ThinkingLevel[];
31
+ default?: ThinkingLevel | null;
32
+ }>;
29
33
  };
30
34
  type ProviderConfigUpdate = {
31
35
  displayName?: string | null;
@@ -34,6 +38,10 @@ type ProviderConfigUpdate = {
34
38
  extraHeaders?: Record<string, string> | null;
35
39
  wireApi?: "auto" | "chat" | "responses" | null;
36
40
  models?: string[] | null;
41
+ modelThinking?: Record<string, {
42
+ supported?: ThinkingLevel[];
43
+ default?: ThinkingLevel | null;
44
+ }> | null;
37
45
  };
38
46
  type ProviderConnectionTestRequest = ProviderConfigUpdate & {
39
47
  model?: string | null;
package/dist/index.js CHANGED
@@ -26,7 +26,9 @@ import {
26
26
  hasSecretRef,
27
27
  isSensitiveConfigPath,
28
28
  SessionManager,
29
- getWorkspacePathFromConfig
29
+ getWorkspacePathFromConfig,
30
+ normalizeThinkingLevels,
31
+ parseThinkingLevel
30
32
  } from "@nextclaw/core";
31
33
 
32
34
  // src/ui/provider-overrides.ts
@@ -184,7 +186,8 @@ function createDefaultProviderConfig(defaultWireApi = "auto") {
184
186
  apiBase: null,
185
187
  extraHeaders: null,
186
188
  wireApi: defaultWireApi,
187
- models: []
189
+ models: [],
190
+ modelThinking: {}
188
191
  };
189
192
  }
190
193
  function ensureProviderConfig(config, providerName) {
@@ -454,6 +457,29 @@ function normalizeModelList(input) {
454
457
  }
455
458
  return [...deduped];
456
459
  }
460
+ function normalizeModelThinkingConfig(input) {
461
+ if (!input || typeof input !== "object") {
462
+ return {};
463
+ }
464
+ const normalized = {};
465
+ for (const [rawModel, rawValue] of Object.entries(input)) {
466
+ const model = rawModel.trim();
467
+ if (!model || !rawValue || typeof rawValue !== "object") {
468
+ continue;
469
+ }
470
+ const supported = normalizeThinkingLevels(rawValue.supported);
471
+ if (supported.length === 0) {
472
+ continue;
473
+ }
474
+ const defaultLevel = parseThinkingLevel(rawValue.default);
475
+ if (defaultLevel && supported.includes(defaultLevel)) {
476
+ normalized[model] = { supported, default: defaultLevel };
477
+ } else {
478
+ normalized[model] = { supported };
479
+ }
480
+ }
481
+ return normalized;
482
+ }
457
483
  function toProviderView(config, provider, providerName, uiHints, spec) {
458
484
  const apiKeyPath = `providers.${providerName}.apiKey`;
459
485
  const apiKeyRefSet = hasSecretRef(config, apiKeyPath);
@@ -469,7 +495,8 @@ function toProviderView(config, provider, providerName, uiHints, spec) {
469
495
  apiKeyMasked: masked.apiKeyMasked ?? (apiKeyRefSet ? "****" : void 0),
470
496
  apiBase: provider.apiBase ?? null,
471
497
  extraHeaders: extraHeaders && Object.keys(extraHeaders).length > 0 ? extraHeaders : null,
472
- models: normalizeModelList(provider.models ?? [])
498
+ models: normalizeModelList(provider.models ?? []),
499
+ modelThinking: normalizeModelThinkingConfig(provider.modelThinking ?? {})
473
500
  };
474
501
  const supportsWireApi = Boolean(spec?.supportsWireApi) || isCustomProviderName(providerName);
475
502
  if (supportsWireApi) {
@@ -776,6 +803,9 @@ function updateProvider(configPath, providerName, patch) {
776
803
  if (Object.prototype.hasOwnProperty.call(patch, "models")) {
777
804
  provider.models = normalizeModelList(patch.models ?? []);
778
805
  }
806
+ if (Object.prototype.hasOwnProperty.call(patch, "modelThinking")) {
807
+ provider.modelThinking = normalizeModelThinkingConfig(patch.modelThinking ?? {});
808
+ }
779
809
  const next = ConfigSchema.parse(config);
780
810
  saveConfig(next, configPath);
781
811
  const uiHints = buildUiHints(next);
@@ -793,7 +823,8 @@ function createCustomProvider(configPath, patch = {}) {
793
823
  apiBase: normalizeOptionalString(patch.apiBase),
794
824
  extraHeaders: normalizeHeaders(patch.extraHeaders ?? null),
795
825
  wireApi: patch.wireApi ?? "auto",
796
- models: normalizeModelList(patch.models ?? [])
826
+ models: normalizeModelList(patch.models ?? []),
827
+ modelThinking: normalizeModelThinkingConfig(patch.modelThinking ?? {})
797
828
  };
798
829
  const next = ConfigSchema.parse(config);
799
830
  saveConfig(next, configPath);
@@ -1509,7 +1540,8 @@ function setProviderApiKey(params) {
1509
1540
  apiBase: null,
1510
1541
  extraHeaders: null,
1511
1542
  wireApi: "auto",
1512
- models: []
1543
+ models: [],
1544
+ modelThinking: {}
1513
1545
  };
1514
1546
  }
1515
1547
  const target = providers[params.provider];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "private": false,
5
5
  "description": "Nextclaw UI/API server.",
6
6
  "type": "module",
@@ -18,9 +18,9 @@
18
18
  "@hono/node-server": "^1.13.3",
19
19
  "hono": "^4.6.2",
20
20
  "ws": "^8.18.0",
21
- "@nextclaw/openclaw-compat": "0.2.5",
22
- "@nextclaw/runtime": "0.1.5",
23
- "@nextclaw/core": "0.7.6"
21
+ "@nextclaw/core": "0.7.7",
22
+ "@nextclaw/openclaw-compat": "0.2.6",
23
+ "@nextclaw/runtime": "0.1.6"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.17.6",