1+ import type {
2+ CommitPolicyOutput ,
3+ TimeSpec ,
4+ TurnClassifierOutput ,
5+ } from "@atlas/core" ;
16import { describe , expect , it } from "vitest" ;
27
3- import type { CommitPolicyOutput , TurnClassifierOutput } from "@atlas/core" ;
8+ function t ( hour : number , minute : number ) : TimeSpec {
9+ return { kind : "absolute" , hour, minute } ;
10+ }
411
512import {
6- decideTurnPolicy ,
713 type DecideTurnPolicyInput ,
14+ decideTurnPolicy ,
815} from "./decide-turn-policy" ;
916
1017const emptyCommit : CommitPolicyOutput = {
@@ -89,7 +96,7 @@ describe("decideTurnPolicy", () => {
8996 decideTurnPolicy (
9097 input (
9198 { turnType : "planning_request" , confidence : 0.68 } ,
92- { committedSlots : { day : "tomorrow" , time : "18:00" } } ,
99+ { committedSlots : { day : "tomorrow" , time : t ( 18 , 0 ) } } ,
93100 {
94101 rawText : "Schedule gym tomorrow at 6pm" ,
95102 normalizedText : "Schedule gym tomorrow at 6pm" ,
@@ -318,7 +325,7 @@ describe("decideTurnPolicy", () => {
318325 resolvedEntityIds : [ "task-1" ] ,
319326 resolvedProposalId : "proposal-1" ,
320327 } ,
321- { committedSlots : { time : "15:00" , day : "tomorrow" } } ,
328+ { committedSlots : { time : t ( 15 , 0 ) , day : "tomorrow" } } ,
322329 {
323330 rawText : "make it 3 instead" ,
324331 normalizedText : "make it 3 instead" ,
@@ -338,7 +345,7 @@ describe("decideTurnPolicy", () => {
338345 confirmationRequired : true ,
339346 targetEntityId : "task-1" ,
340347 originatingTurnText : "move it to tomorrow 2pm" ,
341- slotSnapshot : { time : "14:00" , day : "tomorrow" } ,
348+ slotSnapshot : { time : t ( 14 , 0 ) , day : "tomorrow" } ,
342349 } ,
343350 } ,
344351 ] ,
@@ -492,7 +499,7 @@ describe("decideTurnPolicy", () => {
492499 confidence : 0.9 ,
493500 resolvedEntityIds : [ "task-1" ] ,
494501 } ,
495- { committedSlots : { day : "tomorrow" , time : "17:00" } } ,
502+ { committedSlots : { day : "tomorrow" , time : t ( 17 , 0 ) } } ,
496503 {
497504 rawText : "ok but make it 5pm" ,
498505 normalizedText : "ok but make it 5pm" ,
@@ -511,7 +518,7 @@ describe("decideTurnPolicy", () => {
511518 replyText : "Would you like me to schedule it tomorrow at 3pm?" ,
512519 confirmationRequired : true ,
513520 targetEntityId : "task-1" ,
514- slotSnapshot : { day : "tomorrow" , time : "15:00" } ,
521+ slotSnapshot : { day : "tomorrow" , time : t ( 15 , 0 ) } ,
515522 } ,
516523 } ,
517524 ] ,
@@ -554,7 +561,7 @@ describe("decideTurnPolicy", () => {
554561 route : "conversation_then_mutation" ,
555562 replyText : "Would you like me to schedule it at 3pm?" ,
556563 confirmationRequired : true ,
557- slotSnapshot : { time : "15:00" } ,
564+ slotSnapshot : { time : t ( 15 , 0 ) } ,
558565 } ,
559566 } ,
560567 ] ,
@@ -568,7 +575,7 @@ describe("decideTurnPolicy", () => {
568575 } ) ;
569576
570577 it ( "returns committedSlots on every policy decision" , ( ) => {
571- const slots = { day : "tomorrow" , time : "17:00" } ;
578+ const slots = { day : "tomorrow" , time : t ( 17 , 0 ) } ;
572579 const result = decideTurnPolicy (
573580 input (
574581 { turnType : "planning_request" , confidence : 0.95 } ,
0 commit comments