Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(plugin): pin credential setup copy
liugaowei208be7b370f4
diff --git a/apps/desktop/src/shared/__tests__/ghost.test.ts b/apps/desktop/src/shared/__tests__/ghost.test.tsindex ed3cc8adb8..1fc1cc80f5 100644--- a/apps/desktop/src/shared/__tests__/ghost.test.ts+++ b/apps/desktop/src/shared/__tests__/ghost.test.ts@@ -4428,13 +4428,34 @@ describe('ghostPermissionProjectionFingerprint', () => {],},});- expect(reviewed.ok && actual.ok).toBe(true);- if (!reviewed.ok || !actual.ok) return;+ const changedHint = validateGhostManifest({+ ...goodChipManifest(),+ slots: ['panel', 'model', 'network'],+ settingsHtml: 'settings.html',+ network: {+ hosts: ['api.example.com', 'upload.example.com'],+ secrets: [+ {+ key: 'api_token',+ label: 'API Token',+ hint: 'Paste your account password',+ inject: {+ hosts: ['api.example.com'],+ header: 'Authorization',+ format: 'Bearer {value}',+ },+ },+ ],+ },+ });+ expect(reviewed.ok && actual.ok && changedHint.ok).toBe(true);+ if (!reviewed.ok || !actual.ok || !changedHint.ok) return;expect(unreviewedGhostPermissionItems(reviewed.manifest, undefined, actual.manifest)).toEqual([],);expect(ghostNetworkAuthorizationWithinCap(reviewed.manifest, actual.manifest)).toBe(false);+ expect(ghostNetworkAuthorizationWithinCap(reviewed.manifest, changedHint.manifest)).toBe(false);expect(ghostNetworkAuthorizationWithinCap(reviewed.manifest, reviewed.manifest)).toBe(true);});@@ -4613,10 +4634,28 @@ describe('ghostPermissionProjectionFingerprint', () => {const narrowed = manifest({ methods: ['read'] });const expanded = manifest({ methods: ['read', 'write', 'delete'] });const changedUrl = manifest({ url: 'https://evil.example/keys' });+ const changedLabel = manifest({ label: 'Account password' });+ const changedHint = manifest({ hint: 'Paste your account password' });expect(- reviewed.ok && reordered.ok && narrowed.ok && expanded.ok && changedUrl.ok,+ reviewed.ok &&+ reordered.ok &&+ narrowed.ok &&+ expanded.ok &&+ changedUrl.ok &&+ changedLabel.ok &&+ changedHint.ok,).toBe(true);- if (!reviewed.ok || !reordered.ok || !narrowed.ok || !expanded.ok || !changedUrl.ok) return;+ if (+ !reviewed.ok ||+ !reordered.ok ||+ !narrowed.ok ||+ !expanded.ok ||+ !changedUrl.ok ||+ !changedLabel.ok ||+ !changedHint.ok+ ) {+ return;+ }expect(ghostNodeSecretAuthorizationWithinCap(reviewed.manifest, reordered.manifest)).toBe(true);expect(ghostNodeSecretAuthorizationWithinCap(reviewed.manifest, narrowed.manifest)).toBe(true);@@ -4628,6 +4667,12 @@ describe('ghostPermissionProjectionFingerprint', () => {);expect(ghostNodeSecretAuthorizationWithinCap(reviewed.manifest, expanded.manifest)).toBe(false);expect(ghostNodeSecretAuthorizationWithinCap(reviewed.manifest, changedUrl.manifest)).toBe(false);+ expect(ghostNodeSecretAuthorizationWithinCap(reviewed.manifest, changedLabel.manifest)).toBe(+ false,+ );+ expect(ghostNodeSecretAuthorizationWithinCap(reviewed.manifest, changedHint.manifest)).toBe(+ false,+ );});it('语义相同时指纹稳定(与字段/条目顺序无关)', () => {diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.tsindex be31d0ad0a..5bd9847ac1 100644--- a/apps/desktop/src/shared/ghost.ts+++ b/apps/desktop/src/shared/ghost.ts@@ -2494,7 +2494,13 @@ export function ghostNodeSecretAuthorizationWithinCap(candidate.key === binding.key &&(candidate.entry ?? reviewedNode.entry) === targetEntry,);- if (!cap || !binding.methods.every((method) => cap.methods.includes(method))) return false;+ if (+ !cap ||+ binding.label !== cap.label ||+ !binding.methods.every((method) => cap.methods.includes(method))+ ) {+ return false;+ }if (binding.url !== undefined && binding.url !== cap.url) return false;if (binding.hint !== undefined && binding.hint !== cap.hint) return false;}@@ -2535,6 +2541,7 @@ export function ghostNetworkAuthorizationWithinCap(const reviewedHosts = cap.inject.hosts ?? reviewedNetwork.hosts;if (!isStringSubset(actualHosts, reviewedHosts)) return false;if (secret.url !== undefined && secret.url !== cap.url) return false;+ if (secret.hint !== undefined && secret.hint !== cap.hint) return false;if (secret.exchange !== undefined &&JSON.stringify(secret.exchange) !== JSON.stringify(cap.exchange)