Commit 127ab878 authored by AI-甘富林's avatar AI-甘富林

feat: 启动完成后改为首页绑定员工密钥

parent dd42a21c
...@@ -521,6 +521,7 @@ export function registerDesktopIpc(services: MainServices): RegisteredDesktopIpc ...@@ -521,6 +521,7 @@ export function registerDesktopIpc(services: MainServices): RegisteredDesktopIpc
} = await loadActiveProjectWorkspaceState(projectStore); } = await loadActiveProjectWorkspaceState(projectStore);
const bundleSyncStatus = projectBundleService.getSyncStatus(); const bundleSyncStatus = projectBundleService.getSyncStatus();
const bundleSyncFailed = bundleSyncStatus.state === "error"; const bundleSyncFailed = bundleSyncStatus.state === "error";
const shellReady = !bundleSyncFailed;
const chatSummary = projects.length > 0 const chatSummary = projects.length > 0
? baseChatSummary ? baseChatSummary
: bundleSyncFailed : bundleSyncFailed
...@@ -544,6 +545,7 @@ export function registerDesktopIpc(services: MainServices): RegisteredDesktopIpc ...@@ -544,6 +545,7 @@ export function registerDesktopIpc(services: MainServices): RegisteredDesktopIpc
}; };
return { return {
shellReady,
apiKeyConfigured: config.apiKeyConfigured, apiKeyConfigured: config.apiKeyConfigured,
bindingRequired: !config.apiKeyConfigured, bindingRequired: !config.apiKeyConfigured,
setupRequired: !config.apiKeyConfigured, setupRequired: !config.apiKeyConfigured,
......
...@@ -18,6 +18,7 @@ type SecretName = "apiKey" | "gatewayToken" | "deviceToken" | "authToken"; ...@@ -18,6 +18,7 @@ type SecretName = "apiKey" | "gatewayToken" | "deviceToken" | "authToken";
type KeytarModule = typeof import("keytar"); type KeytarModule = typeof import("keytar");
const KEYTAR_SERVICE = "QianjiangClaw"; const KEYTAR_SERVICE = "QianjiangClaw";
const FORCED_SECRET_BACKEND = (process.env.QJCLAW_SECRET_BACKEND ?? "").trim().toLowerCase();
const KEYTAR_ACCOUNT_MAP: Record<SecretName, string> = { const KEYTAR_ACCOUNT_MAP: Record<SecretName, string> = {
apiKey: "provider-api-key", apiKey: "provider-api-key",
gatewayToken: "gateway-token", gatewayToken: "gateway-token",
...@@ -108,6 +109,12 @@ export class SecretManager { ...@@ -108,6 +109,12 @@ export class SecretManager {
async load(): Promise<void> { async load(): Promise<void> {
await this.fallbackStore.load(); await this.fallbackStore.load();
if (FORCED_SECRET_BACKEND === "file-fallback") {
this.backend = "file-fallback(forced)";
this.store = this.fallbackStore;
return;
}
const keytar = await this.tryLoadKeytar(); const keytar = await this.tryLoadKeytar();
if (!keytar) { if (!keytar) {
this.backend = "file-fallback"; this.backend = "file-fallback";
......
This diff is collapsed.
...@@ -259,6 +259,7 @@ export interface PluginSummary { ...@@ -259,6 +259,7 @@ export interface PluginSummary {
} }
export interface WorkspaceSummary { export interface WorkspaceSummary {
shellReady: boolean;
apiKeyConfigured: boolean; apiKeyConfigured: boolean;
bindingRequired: boolean; bindingRequired: boolean;
setupRequired: boolean; setupRequired: boolean;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment