@tencent-ai/agent-sdk 0.1.0-next.989 → 0.1.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/README.md +73 -2
- package/cli/CHANGELOG.md +2418 -0
- package/cli/LICENSE.txt +19 -0
- package/cli/README.md +26 -0
- package/cli/bin/codebuddy +39 -0
- package/cli/dist/codebuddy.js +20 -0
- package/cli/package.json +44 -0
- package/cli/product.cloudhosted.json +242 -0
- package/cli/product.internal.json +244 -0
- package/cli/product.ioa.json +467 -0
- package/cli/product.json +948 -0
- package/cli/product.selfhosted.json +196 -0
- package/cli/vendor/ripgrep/COPYING +3 -0
- package/cli/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/cli/vendor/ripgrep/arm64-darwin/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/arm64-linux/rg +0 -0
- package/cli/vendor/ripgrep/arm64-linux/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/x64-darwin/rg +0 -0
- package/cli/vendor/ripgrep/x64-darwin/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/x64-linux/rg +0 -0
- package/cli/vendor/ripgrep/x64-linux/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/cli/vendor/ripgrep/x64-win32/ripgrep.node +0 -0
- package/lib/errors.d.ts +10 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +17 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.d.ts +36 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +40 -0
- package/lib/index.js.map +1 -0
- package/lib/package.spec.js +3 -2
- package/lib/package.spec.js.map +1 -1
- package/lib/query.d.ts +46 -0
- package/lib/query.d.ts.map +1 -0
- package/lib/query.js +270 -0
- package/lib/query.js.map +1 -0
- package/lib/session.d.ts +53 -0
- package/lib/session.d.ts.map +1 -0
- package/lib/session.js +163 -0
- package/lib/session.js.map +1 -0
- package/lib/transport/index.d.ts +104 -0
- package/lib/transport/index.d.ts.map +1 -0
- package/lib/transport/index.js +20 -0
- package/lib/transport/index.js.map +1 -0
- package/lib/transport/process-transport.d.ts +65 -0
- package/lib/transport/process-transport.d.ts.map +1 -0
- package/lib/transport/process-transport.js +380 -0
- package/lib/transport/process-transport.js.map +1 -0
- package/lib/types.d.ts +603 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +58 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/cli-resolver.d.ts +36 -0
- package/lib/utils/cli-resolver.d.ts.map +1 -0
- package/lib/utils/cli-resolver.js +123 -0
- package/lib/utils/cli-resolver.js.map +1 -0
- package/lib/utils/env-utils.d.ts +9 -0
- package/lib/utils/env-utils.d.ts.map +1 -0
- package/lib/utils/env-utils.js +19 -0
- package/lib/utils/env-utils.js.map +1 -0
- package/lib/utils/index.d.ts +8 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +17 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/process.d.ts +8 -0
- package/lib/utils/process.d.ts.map +1 -0
- package/lib/utils/process.js +16 -0
- package/lib/utils/process.js.map +1 -0
- package/lib/utils/stream.d.ts +24 -0
- package/lib/utils/stream.d.ts.map +1 -0
- package/lib/utils/stream.js +85 -0
- package/lib/utils/stream.js.map +1 -0
- package/package.json +21 -14
- package/dist/agent-sdk.js +0 -1
- package/lib/common/application-utils.d.ts +0 -5
- package/lib/common/application-utils.d.ts.map +0 -1
- package/lib/common/application-utils.js +0 -18
- package/lib/common/application-utils.js.map +0 -1
- package/lib/common/component-registry.d.ts +0 -10
- package/lib/common/component-registry.d.ts.map +0 -1
- package/lib/common/component-registry.js +0 -50
- package/lib/common/component-registry.js.map +0 -1
- package/lib/common/index.d.ts +0 -4
- package/lib/common/index.d.ts.map +0 -1
- package/lib/common/index.js +0 -20
- package/lib/common/index.js.map +0 -1
- package/lib/common/services.d.ts +0 -8
- package/lib/common/services.d.ts.map +0 -1
- package/lib/common/services.js +0 -21
- package/lib/common/services.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CodeBuddy Agent SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
SDK for building AI agents with CodeBuddy Code's capabilities. Programmatically interact with AI to build autonomous agents that can understand codebases, edit files, and execute workflows.
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tencent-ai/agent-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
15
|
+
|
|
16
|
+
const response = query({
|
|
17
|
+
prompt: 'What files are in this directory?',
|
|
18
|
+
options: {
|
|
19
|
+
permissionMode: 'bypassPermissions',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
for await (const message of response) {
|
|
24
|
+
if (message.type === 'assistant') {
|
|
25
|
+
for (const block of message.message.content) {
|
|
26
|
+
if (block.type === 'text') {
|
|
27
|
+
console.log(block.text);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API Reference
|
|
35
|
+
|
|
36
|
+
### `query(options)`
|
|
37
|
+
|
|
38
|
+
Create a query to interact with the agent.
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
const q = query({
|
|
42
|
+
prompt: string, // The prompt to send
|
|
43
|
+
options: {
|
|
44
|
+
model?: string, // Model to use
|
|
45
|
+
permissionMode?: 'default' | 'acceptEdits' | 'bypassPermissions',
|
|
46
|
+
maxTurns?: number, // Maximum conversation turns
|
|
47
|
+
cwd?: string, // Working directory
|
|
48
|
+
hooks?: HookCallback[], // Event hooks
|
|
49
|
+
agents?: Record<string, AgentDefinition>, // Custom agents
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Iterate over messages
|
|
54
|
+
for await (const message of q) {
|
|
55
|
+
// Handle message
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Message Types
|
|
61
|
+
|
|
62
|
+
- `system` - Session initialization info
|
|
63
|
+
- `assistant` - Agent responses (text, tool calls)
|
|
64
|
+
- `result` - Query completion status
|
|
65
|
+
|
|
66
|
+
## Related Links
|
|
67
|
+
|
|
68
|
+
- [CodeBuddy Code CLI](https://www.npmjs.com/package/@tencent-ai/codebuddy-code)
|
|
69
|
+
- [Documentation](https://cnb.cool/codebuddy/codebuddy-code/-/blob/main/docs)
|
|
70
|
+
- [Issues](https://cnb.cool/codebuddy/codebuddy-code/-/issues)
|
|
71
|
+
|
|
72
|
+
## Feedback
|
|
73
|
+
|
|
74
|
+
- Submit issues at [Issues](https://cnb.cool/codebuddy/codebuddy-code/-/issues)
|
|
75
|
+
- Contact: codebuddy@tencent.com
|