@tencent-ai/agent-sdk 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/CHANGELOG.md +18 -0
- package/cli/dist/codebuddy.js +3 -3
- package/cli/package.json +1 -1
- package/cli/product.cloudhosted.json +2 -2
- package/cli/product.internal.json +2 -2
- package/cli/product.ioa.json +2 -2
- package/cli/product.json +2 -2
- package/cli/product.selfhosted.json +2 -2
- package/lib/acp/index.d.ts +7 -11
- package/lib/acp/index.d.ts.map +1 -1
- package/lib/acp/index.js +7 -14
- package/lib/acp/index.js.map +1 -1
- package/lib/acp/tool-converter.d.ts +98 -53
- package/lib/acp/tool-converter.d.ts.map +1 -1
- package/lib/acp/tool-converter.js +574 -387
- package/lib/acp/tool-converter.js.map +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/query.d.ts +0 -25
- package/lib/query.d.ts.map +1 -1
- package/lib/query.js +38 -167
- package/lib/query.js.map +1 -1
- package/lib/session.d.ts +17 -4
- package/lib/session.d.ts.map +1 -1
- package/lib/session.js +152 -14
- package/lib/session.js.map +1 -1
- package/lib/transport/index.d.ts +7 -0
- package/lib/transport/index.d.ts.map +1 -1
- package/lib/transport/index.js.map +1 -1
- package/lib/transport/process-transport.d.ts +30 -0
- package/lib/transport/process-transport.d.ts.map +1 -1
- package/lib/transport/process-transport.js +177 -1
- package/lib/transport/process-transport.js.map +1 -1
- package/lib/types.d.ts +36 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +2 -1
- package/lib/acp/acp-client.d.ts +0 -62
- package/lib/acp/acp-client.d.ts.map +0 -1
- package/lib/acp/acp-client.js +0 -256
- package/lib/acp/acp-client.js.map +0 -1
package/cli/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencent-ai/codebuddy-code",
|
|
3
|
-
"version": "2.37.
|
|
3
|
+
"version": "2.37.4",
|
|
4
4
|
"description": "Use CodeBuddy, Tencent's AI assistant, right from your terminal. CodeBuddy can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.",
|
|
5
5
|
"main": "lib/node/index.js",
|
|
6
6
|
"typings": "lib/node/index.d.ts",
|
|
@@ -323,6 +323,6 @@
|
|
|
323
323
|
"BillingNotice": false,
|
|
324
324
|
"CustomModelsJSON": true
|
|
325
325
|
},
|
|
326
|
-
"commit": "
|
|
327
|
-
"date": "2026-01-
|
|
326
|
+
"commit": "f5ce19c20fa8ba5cb0e16078d668c72f12436508",
|
|
327
|
+
"date": "2026-01-20T10:57:59.728Z"
|
|
328
328
|
}
|
|
@@ -325,6 +325,6 @@
|
|
|
325
325
|
"BillingNotice": false,
|
|
326
326
|
"CustomModelsJSON": true
|
|
327
327
|
},
|
|
328
|
-
"commit": "
|
|
329
|
-
"date": "2026-01-
|
|
328
|
+
"commit": "f5ce19c20fa8ba5cb0e16078d668c72f12436508",
|
|
329
|
+
"date": "2026-01-20T10:57:56.993Z"
|
|
330
330
|
}
|
package/cli/product.ioa.json
CHANGED
|
@@ -535,6 +535,6 @@
|
|
|
535
535
|
"BillingNotice": false,
|
|
536
536
|
"CustomModelsJSON": true
|
|
537
537
|
},
|
|
538
|
-
"commit": "
|
|
539
|
-
"date": "2026-01-
|
|
538
|
+
"commit": "f5ce19c20fa8ba5cb0e16078d668c72f12436508",
|
|
539
|
+
"date": "2026-01-20T10:57:58.364Z"
|
|
540
540
|
}
|
package/cli/product.json
CHANGED
|
@@ -1044,6 +1044,6 @@
|
|
|
1044
1044
|
"description": "tool-structuredoutput-description"
|
|
1045
1045
|
}
|
|
1046
1046
|
],
|
|
1047
|
-
"commit": "
|
|
1048
|
-
"date": "2026-01-
|
|
1047
|
+
"commit": "f5ce19c20fa8ba5cb0e16078d668c72f12436508",
|
|
1048
|
+
"date": "2026-01-20T10:57:55.654Z"
|
|
1049
1049
|
}
|
|
@@ -205,6 +205,6 @@
|
|
|
205
205
|
"BillingNotice": false,
|
|
206
206
|
"CustomModelsJSON": true
|
|
207
207
|
},
|
|
208
|
-
"commit": "
|
|
209
|
-
"date": "2026-01-
|
|
208
|
+
"commit": "f5ce19c20fa8ba5cb0e16078d668c72f12436508",
|
|
209
|
+
"date": "2026-01-20T10:58:01.075Z"
|
|
210
210
|
}
|
package/lib/acp/index.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ACP (Agent Client Protocol)
|
|
2
|
+
* ACP (Agent Client Protocol) Integration
|
|
3
3
|
*
|
|
4
|
-
* This module provides
|
|
5
|
-
*
|
|
4
|
+
* This module provides a unified interface for ACP protocol integration:
|
|
5
|
+
* - AcpTransformer: Bidirectional conversion between SDK internal format and ACP format
|
|
6
|
+
* - Type definitions for ACP messages and tool calls
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
* - NO DATA LOSS: All tool inputs preserved in rawInput
|
|
9
|
-
* - Tool IDs maintained throughout conversion chain
|
|
10
|
-
* - Error states properly tracked and propagated
|
|
8
|
+
* Uses official @agentclientprotocol/sdk types for full compatibility.
|
|
11
9
|
*/
|
|
12
|
-
export {
|
|
13
|
-
export type {
|
|
14
|
-
export { convertSdkToolUseToAcpToolCall, convertAcpToolResultToSdk, extractToolUseBlocks, extractTextContent, } from './tool-converter';
|
|
15
|
-
export type { AcpToolCall, AcpToolKind, AcpContent, AcpDiff, AcpLocation, AcpToolResult, } from './tool-converter';
|
|
10
|
+
export { AcpTransformer, } from './tool-converter';
|
|
11
|
+
export type { AcpToolCall, AcpToolKind, AcpToolStatus, AcpLocation, AcpToolCallContent, AcpToolResult, AcpMessage, } from './tool-converter';
|
|
16
12
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/acp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/acp/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/acp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACH,cAAc,GACjB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACR,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,UAAU,GACb,MAAM,kBAAkB,CAAC"}
|
package/lib/acp/index.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* ACP (Agent Client Protocol)
|
|
3
|
+
* ACP (Agent Client Protocol) Integration
|
|
4
4
|
*
|
|
5
|
-
* This module provides
|
|
6
|
-
*
|
|
5
|
+
* This module provides a unified interface for ACP protocol integration:
|
|
6
|
+
* - AcpTransformer: Bidirectional conversion between SDK internal format and ACP format
|
|
7
|
+
* - Type definitions for ACP messages and tool calls
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
* - NO DATA LOSS: All tool inputs preserved in rawInput
|
|
10
|
-
* - Tool IDs maintained throughout conversion chain
|
|
11
|
-
* - Error states properly tracked and propagated
|
|
9
|
+
* Uses official @agentclientprotocol/sdk types for full compatibility.
|
|
12
10
|
*/
|
|
13
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
15
|
-
var acp_client_1 = require("./acp-client");
|
|
16
|
-
Object.defineProperty(exports, "createAcpClient", { enumerable: true, get: function () { return acp_client_1.createAcpClient; } });
|
|
12
|
+
exports.AcpTransformer = void 0;
|
|
17
13
|
var tool_converter_1 = require("./tool-converter");
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
-
Object.defineProperty(exports, "convertAcpToolResultToSdk", { enumerable: true, get: function () { return tool_converter_1.convertAcpToolResultToSdk; } });
|
|
20
|
-
Object.defineProperty(exports, "extractToolUseBlocks", { enumerable: true, get: function () { return tool_converter_1.extractToolUseBlocks; } });
|
|
21
|
-
Object.defineProperty(exports, "extractTextContent", { enumerable: true, get: function () { return tool_converter_1.extractTextContent; } });
|
|
14
|
+
Object.defineProperty(exports, "AcpTransformer", { enumerable: true, get: function () { return tool_converter_1.AcpTransformer; } });
|
|
22
15
|
//# sourceMappingURL=index.js.map
|
package/lib/acp/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/acp/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/acp/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,mDAE0B;AADtB,gHAAA,cAAc,OAAA"}
|
|
@@ -1,78 +1,123 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* ACP Message Transformer
|
|
3
3
|
*
|
|
4
4
|
* Converts SDK internal tool formats to ACP (Agent Client Protocol) format and vice versa.
|
|
5
5
|
*
|
|
6
|
+
* Uses official @agentclientprotocol/sdk types for compatibility with the ACP specification.
|
|
7
|
+
*
|
|
6
8
|
* Critical Design Principle: NO DATA LOSS
|
|
7
9
|
* - SDK tool inputs are preserved completely in rawInput
|
|
8
10
|
* - Tool IDs are maintained throughout the conversion
|
|
9
11
|
* - Tool results are preserved with error state tracking
|
|
10
12
|
*/
|
|
11
|
-
import type { ToolUseContentBlock, ToolResultContentBlock } from '../types';
|
|
13
|
+
import type { ToolUseContentBlock, ToolResultContentBlock, Message } from '../types';
|
|
14
|
+
import type { ToolCall, ToolKind, ToolCallStatus, ToolCallLocation, ToolCallContent } from '@agentclientprotocol/sdk';
|
|
15
|
+
import type { ControlRequest } from '../types';
|
|
12
16
|
/**
|
|
13
|
-
* ACP
|
|
14
|
-
* This is the actual tool call information sent to ACP client
|
|
17
|
+
* ACP message types (JSON-RPC 2.0 messages)
|
|
15
18
|
*/
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export interface AcpContent {
|
|
28
|
-
type: 'text' | 'diff' | 'terminal';
|
|
29
|
-
content?: {
|
|
30
|
-
type: string;
|
|
31
|
-
text: string;
|
|
32
|
-
} | AcpDiff;
|
|
33
|
-
}
|
|
34
|
-
export interface AcpDiff {
|
|
35
|
-
path: string;
|
|
36
|
-
oldText: string | null;
|
|
37
|
-
newText: string;
|
|
38
|
-
}
|
|
39
|
-
export interface AcpLocation {
|
|
40
|
-
path: string;
|
|
41
|
-
line?: number;
|
|
19
|
+
export interface AcpMessage {
|
|
20
|
+
jsonrpc: '2.0';
|
|
21
|
+
id?: string | number;
|
|
22
|
+
method?: string;
|
|
23
|
+
params?: unknown;
|
|
24
|
+
result?: unknown;
|
|
25
|
+
error?: {
|
|
26
|
+
code: number;
|
|
27
|
+
message: string;
|
|
28
|
+
data?: unknown;
|
|
29
|
+
};
|
|
42
30
|
}
|
|
43
31
|
/**
|
|
44
|
-
* ACP Tool
|
|
32
|
+
* ACP Tool Call representation using official @agentclientprotocol/sdk types.
|
|
33
|
+
*
|
|
34
|
+
* See: https://agentclientprotocol.com/protocol/tool-calls
|
|
35
|
+
*/
|
|
36
|
+
export type AcpToolCall = ToolCall;
|
|
37
|
+
/**
|
|
38
|
+
* Tool kind categories using official ACP types.
|
|
39
|
+
* Includes: 'read', 'edit', 'delete', 'move', 'search', 'execute', 'think', 'fetch', 'switch_mode', 'other'
|
|
40
|
+
*
|
|
41
|
+
* See: https://agentclientprotocol.com/protocol/tool-calls#creating
|
|
42
|
+
*/
|
|
43
|
+
export type AcpToolKind = ToolKind;
|
|
44
|
+
/**
|
|
45
|
+
* Tool call status using official ACP types.
|
|
46
|
+
*/
|
|
47
|
+
export type AcpToolStatus = ToolCallStatus;
|
|
48
|
+
/**
|
|
49
|
+
* File location information using official ACP types.
|
|
50
|
+
*/
|
|
51
|
+
export type AcpLocation = ToolCallLocation;
|
|
52
|
+
/**
|
|
53
|
+
* Tool call content using official ACP types.
|
|
54
|
+
*/
|
|
55
|
+
export type AcpToolCallContent = ToolCallContent;
|
|
56
|
+
/**
|
|
57
|
+
* ACP Tool Result representation for reporting tool execution results.
|
|
45
58
|
*/
|
|
46
59
|
export interface AcpToolResult {
|
|
47
60
|
toolCallId: string;
|
|
48
61
|
status: 'completed' | 'failed';
|
|
49
|
-
content?:
|
|
62
|
+
content?: ToolCallContent[];
|
|
50
63
|
locations?: AcpLocation[];
|
|
51
64
|
rawOutput?: unknown;
|
|
52
65
|
}
|
|
53
66
|
/**
|
|
54
|
-
*
|
|
55
|
-
* Preserves all input data in rawInput field
|
|
67
|
+
* Bidirectional converter between SDK internal format (JSON Lines) and ACP (Agent Client Protocol) format.
|
|
56
68
|
*
|
|
57
|
-
*
|
|
58
|
-
* @returns ACP tool call with complete data preservation
|
|
59
|
-
*/
|
|
60
|
-
export declare function convertSdkToolUseToAcpToolCall(toolUse: ToolUseContentBlock): AcpToolCall;
|
|
61
|
-
/**
|
|
62
|
-
* Convert ACP Tool Result to SDK ToolResultContentBlock
|
|
63
|
-
* Preserves tool_use_id and ensures error state is tracked
|
|
69
|
+
* This is an abstract utility class with only static methods - do not instantiate.
|
|
64
70
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* Extract tool use blocks from content blocks array
|
|
71
|
+
* Key features:
|
|
72
|
+
* - Converts SDK tool use/result to ACP format
|
|
73
|
+
* - Converts ACP messages to SDK format
|
|
74
|
+
* - Extracts and manipulates tool/text blocks
|
|
75
|
+
* - Complete data preservation in roundtrip conversions
|
|
76
|
+
* - Type-safe message routing
|
|
72
77
|
*/
|
|
73
|
-
export declare
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
export declare abstract class AcpTransformer {
|
|
79
|
+
/**
|
|
80
|
+
* Convert SDK ToolUseContentBlock to ACP Tool Call
|
|
81
|
+
* Preserves all input data in rawInput field
|
|
82
|
+
*/
|
|
83
|
+
static convertSdkToolUseToAcpToolCall(toolUse: ToolUseContentBlock): AcpToolCall;
|
|
84
|
+
/**
|
|
85
|
+
* Convert ACP Tool Result to SDK ToolResultContentBlock
|
|
86
|
+
* Preserves tool_use_id and ensures error state is tracked
|
|
87
|
+
*/
|
|
88
|
+
static convertAcpToolResultToSdk(toolCallId: string, acpResult: AcpToolResult): ToolResultContentBlock;
|
|
89
|
+
/**
|
|
90
|
+
* Convert SDK ToolResultContentBlock to ACP ToolResult
|
|
91
|
+
* Enables bidirectional conversion for tool results
|
|
92
|
+
*/
|
|
93
|
+
static convertSdkToolResultToAcpToolResult(toolResult: ToolResultContentBlock): AcpToolResult;
|
|
94
|
+
/**
|
|
95
|
+
* Convert ACP message to SDK internal format (JSON Lines)
|
|
96
|
+
*
|
|
97
|
+
* Converts all ACP message types to corresponding SDK messages:
|
|
98
|
+
* - session/prompt: User input → UserMessage
|
|
99
|
+
* - session/cancel: Cancellation request → ControlRequest
|
|
100
|
+
* - session/update (tool_call_update): Tool result → UserMessage with tool_result block
|
|
101
|
+
*/
|
|
102
|
+
static acpToSdk(acpMessage: AcpMessage): Message | ControlRequest | null;
|
|
103
|
+
/**
|
|
104
|
+
* Convert SDK internal message to ACP format
|
|
105
|
+
*
|
|
106
|
+
* Converts all SDK message types to corresponding ACP messages:
|
|
107
|
+
* - AssistantMessage with tool_use blocks → tool_call messages
|
|
108
|
+
* - AssistantMessage with text → session/text messages
|
|
109
|
+
* - Other message types are skipped
|
|
110
|
+
*/
|
|
111
|
+
static sdkToAcp(message: Message): AcpMessage[];
|
|
112
|
+
private static generateToolTitle;
|
|
113
|
+
private static getToolKind;
|
|
114
|
+
private static generateToolContent;
|
|
115
|
+
private static extractToolLocations;
|
|
116
|
+
private static formatAcpContentForSdk;
|
|
117
|
+
private static formatDiffHunk;
|
|
118
|
+
private static privateExtractPromptText;
|
|
119
|
+
private static privateExtractToolUseBlocks;
|
|
120
|
+
private static privateExtractTextContent;
|
|
121
|
+
private static privateCreateToolResultMessage;
|
|
122
|
+
}
|
|
78
123
|
//# sourceMappingURL=tool-converter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-converter.d.ts","sourceRoot":"","sources":["../../src/acp/tool-converter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-converter.d.ts","sourceRoot":"","sources":["../../src/acp/tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACR,mBAAmB,EACnB,sBAAsB,EAItB,OAAO,EAEV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACR,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,eAAe,EAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACL;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAID;;;;;;;;;;;GAWG;AACH,8BAAsB,cAAc;IAGhC;;;OAGG;IACH,MAAM,CAAC,8BAA8B,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW;IAiBhF;;;OAGG;IACH,MAAM,CAAC,yBAAyB,CAC5B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,aAAa,GACzB,sBAAsB;IAYzB;;;OAGG;IACH,MAAM,CAAC,mCAAmC,CAAC,UAAU,EAAE,sBAAsB,GAAG,aAAa;IAkC7F;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,GAAG,cAAc,GAAG,IAAI;IAyDxE;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE;IAwG/C,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA4JhC,OAAO,CAAC,MAAM,CAAC,WAAW;IAwD1B,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAgElC,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAuBnC,OAAO,CAAC,MAAM,CAAC,sBAAsB;IA8CrC,OAAO,CAAC,MAAM,CAAC,cAAc;IAoB7B,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAcvC,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAY1C,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAexC,OAAO,CAAC,MAAM,CAAC,8BAA8B;CAgBhD"}
|