Skip to content

Commit 6fbba34

Browse files
committed
Remove live check and migrate to abort signal. Fix cli to pass abort signal
1 parent bedf496 commit 6fbba34

33 files changed

+248
-940
lines changed

cli/src/hooks/use-send-message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ export const useSendMessage = ({
375375
previousRunState: previousRunStateRef.current,
376376
agentDefinitions,
377377
eventHandlerState,
378+
signal: abortController.signal,
378379
})
379380

380381
const runState = await client.run(runConfig)

cli/src/utils/create-run-config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type CreateRunConfigParams = {
1515
previousRunState: RunState | null
1616
agentDefinitions: AgentDefinition[]
1717
eventHandlerState: EventHandlerState
18+
signal: AbortSignal
1819
}
1920

2021
export const createRunConfig = (params: CreateRunConfigParams) => {
@@ -38,5 +39,6 @@ export const createRunConfig = (params: CreateRunConfigParams) => {
3839
maxAgentSteps: 100,
3940
handleStreamChunk: createStreamChunkHandler(eventHandlerState),
4041
handleEvent: createEventHandler(eventHandlerState),
42+
signal: params.signal,
4143
}
4244
}

common/src/testing/fixtures/agent-runtime.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ export const TEST_AGENT_RUNTIME_IMPL = Object.freeze<
104104

105105
// Mutable State
106106
databaseAgentCache: new Map<string, AgentTemplate | null>(),
107-
liveUserInputRecord: {},
108-
sessionConnections: {},
109107

110108
// Analytics
111109
trackEvent: () => {},

common/src/types/contracts/agent-runtime.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type {
1818
GetUserInfoFromApiKeyFn,
1919
StartAgentRunFn,
2020
} from './database'
21-
import type { SessionRecord, UserInputRecord } from './live-user-input'
2221
import type {
2322
PromptAiSdkFn,
2423
PromptAiSdkStreamFn,
@@ -49,8 +48,6 @@ export type AgentRuntimeDeps = {
4948

5049
// Mutable State
5150
databaseAgentCache: DatabaseAgentCache
52-
liveUserInputRecord: UserInputRecord
53-
sessionConnections: SessionRecord
5451

5552
// Analytics
5653
trackEvent: TrackEventFn

common/src/types/contracts/live-user-input.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

common/src/types/contracts/llm.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { TrackEventFn } from './analytics'
22
import type { SendActionFn } from './client'
3-
import type { CheckLiveUserInputFn } from './live-user-input'
43
import type { OpenRouterProviderRoutingOptions } from '../agent-template'
54
import type { ParamsExcluding } from '../function-params'
65
import type { Logger } from './logger'
@@ -50,8 +49,8 @@ export type PromptAiSdkStreamFn = (
5049
sendAction: SendActionFn
5150
logger: Logger
5251
trackEvent: TrackEventFn
53-
} & ParamsExcluding<typeof streamText, 'model' | 'messages'> &
54-
ParamsExcluding<CheckLiveUserInputFn, 'clientSessionId'>,
52+
signal: AbortSignal
53+
} & ParamsExcluding<typeof streamText, 'model' | 'messages'>,
5554
) => AsyncGenerator<StreamChunk, string | null>
5655

5756
export type PromptAiSdkFn = (
@@ -74,8 +73,8 @@ export type PromptAiSdkFn = (
7473
logger: Logger
7574
trackEvent: TrackEventFn
7675
n?: number
77-
} & ParamsExcluding<typeof generateText, 'model' | 'messages'> &
78-
ParamsExcluding<CheckLiveUserInputFn, 'clientSessionId'>,
76+
signal: AbortSignal
77+
} & ParamsExcluding<typeof generateText, 'model' | 'messages'>,
7978
) => Promise<string>
8079

8180
export type PromptAiSdkStructuredInput<T> = {
@@ -100,7 +99,8 @@ export type PromptAiSdkStructuredInput<T> = {
10099
sendAction: SendActionFn
101100
logger: Logger
102101
trackEvent: TrackEventFn
103-
} & ParamsExcluding<CheckLiveUserInputFn, 'clientSessionId'>
102+
signal: AbortSignal
103+
}
104104
export type PromptAiSdkStructuredOutput<T> = Promise<T>
105105
export type PromptAiSdkStructuredFn = <T>(
106106
params: PromptAiSdkStructuredInput<T>,

evals/buffbench/pick-commits.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { execFileSync } from 'child_process'
44
import fs from 'fs'
55
import path from 'path'
66

7-
import { disableLiveUserInputCheck } from '@codebuff/agent-runtime/live-user-inputs'
87
import { models } from '@codebuff/common/old-constants'
98
import { userMessage } from '@codebuff/common/util/messages'
109
import { promptAiSdkStructured } from '@codebuff/sdk'
@@ -399,7 +398,6 @@ async function screenCommitsWithGpt5(
399398
const prompt = `${COMMIT_SCREENING_PROMPT}\n\nCommit to evaluate:\n\n${commitInfo}`
400399

401400
try {
402-
disableLiveUserInputCheck()
403401
const response = await promptAiSdkStructured({
404402
messages: [userMessage(prompt)],
405403
schema: CommitSelectionSchema,
@@ -409,12 +407,11 @@ async function screenCommitsWithGpt5(
409407
userInputId,
410408
userId: undefined,
411409
sendAction: () => {},
412-
liveUserInputRecord: {},
413-
sessionConnections: {},
414410
logger: console,
415411
trackEvent: () => {},
416412
apiKey: 'unused-api-key',
417413
runId: 'unused-run-id',
414+
signal: new AbortController().signal,
418415
})
419416

420417
// Handle empty or invalid response

evals/impl/agent-runtime.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ export const EVALS_AGENT_RUNTIME_IMPL = Object.freeze<AgentRuntimeDeps>({
6464
},
6565

6666
// Mutable State
67-
liveUserInputRecord: {},
68-
sessionConnections: {},
6967
databaseAgentCache: new Map<string, AgentTemplate | null>(),
7068

7169
// Analytics

0 commit comments

Comments
 (0)