Skip to content

Commit 2e36e86

Browse files
committed
add "FINISH" action to /api/v1/agent-runs
1 parent 6fc0a14 commit 2e36e86

File tree

7 files changed

+613
-155
lines changed

7 files changed

+613
-155
lines changed

backend/src/agent-run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export async function finishAgentRun(
8585
* Adds a completed step to the agent_step table
8686
*/
8787
export async function addAgentStep(
88-
params: Parameters<AddAgentStepFn>[0],
88+
params: ParamsOf<AddAgentStepFn>,
8989
): ReturnType<AddAgentStepFn> {
9090
const {
9191
userId,

common/src/constants/analytics-events.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ export enum AnalyticsEvent {
8686
// Web - API
8787
AGENT_RUN_API_REQUEST = 'api.agent_run_request',
8888
AGENT_RUN_CREATED = 'api.agent_run_created',
89+
AGENT_RUN_COMPLETED = 'api.agent_run_completed',
8990
AGENT_RUN_VALIDATION_ERROR = 'api.agent_run_validation_error',
9091
AGENT_RUN_CREATION_ERROR = 'api.agent_run_creation_error',
92+
AGENT_RUN_COMPLETION_ERROR = 'api.agent_run_completion_error',
9193
ME_API_REQUEST = 'api.me_request',
9294
ME_VALIDATION_ERROR = 'api.me_validation_error',
9395
CHAT_COMPLETIONS_REQUEST = 'api.chat_completions_request',

common/src/db/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import postgres from 'postgres'
44

55
import * as schema from './schema'
66

7+
import type { CodebuffPgDatabase } from './types'
8+
79
const client = postgres(env.DATABASE_URL)
810

9-
export const db = drizzle(client, { schema })
11+
export const db: CodebuffPgDatabase = drizzle(client, { schema })
1012
export default db

common/src/db/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type * as schema from './schema'
2+
import type { PgDatabase } from 'drizzle-orm/pg-core'
3+
import type { PostgresJsQueryResultHKT } from 'drizzle-orm/postgres-js'
4+
5+
export type CodebuffPgDatabase = PgDatabase<
6+
PostgresJsQueryResultHKT,
7+
typeof schema
8+
>

0 commit comments

Comments
 (0)