Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
Merge branch 'main' (30564c785) into redo/plugin-approval-receipt-migration
Yuewei-LLe9c26a08de4b
diff --cc apps/desktop/src/main/__tests__/ownerNamespaceMigration.test.tsindex af76cb72be,30b3ca5c95..3dabd1a59f--- a/apps/desktop/src/main/__tests__/ownerNamespaceMigration.test.ts+++ b/apps/desktop/src/main/__tests__/ownerNamespaceMigration.test.ts@@@ -2298,50 -1299,7 +2299,50 @@@ describe('legacy Ghost plugin recovery'expect(hasLegacyOwnerNamespaceClaim('cloud-a', root)).toBe(false);});+ it('keeps a pending but invalid moved target visible for recovery', async () => {+ const root = await tempRoot();+ const ownerId = 'cloud-a';+ const ownerKey = dataOwnerStorageKey(ownerId);+ const markerPath = path.join(root, 'owners', ownerKey, __testing.LEGACY_GHOST_RECOVERY_MARKER);+ const targetDir = path.join(root, 'owners', ownerKey, 'cindy-brain', 'broken-plugin');+ await fs.mkdir(targetDir, { recursive: true });+ await fs.writeFile(path.join(targetDir, 'ghost.json'), '{ broken');+ await fs.mkdir(path.dirname(markerPath), { recursive: true });+ await fs.writeFile(+ markerPath,+ JSON.stringify({ version: 1, ownerKey, pendingIds: ['broken-plugin'] }),+ );++ expect(+ getLegacyGhostRecoveryStatus(+ { mode: 'cloud', dataOwnerId: ownerId, user: { id: ownerId } },+ root,+ ),+ ).toMatchObject({ state: 'partial', legacyPluginCount: 1, canRetry: false });+ });++ it('keeps pending recovery visible when the target root itself becomes invalid', async () => {+ const root = await tempRoot();+ const ownerId = 'cloud-a';+ const ownerKey = dataOwnerStorageKey(ownerId);+ const ownerRoot = path.join(root, 'owners', ownerKey);+ const markerPath = path.join(ownerRoot, __testing.LEGACY_GHOST_RECOVERY_MARKER);+ await fs.mkdir(ownerRoot, { recursive: true });+ await fs.writeFile(path.join(ownerRoot, 'cindy-brain'), 'replaced target root');+ await fs.writeFile(+ markerPath,+ JSON.stringify({ version: 1, ownerKey, pendingIds: ['moved-plugin'] }),+ );++ expect(+ getLegacyGhostRecoveryStatus(+ { mode: 'cloud', dataOwnerId: ownerId, user: { id: ownerId } },+ root,+ ),+ ).toEqual({ state: 'partial', legacyPluginCount: 1, canRetry: false });+ });+- it('reports claimed-by-other-owner and never moves plugins across accounts', async () => {+ it('ignores foreign-owned shared plugins and never moves them across accounts', async () => {const root = await tempRoot();await writeGhostDir(root, 'cindy-brain', 'valid-plugin');await fs.writeFile(diff --cc apps/desktop/src/main/ownerNamespaceMigration.tsindex f6445851f0,eca88d7da9..35dcb95be5--- a/apps/desktop/src/main/ownerNamespaceMigration.ts+++ b/apps/desktop/src/main/ownerNamespaceMigration.ts@@@ -879,37 -537,11 +882,36 @@@ export function getLegacyGhostRecoverySif (process.env.XDT_PASSIVE_SHARED_USER_DATA === '1') {return { state: 'deferred', legacyPluginCount, canRetry: false };}-+ if (hasConcurrentLiveInstanceSync(root, isPidAlive)) {+ 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 };+ }- if (hasConcurrentLiveInstanceSync(root, isPidAlive)) {- return { state: 'deferred', 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 };}