@pikku/kysely 0.12.6 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -183,14 +183,14 @@ export class KyselyAIStorageService
183
183
  const now = new Date()
184
184
 
185
185
  await this.db
186
- .insertInto('ai_threads')
186
+ .insertInto('aiThreads')
187
187
  .values({
188
188
  id,
189
- resource_id: resourceId,
189
+ resourceId: resourceId,
190
190
  title: options?.title ?? null,
191
191
  metadata: JSON.stringify(options?.metadata ?? null),
192
- created_at: now,
193
- updated_at: now,
192
+ createdAt: now,
193
+ updatedAt: now,
194
194
  })
195
195
  .execute()
196
196
 
@@ -206,14 +206,14 @@ export class KyselyAIStorageService
206
206
 
207
207
  async getThread(threadId: string): Promise<AIThread> {
208
208
  const row = await this.db
209
- .selectFrom('ai_threads')
209
+ .selectFrom('aiThreads')
210
210
  .select([
211
211
  'id',
212
- 'resource_id',
212
+ 'resourceId',
213
213
  'title',
214
214
  'metadata',
215
- 'created_at',
216
- 'updated_at',
215
+ 'createdAt',
216
+ 'updatedAt',
217
217
  ])
218
218
  .where('id', '=', threadId)
219
219
  .executeTakeFirst()
@@ -224,41 +224,41 @@ export class KyselyAIStorageService
224
224
 
225
225
  return {
226
226
  id: row.id,
227
- resourceId: row.resource_id,
227
+ resourceId: row.resourceId,
228
228
  title: row.title ?? undefined,
229
229
  metadata: parseJson(row.metadata),
230
- createdAt: new Date(row.created_at),
231
- updatedAt: new Date(row.updated_at),
230
+ createdAt: new Date(row.createdAt),
231
+ updatedAt: new Date(row.updatedAt),
232
232
  }
233
233
  }
234
234
 
235
235
  async getThreads(resourceId: string): Promise<AIThread[]> {
236
236
  const result = await this.db
237
- .selectFrom('ai_threads')
237
+ .selectFrom('aiThreads')
238
238
  .select([
239
239
  'id',
240
- 'resource_id',
240
+ 'resourceId',
241
241
  'title',
242
242
  'metadata',
243
- 'created_at',
244
- 'updated_at',
243
+ 'createdAt',
244
+ 'updatedAt',
245
245
  ])
246
- .where('resource_id', '=', resourceId)
247
- .orderBy('updated_at', 'desc')
246
+ .where('resourceId', '=', resourceId)
247
+ .orderBy('updatedAt', 'desc')
248
248
  .execute()
249
249
 
250
250
  return result.map((row) => ({
251
251
  id: row.id,
252
- resourceId: row.resource_id,
252
+ resourceId: row.resourceId,
253
253
  title: row.title ?? undefined,
254
254
  metadata: parseJson(row.metadata),
255
- createdAt: new Date(row.created_at),
256
- updatedAt: new Date(row.updated_at),
255
+ createdAt: new Date(row.createdAt),
256
+ updatedAt: new Date(row.updatedAt),
257
257
  }))
258
258
  }
259
259
 
260
260
  async deleteThread(threadId: string): Promise<void> {
261
- await this.db.deleteFrom('ai_threads').where('id', '=', threadId).execute()
261
+ await this.db.deleteFrom('aiThreads').where('id', '=', threadId).execute()
262
262
  }
263
263
 
