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(protocol): bump cindy-protocol 至 74f6a54

Lizicb9738a81810
diff --git a/apps/desktop/src/main/cindy-brain/forge.ts b/apps/desktop/src/main/cindy-brain/forge.ts
index 97f3040dcc..26f3bb6734 100644
--- a/apps/desktop/src/main/cindy-brain/forge.ts
+++ b/apps/desktop/src/main/cindy-brain/forge.ts
@@ -1272,7 +1272,7 @@ node 详单**不接受** \`command\` / \`args\` / \`shell\` / \`env\` 或其它
"clientId": "xxx.apps.example.com", // 可选:内置 OAuth 客户端 ID(用户零配置开箱即用;用户在设置页自填的覆盖内置,清除自填即回落)
"clientIdAlternatives": ["xxx-global.apps.example.com"], // 可选 ≤8 条:仅 tokenBroker 模式;意识按 app-context 选 App 时,connect 只接受默认值或这里声明的公开 ID
"clientSecret": "xxx", // 可选(须与 clientId 成对):内置 client 的 secret;桌面应用的 client 凭证本非机密,纯 PKCE 服务商可省略
- "scopes": ["read.a", "write.b"], // 可选 ≤48 条:申请的权限范围(确认框逐条展示给用户)
+ "scopes": ["read.a", "write.b"], // 可选 ≤256 条:申请的权限范围(确认框逐条展示给用户)
"scopeDelimiter": ",", // 可选:authorize URL 的 scope 拼接分隔符;缺省空格(OAuth 标准),Slack 这类逗号分隔的服务商声明 ","(目前只认这一个值)
"pkce": true, // 可选:PKCE(S256)开关,缺省 true
"extraAuthorizeParams": { "access_type": "offline", "prompt": "consent" }, // 可选 ≤8 条:服务商特有授权参数(协议保留参数禁写)
diff --git a/apps/desktop/src/main/cindy-brain/runtime/__tests__/ghostOauthEndpoint.test.ts b/apps/desktop/src/main/cindy-brain/runtime/__tests__/ghostOauthEndpoint.test.ts
index 50a174e772..02ba92ff6d 100644
--- a/apps/desktop/src/main/cindy-brain/runtime/__tests__/ghostOauthEndpoint.test.ts
+++ b/apps/desktop/src/main/cindy-brain/runtime/__tests__/ghostOauthEndpoint.test.ts
@@ -274,7 +274,7 @@ describe('POST /oauth/<key>/connect · scopes body(降面授权)', () => {
});
describe('POST /oauth/<key>/insufficient-scopes', () => {
- const DECLARED_SCOPES = Array.from({ length: 64 }, (_, index) => `scope.${index}`);
+ const DECLARED_SCOPES = Array.from({ length: 320 }, (_, index) => `scope.${index}`);
const SCOPED: GhostOauthDecl = {
authorizeUrl: 'https://accounts.example.com/authorize',
tokenUrl: 'https://accounts.example.com/token',
@@ -325,7 +325,7 @@ describe('POST /oauth/<key>/insufficient-scopes', () => {
expect(onChanged).not.toHaveBeenCalled();
});
- it('64 条边界放行;65 条拒绝', async () => {
+ it('320 条边界放行;321 条拒绝', async () => {
const accepted = fakeManager();
expect((await report(JSON.stringify({ scopes: DECLARED_SCOPES }), accepted)).status).toBe(204);
expect(accepted.reportInsufficientScopes).toHaveBeenCalledWith(
diff --git a/apps/desktop/src/main/cindy-brain/runtime/ghostOauthEndpoint.ts b/apps/desktop/src/main/cindy-brain/runtime/ghostOauthEndpoint.ts
index d3ddb386ec..0b216a6e24 100644
--- a/apps/desktop/src/main/cindy-brain/runtime/ghostOauthEndpoint.ts
+++ b/apps/desktop/src/main/cindy-brain/runtime/ghostOauthEndpoint.ts
@@ -283,7 +283,7 @@ export async function handleGhostOauthRequest(args: {
const parsed = await readJsonBody();
if (!parsed.ok) return { status: parsed.status };
const rawScopes = parsed.body.scopes;
- if (!Array.isArray(rawScopes) || rawScopes.length === 0 || rawScopes.length > 64) {
+ if (!Array.isArray(rawScopes) || rawScopes.length === 0 || rawScopes.length > 320) {
return { status: 400 };
}
// 逐字属于声明面即形状合法(清单校验已保证声明 scope ≤200 字符、无空白),
diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.ts
index 6a378629da..1e34337b7c 100644
--- a/apps/desktop/src/shared/ghost.ts
+++ b/apps/desktop/src/shared/ghost.ts
@@ -630,10 +630,10 @@ export interface GhostSecretExchangeDecl {
* 本校验取值级"严出"(plugin-security-and-authoring.md §7):超上限的包在旧版
* 客户端拒装,插件市场铺开须等携带新上限的客户端先行发布。
*
- * 涨过 64 前必须同步两处只留了防御余量的 64 上限,否则会拒绝合法的缺权上报
- * /静默判废 assessment:insufficient-scopes 端点的整包条数上限
- * (runtime/ghostOauthEndpoint.ts)与 cindy-tools 的 SETUP_REAUTH_SCOPE_MAX
- * (ghost/mcpServer.ts,包依赖方向不允许直接引用本常量)。
+ * 当前 256 上限外另留 64 条防御余量。涨过 320 前必须同步两处 320 上限,
+ * 否则会拒绝合法的缺权上报 / 静默判废 assessment:insufficient-scopes
+ * 端点的整包条数上限(runtime/ghostOauthEndpoint.ts)与 cindy-tools 的
+ * SETUP_REAUTH_SCOPE_MAX(ghost/mcpServer.ts,包依赖方向不允许直接引用本常量)。
*/
export { GHOST_OAUTH_SCOPES_MAX };
/** OAuth broker 模式可声明的备用 clientId 上限(默认 clientId 不计入)。 */
@@ -687,7 +687,7 @@ export interface GhostSecretOauthDecl {
clientIdAlternatives?: string[];
/** 可选:内置 client 的 secret(与 clientId 成对;纯 PKCE 服务商可省略)。 */
clientSecret?: string;
- /** 申请的 scope 列表(0–48 条,确认框逐条展示;缺省 = 不带 scope 参数)。 */
+ /** 申请的 scope 列表(0–256 条,确认框逐条展示;缺省 = 不带 scope 参数)。 */
scopes?: string[];
/**
* 可选:authorize URL 里 scope 参数的拼接分隔符。OAuth 标准是空格(缺省),
diff --git a/cindy-protocol b/cindy-protocol
index e6d1f7f63b..74f6a54425 160000
--- a/cindy-protocol
+++ b/cindy-protocol
@@ -1 +1 @@
-Subproject commit e6d1f7f63b973cd37d289db4e26bee2e929a2b1f
+Subproject commit 74f6a54425b6355867308aa5f1282a3fabb190ee
diff --git a/packages/cindy-tools/src/ghost/mcpServer.ts b/packages/cindy-tools/src/ghost/mcpServer.ts
index 7a9df11ffb..d05419870e 100644
--- a/packages/cindy-tools/src/ghost/mcpServer.ts
+++ b/packages/cindy-tools/src/ghost/mcpServer.ts
@@ -217,9 +217,9 @@ const SETUP_REQUIREMENT_KINDS = new Set([
"client_config",
]);
const SETUP_REQUIREMENT_STATES = new Set(["missing", "expired", "satisfied"]);
-// 对主机声明上限 GHOST_OAUTH_SCOPES_MAX(desktop shared/ghost.ts,当前 48;包依赖
-// 方向不允许引用)只留防御余量;该值涨过 64 时必须同步,否则整份 assessment 判废。
-const SETUP_REAUTH_SCOPE_MAX = 64;
+// 对主机声明上限 GHOST_OAUTH_SCOPES_MAX(desktop shared/ghost.ts,当前 256;包依赖
+// 方向不允许引用)留 64 条防御余量;该值涨过 320 时必须同步,否则整份 assessment 判废。
+const SETUP_REAUTH_SCOPE_MAX = 320;
function sanitizeSetupAction(
raw: unknown,