Feat/integrate lint preview (#285)

* feat: 适配 zed acp 协议

* docs: 完善 acp 文档

* feat: integrate feature branches + daemon/job 命令层级化 + 跨平台后台引擎

Cherry-picked from origin/lint/preview (637c908), excluding lint-only changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: correct detectMimeFromBase64 to decode raw bytes from base64

Cherry-picked from origin/lint/preview (ee36954).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: daemon 子进程 spawn 跨平台修复 + CliLaunchSpec 集中化重构

Cherry-picked from origin/lint/preview (c5f52cd), excluding lint-only formatting changes.

- 新建 src/utils/cliLaunch.ts: 集中化 CLI 子进程启动层
- 修复 --daemon-worker=kind 等号格式解析
- 修复 daemon/bg fast path 缺少 setShellIfWindows()
- 修复 checkPathExists 用 existsSync 替代 execSync('dir')
- 7 个 spawn 站点迁移到 CliLaunchSpec

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: merge tsconfig.base.json into tsconfig.json with full compiler options

The cherry-pick from 637c908 dropped jsx/strict/etc settings when removing
tsconfig.base.json. This commit restores them in a single tsconfig.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: merge tsconfig.base.json into tsconfig.json with full compiler options

The cherry-pick from 637c908 dropped jsx/strict/etc settings when removing
tsconfig.base.json. This commit restores them in a single tsconfig.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-16 20:59:29 +08:00
committed by GitHub
parent a02dc0bded
commit c8d08d235b
137 changed files with 13267 additions and 837 deletions

View File

@@ -9,19 +9,14 @@
* 4. Can be idle (waiting for work) or active (processing)
*/
import {
isTerminalTaskStatus,
type SetAppState,
type Task,
type TaskStateBase,
} from '../../Task.js'
import type { Message } from '../../types/message.js'
import { logForDebugging } from '../../utils/debug.js'
import { createUserMessage } from '../../utils/messages.js'
import { killInProcessTeammate } from '../../utils/swarm/spawnInProcess.js'
import { updateTaskState } from '../../utils/task/framework.js'
import type { InProcessTeammateTaskState } from './types.js'
import { appendCappedMessage, isInProcessTeammateTask } from './types.js'
import { isTerminalTaskStatus, type SetAppState, type Task, type TaskStateBase } from '../../Task.js';
import type { Message, MessageOrigin } from '../../types/message.js';
import { logForDebugging } from '../../utils/debug.js';
import { createUserMessage } from '../../utils/messages.js';
import { killInProcessTeammate } from '../../utils/swarm/spawnInProcess.js';
import { updateTaskState } from '../../utils/task/framework.js';
import type { InProcessTeammateTaskState, PendingTeammateUserMessage } from './types.js';
import { appendCappedMessage, isInProcessTeammateTask } from './types.js';
/**
* InProcessTeammateTask - Handles in-process teammate execution.
@@ -30,48 +25,41 @@ export const InProcessTeammateTask: Task = {
name: 'InProcessTeammateTask',
type: 'in_process_teammate',
async kill(taskId, setAppState) {
killInProcessTeammate(taskId, setAppState)
killInProcessTeammate(taskId, setAppState);
},
}
};
/**
* Request shutdown for a teammate.
*/
export function requestTeammateShutdown(
taskId: string,
setAppState: SetAppState,
): void {
export function requestTeammateShutdown(taskId: string, setAppState: SetAppState): void {
updateTaskState<InProcessTeammateTaskState>(taskId, setAppState, task => {
if (task.status !== 'running' || task.shutdownRequested) {
return task
return task;
}
return {
...task,
shutdownRequested: true,
}
})
};
});
}
/**
* Append a message to a teammate's conversation history.
* Used for zoomed view to show the teammate's conversation.
*/
export function appendTeammateMessage(
taskId: string,
message: Message,
setAppState: SetAppState,
): void {
export function appendTeammateMessage(taskId: string, message: Message, setAppState: SetAppState): void {
updateTaskState<InProcessTeammateTaskState>(taskId, setAppState, task => {
if (task.status !== 'running') {
return task
return task;
}
return {
...task,
messages: appendCappedMessage(task.messages, message),
}
})
};
});
}
/**
@@ -82,27 +70,47 @@ export function appendTeammateMessage(
export function injectUserMessageToTeammate(
taskId: string,
message: string,
options:
| {
autonomyRunId?: string;
origin?: MessageOrigin;
}
| undefined,
setAppState: SetAppState,
): void {
): boolean {
let injected = false;
updateTaskState<InProcessTeammateTaskState>(taskId, setAppState, task => {
// Allow message injection when teammate is running or idle (waiting for input)
// Only reject if teammate is in a terminal state
if (isTerminalTaskStatus(task.status)) {
logForDebugging(
`Dropping message for teammate task ${taskId}: task status is "${task.status}"`,
)
return task
logForDebugging(`Dropping message for teammate task ${taskId}: task status is "${task.status}"`);
return task;
}
injected = true;
const pendingMessage: PendingTeammateUserMessage = { message };
if (options?.autonomyRunId !== undefined) {
pendingMessage.autonomyRunId = options.autonomyRunId;
}
if (options?.origin !== undefined) {
pendingMessage.origin = options.origin;
}
const userMessageArgs: Parameters<typeof createUserMessage>[0] = {
content: message,
};
if (options?.origin !== undefined) {
userMessageArgs.origin = options.origin;
}
return {
...task,
pendingUserMessages: [...task.pendingUserMessages, message],
messages: appendCappedMessage(
task.messages,
createUserMessage({ content: message }),
),
}
})
pendingUserMessages: [...task.pendingUserMessages, pendingMessage],
messages: appendCappedMessage(task.messages, createUserMessage(userMessageArgs)),
};
});
return injected;
}
/**
@@ -115,30 +123,28 @@ export function findTeammateTaskByAgentId(
agentId: string,
tasks: Record<string, TaskStateBase>,
): InProcessTeammateTaskState | undefined {
let fallback: InProcessTeammateTaskState | undefined
let fallback: InProcessTeammateTaskState | undefined;
for (const task of Object.values(tasks)) {
if (isInProcessTeammateTask(task) && task.identity.agentId === agentId) {
// Prefer running tasks in case old killed tasks still exist in AppState
// alongside new running ones with the same agentId
if (task.status === 'running') {
return task
return task;
}
// Keep first match as fallback in case no running task exists
if (!fallback) {
fallback = task
fallback = task;
}
}
}
return fallback
return fallback;
}
/**
* Get all in-process teammate tasks from AppState.
*/
export function getAllInProcessTeammateTasks(
tasks: Record<string, TaskStateBase>,
): InProcessTeammateTaskState[] {
return Object.values(tasks).filter(isInProcessTeammateTask)
export function getAllInProcessTeammateTasks(tasks: Record<string, TaskStateBase>): InProcessTeammateTaskState[] {
return Object.values(tasks).filter(isInProcessTeammateTask);
}
/**
@@ -147,10 +153,8 @@ export function getAllInProcessTeammateTasks(
* and useBackgroundTaskNavigation — selectedIPAgentIndex maps into this
* array, so all three must agree on sort order.
*/
export function getRunningTeammatesSorted(
tasks: Record<string, TaskStateBase>,
): InProcessTeammateTaskState[] {
export function getRunningTeammatesSorted(tasks: Record<string, TaskStateBase>): InProcessTeammateTaskState[] {
return getAllInProcessTeammateTasks(tasks)
.filter(t => t.status === 'running')
.sort((a, b) => a.identity.agentName.localeCompare(b.identity.agentName))
.sort((a, b) => a.identity.agentName.localeCompare(b.identity.agentName));
}