264
264
  async getMessages(
@@ -266,44 +266,44 @@ export class KyselyAIStorageService
266
266
  options?: { lastN?: number; cursor?: string }
267
267
  ): Promise<AIMessage[]> {
268
268
  let msgQuery = this.db
269
- .selectFrom('ai_message')
270
- .select(['id', 'role', 'content', 'created_at'])
271
- .where('thread_id', '=', threadId)
269
+ .selectFrom('aiMessage')
270
+ .select(['id', 'role', 'content', 'createdAt'])
271
+ .where('threadId', '=', threadId)
272
272
 
273
273
  if (options?.cursor) {
274
274
  const cursorRow = await this.db
275
- .selectFrom('ai_message')
276
- .select('created_at')
275
+ .selectFrom('aiMessage')
276
+ .select('createdAt')
277
277
  .where('id', '=', options.cursor)
278
278
  .executeTakeFirst()
279
279
 
280
280
  if (cursorRow) {
281
- msgQuery = msgQuery.where('created_at', '<', cursorRow.created_at)
281
+ msgQuery = msgQuery.where('createdAt', '<', cursorRow.createdAt)
282
282
  }
283
283
  }
284
284
 
285
285
  let msgResult
286
286
  if (options?.cursor || options?.lastN) {
287
287
  const innerResult = await msgQuery
288
- .orderBy('created_at', 'desc')
288
+ .orderBy('createdAt', 'desc')
289
289
  .limit(options?.lastN ?? 50)
290
290
  .execute()
291
291
  innerResult.reverse()
292
292
  msgResult = innerResult
293
293
  } else {
294
- msgResult = await msgQuery.orderBy('created_at', 'asc').execute()
294
+ msgResult = await msgQuery.orderBy('createdAt', 'asc').execute()
295
295
  }
296
296
 
297
297
  const tcResult = await this.db
298
- .selectFrom('ai_tool_call')
299
- .select(['id', 'message_id', 'tool_name', 'args', 'result'])
300
- .where('thread_id', '=', threadId)
301
- .orderBy('created_at', 'asc')
298
+ .selectFrom('aiToolCall')
299
+ .select(['id', 'messageId', 'toolName', 'args', 'result'])
300
+ .where('threadId', '=', threadId)
301
+ .orderBy('createdAt', 'asc')
302
302
  .execute()
303
303
 
304
304
  const tcByMessage = new Map<string, (typeof tcResult)[number][]>()
305
305
  for (const tc of tcResult) {
306
- const msgId = tc.message_id
306
+ const msgId = tc.messageId
307
307
  if (!tcByMessage.has(msgId)) tcByMessage.set(msgId, [])
308
308
  tcByMessage.get(msgId)!.push(tc)
309
309
  }
@@ -328,14 +328,14 @@ export class KyselyAIStorageService
328
328
  id: row.id,
329
329
  role: row.role as AIMessage['role'],
330
330
  content: parsedContent,
331
- createdAt: new Date(row.created_at),
331
+ createdAt: new Date(row.createdAt),
332
332
  }
333
333
 
334
334
  const tcs = tcByMessage.get(msg.id)
