Skip to content

Commit 29e1d46

Browse files
committed
sdk: v0.3.0 new interface
1 parent c59fdef commit 29e1d46

File tree

6 files changed

+403
-377
lines changed

6 files changed

+403
-377
lines changed

sdk/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to the @codebuff/sdk package will be documented in this file.
44

5+
## [0.3.0]
6+
7+
- New more intuitive interface for `CodebuffClient` and `CodebuffClient.run`.
8+
59
## [0.1.30]
610

711
Types updates.

sdk/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,37 @@ async function main() {
2525
// Get one here: https://www.codebuff.com/api-keys
2626
apiKey: process.env.CODEBUFF_API_KEY,
2727
cwd: process.cwd(),
28-
onError: (e) => console.error('Codebuff error:', e.message),
2928
})
3029

3130
// First run
31+
console.log('------- First run started -------')
3232
const run1 = await client.run({
3333
agent: 'base',
3434
prompt: 'Create a simple calculator class',
3535
handleEvent: (event) => {
3636
// This will fire for all events that happen during the run, like when each agent starts/stops and when they respond.
37-
console.log(event) // Log all events
37+
console.dir(event, { depth: null }) // Log all events
3838
},
3939
})
40+
console.log('------- First run ended -------')
41+
42+
if (!run1) {
43+
// The previous run failed, handleEvent should have been called with an error
44+
console.error('First run failed.')
45+
process.exit(1)
46+
}
4047

4148
// Continue the same session with a follow-up
49+
console.log('------- Second run started -------')
4250
const run2 = await client.run({
4351
agent: 'base',
4452
prompt: 'Add unit tests for the calculator',
4553
previousRun: run1, // <-- this is where your next run differs from the previous run
4654
handleEvent: (event) => {
47-
console.log(event)
55+
console.dir(event, { depth: null })
4856
},
4957
})
50-
51-
client.closeConnection()
58+
console.log('------- Second run ended -------')
5259
}
5360

5461
main()

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@codebuff/sdk",
33
"private": false,
4-
"version": "0.2.4",
4+
"version": "0.3.0",
55
"description": "Official SDK for Codebuff — AI coding agent & framework",
66
"license": "Apache-2.0",
77
"type": "module",

0 commit comments

Comments
 (0)