Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

chore: merge origin/main into redo/plugin-approval-receipt-migration

Yuewei-LLe51d4c77863c
diff --cc apps/desktop/src/main/ownerNamespaceMigration.ts
index 4a9a7c58a4,520467aaf3..ad114c29fb
--- a/apps/desktop/src/main/ownerNamespaceMigration.ts
+++ b/apps/desktop/src/main/ownerNamespaceMigration.ts
@@@ -1,5 -1,5 +1,6 @@@
import { app } from 'electron';
+ import { execFile } from 'node:child_process';
+import { randomUUID } from 'node:crypto';
import fsSync from 'node:fs';
import fs from 'node:fs/promises';
import path from 'node:path';
@@@ -81,12 -60,7 +82,13 @@@ interface MigrationDeps
readFile(file: string): Promise<string>;
writeFileExclusive(file: string, text: string): Promise<void>;
writeFile(file: string, text: string): Promise<void>;
- lstat(file: string): Promise<{ isDirectory(): boolean; mtimeMs?: number }>;
+ unlink(file: string): Promise<void>;
+ lstat(file: string): Promise<{
+ isDirectory(): boolean;
+ isFile?: () => boolean;
+ isSymbolicLink?: () => boolean;
++ mtimeMs?: number;
+ }>;
readdir(dir: string): Promise<string[]>;
mkdir(dir: string): Promise<void>;
rename(source: string, target: string): Promise<void>;
@@@ -961,36 -895,11 +1273,36 @@@ export function getLegacyGhostRecoveryS
if (process.env.XDT_PASSIVE_SHARED_USER_DATA === '1') {
return { state: 'deferred', legacyPluginCount, canRetry: false };
}
- if (hasConcurrentLiveInstanceSync(root, isPidAlive)) {
+ if (hasConcurrentLiveInstanceSync(root, isPidAlive, readProcessIdentity)) {
return { state: 'deferred', legacyPluginCount, canRetry: false };
}
+ if (recoveredIds.length > 0) {
+ if (hasConcurrentLiveInstanceSync(root, isPidAlive)) {
+ return { state: 'deferred', legacyPluginCount, canRetry: false };
+ }
+ return { state: 'partial', legacyPluginCount, canRetry: true };
+ }
+ if (unexpectedFrozenIds.length > 0) {
+ return { state: 'partial', legacyPluginCount, canRetry: false };
+ }
- const targetRoot = path.join(root, 'owners', ownerKey, 'cindy-brain');
+ if (discoveryHasInvalid && legacyGhosts.length === 0) {
+ return { state: 'partial', legacyPluginCount, canRetry: false };
+ }
+ const markerRead = readMarkerSync(root);
+ const sharedRecoveryBlocked =
+ sharedLegacyGhosts.length > 0 &&
+ (markerRead.invalid ||
+ (markerRead.marker !== null && markerRead.marker.ownerKey !== ownerKey));
+ if (sharedRecoveryBlocked && scopedLegacyGhosts.length === 0) {
+ if (markerRead.marker && markerRead.marker.ownerKey !== ownerKey) {
+ return { state: 'claimed-by-other-owner', legacyPluginCount, canRetry: false };
+ }
+ return { state: 'partial', legacyPluginCount, canRetry: false };
+ }
+
+ const eligibleLegacyGhosts = (sharedRecoveryBlocked ? scopedLegacyGhosts : legacyGhosts)
+ .filter((ghost) => !recoveryMarker || recoveryMarker.pendingIds.includes(ghost.id));
if (!hasSafeRecoveryTargetChainSync(root, targetRoot)) {
return { state: 'partial', legacyPluginCount, canRetry: false };
}