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。

feat(plugins): 对话内通用 Setup Runtime(集成 #329 至最新 main) (#393)

Lizic9a0c15d5427
diff --git a/apps/desktop/src/main/agent-island/service.ts b/apps/desktop/src/main/agent-island/service.ts
index e93bfaa14a..950381a96b 100644
--- a/apps/desktop/src/main/agent-island/service.ts
+++ b/apps/desktop/src/main/agent-island/service.ts
@@ -908,6 +908,14 @@ export class AgentIslandService {
): void {
const hydrated = this.hydrateMeta({ sessionId });
setAgentIslandStrings(this.state, buildAgentIslandStrings());
+ // If the requestId is already pending (revision update from the coordinator),
+ // only update the detail string without resetting the dismissal state.
+ const existing = this.state.sessions.get(hydrated.sessionId);
+ if (existing?.pendingInteractionIds.has(requestId)) {
+ existing.pendingInteractionDetails.set(requestId, detail);
+ this.publish();
+ return;
+ }
applyAgentIslandInteractionRequest(
this.state,
hydrated,
diff --git a/apps/desktop/src/main/cindy-brain/ghostSetupCoordinator.ts b/apps/desktop/src/main/cindy-brain/ghostSetupCoordinator.ts
index ae8da2a3c2..a932590f10 100644
--- a/apps/desktop/src/main/cindy-brain/ghostSetupCoordinator.ts
+++ b/apps/desktop/src/main/cindy-brain/ghostSetupCoordinator.ts
@@ -91,6 +91,7 @@ export interface GhostSetupCoordinatorDeps {
}) => Promise<GhostSetupActionResult>;
timeoutMs?: number;
terminalGraceMs?: number;
+ timeoutMessage?: () => string;
createRequestId?: () => string;
logger?: {
warn: (message: string, context?: Record<string, unknown>) => void;
@@ -472,7 +473,7 @@ export class GhostSetupCoordinator {
{
ok: false,
errorCode: 'TIMEOUT',
- message: '插件设置等待超时,本次调用未执行。',
+ message: this.deps.timeoutMessage?.() ?? 'Setup timed out',
},
'timeout',
);
diff --git a/apps/desktop/src/main/cindy-brain/ghostSetupInlineExecutor.ts b/apps/desktop/src/main/cindy-brain/ghostSetupInlineExecutor.ts
index f1b1cbf2de..e838b90bcf 100644
--- a/apps/desktop/src/main/cindy-brain/ghostSetupInlineExecutor.ts
+++ b/apps/desktop/src/main/cindy-brain/ghostSetupInlineExecutor.ts
@@ -5,6 +5,7 @@ import type {
} from '../../shared/ghost.js';
import { GHOST_SECRET_VALUE_MAX_CHARS } from '../../shared/ghost.js';
import type { GhostSetupActionResult } from './ghostSetupCoordinator.js';
+import { t } from '../i18n.js';
export interface GhostSetupInlineExecutorDeps {
getAssessment: (ghostId: string) => GhostSetupAssessment;
@@ -31,7 +32,7 @@ export function executeGhostSetupInlineSubmission(
): GhostSetupActionResult {
const trimmed = args.value.trim();
if (trimmed.length === 0 || trimmed.length > GHOST_SECRET_VALUE_MAX_CHARS) {
- return { ok: false, errorCode: 'INLINE_INVALID', message: '凭证内容无效' };
+ return { ok: false, errorCode: 'INLINE_INVALID', message: t('newChat.pluginSetup.inlineSecretInvalid') };
}
const manifest = deps.getManifest(args.ghostId);
@@ -39,7 +40,7 @@ export function executeGhostSetupInlineSubmission(
return {
ok: false,
errorCode: 'TARGET_UNAVAILABLE',
- message: '目标插件已卸载或不可用',
+ message: t('newChat.pluginSetup.pluginUnavailable'),
};
}
@@ -64,7 +65,7 @@ export function executeGhostSetupInlineSubmission(
return {
ok: false,
errorCode: 'ACTION_STALE',
- message: '配置动作已失效,请重新尝试',
+ message: t('newChat.pluginSetup.inlineActionExpired'),
};
}
@@ -81,11 +82,11 @@ export function executeGhostSetupInlineSubmission(
return {
ok: false,
errorCode: 'ACTION_STALE',
- message: '凭证声明已变更,请重新尝试',
+ message: t('newChat.pluginSetup.inlineSecretDeclChanged'),
};
}
if (!deps.storeSecret(args.ghostId, secretKey, trimmed)) {
- return { ok: false, errorCode: 'SAVE_FAILED', message: '凭证保存失败' };
+ return { ok: false, errorCode: 'SAVE_FAILED', message: t('newChat.pluginSetup.inlineSecretStoreFailed') };
}
deps.emitChange(args.ghostId, secretKey);
try {
diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.ts
index 0ee76b11d2..4e718990c4 100644
--- a/apps/desktop/src/main/cindy-brain/index.ts
+++ b/apps/desktop/src/main/cindy-brain/index.ts
@@ -1782,7 +1782,7 @@ export async function executeGhostSetupAction(args: {
return {
ok: false,
errorCode: 'TARGET_UNAVAILABLE',
- message: '目标插件已卸载或不可用',
+ message: t('newChat.pluginSetup.pluginUnavailable'),
};
}
if (args.action.kind === 'oauth_connect') {
@@ -1814,8 +1814,8 @@ export async function executeGhostSetupAction(args: {
errorCode: connected.error === 'CANCELLED' ? 'AUTH_CANCELLED' : 'AUTH_FAILED',
message:
connected.error === 'CANCELLED'
- ? '授权已取消'
- : connected.detail ?? `授权失败:${connected.error}`,
+ ? t('newChat.pluginSetup.oauthCancelled')
+ : connected.detail ?? t('newChat.pluginSetup.oauthFailed').replace('{{detail}}', connected.error),
};
}
diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.ts
index 09b085b792..8c3b71644d 100644
--- a/apps/desktop/src/main/maker-ipc/register.ts
+++ b/apps/desktop/src/main/maker-ipc/register.ts
@@ -156,6 +156,7 @@ import {
updateWorkerStatus,
} from '../localDb/orcaTeamStore.js';
import { messages, orcaTeams, orcaWorkers, sessions } from '../localDb/schema.js';
+import { t } from '../i18n.js';
import { createLogger } from '../logger.js';
import { desktopClaudeAuthAdapter, desktopCodexAuthAdapter, readClaudeApiKey } from '../maker-host/auth-adapters.js';
import { prepareSharedProjectSkillLinks } from '../maker-host/shared-global-skills.js';
@@ -1165,7 +1166,7 @@ const ghostSetupInteractionBridge = initGhostSetupInteractionBridge({
getAgentIslandService()?.handlePluginSetupInteraction(
value.sessionId,
value.request.requestId,
- activeStep?.title ?? `${value.request.ghost.name} 设置`,
+ activeStep?.title ?? t('newChat.pluginSetup.title').replace('{{name}}', value.request.ghost.name),
);
return;
}
@@ -1194,28 +1195,28 @@ initGhostSetupCoordinator({
return {
ok: false,
errorCode: 'GHOST_NOT_FOUND',
- message: '目标插件已卸载或当前不可用',
+ message: t('newChat.pluginSetup.targetNotFound'),
};
}
if (!ghost.enabled) {
return {
ok: false,
errorCode: 'GHOST_ASLEEP',
- message: '目标插件已被停用',
+ message: t('newChat.pluginSetup.targetDisabled'),
};
}
if (isGhostDisabledForWorkdir(ghostId, workingDir)) {
return {
ok: false,
errorCode: 'GHOST_DISABLED_IN_WORKDIR',
- message: '用户已在当前工作目录停用该插件;不要重试。',
+ message: t('newChat.pluginSetup.targetDisabledInWorkdir'),
};
}
if (tool && !(ghost.manifest.tools ?? []).some((candidate) => candidate.name === tool)) {
return {
ok: false,
errorCode: 'TOOL_NOT_FOUND',
- message: `目标插件不再提供工具 ${tool}`,
+ message: `${t('newChat.pluginSetup.targetToolNotFound')} (${tool})`,
};
}
return { ok: true };
@@ -1239,6 +1240,7 @@ initGhostSetupCoordinator({
}),
executeInlineAction: ({ sessionId, ghostId, action, value }) =>
executeGhostSetupInlineAction({ sessionId, ghostId, action, value }),
+ timeoutMessage: () => t('newChat.pluginSetup.timeout'),
logger: log,
});
diff --git a/apps/desktop/src/main/mcp-integrations/__tests__/ghostSetupInteractionSurface.test.ts b/apps/desktop/src/main/mcp-integrations/__tests__/ghostSetupInteractionSurface.test.ts
index 7eb5dc8425..e8920af0ed 100644
--- a/apps/desktop/src/main/mcp-integrations/__tests__/ghostSetupInteractionSurface.test.ts
+++ b/apps/desktop/src/main/mcp-integrations/__tests__/ghostSetupInteractionSurface.test.ts
@@ -17,7 +17,7 @@ describe('ghostSetupInteractionSessionId', () => {
).toBe('desktop-session');
});
- it.each(['feishu', 'discord', 'scheduler', 'slack-hook', 'telegram'])(
+ it.each(['feishu', 'discord', 'slack-hook', 'telegram'])(
'treats %s turns as non-interactive even when they have a business session id',
(source) => {
expect(
@@ -31,6 +31,17 @@ describe('ghostSetupInteractionSessionId', () => {
},
);
+ it('treats scheduler turns as interactive (headless marker is turn-scoped)', () => {
+ expect(
+ ghostSetupInteractionSessionId({
+ agentKind: 'codex',
+ workingDir: '/repo',
+ sessionId: 'scheduler-session',
+ vendorOptions: { source: 'scheduler' },
+ }),
+ ).toBe('scheduler-session');
+ });
+
it('treats a missing session context as non-interactive', () => {
expect(ghostSetupInteractionSessionId(undefined)).toBeNull();
});
diff --git a/apps/desktop/src/main/mcp-integrations/ghost.ts b/apps/desktop/src/main/mcp-integrations/ghost.ts
index 1dc5508452..ea152dfb1d 100644
--- a/apps/desktop/src/main/mcp-integrations/ghost.ts
+++ b/apps/desktop/src/main/mcp-integrations/ghost.ts
@@ -68,6 +68,7 @@ import * as ledger from '../cindy-media/ledger.js';
import { chatAttachmentOrigin } from '../cindy-media/attachmentGrantGate.js';
import { resolveGhostAttachmentUrl } from './ghostAttachmentResolve.js';
import { ghostSetupInteractionSessionId } from './ghostSetupInteractionSurface.js';
+import { t } from '../i18n.js';
import { createLogger } from '../logger.js';
const log = createLogger('mcp/cindy');
@@ -628,8 +629,7 @@ export function getCindyGhostsMcpDeps(sessionCtx?: LiziMcpSessionContext): Cindy
return {
ok: false,
errorCode: 'GHOST_DISABLED_IN_WORKDIR',
- message:
- '用户已在当前工作目录停用该插件;不要重试,改用其它可用方式完成任务,必要时如实转告用户。',
+ message: t('newChat.pluginSetup.targetDisabledInWorkdir'),
};
}
// Runtime setup gate: resolve the target before creating any durable
@@ -688,36 +688,63 @@ export function getCindyGhostsMcpDeps(sessionCtx?: LiziMcpSessionContext): Cindy
.list()
.find((g) => g.manifest.id === ghostId);
if (!refreshed || !isGhostAvailableForActiveSession(ghostId)) {
- return { ok: false, errorCode: 'GHOST_NOT_FOUND', message: '目标插件已卸载或当前不可用' };
+ return { ok: false, errorCode: 'GHOST_NOT_FOUND', message: t('newChat.pluginSetup.targetNotFound') };
}
if (!refreshed.enabled) {
- return { ok: false, errorCode: 'GHOST_ASLEEP', message: '目标插件已被停用' };
+ return { ok: false, errorCode: 'GHOST_ASLEEP', message: t('newChat.pluginSetup.targetDisabled') };
}
if (isGhostDisabledForWorkdir(ghostId, sessionWorkdir)) {
return {
ok: false,
errorCode: 'GHOST_DISABLED_IN_WORKDIR',
- message: '用户已在当前工作目录停用该插件;不要重试。',
+ message: t('newChat.pluginSetup.targetDisabledInWorkdir'),
};
}
if (
!grantOnly &&
!(refreshed.manifest.tools ?? []).some((candidate) => candidate.name === tool)
) {
- return { ok: false, errorCode: 'TOOL_NOT_FOUND', message: `目标插件不再提供工具 ${tool}` };
+ return { ok: false, errorCode: 'TOOL_NOT_FOUND', message: `${t('newChat.pluginSetup.targetToolNotFound')} (${tool})` };
+ }
+ let finalAssessment;
+ try {
+ finalAssessment = getGhostSetupAssessment(ghostId);
+ } catch {
+ return { ok: false, errorCode: 'INTERNAL', message: t('newChat.pluginSetup.assessmentReadFailed') };
}
- const finalAssessment = getGhostSetupAssessment(ghostId);
if (finalAssessment.state !== 'ready') {
return {
ok: false,
errorCode: 'SETUP_REQUIRED',
- message: '插件配置在调用恢复前发生变化,请完成设置后重试。',
+ message: t('newChat.pluginSetup.setupChangedDuringResume'),
setup: finalAssessment,
};
}
// 批量预授权(grant_only):只过户不派发。它与普通调用共用上面的
// Host-authoritative setup gate,确保任何授权副作用之前插件已经 ready。
if (grantOnly) {
+ // Full pre-grant gate: confirm target, workdir, and setup readiness
+ // BEFORE grantAttachmentUrls creates durable ledger entries.
+ const grantTarget = getGhostManager()
+ .list()
+ .find((g) => g.manifest.id === ghostId);
+ if (!grantTarget || !isGhostAvailableForActiveSession(ghostId)) {
+ return { ok: false, errorCode: 'GHOST_NOT_FOUND', message: t('newChat.pluginSetup.targetNotFound') };
+ }
+ if (!grantTarget.enabled) {
+ return { ok: false, errorCode: 'GHOST_ASLEEP', message: t('newChat.pluginSetup.targetDisabled') };
+ }
+ if (isGhostDisabledForWorkdir(ghostId, sessionWorkdir)) {
+ return { ok: false, errorCode: 'GHOST_DISABLED_IN_WORKDIR', message: t('newChat.pluginSetup.targetDisabledInWorkdir') };
+ }
+ try {
+ const grantOnlyAssessment = getGhostSetupAssessment(ghostId);
+ if (grantOnlyAssessment.state !== 'ready') {
+ return { ok: false, errorCode: 'SETUP_REQUIRED', message: t('newChat.pluginSetup.setupIncomplete'), setup: grantOnlyAssessment };
+ }
+ } catch {
+ return { ok: false, errorCode: 'INTERNAL', message: t('newChat.pluginSetup.assessmentReadFailed') };
+ }
const grant = await grantAttachmentUrls({
ghostId,
urls: attachments!,
@@ -728,6 +755,28 @@ export function getCindyGhostsMcpDeps(sessionCtx?: LiziMcpSessionContext): Cindy
if (!grant.ok) {
return { ok: false, errorCode: 'ATTACHMENT_INVALID', message: grant.message };
}
+ // Post-grant revalidation: the grant process includes an async user
+ // confirmation step; re-check everything before returning success.
+ const postGrant = getGhostManager()
+ .list()
+ .find((g) => g.manifest.id === ghostId);
+ if (!postGrant || !isGhostAvailableForActiveSession(ghostId)) {
+ return { ok: false, errorCode: 'GHOST_NOT_FOUND', message: t('newChat.pluginSetup.targetNotFound') };
+ }
+ if (!postGrant.enabled) {
+ return { ok: false, errorCode: 'GHOST_ASLEEP', message: t('newChat.pluginSetup.targetDisabled') };
+ }
+ if (isGhostDisabledForWorkdir(ghostId, sessionWorkdir)) {
+ return { ok: false, errorCode: 'GHOST_DISABLED_IN_WORKDIR', message: t('newChat.pluginSetup.targetDisabledInWorkdir') };
+ }
+ try {
+ const postGrantAssessment = getGhostSetupAssessment(ghostId);
+ if (postGrantAssessment.state !== 'ready') {
+ return { ok: false, errorCode: 'SETUP_REQUIRED', message: t('newChat.pluginSetup.setupChangedDuringResume'), setup: postGrantAssessment };
+ }
+ } catch {
+ return { ok: false, errorCode: 'INTERNAL', message: t('newChat.pluginSetup.assessmentReadFailed') };
+ }
log.info('ghost grant-only: batch pre-granted', { ghostId, count: grant.hashes.length });
return {
ok: true,
@@ -811,15 +860,75 @@ export function getCindyGhostsMcpDeps(sessionCtx?: LiziMcpSessionContext): Cindy
const { session_context: _dropped, ...rest } = mergedArgs;
mergedArgs = rest;
}
- const targetManifest = getGhostManager()
+ // Pre-dispatch revalidation: attachment grants and dir tickets may have
+ // taken time; confirm the target is still available before committing the
+ // callId and dispatching to the sandbox.
+ const preDispatch = getGhostManager()
.list()
- .find((g) => g.manifest.id === ghostId)?.manifest;
- if (targetManifest?.slots?.includes('session-context')) {
- mergedArgs = {
- ...mergedArgs,
- session_context: await buildGhostSessionContext(sessionIdForConfirm, sessionWorkdir),
+ .find((g) => g.manifest.id === ghostId);
+ if (!preDispatch || !isGhostAvailableForActiveSession(ghostId)) {
+ return { ok: false, errorCode: 'GHOST_NOT_FOUND', message: t('newChat.pluginSetup.targetNotFound') };
+ }
+ if (!preDispatch.enabled) {
+ return { ok: false, errorCode: 'GHOST_ASLEEP', message: t('newChat.pluginSetup.targetDisabled') };
+ }
+ if (isGhostDisabledForWorkdir(ghostId, sessionWorkdir)) {
+ return {
+ ok: false,
+ errorCode: 'GHOST_DISABLED_IN_WORKDIR',
+ message: t('newChat.pluginSetup.targetDisabledInWorkdir'),
};
}
+ if (!(preDispatch.manifest.tools ?? []).some((c) => c.name === tool)) {
+ return { ok: false, errorCode: 'TOOL_NOT_FOUND', message: `${t('newChat.pluginSetup.targetToolNotFound')} (${tool})` };
+ }
+ try {
+ const preDispatchAssessment = getGhostSetupAssessment(ghostId);
+ if (preDispatchAssessment.state !== 'ready') {
+ return {
+ ok: false,
+ errorCode: 'SETUP_REQUIRED',
+ message: t('newChat.pluginSetup.setupChangedDuringResume'),
+ setup: preDispatchAssessment,
+ };
+ }
+ } catch {
+ return { ok: false, errorCode: 'INTERNAL', message: t('newChat.pluginSetup.assessmentReadFailed') };
+ }
+ // Session-context slot: use the revalidated manifest to decide injection.
+ // Re-read manifest after the async buildGhostSessionContext to guard against
+ // a same-ID plugin replacement removing the slot during the await.
+ if (preDispatch.manifest.slots?.includes('session-context')) {
+ const ctx = await buildGhostSessionContext(sessionIdForConfirm, sessionWorkdir);
+ const postCtxManifest = getGhostManager()
+ .list()
+ .find((g) => g.manifest.id === ghostId)?.manifest;
+ if (postCtxManifest?.slots?.includes('session-context')) {
+ mergedArgs = { ...mergedArgs, session_context: ctx };
+ }
+ }
+ // Full revalidation after session-context await (DB query may take time)
+ const postCtx = getGhostManager().list().find((g) => g.manifest.id === ghostId);
+ if (!postCtx || !isGhostAvailableForActiveSession(ghostId)) {
+ return { ok: false, errorCode: 'GHOST_NOT_FOUND', message: t('newChat.pluginSetup.targetNotFound') };
+ }
+ if (!postCtx.enabled) {
+ return { ok: false, errorCode: 'GHOST_ASLEEP', message: t('newChat.pluginSetup.targetDisabled') };
+ }
+ if (isGhostDisabledForWorkdir(ghostId, sessionWorkdir)) {
+ return { ok: false, errorCode: 'GHOST_DISABLED_IN_WORKDIR', message: t('newChat.pluginSetup.targetDisabledInWorkdir') };
+ }
+ if (!(postCtx.manifest.tools ?? []).some((c) => c.name === tool)) {
+ return { ok: false, errorCode: 'TOOL_NOT_FOUND', message: `${t('newChat.pluginSetup.targetToolNotFound')} (${tool})` };
+ }
+ try {
+ const postCtxAssessment = getGhostSetupAssessment(ghostId);
+ if (postCtxAssessment.state !== 'ready') {
+ return { ok: false, errorCode: 'SETUP_REQUIRED', message: t('newChat.pluginSetup.setupChangedDuringResume'), setup: postCtxAssessment };
+ }
+ } catch {
+ return { ok: false, errorCode: 'INTERNAL', message: t('newChat.pluginSetup.assessmentReadFailed') };
+ }
// ── 卡槽③:callId 在这里预铸并登记给卡片服务 ────────────────────
// 时序契约:register(供片窗开)→ dispatch(意识拿到同一 callId,执行
// 中可 card-update)→ finalize(问"这单供过卡吗",开晚到宽限窗)→
diff --git a/apps/desktop/src/main/mcp-integrations/ghostSetupInteractionSurface.ts b/apps/desktop/src/main/mcp-integrations/ghostSetupInteractionSurface.ts
index 8c98ceae44..385b468357 100644
--- a/apps/desktop/src/main/mcp-integrations/ghostSetupInteractionSurface.ts
+++ b/apps/desktop/src/main/mcp-integrations/ghostSetupInteractionSurface.ts
@@ -1,9 +1,12 @@
import type { LiziMcpSessionContext } from '@cindy/mcps';
+// Scheduler is intentionally excluded: it uses the headless turn marker
+// (beginHeadlessGhostSetupTurn) acquired in onAccepted instead of a static
+// source-based blocklist, so it can participate in interactive setup when
+// triggered from a Desktop session.
const NON_DESKTOP_SETUP_SOURCES = new Set([
'feishu',
'discord',
- 'scheduler',
'slack-hook',
'telegram',
]);
diff --git a/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsx b/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsx
index 7481365e4e..bc2e2f4781 100644
--- a/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsx
@@ -157,7 +157,7 @@ describe('PluginSetupPrompt', () => {
expect(
parsePendingPluginSetup({
...pending,
- steps: Array.from({ length: 73 }, (_, index) => ({
+ steps: Array.from({ length: 89 }, (_, index) => ({
...pending.steps[0],
id: `oversized-step-${index}`,
})),
diff --git a/apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx b/apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx
index ed477d0472..14dc5dd671 100644
--- a/apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx
@@ -37,7 +37,7 @@ function isTerminalPhase(phase: GhostSetupStepPhase): boolean {
}
function normalizedCopy(value: string | undefined): string {
- return (value ?? '').trim().replace(/\s+/g, ' ').toLocaleLowerCase();
+ return (value ?? '').trim().replace(/\s+/g, ' ').toLowerCase();
}
export function PluginSetupPrompt({ pending, ...props }: PluginSetupPromptProps) {
@@ -89,7 +89,7 @@ function PluginSetupPromptStateful({
const cancelledTerminal =
pending.steps.some((step) => step.phase === 'cancelled') &&
pending.steps.every((step) => isTerminalPhase(step.phase));
- const terminal = allSatisfied || cancelledTerminal;
+ const terminal = pending.terminal === true || allSatisfied || cancelledTerminal;
const busy = !!commandInFlight || (!!currentStep && RUNNING_PHASES.has(currentStep.phase));
const title = t('newChat.pluginSetup.title', { name: pending.ghost.name });
const inlineFormAction = currentStep?.action?.kind === 'inline_form' ? currentStep.action : null;
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 4da146f071..28a4faaf61 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -3690,6 +3690,9 @@
},
"pluginSetup": {
"title": "{{name}} Settings",
+ "assessmentReadFailed": "Couldn't read the plugin setup status.",
+ "setupIncomplete": "Plugin setup is not complete.",
+ "setupChangedDuringResume": "Plugin setup changed while the call was resuming. Please complete setup and try again.",
"chooseOne": "Choose one setup method",
"restoreAria": "Restore {{name}} settings",
"minimizeAria": "Minimize {{name}} settings",
@@ -3739,7 +3742,20 @@
"satisfied": "Completed",
"failed": "Failed",
"cancelled": "Cancelled"
- }
+ },
+ "timeout": "Setup timed out",
+ "oauthCancelled": "Authorization was cancelled",
+ "oauthFailed": "Authorization failed: {{detail}}",
+ "pluginUninstalledDuringOauth": "The target plugin was uninstalled or is unavailable",
+ "inlineSecretInvalid": "Credential value is invalid",
+ "pluginUnavailable": "The target plugin was uninstalled or is unavailable",
+ "inlineActionExpired": "This setup action has expired; please try again",
+ "inlineSecretDeclChanged": "Credential declaration has changed; please try again",
+ "inlineSecretStoreFailed": "Failed to save credential",
+ "targetNotFound": "The target plugin was uninstalled or is currently unavailable",
+ "targetDisabled": "The target plugin has been disabled",
+ "targetDisabledInWorkdir": "The user has disabled this plugin in the current working directory; do not retry.",
+ "targetToolNotFound": "The target plugin no longer provides this tool"
},
"createAgent": {
"quickStart": "Quick start",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 72e9d0a371..e237a85e83 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -3689,6 +3689,9 @@
},
"pluginSetup": {
"title": "{{name}} の設定",
+ "assessmentReadFailed": "プラグインの設定状態を読み取れませんでした。",
+ "setupIncomplete": "プラグインの設定が完了していません。",
+ "setupChangedDuringResume": "呼び出し再開中にプラグインの設定が変更されました。設定を完了してから再試行してください。",
"chooseOne": "設定方法を1つ選択してください",
"restoreAria": "{{name}} の設定を展開",
"minimizeAria": "{{name}} の設定を折りたたむ",
@@ -3738,7 +3741,20 @@
"satisfied": "完了",
"failed": "失敗",
"cancelled": "キャンセル済み"
- }
+ },
+ "timeout": "設定がタイムアウトしました",
+ "oauthCancelled": "認証がキャンセルされました",
+ "oauthFailed": "認証に失敗しました:{{detail}}",
+ "pluginUninstalledDuringOauth": "対象プラグインがアンインストールされたか利用不可です",
+ "inlineSecretInvalid": "認証情報の値が無効です",
+ "pluginUnavailable": "対象プラグインがアンインストールされたか利用不可です",
+ "inlineActionExpired": "設定アクションの有効期限が切れました。もう一度お試しください",
+ "inlineSecretDeclChanged": "認証情報の宣言が変更されました。もう一度お試しください",
+ "inlineSecretStoreFailed": "認証情報の保存に失敗しました",
+ "targetNotFound": "対象プラグインがアンインストールされたか現在利用不可です",
+ "targetDisabled": "対象プラグインが無効化されています",
+ "targetDisabledInWorkdir": "ユーザーが現在のワーキングディレクトリでこのプラグインを無効にしています。リトライしないでください。",
+ "targetToolNotFound": "対象プラグインはこのツールを提供していません"
},
"createAgent": {
"quickStart": "クイックスタート",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 28cec1506c..b2842a3e1b 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -3689,6 +3689,9 @@
},
"pluginSetup": {
"title": "{{name}} 설정",
+ "assessmentReadFailed": "플러그인 설정 상태를 읽을 수 없습니다.",
+ "setupIncomplete": "플러그인 설정이 완료되지 않았습니다.",
+ "setupChangedDuringResume": "호출 재개 중 플러그인 설정이 변경되었습니다. 설정을 완료한 후 다시 시도하세요.",
"chooseOne": "설정 방법을 하나 선택하세요",
"restoreAria": "{{name}} 설정 펼치기",
"minimizeAria": "{{name}} 설정 접기",
@@ -3738,7 +3741,20 @@
"satisfied": "완료",
"failed": "실패",
"cancelled": "취소됨"
- }
+ },
+ "timeout": "설정 시간이 초과되었습니다",
+ "oauthCancelled": "인증이 취소되었습니다",
+ "oauthFailed": "인증 실패: {{detail}}",
+ "pluginUninstalledDuringOauth": "대상 플러그인이 제거되었거나 사용할 수 없습니다",
+ "inlineSecretInvalid": "자격 증명 값이 유효하지 않습니다",
+ "pluginUnavailable": "대상 플러그인이 제거되었거나 사용할 수 없습니다",
+ "inlineActionExpired": "설정 작업이 만료되었습니다. 다시 시도해 주세요",
+ "inlineSecretDeclChanged": "자격 증명 선언이 변경되었습니다. 다시 시도해 주세요",
+ "inlineSecretStoreFailed": "자격 증명 저장에 실패했습니다",
+ "targetNotFound": "대상 플러그인이 제거되었거나 현재 사용할 수 없습니다",
+ "targetDisabled": "대상 플러그인이 비활성화되었습니다",
+ "targetDisabledInWorkdir": "사용자가 현재 작업 디렉토리에서 이 플러그인을 비활성화했습니다. 재시도하지 마세요.",
+ "targetToolNotFound": "대상 플러그인이 더 이상 이 도구를 제공하지 않습니다"
},
"createAgent": {
"quickStart": "빠른 시작",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index ec75d62885..19b8596d24 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -3689,6 +3689,9 @@
},
"pluginSetup": {
"title": "{{name}} 设置",
+ "assessmentReadFailed": "无法读取插件配置状态。",
+ "setupIncomplete": "插件尚未完成配置。",
+ "setupChangedDuringResume": "插件配置在调用恢复前发生变化,请完成设置后重试。",
"chooseOne": "选择一种配置方式",
"restoreAria": "展开 {{name}} 设置",
"minimizeAria": "收起 {{name}} 设置",
@@ -3738,7 +3741,20 @@
"satisfied": "已完成",
"failed": "失败",
"cancelled": "已取消"
- }
+ },
+ "timeout": "等待超时",
+ "oauthCancelled": "授权已取消",
+ "oauthFailed": "授权失败:{{detail}}",
+ "pluginUninstalledDuringOauth": "目标插件已卸载或不可用",
+ "inlineSecretInvalid": "凭证内容无效",
+ "pluginUnavailable": "目标插件已卸载或不可用",
+ "inlineActionExpired": "配置动作已失效,请重新尝试",
+ "inlineSecretDeclChanged": "凭证声明已变更,请重新尝试",
+ "inlineSecretStoreFailed": "凭证保存失败",
+ "targetNotFound": "目标插件已卸载或当前不可用",
+ "targetDisabled": "目标插件已被停用",
+ "targetDisabledInWorkdir": "用户已在当前工作目录停用该插件;不要重试。",
+ "targetToolNotFound": "目标插件不再提供该工具"
},
"createAgent": {
"quickStart": "快速开始",
diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.ts
index fb18fc9469..dbb7147a2c 100644
--- a/apps/desktop/src/shared/ghost.ts
+++ b/apps/desktop/src/shared/ghost.ts
@@ -873,11 +873,13 @@ export const GHOST_NETWORK_FORBIDDEN_INJECT_HEADERS: readonly string[] = [
/** setup.requires 需求组条数上限。 */
export const GHOST_SETUP_MAX_GROUPS = 8;
+/** Host-owned requirement groups (e.g. model-provider capability). */
+export const GHOST_SETUP_MAX_HOST_GROUPS = 2;
/** 每个需求组内 anyOf 条目上限。 */
export const GHOST_SETUP_MAX_ITEMS_PER_GROUP = 8;
/** 一张 setup 卡最多需要覆盖 manifest 合法声明的全部可操作条目。 */
export const GHOST_SETUP_MAX_STEPS =
- GHOST_SETUP_MAX_GROUPS * GHOST_SETUP_MAX_ITEMS_PER_GROUP;
+ (GHOST_SETUP_MAX_GROUPS + GHOST_SETUP_MAX_HOST_GROUPS) * GHOST_SETUP_MAX_ITEMS_PER_GROUP;
/**
* Host-owned setup providers may append requirements that do not exist in the
* plugin manifest (for example, a shared client capability). Reserve a bounded
diff --git a/packages/cindy-tools/src/__tests__/ghostMcp.test.ts b/packages/cindy-tools/src/__tests__/ghostMcp.test.ts
index b3f2c423b8..a3adaee9b7 100644
--- a/packages/cindy-tools/src/__tests__/ghostMcp.test.ts
+++ b/packages/cindy-tools/src/__tests__/ghostMcp.test.ts
@@ -846,7 +846,7 @@ describe("ghost_call · setup_plan MCP 边界", () => {
expect(
ghostSetupPlanInputSchema.safeParse({
...validPlan,
- steps: Array.from({ length: 72 }, (_, i) => ({
+ steps: Array.from({ length: 80 }, (_, i) => ({
...validPlan.steps[0],
id: `step-${i}`,
})),
@@ -855,7 +855,7 @@ describe("ghost_call · setup_plan MCP 边界", () => {
expect(
ghostSetupPlanInputSchema.safeParse({
...validPlan,
- steps: Array.from({ length: 73 }, (_, i) => ({
+ steps: Array.from({ length: 81 }, (_, i) => ({
...validPlan.steps[0],
id: `step-${i}`,
})),
diff --git a/packages/cindy-tools/src/ghost/mcpServer.ts b/packages/cindy-tools/src/ghost/mcpServer.ts
index 48ae2fe4f9..478308d729 100644
--- a/packages/cindy-tools/src/ghost/mcpServer.ts
+++ b/packages/cindy-tools/src/ghost/mcpServer.ts
@@ -84,10 +84,10 @@ const ROSTER_MAX_ITEMS = 16;
/**
* Agent setup plan 的 MCP 边界上限。须覆盖 Desktop manifest 的
- * max groups × max any-of items (8 × 8) 和 Host-owned reserve (8);
+ * (max groups + host groups) × max any-of items ((8+2) × 8 = 80);
* 本包刻意不依赖 Desktop。
*/
-const SETUP_PLAN_MAX_STEPS = 72;
+const SETUP_PLAN_MAX_STEPS = 80;
const SETUP_PLAN_MAX_REFS_PER_STEP = 8;
const SETUP_PLAN_MAX_ID_LENGTH = 128;
const SETUP_PLAN_MAX_INTRO_LENGTH = 500;