File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ import { loadLocalAgents } from '@codebuff/npm-app/agents/load-agents'
55import type { Runner } from './runner'
66import type { RunState } from '../../../sdk/src/index'
77import type { AgentStep } from '../../scaffolding'
8+ import { API_KEY_ENV_VAR } from '@codebuff/common/constants'
9+ import { getUserCredentials } from '@codebuff/npm-app/credentials'
10+
11+ const getLocalAuthToken = ( ) => {
12+ return getUserCredentials ( ) ?. authToken
13+ }
814
915export class CodebuffRunner implements Runner {
1016 private client : CodebuffClient | null
@@ -29,8 +35,11 @@ export class CodebuffRunner implements Runner {
2935 toolResults = [ ]
3036 }
3137
38+ const apiKey = process . env [ API_KEY_ENV_VAR ] || getLocalAuthToken ( )
39+
3240 if ( ! this . client ) {
3341 this . client = new CodebuffClient ( {
42+ apiKey,
3443 cwd : this . runState . sessionState . fileContext . cwd ,
3544 onError : ( error ) => {
3645 throw new Error ( error . message )
You can’t perform that action at this time.
0 commit comments