mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
refactor(acp): migrate ACP integration to use @agentclientprotocol/sdk
- Remove acp.ts and schema.ts in favor of SDK types - Refactor acpAgent.ts to leverage SDK client - Update session management types and implementations - Adjust all test cases for new SDK-based architecture - Update integration tests and export utilities Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
79adac930f
commit
180dcd8b36
21 changed files with 421 additions and 1709 deletions
|
|
@ -24,7 +24,12 @@ import { z } from 'zod';
|
|||
import type { SessionContext } from './types.js';
|
||||
import { ToolCallEmitter } from './emitters/ToolCallEmitter.js';
|
||||
import { MessageEmitter } from './emitters/MessageEmitter.js';
|
||||
import type * as acp from '../acp.js';
|
||||
import type {
|
||||
AgentSideConnection,
|
||||
PermissionOption,
|
||||
RequestPermissionRequest,
|
||||
ToolCallContent,
|
||||
} from '@agentclientprotocol/sdk';
|
||||
|
||||
const debugLogger = createDebugLogger('ACP_SUBAGENT_TRACKER');
|
||||
|
||||
|
|
@ -80,7 +85,7 @@ export class SubAgentTracker {
|
|||
|
||||
constructor(
|
||||
private readonly ctx: SessionContext,
|
||||
private readonly client: acp.Client,
|
||||
private readonly client: AgentSideConnection,
|
||||
private readonly parentToolCallId: string,
|
||||
private readonly subagentType: string,
|
||||
) {
|
||||
|
|
@ -214,7 +219,7 @@ export class SubAgentTracker {
|
|||
if (abortSignal.aborted) return;
|
||||
|
||||
const state = this.toolStates.get(event.callId);
|
||||
const content: acp.ToolCallContent[] = [];
|
||||
const content: ToolCallContent[] = [];
|
||||
|
||||
// Handle edit confirmation type - show diff
|
||||
if (event.confirmationDetails.type === 'edit') {
|
||||
|
|
@ -243,7 +248,7 @@ export class SubAgentTracker {
|
|||
const { title, locations, kind } =
|
||||
this.toolCallEmitter.resolveToolMetadata(event.name, state?.args);
|
||||
|
||||
const params: acp.RequestPermissionRequest = {
|
||||
const params: RequestPermissionRequest = {
|
||||
sessionId: this.ctx.sessionId,
|
||||
options: this.toPermissionOptions(fullConfirmationDetails),
|
||||
toolCall: {
|
||||
|
|
@ -324,7 +329,7 @@ export class SubAgentTracker {
|
|||
*/
|
||||
private toPermissionOptions(
|
||||
confirmation: ToolCallConfirmationDetails,
|
||||
): acp.PermissionOption[] {
|
||||
): PermissionOption[] {
|
||||
switch (confirmation.type) {
|
||||
case 'edit':
|
||||
return [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue