Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/junior/src/chat/conversations/turn-lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
ConversationTurnFailureCode,
ConversationTurnFailureReason,
} from "./history";
import { getConversationEventStore } from "@/chat/db";

/** Product-owned inputs for opening one correlated conversation turn. */
export interface StartConversationTurnInput {
Expand Down Expand Up @@ -92,3 +93,8 @@ export class ConversationTurnLifecycleService implements ConversationTurnLifecyc
]);
}
}

/** Return the Turn lifecycle that records Conversation events. */
export function getTurnLifecycle(): ConversationTurnLifecycle {
return new ConversationTurnLifecycleService(getConversationEventStore());
}
7 changes: 2 additions & 5 deletions packages/junior/src/chat/providers/slack/resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ import {
requireTurnFailureEventId,
} from "@/chat/services/turn-failure-response";
import {
ConversationTurnLifecycleService,
getTurnLifecycle,
type ConversationTurnLifecycle,
} from "@/chat/conversations/turn-lifecycle";
import type { ConversationTurnFailureCode } from "@/chat/conversations/history";
import { getConversationEventStore } from "@/chat/db";
import {
recordTurnSummary,
saveTurnCheckpoint,
Expand Down Expand Up @@ -457,9 +456,7 @@ async function resumeSlackTurnInContext(
let assistantMessageDelivered = false;
let shouldScheduleCompletedPluginTasks = false;
let postDeliveryCommitError: unknown;
const turnLifecycle = new ConversationTurnLifecycleService(
getConversationEventStore(),
);
const turnLifecycle = getTurnLifecycle();
let failureCode: ConversationTurnFailureCode = "agent_run_failed";
let runArgs = args;
try {
Expand Down
Loading