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。

Merge upstream/main at e8dfe4d7d

JiangJiahaoda18662af08f
diff --cc apps/desktop/src/main/cindy-brain/GhostManager.ts
index 26aa33188f,a06150626a..9c4f8c67fa
--- a/apps/desktop/src/main/cindy-brain/GhostManager.ts
+++ b/apps/desktop/src/main/cindy-brain/GhostManager.ts
@@@ -314,17 -321,19 +356,21 @@@ export class GhostManager
...(typeof raw.publisherName === 'string' ? { publisherName: raw.publisherName } : {}),
...(typeof raw.publisherKeyId === 'string' ? { publisherKeyId: raw.publisherKeyId } : {}),
...(typeof raw.reviewerName === 'string' ? { reviewerName: raw.reviewerName } : {}),
- ...(typeof raw.unknownReviewer === 'boolean' ? { unknownReviewer: raw.unknownReviewer } : {}),
+ ...(typeof raw.unknownReviewer === 'boolean'
+ ? { unknownReviewer: raw.unknownReviewer }
+ : {}),
};
+ // Official trust is a capability-bearing identity. A malformed receipt is
+ // not downgraded into a partially trusted official object; it disappears
+ // from the projection so every consumer fails closed.
+ if (trust.level === 'cindy-official' && !isCindyOfficialTrustInfo(trust)) return null;
const approval = raw.approvedAtResourceProvider;
const approvedAtResourceProviderTool =
- approval
- && typeof approval === 'object'
- && !Array.isArray(approval)
- && Object.keys(approval).length === 1
- && typeof (approval as Record<string, unknown>).tool === 'string'
+ approval &&
+ typeof approval === 'object' &&
+ !Array.isArray(approval) &&
+ Object.keys(approval).length === 1 &&
+ typeof (approval as Record<string, unknown>).tool === 'string'
? (approval as Record<string, string>).tool
: undefined;
return {
diff --cc apps/desktop/src/main/cindy-brain/index.ts
index e890859d4b,2adc225958..307f26e75f
--- a/apps/desktop/src/main/cindy-brain/index.ts
+++ b/apps/desktop/src/main/cindy-brain/index.ts
@@@ -3787,8 -3641,15 +3811,12 @@@ async function installOrUpdateMarketGho
inspected.canonicalManifest.id !== expected.ghostId ||
inspected.canonicalManifest.version !== expected.version
) {
- throwIpcError(
- 'GHOST_FILE_INVALID',
- '下载包清单与市场 Release 不一致',
- );
+ throwIpcError('GHOST_FILE_INVALID', '下载包清单与市场 Release 不一致');
}
+ const trustOverride: GhostHostTrustOverride | undefined =
+ expected.officialCindyGithub === true && expected.ghostId === 'cindy-github'
+ ? 'cindy-official'
+ : undefined;
requireGhostAvailableForActiveSession(expected.ghostId);
const installed = manager.list().find((ghost) => ghost.manifest.id === expected.ghostId);
if (expected.reviewedManifest) {
diff --cc apps/desktop/src/shared/ghost.ts
index c2b81e1c58,652cf743ed..b0188015cc
--- a/apps/desktop/src/shared/ghost.ts
+++ b/apps/desktop/src/shared/ghost.ts
@@@ -4700,26 -4374,27 +4762,30 @@@ export function validateGhostManifest(r
// 空数组是合法的显式 opt-out:「本意识没有使用前置需求」——凭证全为
// 可选项的意识用它关掉宿主启发式(不声明才走启发式)。
if (!Array.isArray(su.requires) || su.requires.length > GHOST_SETUP_MAX_GROUPS) {
- return { ok: false, reason: `setup.requires 必须是 0–${GHOST_SETUP_MAX_GROUPS} 组的数组(空数组 = 显式声明无使用前置需求)` };
+ return {
+ ok: false,
+ reason: `setup.requires 必须是 0–${GHOST_SETUP_MAX_GROUPS} 组的数组(空数组 = 显式声明无使用前置需求)`,
+ };
}
- const secretByKey = new Map<string, { hostDerivedSource: 'login-email' | 'oidc-token' | null }>(
- [
- ...(network?.secrets ?? []).map(
- (s) =>
- [
- s.key,
- {
- hostDerivedSource:
- s.source === 'login-email' || s.source === 'oidc-token' ? s.source : null,
- },
- ] as const,
- ),
- ...(node?.secretBindings ?? []).map((s) => [s.key, { hostDerivedSource: null }] as const),
- ],
- );
+ const secretByKey = new Map<
+ string,
+ { hostDerivedSource: 'login-email' | 'gh-cli' | 'oidc-token' | null }
+ >([
+ ...(network?.secrets ?? []).map(
+ (s) => [
+ s.key,
+ {
+ hostDerivedSource:
+ s.source === 'login-email' || s.source === 'gh-cli' || s.source === 'oidc-token'
+ ? s.source
+ : null,
+ },
+ ] as const,
+ ),
+ ...(node?.secretBindings ?? []).map(
+ (s) => [s.key, { hostDerivedSource: null }] as const,
+ ),
+ ]);
const connectionKeys = new Set((network?.connections ?? []).map((c) => c.key));
const groups: GhostSetupGroup[] = [];
for (const g of su.requires) {