335
335
  if (tcs?.length) {
336
336
  msg.toolCalls = tcs.map((tc) => ({
337
337
  id: tc.id,
338
- name: tc.tool_name,
338
+ name: tc.toolName,
339
339
  args: parseJson(tc.args) as Record<string, unknown>,
340
340
  }))
341
341
 
@@ -347,7 +347,7 @@ export class KyselyAIStorageService
347
347
  role: 'tool',
348
348
  toolResults: completed.map((tc) => ({
349
349
  id: tc.id,
350
- name: tc.tool_name,
350
+ name: tc.toolName,
351
351
  result: tc.result!,
352
352
  })),
353
353
  createdAt: msg.createdAt,
@@ -370,14 +370,14 @@ export class KyselyAIStorageService
370
370
 
371
371
  if (nonToolMessages.length > 0) {
372
372
  await this.db
373
- .insertInto('ai_message')
373
+ .insertInto('aiMessage')
374
374
  .values(
375
375
  nonToolMessages.map((msg) => ({
376
376
  id: msg.id,
377
- thread_id: threadId,
377
+ threadId: threadId,
378
378
  role: msg.role,
379
379
  content: msg.content != null ? JSON.stringify(msg.content) : null,
380
- created_at: msg.createdAt ?? new Date(),
380
+ createdAt: msg.createdAt ?? new Date(),
381
381
  }))
382
382
  )
383
383
  .execute()
@@ -388,13 +388,13 @@ export class KyselyAIStorageService
388
388
  )
389
389
  if (toolCalls.length > 0) {
390
390
  await this.db
391
- .insertInto('ai_tool_call')
391
+ .insertInto('aiToolCall')
392
392
  .values(
393
393
  toolCalls.map((tc) => ({
394
394
  id: tc.id,
395
- thread_id: threadId,
396
- message_id: tc.messageId,
397
- tool_name: tc.name,
395
+ threadId: threadId,
396
+ messageId: tc.messageId,
397
+ toolName: tc.name,
398
398
  args: JSON.stringify(tc.args),
399
399
  }))
400
400
  )
@@ -405,7 +405,7 @@ export class KyselyAIStorageService
405
405
  if (!toolMsg.toolResults) continue
406
406
  for (const tr of toolMsg.toolResults) {
407
407
  await this.db
408
- .updateTable('ai_tool_call')
408
+ .updateTable('aiToolCall')
409
409
  .set({ result: tr.result })
410
410
  .where('id', '=', tr.id)
411
411
  .execute()
@@ -413,8 +413,8 @@ export class KyselyAIStorageService
413
413
  }
414
414
 
415
415
  await this.db
416
- .updateTable('ai_threads')
417
- .set({ updated_at: new Date() })
416
+ .updateTable('aiThreads')
417
+ .set({ updatedAt: new Date() })
418
418
  .where('id', '=', threadId)
419
419
  .execute()
420
420
  }
@@ -424,7 +424,7 @@ export class KyselyAIStorageService
424
424
  scope: 'resource' | 'thread'
425
425
  ): Promise<Record<string, unknown> | null> {
426
426
  const row = await this.db
427
- .selectFrom('ai_working_memory')
427
+ .selectFrom('aiWorkingMemory')
428
428
  .select('data')
429
429
  .where('id', '=', id)
430
430
  .where('scope', '=', scope)
@@ -440,17 +440,17 @@ export class KyselyAIStorageService
440
440
  data: Record<string, unknown>
441
441
  ): Promise<void> {
442
442
  await this.db
443
- .insertInto('ai_working_memory')
443
+ .insertInto('aiWorkingMemory')
444
444
  .values({
445
445
  id,
446
446
  scope,
447
447
  data: JSON.stringify(data),
448
- updated_at: new Date(),
448
+ updatedAt: new Date(),
449
449
  })
450
450
  .onConflict((oc) =>
451
451
  oc.columns(['id', 'scope']).doUpdateSet({
452
452
  data: JSON.stringify(data),
453
- updated_at: new Date(),
453
+ updatedAt: new Date(),
454
454
  })
455
455
  )
456
456
  .execute()
@@ -460,21 +460,21 @@ export class KyselyAIStorageService
460
460
  const runId = crypto.randomUUID()
461
461
 
462
462
  await this.db
463
- .insertInto('ai_run')
463
+ .insertInto('aiRun')
464
464
  .values({
465
- run_id: runId,
466
- agent_name: run.agentName,
467
- thread_id: run.threadId,
468
- resource_id: run.resourceId,
465
+ runId: runId,
466
+ agentName: run.agentName,
467
+ threadId: run.threadId,
468
+ resourceId: run.resourceId,
469
469
  status: run.status,
470
- error_message: run.errorMessage ?? null,
471
- suspend_reason: run.suspendReason ?? null,
472
- missing_rpcs: run.missingRpcs ? JSON.stringify(run.missingRpcs) : null,
473
- usage_input_tokens: run.usage.inputTokens,
474
- usage_output_tokens: run.usage.outputTokens,
475
- usage_model: run.usage.model,
476
- created_at: run.createdAt,
477
- updated_at: run.updatedAt,
470
+ errorMessage: run.errorMessage ?? null,
471
+ suspendReason: run.suspendReason ?? null,
472
+ missingRpcs: run.missingRpcs ? JSON.stringify(run.missingRpcs) : null,
473
+ usageInputTokens: run.usage.inputTokens,
474
+ usageOutputTokens: run.usage.outputTokens,
475
+ usageModel: run.usage.model,
476
+ createdAt: run.createdAt,
477
+ updatedAt: run.updatedAt,
478
478
  })
479
479
  .execute()
480
480
 
@@ -489,45 +489,45 @@ export class KyselyAIStorageService
489
489
  runId: string,
490
490
  updates: Partial<AgentRunState>
491
491
  ): Promise<void> {
492
- const setValues: Record<string, any> = { updated_at: new Date() }
492
+ const setValues: Record<string, unknown> = { updatedAt: new Date() }
493
493
 
494
494
  if (updates.status !== undefined) {
495
495
  setValues.status = updates.status
496
496
  }
497
497
  if (updates.errorMessage !== undefined) {
498
- setValues.error_message = updates.errorMessage
498
+ setValues.errorMessage = updates.errorMessage
499
499
  }
500
500
  if (updates.suspendReason !== undefined) {
501
- setValues.suspend_reason = updates.suspendReason
501
+ setValues.suspendReason = updates.suspendReason
502
502
  }
503
503
  if (updates.missingRpcs !== undefined) {
504
- setValues.missing_rpcs = JSON.stringify(updates.missingRpcs)
504
+ setValues.missingRpcs = JSON.stringify(updates.missingRpcs)
505
505
  }
506
506
  if (updates.usage !== undefined) {
507
- setValues.usage_input_tokens = updates.usage.inputTokens
508
- setValues.usage_output_tokens = updates.usage.outputTokens
509
- setValues.usage_model = updates.usage.model
507
+ setValues.usageInputTokens = updates.usage.inputTokens
508
+ setValues.usageOutputTokens = updates.usage.outputTokens
509
+ setValues.usageModel = updates.usage.model
510
510
  }
511
511
 
512
512
  await this.db
513
- .updateTable('ai_run')
513
+ .updateTable('aiRun')
514
514
  .set(setValues)
515
- .where('run_id', '=', runId)
515
+ .where('runId', '=', runId)
516
516
  .execute()
517
517
 
518
518
  if (updates.pendingApprovals !== undefined) {
519
519
  await this.db
520
- .updateTable('ai_tool_call')
520
+ .updateTable('aiToolCall')
521
521
  .set({
522
- approval_status: null,
523
- run_id: null,
524
- approval_type: null,
525
- agent_run_id: null,
526
- display_tool_name: null,
527
- display_args: null,
522
+ approvalStatus: null,
523
+ runId: null,
524
+ approvalType: null,
525
+ agentRunId: null,
526
+ displayToolName: null,
527
+ displayArgs: null,
528
528
  })
529
- .where('run_id', '=', runId)
530
- .where('approval_status', 'is not', null)
529
+ .where('runId', '=', runId)
530
+ .where('approvalStatus', 'is not', null)
531
531
  .execute()
532
532
 
533
533
  if (updates.pendingApprovals.length) {
@@ -538,40 +538,40 @@ export class KyselyAIStorageService
538
538
 
539
539
  async getRun(runId: string): Promise<AgentRunState | null> {
540
540
  const row = await this.db
541
- .selectFrom('ai_run')
541
+ .selectFrom('aiRun')
542
542
  .select([
543
- 'run_id',
544
- 'agent_name',
545
- 'thread_id',
546
- 'resource_id',
543
+ 'runId',
544
+ 'agentName',
545
+ 'threadId',
546
+ 'resourceId',
547
547
  'status',
548
- 'error_message',
549
- 'suspend_reason',
550
- 'missing_rpcs',
551
- 'usage_input_tokens',
552
- 'usage_output_tokens',
553
- 'usage_model',
554
- 'created_at',
555
- 'updated_at',
548
+ 'errorMessage',
549
+ 'suspendReason',
550
+ 'missingRpcs',
551
+ 'usageInputTokens',
552
+ 'usageOutputTokens',
553
+ 'usageModel',
554
+ 'createdAt',
555
+ 'updatedAt',
556
556
  ])
557
- .where('run_id', '=', runId)
557
+ .where('runId', '=', runId)
558
558
  .executeTakeFirst()
559
559
 
560
560
  if (!row) return null
561
561
 
562
562
  const approvals = await this.db
563
- .selectFrom('ai_tool_call')
563
+ .selectFrom('aiToolCall')
564
564
  .select([
565
565
  'id',
566
- 'tool_name',
566
+ 'toolName',
567
567
  'args',
568
- 'approval_type',
569
- 'agent_run_id',
570
- 'display_tool_name',
571
- 'display_args',
568
+ 'approvalType',
569
+ 'agentRunId',
570
+ 'displayToolName',
571
+ 'displayArgs',
572
572
  ])
573
- .where('run_id', '=', runId)
574
- .where('approval_status', '=', 'pending')
573
+ .where('runId', '=', runId)
574
+ .where('approvalStatus', '=', 'pending')
575
575
  .execute()
576
576
 
577
577
  return this.mapRunRow(row, approvals)
@@ -579,41 +579,41 @@ export class KyselyAIStorageService
579
579
 
580
580
  async getRunsByThread(threadId: string): Promise<AgentRunState[]> {
581
581
  const result = await this.db
582
- .selectFrom('ai_run')
582
+ .selectFrom('aiRun')
583
583
  .select([
584
- 'run_id',
585
- 'agent_name',
586
- 'thread_id',
587
- 'resource_id',
584
+ 'runId',
585
+ 'agentName',
586
+ 'threadId',
587
+ 'resourceId',
588
588
  'status',
589
- 'error_message',
590
- 'suspend_reason',
591
- 'missing_rpcs',
592
- 'usage_input_tokens',
593
- 'usage_output_tokens',
594
- 'usage_model',
595
- 'created_at',
596
- 'updated_at',
589
+ 'errorMessage',
590
+ 'suspendReason',
591
+ 'missingRpcs',
592
+ 'usageInputTokens',
593
+ 'usageOutputTokens',
594
+ 'usageModel',
595
+ 'createdAt',
596
+ 'updatedAt',
597
597
  ])
598
- .where('thread_id', '=', threadId)
599
- .orderBy('created_at', 'desc')
598
+ .where('threadId', '=', threadId)
599
+ .orderBy('createdAt', 'desc')
600
600
  .execute()
601
601
 
602
602
  const runs: AgentRunState[] = []
603
603
  for (const row of result) {
604
604
  const approvals = await this.db
605
- .selectFrom('ai_tool_call')
605
+ .selectFrom('aiToolCall')
606
606
  .select([
607
607
  'id',
608
- 'tool_name',
608
+ 'toolName',
609
609
  'args',
610
- 'approval_type',
611
- 'agent_run_id',
612
- 'display_tool_name',
613
- 'display_args',
610
+ 'approvalType',
611
+ 'agentRunId',
612
+ 'displayToolName',
613
+ 'displayArgs',
614
614
  ])
615
- .where('run_id', '=', row.run_id)
616
- .where('approval_status', '=', 'pending')
615
+ .where('runId', '=', row.runId)
616
+ .where('approvalStatus', '=', 'pending')
617
617
  .execute()
618
618
  runs.push(this.mapRunRow(row, approvals))
619
619
  }
@@ -627,24 +627,24 @@ export class KyselyAIStorageService
627
627
  for (const a of approvals) {
628
628
  if (a.type === 'agent-call') {
629
629
  await this.db
630
- .updateTable('ai_tool_call')
630
+ .updateTable('aiToolCall')
631
631
  .set({
632
- approval_status: 'pending',
633
- run_id: runId,
634
- approval_type: 'agent-call',
635
- agent_run_id: a.agentRunId,
636
- display_tool_name: a.displayToolName,
637
- display_args: JSON.stringify(a.displayArgs),
632
+ approvalStatus: 'pending',
633
+ runId: runId,
634
+ approvalType: 'agent-call',
635
+ agentRunId: a.agentRunId,
636
+ displayToolName: a.displayToolName,
637
+ displayArgs: JSON.stringify(a.displayArgs),
638
638
  })
639
639
  .where('id', '=', a.toolCallId)
640
640
  .execute()
641
641
  } else {
642
642
  await this.db
643
- .updateTable('ai_tool_call')
643
+ .updateTable('aiToolCall')
644
644
  .set({
645
- approval_status: 'pending',
646
- run_id: runId,
647
- approval_type: 'tool-call',
645
+ approvalStatus: 'pending',
646
+ runId: runId,
647
+ approvalType: 'tool-call',
648
648
  })
649
649
  .where('id', '=', a.toolCallId)
650
650
  .execute()
@@ -655,42 +655,42 @@ export class KyselyAIStorageService
655
655
  private mapRunRow(row: any, approvalRows?: any[]): AgentRunState {
656
656
  const pendingApprovals = approvalRows?.length
657
657
  ? approvalRows.map((a: any) => {
658
- if (a.approval_type === 'agent-call') {
658
+ if (a.approvalType === 'agent-call') {
659
659
  return {
660
660
  type: 'agent-call' as const,
661
661
  toolCallId: a.id as string,
662
- agentName: a.tool_name as string,
663
- agentRunId: a.agent_run_id as string,
664
- displayToolName: a.display_tool_name as string,
665
- displayArgs: parseJson(a.display_args) as unknown,
662
+ agentName: a.toolName as string,
663
+ agentRunId: a.agentRunId as string,
664
+ displayToolName: a.displayToolName as string,
665
+ displayArgs: parseJson(a.displayArgs) as unknown,
666
666
  }
667
667
  }
668
668
  return {
669
669
  type: 'tool-call' as const,
670
670
  toolCallId: a.id as string,
671
- toolName: a.tool_name as string,
671
+ toolName: a.toolName as string,
672
672
  args: parseJson(a.args) as unknown,
673
673
  }
674
674
  })
675
675
  : undefined
676
676
 
677
677
  return {
678
- runId: row.run_id as string,
679
- agentName: row.agent_name as string,
680
- threadId: row.thread_id as string,
681
- resourceId: row.resource_id as string,
678
+ runId: row.runId as string,
679
+ agentName: row.agentName as string,
680
+ threadId: row.threadId as string,
681
+ resourceId: row.resourceId as string,
682
682
  status: row.status as AgentRunState['status'],
683
- errorMessage: row.error_message ?? undefined,
684
- suspendReason: row.suspend_reason as AgentRunState['suspendReason'],
685
- missingRpcs: parseJson(row.missing_rpcs),
683
+ errorMessage: row.errorMessage ?? undefined,
684
+ suspendReason: row.suspendReason as AgentRunState['suspendReason'],
685
+ missingRpcs: parseJson(row.missingRpcs),
686
686
  pendingApprovals,
687
687
  usage: {
688
- inputTokens: Number(row.usage_input_tokens),
689
- outputTokens: Number(row.usage_output_tokens),
690
- model: row.usage_model as string,
688
+ inputTokens: Number(row.usageInputTokens),
689
+ outputTokens: Number(row.usageOutputTokens),
690
+ model: row.usageModel as string,
691
691
  },
692
- createdAt: new Date(row.created_at as string),
693
- updatedAt: new Date(row.updated_at as string),
692
+ createdAt: new Date(row.createdAt as string),
693
+ updatedAt: new Date(row.updatedAt as string),
694
694
  }
695
695
  }
696
696
 
@@ -699,41 +699,41 @@ export class KyselyAIStorageService
699
699
  approval: NonNullable<AgentRunState['pendingApprovals']>[number]
700
700
  } | null> {
701
701
  const tc = await this.db
702
- .selectFrom('ai_tool_call')
702
+ .selectFrom('aiToolCall')
703
703
  .select([
704
704
  'id',
705
- 'tool_name',
705
+ 'toolName',
706
706
  'args',
707
- 'run_id',
708
- 'approval_type',
709
- 'agent_run_id',
710
- 'display_tool_name',
711
- 'display_args',
707
+ 'runId',
708
+ 'approvalType',
709
+ 'agentRunId',
710
+ 'displayToolName',
711
+ 'displayArgs',
712
712
  ])
713
713
  .where('id', '=', toolCallId)
714
- .where('approval_status', '=', 'pending')
714
+ .where('approvalStatus', '=', 'pending')
715
715
  .executeTakeFirst()
716
716
 
717
- if (!tc || !tc.run_id) return null
717
+ if (!tc || !tc.runId) return null
718
718
 
719
- const run = await this.getRun(tc.run_id)
719
+ const run = await this.getRun(tc.runId)
720
720
  if (!run) return null
721
721
 
722
722
  let approval: NonNullable<AgentRunState['pendingApprovals']>[number]
723
- if (tc.approval_type === 'agent-call') {
723
+ if (tc.approvalType === 'agent-call') {
724
724
  approval = {
725
725
  type: 'agent-call',
726
726
  toolCallId: tc.id,
727
- agentName: tc.tool_name,
728
- agentRunId: tc.agent_run_id!,
729
- displayToolName: tc.display_tool_name!,
730
- displayArgs: parseJson(tc.display_args) as unknown,
727
+ agentName: tc.toolName,
728
+ agentRunId: tc.agentRunId!,
729
+ displayToolName: tc.displayToolName!,
730
+ displayArgs: parseJson(tc.displayArgs) as unknown,
731
731
  }
732
732
  } else {
733
733
  approval = {
734
734
  type: 'tool-call',
735
735
  toolCallId: tc.id,
736
- toolName: tc.tool_name,
736
+ toolName: tc.toolName,
737
737
  args: parseJson(tc.args) as unknown,
738
738
  }
739
739
  }
@@ -746,8 +746,8 @@ export class KyselyAIStorageService
746
746
  status: 'approved' | 'denied'
747
747
  ): Promise<void> {
748
748
  await this.db
749
- .updateTable('ai_tool_call')
750
- .set({ approval_status: status })
749
+ .updateTable('aiToolCall')
750
+ .set({ approvalStatus: status })
751
751
  .where('id', '=', toolCallId)
752
752
  .execute()
753
753
  }