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。

fix(claude-code): 避免远程图片误告警

DavidShen212c1ec28e1b
diff --git a/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.ts b/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.ts
index 7707737387..887d7dfb61 100644
--- a/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.ts
+++ b/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.ts
@@ -520,7 +520,9 @@ describe('ClaudeCodeAgent plan mode', () => {
const fakeQuery = { ...createFakeQuery(), send: remoteSend };
const remoteCcQueryFactory: NonNullable<AgentDeps['remoteCcQueryFactory']> = async () =>
fakeQuery as never;
- const agent = new ClaudeCodeAgent(createDeps({ remoteCcQueryFactory }));
+ const logger = createNoopLogger();
+ const warn = vi.spyOn(logger, 'warn');
+ const agent = new ClaudeCodeAgent(createDeps({ logger, remoteCcQueryFactory }));
const handle = await agent.startSession({
sessionId: 'session-remote-image-path',
model: 'claude-opus-4-6',
@@ -541,6 +543,10 @@ describe('ClaudeCodeAgent plan mode', () => {
expect(remoteSend.mock.calls[0]?.[0]).toMatchObject({
message: { content: `@"${imagePath}" Inspect this` },
});
+ expect(warn).not.toHaveBeenCalledWith(
+ 'cc remote: local attachment not accessible on remote session',
+ expect.anything(),
+ );
await handle.close();
});
diff --git a/packages/maker-core/src/agents/claude-code/index.ts b/packages/maker-core/src/agents/claude-code/index.ts
index 7c2c521307..f064910624 100644
--- a/packages/maker-core/src/agents/claude-code/index.ts
+++ b/packages/maker-core/src/agents/claude-code/index.ts
@@ -5163,12 +5163,7 @@ export class ClaudeCodeAgent extends BaseAgent {
const hasFileAttachment = message.content.some(
(b) => b.type === 'file' || b.type === 'mention',
);
- const sourceImageCount = message.content.filter((b) => b.type === 'image').length;
- const inlineImageCount = Array.isArray(content)
- ? content.filter((b) => b.type === 'image').length
- : 0;
- const hasPathBackedImage = sourceImageCount > inlineImageCount;
- if (hasFileAttachment || hasPathBackedImage) {
+ if (hasFileAttachment) {
log.warn('cc remote: local attachment not accessible on remote session', {
sessionId: opts.sessionId,
hostId: opts.remoteHostId,
@@ -5176,7 +5171,7 @@ export class ClaudeCodeAgent extends BaseAgent {
eventQueue.push({
type: 'error',
data: {
- message: '[REMOTE_LOCAL_ATTACHMENT_UNSUPPORTED] Local file attachments and images that cannot be embedded are not accessible on remote sessions. Paste content directly instead.',
+ message: '[REMOTE_LOCAL_ATTACHMENT_UNSUPPORTED] Local file attachments are not accessible on remote sessions. Paste content directly instead.',
isTerminal: false,
},
source: 'claude-code',