refactor(beaver): 移除Hermes相关引用和迁移代码,完善Beaver后端主线实现
移除了所有Hermes相关的命名引用,包括: - 从.gitignore中清理相关构建缓存文件 - 将README中的beaver-home路径配置更新 - 完善backend/README.md文档说明Beaver后端主线实现 - 移除Hermes风格的相关注释和兼容性代码 - 清理nanobot环境变量兼容性处理 - 删除技能迁移和服务迁移相关功能代码 - 更新测试用例中相关命名和函数名 BREAKING CHANGE: 移除了Hermes迁移相关API和CLI命令,不再支持nanobot环境变量兼容性
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
// Nanobot API client — single-user direct mode.
|
||||
// Beaver API client - single-user direct mode.
|
||||
|
||||
import type {
|
||||
AuthzBackendRecord,
|
||||
AuthzChannelSettings,
|
||||
AuthzRegisterBackendResponse,
|
||||
AuthzStatus,
|
||||
AuthUser,
|
||||
ActiveTask,
|
||||
@ -12,11 +9,8 @@ import type {
|
||||
ChatMessage,
|
||||
CronJob,
|
||||
FileAttachment,
|
||||
Marketplace,
|
||||
MarketplacePlugin,
|
||||
NotificationDetail,
|
||||
NotificationRun,
|
||||
PluginInfo,
|
||||
ProviderConfigPayload,
|
||||
Session,
|
||||
SessionDetail,
|
||||
@ -33,7 +27,6 @@ import type {
|
||||
SkillHubVersionsResponse,
|
||||
SkillLearningCandidate,
|
||||
SkillReviewRecord,
|
||||
SlashCommand,
|
||||
SessionProcessProjection,
|
||||
SystemStatus,
|
||||
TokenResponse,
|
||||
@ -55,8 +48,8 @@ import { getCurrentAppLocale, pickAppText } from '@/lib/i18n/core';
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL?.trim();
|
||||
const WS_URL = process.env.NEXT_PUBLIC_WS_URL?.trim();
|
||||
const DEFAULT_API_URL = 'http://127.0.0.1:18080';
|
||||
const ACCESS_TOKEN_KEY = 'nanobot_access_token';
|
||||
const REFRESH_TOKEN_KEY = 'nanobot_refresh_token';
|
||||
const ACCESS_TOKEN_KEY = 'beaver_access_token';
|
||||
const REFRESH_TOKEN_KEY = 'beaver_refresh_token';
|
||||
const REQUEST_TIMEOUT_MS = 8000;
|
||||
const OUTLOOK_REQUEST_TIMEOUT_MS = 45000;
|
||||
const SKILL_LEARNING_REQUEST_TIMEOUT_MS = 120000;
|
||||
@ -636,16 +629,6 @@ export async function updateProviderConfig(
|
||||
});
|
||||
}
|
||||
|
||||
export async function restartSystem(): Promise<{
|
||||
ok: boolean;
|
||||
restarting: boolean;
|
||||
detail: string;
|
||||
}> {
|
||||
return fetchJSON('/api/system/restart', {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Cron (proxied)
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -861,14 +844,6 @@ export async function rollbackPublishedSkill(
|
||||
});
|
||||
}
|
||||
|
||||
export async function listCommands(): Promise<SlashCommand[]> {
|
||||
return fetchJSON('/api/commands');
|
||||
}
|
||||
|
||||
export async function listPlugins(): Promise<PluginInfo[]> {
|
||||
return fetchJSON('/api/plugins');
|
||||
}
|
||||
|
||||
export async function listAgents(): Promise<UiAgentDescriptor[]> {
|
||||
return fetchJSON('/api/agents');
|
||||
}
|
||||
@ -957,18 +932,6 @@ export async function deleteSubagent(subagentId: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function cancelDelegation(runId: string): Promise<{ ok: boolean; run_id: string }> {
|
||||
return fetchJSON(`/api/delegations/${encodeURIComponent(runId)}/cancel`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function retryDelegation(runId: string): Promise<{ ok: boolean; run_id: string }> {
|
||||
return fetchJSON(`/api/delegations/${encodeURIComponent(runId)}/retry`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function listMcpServers(): Promise<UiMcpServerDescriptor[]> {
|
||||
return fetchJSON('/api/mcp/servers');
|
||||
}
|
||||
@ -1022,122 +985,6 @@ export async function getAuthzStatus(): Promise<AuthzStatus> {
|
||||
return fetchJSON('/api/authz/status');
|
||||
}
|
||||
|
||||
export async function bindLocalBackendIdentity(payload: {
|
||||
backend_id: string;
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
name?: string;
|
||||
public_base_url?: string;
|
||||
authz_base_url?: string;
|
||||
authz_enabled?: boolean;
|
||||
}): Promise<Record<string, unknown>> {
|
||||
return fetchJSON('/api/authz/local-backend/bind', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function listAuthzBackends(): Promise<AuthzBackendRecord[]> {
|
||||
return fetchJSON('/api/authz/backends');
|
||||
}
|
||||
|
||||
export async function registerAuthzBackend(payload: {
|
||||
name?: string;
|
||||
backend_id?: string;
|
||||
base_url?: string;
|
||||
save_to_backend?: boolean;
|
||||
authz_base_url?: string;
|
||||
}): Promise<AuthzRegisterBackendResponse> {
|
||||
return fetchJSON('/api/authz/backends/register', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAuthzBackend(backendId: string): Promise<AuthzBackendRecord> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}`);
|
||||
}
|
||||
|
||||
export async function enableAuthzBackend(backendId: string): Promise<AuthzBackendRecord> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/enable`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function disableAuthzBackend(backendId: string): Promise<AuthzBackendRecord> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/disable`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function rotateAuthzBackendSecret(backendId: string): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/rotate-secret`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAuthzBackendPermissions(backendId: string): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/permissions`);
|
||||
}
|
||||
|
||||
export async function setAuthzBackendPermissions(
|
||||
backendId: string,
|
||||
payload: Record<string, unknown>
|
||||
): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/permissions`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAuthzBackendOutlookSettings(backendId: string): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/settings/outlook`);
|
||||
}
|
||||
|
||||
export async function setAuthzBackendOutlookSettings(
|
||||
backendId: string,
|
||||
payload: Record<string, unknown>
|
||||
): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/settings/outlook`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteAuthzBackendOutlookSettings(backendId: string): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/authz/backends/${encodeURIComponent(backendId)}/settings/outlook`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export async function listAuthzChannelSettings(): Promise<Record<string, AuthzChannelSettings>> {
|
||||
return fetchJSON('/api/authz/channel-settings');
|
||||
}
|
||||
|
||||
export async function getAuthzChannelSettings(channelId: string): Promise<AuthzChannelSettings> {
|
||||
return fetchJSON(`/api/authz/channel-settings/${encodeURIComponent(channelId)}`);
|
||||
}
|
||||
|
||||
export async function setAuthzChannelSettings(
|
||||
channelId: string,
|
||||
payload: {
|
||||
configured?: boolean;
|
||||
config?: Record<string, unknown>;
|
||||
secrets?: Record<string, unknown>;
|
||||
}
|
||||
): Promise<AuthzChannelSettings> {
|
||||
return fetchJSON(`/api/authz/channel-settings/${encodeURIComponent(channelId)}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteAuthzChannelSettings(channelId: string): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/authz/channel-settings/${encodeURIComponent(channelId)}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export async function testMcpServer(serverId: string): Promise<Record<string, unknown>> {
|
||||
return fetchJSON(`/api/mcp/servers/${encodeURIComponent(serverId)}/test`, {
|
||||
method: 'POST',
|
||||
@ -1282,10 +1129,6 @@ export async function uploadSkill(file: File): Promise<Skill> {
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function migrateSkills(): Promise<{ included: Array<Record<string, unknown>>; skipped: Array<Record<string, unknown>> }> {
|
||||
return fetchJSON('/api/skills/migrate', { method: 'POST', timeoutMs: 45000 });
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SkillHub marketplace
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -1356,50 +1199,6 @@ export async function installSkillHubSkill(
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Marketplace (proxied)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export async function listMarketplaces(): Promise<Marketplace[]> {
|
||||
return fetchJSON('/api/marketplaces');
|
||||
}
|
||||
|
||||
export async function addMarketplace(source: string): Promise<Marketplace> {
|
||||
return fetchJSON('/api/marketplaces', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ source }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function removeMarketplace(name: string): Promise<void> {
|
||||
await fetchJSON(`/api/marketplaces/${encodeURIComponent(name)}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateMarketplace(name: string): Promise<Marketplace> {
|
||||
return fetchJSON(`/api/marketplaces/${encodeURIComponent(name)}/update`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function listMarketplacePlugins(name: string): Promise<MarketplacePlugin[]> {
|
||||
return fetchJSON(`/api/marketplaces/${encodeURIComponent(name)}/plugins`);
|
||||
}
|
||||
|
||||
export async function installMarketplacePlugin(marketplaceName: string, pluginName: string): Promise<void> {
|
||||
await fetchJSON(
|
||||
`/api/marketplaces/${encodeURIComponent(marketplaceName)}/plugins/${encodeURIComponent(pluginName)}/install`,
|
||||
{ method: 'POST' }
|
||||
);
|
||||
}
|
||||
|
||||
export async function uninstallPlugin(pluginName: string): Promise<void> {
|
||||
await fetchJSON(`/api/plugins/${encodeURIComponent(pluginName)}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Files (proxied)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user