@nextclaw/server 0.12.7 → 0.12.9
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 +26 -1
- package/dist/index.js +68 -5
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -360,6 +360,12 @@ type RuntimeActionCapability = {
|
|
|
360
360
|
reasonIfUnavailable?: string;
|
|
361
361
|
};
|
|
362
362
|
type RuntimeServiceState = "running" | "stopped" | "starting" | "stopping" | "restarting" | "unknown";
|
|
363
|
+
type RuntimePendingRestart = {
|
|
364
|
+
changedPaths: string[];
|
|
365
|
+
message: string;
|
|
366
|
+
reasons: string[];
|
|
367
|
+
requestedAt: string;
|
|
368
|
+
};
|
|
363
369
|
type RuntimeControlView = {
|
|
364
370
|
environment: RuntimeControlEnvironment;
|
|
365
371
|
lifecycle: RuntimeLifecycleState;
|
|
@@ -368,6 +374,7 @@ type RuntimeControlView = {
|
|
|
368
374
|
canRestartService: RuntimeActionCapability;
|
|
369
375
|
canStopService: RuntimeActionCapability;
|
|
370
376
|
canRestartApp: RuntimeActionCapability;
|
|
377
|
+
pendingRestart?: RuntimePendingRestart | null;
|
|
371
378
|
ownerLabel?: string;
|
|
372
379
|
managementHint?: string;
|
|
373
380
|
message?: string;
|
|
@@ -417,6 +424,11 @@ type UiRuntimeControlHost = {
|
|
|
417
424
|
};
|
|
418
425
|
//#endregion
|
|
419
426
|
//#region src/ui/chat-session-type.types.d.ts
|
|
427
|
+
type ChatSessionTypeIconView = {
|
|
428
|
+
kind: "image";
|
|
429
|
+
src: string;
|
|
430
|
+
alt?: string | null;
|
|
431
|
+
};
|
|
420
432
|
type ChatSessionTypeCtaView = {
|
|
421
433
|
kind: string;
|
|
422
434
|
label?: string;
|
|
@@ -425,6 +437,7 @@ type ChatSessionTypeCtaView = {
|
|
|
425
437
|
type ChatSessionTypeOptionView = {
|
|
426
438
|
value: string;
|
|
427
439
|
label: string;
|
|
440
|
+
icon?: ChatSessionTypeIconView | null;
|
|
428
441
|
ready?: boolean;
|
|
429
442
|
reason?: string | null;
|
|
430
443
|
reasonMessage?: string | null;
|
|
@@ -801,6 +814,11 @@ type SessionConfigView = {
|
|
|
801
814
|
type RuntimeEntryView = {
|
|
802
815
|
enabled?: boolean;
|
|
803
816
|
label?: string;
|
|
817
|
+
icon?: {
|
|
818
|
+
kind: "image";
|
|
819
|
+
src: string;
|
|
820
|
+
alt?: string | null;
|
|
821
|
+
} | null;
|
|
804
822
|
type: string;
|
|
805
823
|
config?: Record<string, unknown>;
|
|
806
824
|
};
|
|
@@ -1221,6 +1239,13 @@ type UiServerEvent = {
|
|
|
1221
1239
|
payload: {
|
|
1222
1240
|
path: string;
|
|
1223
1241
|
};
|
|
1242
|
+
} | {
|
|
1243
|
+
type: "channel.config.apply-status";
|
|
1244
|
+
payload: {
|
|
1245
|
+
channel: string;
|
|
1246
|
+
status: "started" | "succeeded" | "failed";
|
|
1247
|
+
message?: string;
|
|
1248
|
+
};
|
|
1224
1249
|
} | {
|
|
1225
1250
|
type: "session.updated";
|
|
1226
1251
|
payload: {
|
|
@@ -1348,4 +1373,4 @@ declare function getUiBridgeSecretPath(): string;
|
|
|
1348
1373
|
declare function readUiBridgeSecret(): string | null;
|
|
1349
1374
|
declare function ensureUiBridgeSecret(): string;
|
|
1350
1375
|
//#endregion
|
|
1351
|
-
export { AgentBindingView, AgentCreateRequest, AgentDeleteResult, AgentProfileView, AgentUpdateRequest, ApiError, ApiResponse, AppMetaView, AuthEnabledUpdateRequest, AuthLoginRequest, AuthPasswordUpdateRequest, AuthSetupRequest, AuthStatusView, BindingPeerView, BochaFreshnessValue, BootstrapPhase, BootstrapRemoteState, BootstrapStageState, BootstrapStatusView, ChannelAuthPollRequest, ChannelAuthPollResult, ChannelAuthStartRequest, ChannelAuthStartResult, ChannelSpecView, type ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, ConfigActionExecuteRequest, ConfigActionExecuteResult, ConfigActionManifest, ConfigActionType, ConfigMetaView, ConfigSchemaResponse, ConfigUiHint, ConfigUiHints, ConfigView, CronActionResult, CronCreateRequest, CronCreateResult, CronEnableRequest, CronJobStateView, CronJobView, CronListView, CronPayloadView, CronRunRequest, CronScheduleView, DEFAULT_SESSION_TYPE, MarketplaceApiConfig, MarketplaceInstallKind, MarketplaceInstallSkillParams, MarketplaceInstallSpec, MarketplaceInstalledRecord, MarketplaceInstalledView, MarketplaceInstaller, MarketplaceItemSummary, MarketplaceItemType, MarketplaceItemView, MarketplaceListView, MarketplaceLocalizedTextMap, MarketplaceMcpContentView, MarketplaceMcpDoctorResult, MarketplaceMcpInstallKind, MarketplaceMcpInstallRequest, MarketplaceMcpInstallResult, MarketplaceMcpInstallSpec, MarketplaceMcpManageAction, MarketplaceMcpManageRequest, MarketplaceMcpManageResult, MarketplaceMcpTemplateInput, MarketplacePluginContentView, MarketplacePluginInstallKind, MarketplacePluginInstallRequest, MarketplacePluginInstallResult, MarketplacePluginManageAction, MarketplacePluginManageRequest, MarketplacePluginManageResult, MarketplaceRecommendationView, MarketplaceSkillContentView, MarketplaceSkillInstallKind, MarketplaceSkillInstallRequest, MarketplaceSkillInstallResult, MarketplaceSkillManageAction, MarketplaceSkillManageRequest, MarketplaceSkillManageResult, MarketplaceSort, NcpSessionSkillsView, ProviderAuthImportResult, ProviderAuthPollRequest, ProviderAuthPollResult, ProviderAuthStartRequest, ProviderAuthStartResult, ProviderConfigUpdate, ProviderConfigView, ProviderConnectionTestRequest, ProviderConnectionTestResult, ProviderCreateRequest, ProviderCreateResult, ProviderDeleteResult, ProviderSpecView, RemoteAccessView, RemoteAccountProfileUpdateRequest, RemoteAccountView, RemoteBrowserAuthPollRequest, RemoteBrowserAuthPollResult, RemoteBrowserAuthStartRequest, RemoteBrowserAuthStartResult, RemoteDoctorCheckView, RemoteDoctorView, RemoteLoginRequest, RemoteRuntimeView, RemoteServiceAction, RemoteServiceActionResult, RemoteServiceView, RemoteSettingsUpdateRequest, RemoteSettingsView, RuntimeActionCapability, RuntimeActionImpact, RuntimeConfigUpdate, RuntimeControlAction, RuntimeControlActionResult, RuntimeControlEnvironment, RuntimeControlView, RuntimeEntryView, RuntimeLifecycleState, RuntimeServiceState, SearchConfigUpdate, SearchConfigView, SearchProviderConfigView, SearchProviderName, SearchProviderSpecView, SecretProviderEnvView, SecretProviderExecView, SecretProviderFileView, SecretProviderView, SecretRefView, SecretSourceView, SecretsConfigUpdate, SecretsView, ServerPathBreadcrumbView, ServerPathBrowseView, ServerPathEntryView, ServerPathReadView, SessionConfigView, SessionEntryView, SessionEventView, SessionHistoryView, SessionMessageView, SessionPatchUpdate, SessionPatchValidationError, SessionSkillEntryView, SessionTypeDescribeParams, SessionsListView, TavilySearchDepthValue, UiNcpAgent, UiNcpAssetPutView, UiNcpAssetView, UiNcpSessionListView, UiNcpSessionMessagesView, UiNcpSessionService, UiNcpStoredAssetRecord, type UiRemoteAccessHost, type UiRuntimeControlHost, UiServerEvent, UiServerHandle, UiServerOptions, buildConfigMeta, buildConfigSchemaView, buildConfigView, createCustomProvider, createUiRouter, deleteCustomProvider, deleteSession, ensureUiBridgeSecret, executeConfigAction, getSessionHistory, getUiBridgeSecretPath, listSessions, loadConfigOrDefault, patchSession, readUiBridgeSecret, startUiServer, testProviderConnection, updateChannel, updateModel, updateProvider, updateRuntime, updateSearch, updateSecrets };
|
|
1376
|
+
export { AgentBindingView, AgentCreateRequest, AgentDeleteResult, AgentProfileView, AgentUpdateRequest, ApiError, ApiResponse, AppMetaView, AuthEnabledUpdateRequest, AuthLoginRequest, AuthPasswordUpdateRequest, AuthSetupRequest, AuthStatusView, BindingPeerView, BochaFreshnessValue, BootstrapPhase, BootstrapRemoteState, BootstrapStageState, BootstrapStatusView, ChannelAuthPollRequest, ChannelAuthPollResult, ChannelAuthStartRequest, ChannelAuthStartResult, ChannelSpecView, type ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, ConfigActionExecuteRequest, ConfigActionExecuteResult, ConfigActionManifest, ConfigActionType, ConfigMetaView, ConfigSchemaResponse, ConfigUiHint, ConfigUiHints, ConfigView, CronActionResult, CronCreateRequest, CronCreateResult, CronEnableRequest, CronJobStateView, CronJobView, CronListView, CronPayloadView, CronRunRequest, CronScheduleView, DEFAULT_SESSION_TYPE, MarketplaceApiConfig, MarketplaceInstallKind, MarketplaceInstallSkillParams, MarketplaceInstallSpec, MarketplaceInstalledRecord, MarketplaceInstalledView, MarketplaceInstaller, MarketplaceItemSummary, MarketplaceItemType, MarketplaceItemView, MarketplaceListView, MarketplaceLocalizedTextMap, MarketplaceMcpContentView, MarketplaceMcpDoctorResult, MarketplaceMcpInstallKind, MarketplaceMcpInstallRequest, MarketplaceMcpInstallResult, MarketplaceMcpInstallSpec, MarketplaceMcpManageAction, MarketplaceMcpManageRequest, MarketplaceMcpManageResult, MarketplaceMcpTemplateInput, MarketplacePluginContentView, MarketplacePluginInstallKind, MarketplacePluginInstallRequest, MarketplacePluginInstallResult, MarketplacePluginManageAction, MarketplacePluginManageRequest, MarketplacePluginManageResult, MarketplaceRecommendationView, MarketplaceSkillContentView, MarketplaceSkillInstallKind, MarketplaceSkillInstallRequest, MarketplaceSkillInstallResult, MarketplaceSkillManageAction, MarketplaceSkillManageRequest, MarketplaceSkillManageResult, MarketplaceSort, NcpSessionSkillsView, ProviderAuthImportResult, ProviderAuthPollRequest, ProviderAuthPollResult, ProviderAuthStartRequest, ProviderAuthStartResult, ProviderConfigUpdate, ProviderConfigView, ProviderConnectionTestRequest, ProviderConnectionTestResult, ProviderCreateRequest, ProviderCreateResult, ProviderDeleteResult, ProviderSpecView, RemoteAccessView, RemoteAccountProfileUpdateRequest, RemoteAccountView, RemoteBrowserAuthPollRequest, RemoteBrowserAuthPollResult, RemoteBrowserAuthStartRequest, RemoteBrowserAuthStartResult, RemoteDoctorCheckView, RemoteDoctorView, RemoteLoginRequest, RemoteRuntimeView, RemoteServiceAction, RemoteServiceActionResult, RemoteServiceView, RemoteSettingsUpdateRequest, RemoteSettingsView, RuntimeActionCapability, RuntimeActionImpact, RuntimeConfigUpdate, RuntimeControlAction, RuntimeControlActionResult, RuntimeControlEnvironment, RuntimeControlView, RuntimeEntryView, RuntimeLifecycleState, RuntimePendingRestart, RuntimeServiceState, SearchConfigUpdate, SearchConfigView, SearchProviderConfigView, SearchProviderName, SearchProviderSpecView, SecretProviderEnvView, SecretProviderExecView, SecretProviderFileView, SecretProviderView, SecretRefView, SecretSourceView, SecretsConfigUpdate, SecretsView, ServerPathBreadcrumbView, ServerPathBrowseView, ServerPathEntryView, ServerPathReadView, SessionConfigView, SessionEntryView, SessionEventView, SessionHistoryView, SessionMessageView, SessionPatchUpdate, SessionPatchValidationError, SessionSkillEntryView, SessionTypeDescribeParams, SessionsListView, TavilySearchDepthValue, UiNcpAgent, UiNcpAssetPutView, UiNcpAssetView, UiNcpSessionListView, UiNcpSessionMessagesView, UiNcpSessionService, UiNcpStoredAssetRecord, type UiRemoteAccessHost, type UiRuntimeControlHost, UiServerEvent, UiServerHandle, UiServerOptions, buildConfigMeta, buildConfigSchemaView, buildConfigView, createCustomProvider, createUiRouter, deleteCustomProvider, deleteSession, ensureUiBridgeSecret, executeConfigAction, getSessionHistory, getUiBridgeSecretPath, listSessions, loadConfigOrDefault, patchSession, readUiBridgeSecret, startUiServer, testProviderConnection, updateChannel, updateModel, updateProvider, updateRuntime, updateSearch, updateSecrets };
|
package/dist/index.js
CHANGED
|
@@ -1357,15 +1357,35 @@ function normalizeRuntimeEntries(entries) {
|
|
|
1357
1357
|
const entry = rawEntry;
|
|
1358
1358
|
const type = normalizeOptionalString(entry.type);
|
|
1359
1359
|
if (!type) continue;
|
|
1360
|
+
const normalizedIcon = normalizeRuntimeEntryIcon(entry.icon);
|
|
1360
1361
|
normalized[id] = {
|
|
1361
1362
|
enabled: typeof entry.enabled === "boolean" ? entry.enabled : true,
|
|
1362
1363
|
...normalizeOptionalString(entry.label) ? { label: normalizeOptionalString(entry.label) ?? void 0 } : {},
|
|
1364
|
+
...normalizedIcon ? { icon: normalizedIcon } : {},
|
|
1363
1365
|
type,
|
|
1364
1366
|
config: normalizeRuntimeEntryConfig(type, entry.config && typeof entry.config === "object" && !Array.isArray(entry.config) ? entry.config : {})
|
|
1365
1367
|
};
|
|
1366
1368
|
}
|
|
1367
1369
|
return normalized;
|
|
1368
1370
|
}
|
|
1371
|
+
function normalizeRuntimeEntryIcon(value) {
|
|
1372
|
+
if (typeof value === "string") {
|
|
1373
|
+
const src = value.trim();
|
|
1374
|
+
return src ? {
|
|
1375
|
+
kind: "image",
|
|
1376
|
+
src
|
|
1377
|
+
} : null;
|
|
1378
|
+
}
|
|
1379
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1380
|
+
const src = normalizeOptionalString(value.src);
|
|
1381
|
+
if (!src) return null;
|
|
1382
|
+
const alt = normalizeOptionalString(value.alt);
|
|
1383
|
+
return {
|
|
1384
|
+
kind: "image",
|
|
1385
|
+
src,
|
|
1386
|
+
...alt ? { alt } : {}
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1369
1389
|
function normalizeRuntimeEntryConfig(type, config) {
|
|
1370
1390
|
if (type !== "narp-stdio") return { ...config };
|
|
1371
1391
|
const command = normalizeOptionalString(config.command);
|
|
@@ -2441,22 +2461,64 @@ async function importProviderAuthFromCli(configPath, providerName) {
|
|
|
2441
2461
|
//#endregion
|
|
2442
2462
|
//#region src/ui/ui-routes/config.controller.ts
|
|
2443
2463
|
var ConfigRoutesController = class {
|
|
2464
|
+
channelConfigApplyTasks = /* @__PURE__ */ new Map();
|
|
2444
2465
|
constructor(options) {
|
|
2445
2466
|
this.options = options;
|
|
2446
2467
|
}
|
|
2447
|
-
getPluginConfigOptions() {
|
|
2468
|
+
getPluginConfigOptions = () => {
|
|
2448
2469
|
return {
|
|
2449
2470
|
pluginChannelBindings: this.options.getPluginChannelBindings?.() ?? [],
|
|
2450
2471
|
pluginUiMetadata: this.options.getPluginUiMetadata?.() ?? []
|
|
2451
2472
|
};
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2473
|
+
};
|
|
2474
|
+
publishConfigUpdatedPaths = (paths) => {
|
|
2454
2475
|
for (const path of paths) this.options.publish({
|
|
2455
2476
|
type: "config.updated",
|
|
2456
2477
|
payload: { path }
|
|
2457
2478
|
});
|
|
2479
|
+
};
|
|
2480
|
+
publishConfigUpdates = async (paths) => {
|
|
2481
|
+
this.publishConfigUpdatedPaths(paths);
|
|
2458
2482
|
await this.options.applyLiveConfigReload?.();
|
|
2459
|
-
}
|
|
2483
|
+
};
|
|
2484
|
+
publishChannelConfigApplyStatus = (params) => {
|
|
2485
|
+
this.options.publish({
|
|
2486
|
+
type: "channel.config.apply-status",
|
|
2487
|
+
payload: params
|
|
2488
|
+
});
|
|
2489
|
+
};
|
|
2490
|
+
enqueueChannelConfigApply = (channel) => {
|
|
2491
|
+
const task = (this.channelConfigApplyTasks.get(channel) ?? Promise.resolve()).catch(() => void 0).then(async () => {
|
|
2492
|
+
this.publishChannelConfigApplyStatus({
|
|
2493
|
+
channel,
|
|
2494
|
+
status: "started"
|
|
2495
|
+
});
|
|
2496
|
+
try {
|
|
2497
|
+
await this.options.applyLiveConfigReload?.();
|
|
2498
|
+
this.publishChannelConfigApplyStatus({
|
|
2499
|
+
channel,
|
|
2500
|
+
status: "succeeded"
|
|
2501
|
+
});
|
|
2502
|
+
} catch (error) {
|
|
2503
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2504
|
+
this.publishChannelConfigApplyStatus({
|
|
2505
|
+
channel,
|
|
2506
|
+
status: "failed",
|
|
2507
|
+
message
|
|
2508
|
+
});
|
|
2509
|
+
this.options.publish({
|
|
2510
|
+
type: "error",
|
|
2511
|
+
payload: {
|
|
2512
|
+
code: "CHANNEL_CONFIG_APPLY_FAILED",
|
|
2513
|
+
message: `Failed to apply ${channel} channel config: ${message}`
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
}
|
|
2517
|
+
}).finally(() => {
|
|
2518
|
+
if (this.channelConfigApplyTasks.get(channel) === task) this.channelConfigApplyTasks.delete(channel);
|
|
2519
|
+
});
|
|
2520
|
+
this.channelConfigApplyTasks.set(channel, task);
|
|
2521
|
+
};
|
|
2460
2522
|
getConfig = (c) => {
|
|
2461
2523
|
const config = loadConfigOrDefault(this.options.configPath);
|
|
2462
2524
|
return c.json(ok(buildConfigView(config, this.getPluginConfigOptions())));
|
|
@@ -2582,7 +2644,8 @@ var ConfigRoutesController = class {
|
|
|
2582
2644
|
if (!body.ok) return c.json(err("INVALID_BODY", "invalid json body"), 400);
|
|
2583
2645
|
const result = updateChannel(this.options.configPath, channel, body.data, this.getPluginConfigOptions());
|
|
2584
2646
|
if (!result) return c.json(err("NOT_FOUND", `unknown channel: ${channel}`), 404);
|
|
2585
|
-
|
|
2647
|
+
this.publishConfigUpdatedPaths([`channels.${channel}`]);
|
|
2648
|
+
this.enqueueChannelConfigApply(channel);
|
|
2586
2649
|
return c.json(ok(result));
|
|
2587
2650
|
};
|
|
2588
2651
|
startChannelAuth = async (c) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/server",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nextclaw UI/API server.",
|
|
6
6
|
"type": "module",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"@hono/node-server": "^1.13.3",
|
|
19
19
|
"hono": "^4.6.2",
|
|
20
20
|
"ws": "^8.18.0",
|
|
21
|
-
"@nextclaw/core": "0.12.
|
|
22
|
-
"@nextclaw/
|
|
23
|
-
"@nextclaw/
|
|
24
|
-
"@nextclaw/
|
|
25
|
-
"@nextclaw/
|
|
26
|
-
"@nextclaw/
|
|
21
|
+
"@nextclaw/core": "0.12.9",
|
|
22
|
+
"@nextclaw/ncp": "0.5.3",
|
|
23
|
+
"@nextclaw/mcp": "0.1.74",
|
|
24
|
+
"@nextclaw/runtime": "0.2.41",
|
|
25
|
+
"@nextclaw/openclaw-compat": "1.0.9",
|
|
26
|
+
"@nextclaw/ncp-http-agent-server": "0.3.15"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^20.17.6",
|