mirror of https://github.com/buster-so/buster.git
move sequential thinking away from old inherited context
This commit is contained in:
parent
0b8f8665d6
commit
e52c0c7d72
|
@ -21,9 +21,9 @@ const NEXT_THOUGHT_NEEDED_KEY =
|
|||
'nextThoughtNeeded' as const satisfies keyof SequentialThinkingInput;
|
||||
const THOUGHT_NUMBER_KEY = 'thoughtNumber' as const satisfies keyof SequentialThinkingInput;
|
||||
|
||||
export function createSequentialThinkingDelta<TAgentContext extends SequentialThinkingContext>(
|
||||
export function createSequentialThinkingDelta(
|
||||
sequentialThinkingState: SequentialThinkingState,
|
||||
context: TAgentContext
|
||||
context: SequentialThinkingContext
|
||||
) {
|
||||
return async function sequentialThinkingDelta(
|
||||
options: { inputTextDelta: string } & ToolCallOptions
|
||||
|
|
|
@ -35,9 +35,7 @@ async function processSequentialThinking(
|
|||
}
|
||||
|
||||
// Factory function that creates the execute function with proper context typing
|
||||
export function createSequentialThinkingExecute<TAgentContext extends SequentialThinkingContext>(
|
||||
context: TAgentContext
|
||||
) {
|
||||
export function createSequentialThinkingExecute(context: SequentialThinkingContext) {
|
||||
return wrapTraced(
|
||||
async (input: SequentialThinkingInput): Promise<SequentialThinkingOutput> => {
|
||||
// Use the messageId from the passed context
|
||||
|
|
|
@ -11,9 +11,9 @@ import type {
|
|||
SequentialThinkingState,
|
||||
} from './sequential-thinking-tool';
|
||||
|
||||
export function createSequentialThinkingFinish<TAgentContext extends SequentialThinkingContext>(
|
||||
export function createSequentialThinkingFinish(
|
||||
sequentialThinkingState: SequentialThinkingState,
|
||||
context: TAgentContext
|
||||
context: SequentialThinkingContext
|
||||
) {
|
||||
return async function sequentialThinkingFinish(
|
||||
options: { input: SequentialThinkingInput } & ToolCallOptions
|
||||
|
|
|
@ -10,9 +10,9 @@ import type {
|
|||
} from './sequential-thinking-tool';
|
||||
|
||||
// Factory function that creates a type-safe callback for the specific agent context
|
||||
export function createSequentialThinkingStart<TAgentContext extends SequentialThinkingContext>(
|
||||
export function createSequentialThinkingStart(
|
||||
sequentialThinkingState: SequentialThinkingState,
|
||||
context: TAgentContext
|
||||
context: SequentialThinkingContext
|
||||
) {
|
||||
return async function sequentialThinkingStart(options: ToolCallOptions): Promise<void> {
|
||||
// Set the entry ID in state
|
||||
|
|
|
@ -58,9 +58,7 @@ export type SequentialThinkingOutput = z.infer<typeof SequentialThinkingOutputSc
|
|||
export type SequentialThinkingContext = z.infer<typeof SequentialThinkingContextSchema>;
|
||||
export type SequentialThinkingState = z.infer<typeof SequentialThinkingStateSchema>;
|
||||
|
||||
export function createSequentialThinkingTool<
|
||||
TAgentContext extends SequentialThinkingContext = SequentialThinkingContext,
|
||||
>(context: TAgentContext) {
|
||||
export function createSequentialThinkingTool(context: SequentialThinkingContext) {
|
||||
const state: SequentialThinkingState = {
|
||||
entry_id: undefined,
|
||||
args: undefined,
|
||||
|
@ -69,10 +67,10 @@ export function createSequentialThinkingTool<
|
|||
thoughtNumber: undefined,
|
||||
};
|
||||
|
||||
const execute = createSequentialThinkingExecute<TAgentContext>(context);
|
||||
const onInputStart = createSequentialThinkingStart<TAgentContext>(state, context);
|
||||
const onInputDelta = createSequentialThinkingDelta<TAgentContext>(state, context);
|
||||
const onInputAvailable = createSequentialThinkingFinish<TAgentContext>(state, context);
|
||||
const execute = createSequentialThinkingExecute(context);
|
||||
const onInputStart = createSequentialThinkingStart(state, context);
|
||||
const onInputDelta = createSequentialThinkingDelta(state, context);
|
||||
const onInputAvailable = createSequentialThinkingFinish(state, context);
|
||||
|
||||
return tool({
|
||||
description: `A detailed tool for dynamic and reflective problem-solving through thoughts.
|
||||
|
|
|
@ -852,10 +852,10 @@ export const messages = pgTable(
|
|||
{
|
||||
id: uuid().defaultRandom().primaryKey().notNull(),
|
||||
requestMessage: text('request_message'),
|
||||
responseMessages: jsonb('response_messages').notNull(),
|
||||
reasoning: jsonb().notNull(),
|
||||
responseMessages: jsonb('response_messages').default([]).notNull(),
|
||||
reasoning: jsonb().default([]).notNull(),
|
||||
title: text().notNull(),
|
||||
rawLlmMessages: jsonb('raw_llm_messages').notNull(),
|
||||
rawLlmMessages: jsonb('raw_llm_messages').default([]).notNull(),
|
||||
finalReasoningMessage: text('final_reasoning_message'),
|
||||
chatId: uuid('chat_id').notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' })
|
||||
|
|
Loading…
Reference in New Issue