File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @codebuff/sdk" ,
33 "private" : false ,
4- "version" : " 0.3.5 " ,
4+ "version" : " 0.3.6 " ,
55 "description" : " Official SDK for Codebuff — AI coding agent & framework" ,
66 "license" : " Apache-2.0" ,
77 "type" : " module" ,
Original file line number Diff line number Diff line change 11import path from 'path'
22
3+ import { cloneDeep } from 'lodash'
4+
35import { initialSessionState , applyOverridesToSessionState } from './run-state'
46import { changeFile } from './tools/change-file'
57import { codeSearch } from './tools/code-search'
@@ -61,7 +63,7 @@ export type CodebuffClientOptions = {
6163}
6264
6365export type RunOptions = {
64- agent : string
66+ agent : string | AgentDefinition
6567 prompt : string
6668 params ?: Record < string , any >
6769 previousRun ?: RunState
@@ -163,6 +165,13 @@ export async function run({
163165 } )
164166
165167 // Init session state
168+ let agentId
169+ if ( typeof agent !== 'string' ) {
170+ agentDefinitions = [ ...( cloneDeep ( agentDefinitions ) ?? [ ] ) , agent ]
171+ agentId = agent . id
172+ } else {
173+ agentId = agent
174+ }
166175 let sessionState : SessionState
167176 if ( previousRun ?. sessionState ) {
168177 // applyOverridesToSessionState handles deep cloning and applying any provided overrides
@@ -201,7 +210,7 @@ export async function run({
201210 costMode : 'normal' ,
202211 sessionState,
203212 toolResults : extraToolResults ?? [ ] ,
204- agentId : agent ,
213+ agentId,
205214 } )
206215
207216 const result = await promise
You can’t perform that action at this time.
0 commit comments