@nextclaw/server 0.6.10 → 0.6.12
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 +9 -1
- package/dist/index.js +49 -6
- package/package.json +4 -8
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];
|
|
@@ -3110,7 +3142,18 @@ function createUiRouter(options) {
|
|
|
3110
3142
|
const app = new Hono();
|
|
3111
3143
|
const marketplaceBaseUrl = normalizeMarketplaceBaseUrl(options);
|
|
3112
3144
|
app.notFound((c) => c.json(err("NOT_FOUND", "endpoint not found"), 404));
|
|
3113
|
-
app.get(
|
|
3145
|
+
app.get(
|
|
3146
|
+
"/api/health",
|
|
3147
|
+
(c) => c.json(
|
|
3148
|
+
ok({
|
|
3149
|
+
status: "ok",
|
|
3150
|
+
services: {
|
|
3151
|
+
chatRuntime: options.chatRuntime ? "ready" : "unavailable",
|
|
3152
|
+
cronService: options.cronService ? "ready" : "unavailable"
|
|
3153
|
+
}
|
|
3154
|
+
})
|
|
3155
|
+
)
|
|
3156
|
+
);
|
|
3114
3157
|
app.get("/api/app/meta", (c) => c.json(ok(buildAppMetaView(options))));
|
|
3115
3158
|
app.get("/api/config", (c) => {
|
|
3116
3159
|
const config = loadConfigOrDefault(options.configPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/server",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nextclaw UI/API server.",
|
|
6
6
|
"type": "module",
|
|
@@ -18,17 +18,13 @@
|
|
|
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.
|
|
22
|
-
"@nextclaw/
|
|
23
|
-
"@nextclaw/
|
|
21
|
+
"@nextclaw/openclaw-compat": "0.2.6",
|
|
22
|
+
"@nextclaw/core": "0.7.7",
|
|
23
|
+
"@nextclaw/runtime": "0.1.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^20.17.6",
|
|
27
27
|
"@types/ws": "^8.5.14",
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
29
|
-
"@typescript-eslint/parser": "^7.18.0",
|
|
30
|
-
"eslint": "^8.57.1",
|
|
31
|
-
"eslint-config-prettier": "^9.1.0",
|
|
32
28
|
"prettier": "^3.3.3",
|
|
33
29
|
"tsup": "^8.3.5",
|
|
34
30
|
"tsx": "^4.19.2",
|