@@ -315,10 +315,10 @@ describe("useAppStore", () => {
315315
316316 it ( "should set document" , ( ) => {
317317 useAppStore . getState ( ) . setDocument ( {
318+ id : "doc-1" ,
318319 filename : "README.md" ,
319320 language : "markdown" ,
320321 content : "# Hello World" ,
321- isEditing : false ,
322322 } ) ;
323323
324324 const { document } = useAppStore . getState ( ) ;
@@ -329,10 +329,10 @@ describe("useAppStore", () => {
329329
330330 it ( "should clear document" , ( ) => {
331331 useAppStore . getState ( ) . setDocument ( {
332+ id : "doc-1" ,
332333 filename : "test.txt" ,
333334 language : "text" ,
334335 content : "Test" ,
335- isEditing : false ,
336336 } ) ;
337337
338338 useAppStore . getState ( ) . setDocument ( null ) ;
@@ -350,10 +350,16 @@ describe("useAppStore", () => {
350350
351351 it ( "should add tool run with generated id" , ( ) => {
352352 const id = useAppStore . getState ( ) . addToolRun ( {
353+ toolCallId : null ,
353354 name : "read_file" ,
354355 label : "Reading file.txt" ,
355356 status : "running" ,
356- input : { path : "file.txt" } ,
357+ startedAt : Date . now ( ) ,
358+ completedAt : null ,
359+ progress : null ,
360+ args : { path : "file.txt" } ,
361+ output : null ,
362+ error : null ,
357363 } ) ;
358364
359365 const { toolRuns } = useAppStore . getState ( ) ;
@@ -365,10 +371,16 @@ describe("useAppStore", () => {
365371
366372 it ( "should update tool run" , ( ) => {
367373 const id = useAppStore . getState ( ) . addToolRun ( {
374+ toolCallId : null ,
368375 name : "read_file" ,
369376 label : "Reading file.txt" ,
370377 status : "running" ,
371- input : { path : "file.txt" } ,
378+ startedAt : Date . now ( ) ,
379+ completedAt : null ,
380+ progress : null ,
381+ args : { path : "file.txt" } ,
382+ output : null ,
383+ error : null ,
372384 } ) ;
373385
374386 useAppStore . getState ( ) . updateToolRun ( id , {
@@ -383,43 +395,67 @@ describe("useAppStore", () => {
383395
384396 it ( "should log to tool run" , ( ) => {
385397 const id = useAppStore . getState ( ) . addToolRun ( {
398+ toolCallId : null ,
386399 name : "bash" ,
387400 label : "Running command" ,
388401 status : "running" ,
389- input : { command : "npm test" } ,
402+ startedAt : Date . now ( ) ,
403+ completedAt : null ,
404+ progress : null ,
405+ args : { command : "npm test" } ,
406+ output : null ,
407+ error : null ,
390408 } ) ;
391409
392410 useAppStore . getState ( ) . logToolRun ( id , {
393- type : "output " ,
394- content : "Tests passed" ,
411+ level : "info " ,
412+ message : "Tests passed" ,
395413 } ) ;
396414
397415 const { toolRuns } = useAppStore . getState ( ) ;
398416 expect ( toolRuns [ 0 ] . logs ) . toHaveLength ( 1 ) ;
399- expect ( toolRuns [ 0 ] . logs [ 0 ] . content ) . toBe ( "Tests passed" ) ;
417+ expect ( toolRuns [ 0 ] . logs [ 0 ] . message ) . toBe ( "Tests passed" ) ;
400418 expect ( toolRuns [ 0 ] . logs [ 0 ] . timestamp ) . toBeDefined ( ) ;
401419 } ) ;
402420
403421 it ( "should filter tool runs by status" , ( ) => {
404422 useAppStore . getState ( ) . addToolRun ( {
423+ toolCallId : null ,
405424 name : "tool1" ,
406425 label : "Tool 1" ,
407426 status : "running" ,
408- input : { } ,
427+ startedAt : null ,
428+ completedAt : null ,
429+ progress : null ,
430+ args : { } ,
431+ output : null ,
432+ error : null ,
409433 } ) ;
410434
411435 useAppStore . getState ( ) . addToolRun ( {
436+ toolCallId : null ,
412437 name : "tool2" ,
413438 label : "Tool 2" ,
414439 status : "succeeded" ,
415- input : { } ,
440+ startedAt : null ,
441+ completedAt : null ,
442+ progress : null ,
443+ args : { } ,
444+ output : null ,
445+ error : null ,
416446 } ) ;
417447
418448 useAppStore . getState ( ) . addToolRun ( {
449+ toolCallId : null ,
419450 name : "tool3" ,
420451 label : "Tool 3" ,
421452 status : "failed" ,
422- input : { } ,
453+ startedAt : null ,
454+ completedAt : null ,
455+ progress : null ,
456+ args : { } ,
457+ output : null ,
458+ error : null ,
423459 } ) ;
424460
425461 // Filter by active (running)
@@ -443,17 +479,29 @@ describe("useAppStore", () => {
443479
444480 it ( "should filter tool runs by query" , ( ) => {
445481 useAppStore . getState ( ) . addToolRun ( {
482+ toolCallId : null ,
446483 name : "read_file" ,
447484 label : "Reading package.json" ,
448485 status : "succeeded" ,
449- input : { } ,
486+ startedAt : null ,
487+ completedAt : null ,
488+ progress : null ,
489+ args : { } ,
490+ output : null ,
491+ error : null ,
450492 } ) ;
451493
452494 useAppStore . getState ( ) . addToolRun ( {
495+ toolCallId : null ,
453496 name : "write_file" ,
454497 label : "Writing config" ,
455498 status : "succeeded" ,
456- input : { } ,
499+ startedAt : null ,
500+ completedAt : null ,
501+ progress : null ,
502+ args : { } ,
503+ output : null ,
504+ error : null ,
457505 } ) ;
458506
459507 useAppStore . getState ( ) . setToolRunFilter ( { status : "all" , query : "package" } ) ;
@@ -467,10 +515,16 @@ describe("useAppStore", () => {
467515 // Add more than MAX_TOOL_RUNS (100) tool runs
468516 for ( let i = 0 ; i < 110 ; i ++ ) {
469517 useAppStore . getState ( ) . addToolRun ( {
518+ toolCallId : null ,
470519 name : `tool-${ i } ` ,
471520 label : `Tool ${ i } ` ,
472521 status : "succeeded" ,
473- input : { } ,
522+ startedAt : null ,
523+ completedAt : null ,
524+ progress : null ,
525+ args : { } ,
526+ output : null ,
527+ error : null ,
474528 } ) ;
475529 }
476530
@@ -480,10 +534,16 @@ describe("useAppStore", () => {
480534
481535 it ( "should clear tool runs" , ( ) => {
482536 useAppStore . getState ( ) . addToolRun ( {
537+ toolCallId : null ,
483538 name : "tool" ,
484539 label : "Tool" ,
485540 status : "succeeded" ,
486- input : { } ,
541+ startedAt : null ,
542+ completedAt : null ,
543+ progress : null ,
544+ args : { } ,
545+ output : null ,
546+ error : null ,
487547 } ) ;
488548
489549 useAppStore . getState ( ) . clearToolRuns ( ) ;
@@ -502,13 +562,16 @@ describe("useAppStore", () => {
502562 it ( "should add cost entry" , ( ) => {
503563 useAppStore . getState ( ) . addCostEntry ( {
504564 model : "claude-sonnet" ,
565+ toolNames : [ ] ,
566+ inputTokens : 1000 ,
567+ outputTokens : 500 ,
568+ cacheReadTokens : 0 ,
569+ cacheWriteTokens : 0 ,
505570 cost : {
506- inputTokens : 1000 ,
507- outputTokens : 500 ,
571+ input : 0.003 ,
572+ output : 0.0075 ,
508573 cacheRead : 0 ,
509574 cacheWrite : 0 ,
510- inputCost : 0.003 ,
511- outputCost : 0.0075 ,
512575 total : 0.0105 ,
513576 } ,
514577 } ) ;
@@ -522,26 +585,32 @@ describe("useAppStore", () => {
522585 it ( "should calculate total cost" , ( ) => {
523586 useAppStore . getState ( ) . addCostEntry ( {
524587 model : "claude-sonnet" ,
588+ toolNames : [ ] ,
589+ inputTokens : 1000 ,
590+ outputTokens : 500 ,
591+ cacheReadTokens : 0 ,
592+ cacheWriteTokens : 0 ,
525593 cost : {
526- inputTokens : 1000 ,
527- outputTokens : 500 ,
594+ input : 0.003 ,
595+ output : 0.0075 ,
528596 cacheRead : 0 ,
529597 cacheWrite : 0 ,
530- inputCost : 0.003 ,
531- outputCost : 0.0075 ,
532598 total : 0.01 ,
533599 } ,
534600 } ) ;
535601
536602 useAppStore . getState ( ) . addCostEntry ( {
537603 model : "claude-sonnet" ,
604+ toolNames : [ ] ,
605+ inputTokens : 2000 ,
606+ outputTokens : 1000 ,
607+ cacheReadTokens : 0 ,
608+ cacheWriteTokens : 0 ,
538609 cost : {
539- inputTokens : 2000 ,
540- outputTokens : 1000 ,
610+ input : 0.006 ,
611+ output : 0.015 ,
541612 cacheRead : 0 ,
542613 cacheWrite : 0 ,
543- inputCost : 0.006 ,
544- outputCost : 0.015 ,
545614 total : 0.02 ,
546615 } ,
547616 } ) ;
@@ -553,13 +622,16 @@ describe("useAppStore", () => {
553622 it ( "should clear cost timeline" , ( ) => {
554623 useAppStore . getState ( ) . addCostEntry ( {
555624 model : "claude-sonnet" ,
625+ toolNames : [ ] ,
626+ inputTokens : 1000 ,
627+ outputTokens : 500 ,
628+ cacheReadTokens : 0 ,
629+ cacheWriteTokens : 0 ,
556630 cost : {
557- inputTokens : 1000 ,
558- outputTokens : 500 ,
631+ input : 0.003 ,
632+ output : 0.0075 ,
559633 cacheRead : 0 ,
560634 cacheWrite : 0 ,
561- inputCost : 0.003 ,
562- outputCost : 0.0075 ,
563635 total : 0.01 ,
564636 } ,
565637 } ) ;
0 commit comments